Re: [Mesa-dev] [PATCH] Anisotropic filtering extension for swrast

2011-05-19 Thread Andreas Fänger
I will have a look at it. This might take a while, though, as I'm currently
quite busy with other projects.

/ Andreas

-Ursprüngliche Nachricht-
Von: Brian Paul [mailto:bri...@vmware.com] 
Gesendet: Mittwoch, 18. Mai 2011 16:06
An: Andreas Faenger
Cc: mesa-dev@lists.freedesktop.org
Betreff: Re: [Mesa-dev] [PATCH] Anisotropic filtering extension for swrast

On 05/17/2011 05:08 AM, Andreas Faenger wrote:
> Hi,
>
> this patch makes it possible to have high quality texture filtering
> with the pure software renderer. The main purpose is to use it with
> osmesa. The anisotropic filtering is based on Elliptical Weighted Avarage
(EWA).
>
> The patch was designed to make as little changes to the existing codebase
as possible. Therefore, the existing texture_sample_func
> signature has not been adjusted although this was required; a "hack"
> was used instead to pass the required arguments.
>
> I provide this patch as other people might be interessted in
> using anisotropic filtering for osmesa, especially when rendering
> images in a headless environment.

Thanks.  I'm about to commit your patch (with some formatting fixes).

Would you be interested in implementing this feature in the Gallium 
softpipe driver too?

-Brian

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 36333] can't build demos if mesa build with --enable-selinux

2011-05-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=36333

Tapani Pälli  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #2 from Tapani Pälli  2011-05-19 01:20:38 PDT ---
fixed in git, commit 2758e65f28cc68411775ec41c53f773268cddc05

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Use signed math for possibly negative values

2011-05-19 Thread Ian Romanick
From: Ian Romanick 

Since RowStride might be negative, we want a signed result.  On 64-bit
platforms, an unsigned 32-bit result added to a 64-bit pointer will
give the wrong answer.

For x = y = 50, RowStride = -128, and format bytes = 4, the difference is:

Breakpoint 1, get_pointer_generic (ctx=0x686320, rb=0x9c3600, x=50, y=50)
at main/renderbuffer.c:99
99 if (!rb->Data)
(gdb) print (int *) rb->Data + (y * rb->RowStride + x)
$1 = (int *) 0x72e3e2c8
(gdb) print rb->Data + (y * rb->RowStride + 
x)*_mesa_get_format_bytes(rb->Format)
$3 = (GLvoid *) 0x8000f2e3e2c8

The delta between 0x72e3e2c8 and 0x8000f2e3e2c8 is pretty big.
Math is hard.

Fixes crashes in lots of depth/stencil piglit tests on 64-bit platforms.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37351
---
 src/mesa/main/renderbuffer.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index fa884c0..b7ab49f 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -96,11 +96,17 @@ static void *
 get_pointer_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
GLint x, GLint y)
 {
+   intptr_t offset;
+
if (!rb->Data)
   return NULL;
 
-   return ((char *) rb->Data +
-  (y * rb->RowStride + x) * _mesa_get_format_bytes(rb->Format));
+   /* Must use signed math for this!  Since RowStride might be negative, we
+* want a signed result.  On 64-bit platforms, an unsigned 32-bit result
+* added to a 64-bit pointer will give the wrong answer.
+*/
+   offset = (y * rb->RowStride + x) * (int)_mesa_get_format_bytes(rb->Format);
+   return ((char *) rb->Data + offset);
 }
 
 /* GetRow() implementation for formats where DataType matches the rb->Format.
-- 
1.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Status of VDPAU and XvMC state-trackers (was Re: Build error on current xvmc-r600 pipe-video)

2011-05-19 Thread Andy Furniss

Christian König wrote:

Am Montag, den 16.05.2011, 19:54 +0100 schrieb Andy Furniss:

I noticed another strange thing with pipe-video on my rv670.

Until recently there was a bug that made the mesa demo lodbias misrender.

It's fixed now in master and pipe-video, but if I use pipe-video + vdpau
decode (xvmc untested) then lodbias reverts to the broken state.



I don't install pipe-video, so just using libvdpau_g3dvl makes my
installed (master) driver behave differently on that test. I have to
reboot to get working lodbias and have failed to regress it any other way.

Sounds like some register bits for LOD biasing didn't get set correctly.
So they are programmed once by the vdpau driver and never gets resetted
to their initial state. Which piglit test exactly shows a regression?
shouldn't be to hard to reproduce and fix.


fbo-generatemipmap shows it.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] egl: Link wayland-drm.a into libEGL after egl_dri2

2011-05-19 Thread Kristian Høgsberg
On Wed, May 18, 2011 at 2:59 PM, Thierry Reding
 wrote:
> Fixes the following build error in wayland-demos:
>
>          CCLD   wayland-compositor
>        /usr/lib/libEGL.so: undefined reference to 
> `wayland_drm_buffer_get_buffer'
>        /usr/lib/libEGL.so: undefined reference to `wayland_drm_uninit'
>        /usr/lib/libEGL.so: undefined reference to `wayland_buffer_is_drm'
>        /usr/lib/libEGL.so: undefined reference to `wayland_drm_init'
>        /usr/lib/libEGL.so: undefined reference to `wl_drm_interface'

Thanks.  I did fix this locally but was a little slow to push it.
It's upstream now.

Kristian

>  src/egl/main/Makefile |    8 
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/src/egl/main/Makefile b/src/egl/main/Makefile
> index 6c24255..6c4a392 100644
> --- a/src/egl/main/Makefile
> +++ b/src/egl/main/Makefile
> @@ -54,10 +54,6 @@ OBJECTS = $(SOURCES:.c=.o)
>  LOCAL_CFLAGS = -D_EGL_OS_UNIX=1
>  LOCAL_LIBS =
>
> -ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
> -LOCAL_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
> -endif
> -
>  # egl_dri2 and egl_glx are built-ins
>  ifeq ($(filter dri2, $(EGL_DRIVERS_DIRS)),dri2)
>  LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2
> @@ -68,6 +64,10 @@ endif
>  EGL_LIB_DEPS += $(LIBUDEV_LIBS) $(DLOPEN_LIBS) $(LIBDRM_LIB) $(WAYLAND_LIBS)
>  endif
>
> +ifneq ($(findstring wayland, $(EGL_PLATFORMS)),)
> +LOCAL_LIBS += $(TOP)/src/egl/wayland/wayland-drm/libwayland-drm.a
> +endif
> +
>  ifeq ($(filter glx, $(EGL_DRIVERS_DIRS)),glx)
>  LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_GLX
>  LOCAL_LIBS += $(TOP)/src/egl/drivers/glx/libegl_glx.a
> --
> 1.7.5.1
>
> ___
> wayland-devel mailing list
> wayland-de...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] shared LLVM library causes program abortion

2011-05-19 Thread Jose Fonseca


- Original Message -
> On 5/17/11 3:24 PM, Jose Fonseca wrote:
> 
> > I believe the best alternative here is to build  *_dri.so with -z
> > nodelete when linking against a shared libLLVM*.
> 
> That should work, even though it's incredibly unpleasant.  I would
> think
> LLVM would want to be robust against multiple users within the same
> address space.
> 
> - ajax
> 

I think I may have found a less intrusive workaround: to use another global 
variable inside libllvm.so to avoid doing the command line parsing twice. Diff 
below, but still need to verify on Fedora.

This is really just for LLVM 2.8, as LLVM 2.9 handles mmx properly out of the 
box.

Jose


diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp 
b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index 0ccf6a6..d2d7ecc 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -106,13 +106,23 @@ lp_set_target_options(void)
 * See also:
 * - http://llvm.org/bugs/show_bug.cgi?id=3287
 * - 
http://l4.me.uk/post/2009/06/07/llvm-wrinkle-3-configuration-what-configuration/
+*
+* The -disable-mmx global option can be specified only once  since we
+* dynamically link against LLVM it will reside in a separate shared object,
+* which may or not be delete when this shared object is, so we use the
+* llvm::DisablePrettyStackTrace variable (which we set below and should
+* reside in the same shared library) to determine whether the -disable-mmx
+* option has been set or not.
+*
+* Thankfully this ugly hack is not necessary on LLVM 2.9 onwards.
 */
-   static boolean first = TRUE;
-   if (first) {
+   if (!llvm::DisablePrettyStackTrace) {
+  static boolean first = TRUE;
   static const char* options[] = {
  "prog",
  "-disable-mmx"
   };
+  assert(first);
   llvm::cl::ParseCommandLineOptions(2, const_cast(options));
   first = FALSE;
}
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH mesa-demos] Fix compilation of osdemo.c after commit 5d5dc0e

2011-05-19 Thread Jon TURNEY
Fix compilation of osdemo.c after commit 5d5dc0e "Mac OS X portability fixes."

ostest1.c also now needs some kind of attention, as it now no longer includes
glu.h but refers to symbols defined there, but it is not built by the makefile.

Found by tinderbox, see [1]

[1] 
http://tinderbox.freedesktop.org/builds/2011-05-13-0004/logs/mesa-demos/#build

Signed-off-by: Jon TURNEY 
---
 src/osdemos/osdemo.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/osdemos/osdemo.c b/src/osdemos/osdemo.c
index 7f8..cd98ce4 100644
--- a/src/osdemos/osdemo.c
+++ b/src/osdemos/osdemo.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include "GL/osmesa.h"
+#include "gl_wrap.h"
 
 
 #define SAVE_TARGA
-- 
1.7.5.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Fix return type of _mesa_get_format_bytes() (#37351)

2011-05-19 Thread Adam Jackson
Despite that negative values aren't sensible here, making this unsigned
is dangerous.  Consider get_pointer_generic, which computes a value of
the form:

void *base + (int x * int stride + int y) * unsigned bpp

The usual arithmetic conversions will coerce the (x*stride + y)
subexpression to unsigned.  Since stride can be negative, this is
disastrous.

Fixes at least the following piglit tests on Ironlake:

fbo/fbo-blit-d24s8
spec/ARB_depth_texture/fbo-clear-formats
spec/EXT_packed_depth_stencil/fbo-clear-formats

Signed-off-by: Adam Jackson 
---
 src/mesa/main/formats.c |2 +-
 src/mesa/main/formats.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 60e8ae3..a46633b 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -1119,7 +1119,7 @@ _mesa_get_format_name(gl_format format)
  * Normally, a block is 1x1 (a single pixel).  But for compressed formats
  * a block may be 4x4 or 8x4, etc.
  */
-GLuint
+GLint
 _mesa_get_format_bytes(gl_format format)
 {
const struct gl_format_info *info = _mesa_get_format_info(format);
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index df9ed70..0640bbc 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -216,7 +216,7 @@ typedef enum
 extern const char *
 _mesa_get_format_name(gl_format format);
 
-extern GLuint
+extern GLint
 _mesa_get_format_bytes(gl_format format);
 
 extern GLint
-- 
1.7.5.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Use signed math for possibly negative values

2011-05-19 Thread Adam Jackson
On Thu, 2011-05-19 at 14:13 +0200, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Since RowStride might be negative, we want a signed result.  On 64-bit
> platforms, an unsigned 32-bit result added to a 64-bit pointer will
> give the wrong answer.

Hah, saw this just as I sent my patch.  Let's hear it for communication.

This is less intrusive than mine, but I think mine's preferable, unless
we're sure all other users of _mesa_get_format_bytes() are correct.

- ajax


signature.asc
Description: This is a digitally signed message part
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): glapi: Implement SET_xxx as inline functions instead of macros.

2011-05-19 Thread Thierry Reding
* Jose Fonseca wrote:
> Module: Mesa
> Branch: master
> Commit: ec4dfc2aad16ed3d04f47657e9f2cb22e791d511
> URL:
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec4dfc2aad16ed3d04f47657e9f2cb22e791d511
> 
> Author: José Fonseca 
> Date:   Thu May 19 16:49:49 2011 +0100
> 
> glapi: Implement SET_xxx as inline functions instead of macros.
> 
> In order to have the benefit of type checking, and detect missing
> GLAPIENTRY keywords on public entrypoints.

This breaks GLES support for me. Looking at the preprocessor output (using
-save-temps) it seems to be caused by GLAPIENTRY and GLAPIENTRYP not being
defined for GLES.

I don't know what the best course of action would be? Defining GLAPIENTRY{,P}
to GL_APIENTRY{,P} in both src/mesa/main/api_exec_es{1,2}.c fixes the issue.

Thierry


pgpnwYRJlimGS.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Use signed math for possibly negative values

2011-05-19 Thread Chad Versace
On 05/19/2011 05:13 AM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> Since RowStride might be negative, we want a signed result.  On 64-bit
> platforms, an unsigned 32-bit result added to a 64-bit pointer will
> give the wrong answer.
> 
> For x = y = 50, RowStride = -128, and format bytes = 4, the difference is:
> 
> Breakpoint 1, get_pointer_generic (ctx=0x686320, rb=0x9c3600, x=50, y=50)
> at main/renderbuffer.c:99
> 99   if (!rb->Data)
> (gdb) print (int *) rb->Data + (y * rb->RowStride + x)
> $1 = (int *) 0x72e3e2c8
> (gdb) print rb->Data + (y * rb->RowStride + 
> x)*_mesa_get_format_bytes(rb->Format)
> $3 = (GLvoid *) 0x8000f2e3e2c8
> 
> The delta between 0x72e3e2c8 and 0x8000f2e3e2c8 is pretty big.
> Math is hard.
> 
> Fixes crashes in lots of depth/stencil piglit tests on 64-bit platforms.
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37351
> ---
>  src/mesa/main/renderbuffer.c |   10 --
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
> index fa884c0..b7ab49f 100644
> --- a/src/mesa/main/renderbuffer.c
> +++ b/src/mesa/main/renderbuffer.c
> @@ -96,11 +96,17 @@ static void *
>  get_pointer_generic(struct gl_context *ctx, struct gl_renderbuffer *rb,
>   GLint x, GLint y)
>  {
> +   intptr_t offset;
> +
> if (!rb->Data)
>return NULL;
>  
> -   return ((char *) rb->Data +
> -(y * rb->RowStride + x) * _mesa_get_format_bytes(rb->Format));
> +   /* Must use signed math for this!  Since RowStride might be negative, we
> +* want a signed result.  On 64-bit platforms, an unsigned 32-bit result
> +* added to a 64-bit pointer will give the wrong answer.
> +*/
> +   offset = (y * rb->RowStride + x) * 
> (int)_mesa_get_format_bytes(rb->Format);
> +   return ((char *) rb->Data + offset);
>  }
>  
>  /* GetRow() implementation for formats where DataType matches the rb->Format.


Looks like all eyes were on this bug. I was just about a submit this
patch to the list myself.

Reviewed-by: Chad Versace 
-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glproto: add a new GLXBufferSwapComplete struct that matches the spec

2011-05-19 Thread Jesse Barnes
On Tue, 10 May 2011 17:57:52 -0700
Eric Anholt  wrote:

> On Tue, 10 May 2011 12:32:24 -0700, Jesse Barnes  
> wrote:
> > On Tue, 10 May 2011 11:59:56 -0700
> > Eric Anholt  wrote:
> > 
> > > On Thu, 5 May 2011 12:39:57 -0700, Jesse Barnes 
> > >  wrote:
> > > > Just add a new struct to remain compatible with existing code.
> > > > 
> > > > Signed-off-by: Jesse Barnes 
> > > > 
> > > > diff --git a/configure.ac b/configure.ac
> > > > index a3047e4..a6c301c 100644
> > > > --- a/configure.ac
> > > > +++ b/configure.ac
> > > > @@ -1,5 +1,5 @@
> > > >  AC_PREREQ([2.60])
> > > > -AC_INIT([GLProto], [1.4.13], 
> > > > [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
> > > > +AC_INIT([GLProto], [1.4.14], 
> > > > [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
> > > >  AM_INIT_AUTOMAKE([foreign dist-bzip2])
> > > >  AM_MAINTAINER_MODE
> > > >  
> > > > diff --git a/glxproto.h b/glxproto.h
> > > > index dfa0647..3f9e837 100644
> > > > --- a/glxproto.h
> > > > +++ b/glxproto.h
> > > > @@ -1375,6 +1375,20 @@ typedef struct {
> > > >  BYTE pad;
> > > >  CARD16 sequenceNumber B16;
> > > >  CARD16 event_type B16;
> > > 
> > > While this is the compat structure, I'd still like to see the padding
> > > explicit so I don't worry about it when reading the code ever again.
> > 
> > Ok, wanna push your existing patch for that or should I push it with
> > this stuff?
> 
> Meh, just push it with your stuff.

Ok, I've just pushed the dri2proto and glproto changes.  I'd appreciate
some testing besides myself before pushing the mesa bits though (which
work with both old and new X servers, so the delay in getting the X
bits merged should be fine).

There's a glx-swap-event test in piglit I've been using.  The -v option
will give you counts, and you can edit the server to start at a high
swap count to test the wrapping.

Thanks,
-- 
Jesse Barnes, Intel Open Source Technology Center
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Use signed math for possibly negative values

2011-05-19 Thread Chad Versace
On 05/19/2011 01:19 PM, Chad Versace wrote:
> On 05/19/2011 05:13 AM, Ian Romanick wrote:
>> From: Ian Romanick 
>>
>> Since RowStride might be negative, we want a signed result.  On 64-bit
>> platforms, an unsigned 32-bit result added to a 64-bit pointer will
>> give the wrong answer.
>
> Looks like all eyes were on this bug. I was just about a submit this
> patch to the list myself.
> 
> Reviewed-by: Chad Versace 

Oops, I just saw airlied's patch. I prefer airlie's approach because it
prevents future bugs arising from similiar misuse of
_mesa_get_format_bytes(). I think that if we rely on an explicit cast
here, in the future someone will forget to do the cast and this bug will
reappear.

-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH]: global forcing anisotropy

2011-05-19 Thread Carl-Philip Haensch
This attached patch should enable an option for forcing anisotropy  
from driconf.

Please comment or push if it's ok.
>From 79e2c7785ab0398eaf7a2ebc70ef980a26b7ca3a Mon Sep 17 00:00:00 2001
From: Carl-Philip Haensch 
Date: Thu, 19 May 2011 21:45:55 +0200
Subject: [PATCH] gallium/st: force anisotropy setting in driconf

---
 src/gallium/include/state_tracker/st_api.h |6 -
 .../state_trackers/dri/common/dri_context.c|5 ++-
 src/gallium/state_trackers/dri/common/dri_screen.c |   25 ---
 src/gallium/state_trackers/dri/common/dri_screen.h |2 +-
 src/mesa/state_tracker/st_atom_sampler.c   |5 ++-
 src/mesa/state_tracker/st_context.h|1 +
 src/mesa/state_tracker/st_manager.c|4 ++-
 7 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/src/gallium/include/state_tracker/st_api.h 
b/src/gallium/include/state_tracker/st_api.h
index d4973a1..b6e8262 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -136,7 +136,11 @@ enum st_manager_param {
 * For the mesa state tracker that means that it needs to invalidate
 * the framebuffer in glViewport itself.
 */
-   ST_MANAGER_BROKEN_INVALIDATE
+   ST_MANAGER_BROKEN_INVALIDATE,
+   /**
+* This parameter represents the global forced anisotropy.
+*/
+   ST_GLOBAL_ANISOTROPY
 };
 
 /**
diff --git a/src/gallium/state_trackers/dri/common/dri_context.c 
b/src/gallium/state_trackers/dri/common/dri_context.c
index e23c1bc..73ac43b 100644
--- a/src/gallium/state_trackers/dri/common/dri_context.c
+++ b/src/gallium/state_trackers/dri/common/dri_context.c
@@ -37,6 +37,7 @@
 
 #include "pipe/p_context.h"
 #include "state_tracker/st_context.h"
+#include "state_tracker/drm_driver.h"
 
 static void
 dri_init_extensions(struct dri_context *ctx)
@@ -86,8 +87,8 @@ dri_create_context(gl_api api, const struct gl_config * 
visual,
ctx->lock = screen->drmLock;
 
driParseConfigFiles(&ctx->optionCache,
-  &screen->optionCache, sPriv->myNum, "dri");
-
+  &screen->optionCache, sPriv->myNum, 
driver_descriptor.name);
+   screen->global_optionCache = &ctx->optionCache;
dri_fill_st_visual(&attribs.visual, screen, visual);
ctx->st = stapi->create_context(stapi, &screen->base, &attribs, st_share);
if (ctx->st == NULL)
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.c 
b/src/gallium/state_trackers/dri/common/dri_screen.c
index 5931df9..46f9984 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.c
+++ b/src/gallium/state_trackers/dri/common/dri_screen.c
@@ -42,15 +42,20 @@
 #include "util/u_debug.h"
 
 PUBLIC const char __driConfigOptions[] =
-   DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE
-   DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
-   DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
-   DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY
-/* DRI_CONF_FORCE_S3TC_ENABLE(false) */
-   DRI_CONF_ALLOW_LARGE_TEXTURES(1)
-   DRI_CONF_SECTION_END DRI_CONF_END;
-
-static const uint __driNConfigOptions = 3;
+   DRI_CONF_BEGIN
+  DRI_CONF_SECTION_PERFORMANCE
+ DRI_CONF_FTHROTTLE_MODE(DRI_CONF_FTHROTTLE_IRQS)
+ DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0)
+  DRI_CONF_SECTION_END
+   
+  DRI_CONF_SECTION_QUALITY
+ /*DRI_CONF_FORCE_S3TC_ENABLE(false)*/
+ DRI_CONF_ALLOW_LARGE_TEXTURES(1)
+ DRI_CONF_DEF_MAX_ANISOTROPY(1.0, "1.0,2.0,4.0,8.0,16.0")
+  DRI_CONF_SECTION_END
+   DRI_CONF_END;
+
+static const uint __driNConfigOptions = 4;
 
 static const __DRIconfig **
 dri_fill_in_modes(struct dri_screen *screen,
@@ -321,6 +326,8 @@ dri_get_param(struct st_manager *smapi,
switch(param) {
case ST_MANAGER_BROKEN_INVALIDATE:
   return screen->broken_invalidate;
+   case ST_GLOBAL_ANISOTROPY:
+  return (int)driQueryOptionf(screen->global_optionCache, 
"def_max_anisotropy");
default:
   return 0;
}
diff --git a/src/gallium/state_trackers/dri/common/dri_screen.h 
b/src/gallium/state_trackers/dri/common/dri_screen.h
index 8cb0a10..cf1b1fc 100644
--- a/src/gallium/state_trackers/dri/common/dri_screen.h
+++ b/src/gallium/state_trackers/dri/common/dri_screen.h
@@ -58,7 +58,7 @@ struct dri_screen
/**
 * Configuration cache with default values for all contexts
 */
-   driOptionCache optionCache;
+   driOptionCache optionCache, *global_optionCache;
 
/* drm */
int fd;
diff --git a/src/mesa/state_tracker/st_atom_sampler.c 
b/src/mesa/state_tracker/st_atom_sampler.c
index 06024ad..0dba553 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -177,8 +177,9 @@ static void convert_sampler(struct st_context *st,
  sampler->border_color);
 }
 
-sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?
-  0 : (GLuint) msamp->MaxAnisotropy);
+sampler->max_an

Re: [Mesa-dev] [PATCH] mesa: Fix return type of _mesa_get_format_bytes() (#37351)

2011-05-19 Thread Chad Versace
On 05/19/2011 11:14 AM, Adam Jackson wrote:
> Despite that negative values aren't sensible here, making this unsigned
> is dangerous.  Consider get_pointer_generic, which computes a value of
> the form:
> 
> void *base + (int x * int stride + int y) * unsigned bpp
> 
> The usual arithmetic conversions will coerce the (x*stride + y)
> subexpression to unsigned.  Since stride can be negative, this is
> disastrous.
> 
> Fixes at least the following piglit tests on Ironlake:
> 
> fbo/fbo-blit-d24s8
> spec/ARB_depth_texture/fbo-clear-formats
> spec/EXT_packed_depth_stencil/fbo-clear-formats
> 
> Signed-off-by: Adam Jackson 
> ---
>  src/mesa/main/formats.c |2 +-
>  src/mesa/main/formats.h |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)


I was just about to submit my own patch for this bug, but I you and idr
were too quick. My patch resembled idr's, but I prefer your approach. It
doesn't rely on users of _mesa_get_format_bytes() to remember to do an
explicit cast.

Reviewed-by: Chad Versace 


-- 
Chad Versace
c...@chad-versace.us
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): glapi: Implement SET_xxx as inline functions instead of macros.

2011-05-19 Thread Jose Fonseca
Sorry about that.

I don't know if GLAPIENTRY should be part of GL ES headers or not -- I'm not 
even sure there's an ABI defined on Windows.

Probably the easiest thing to do is to add
  
  #ifndef GLAPIENTRY
  #define GLAPIENTRY
  #endif

etc to the header being generated for GL ES.  I don't have time right now, but 
will take a look tomorrow.

Jose


- Original Message -
> * Jose Fonseca wrote:
> > Module: Mesa
> > Branch: master
> > Commit: ec4dfc2aad16ed3d04f47657e9f2cb22e791d511
> > URL:
> >
> > http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec4dfc2aad16ed3d04f47657e9f2cb22e791d511
> > 
> > Author: José Fonseca 
> > Date:   Thu May 19 16:49:49 2011 +0100
> > 
> > glapi: Implement SET_xxx as inline functions instead of macros.
> > 
> > In order to have the benefit of type checking, and detect missing
> > GLAPIENTRY keywords on public entrypoints.
> 
> This breaks GLES support for me. Looking at the preprocessor output
> (using
> -save-temps) it seems to be caused by GLAPIENTRY and GLAPIENTRYP not
> being
> defined for GLES.
> 
> I don't know what the best course of action would be? Defining
> GLAPIENTRY{,P}
> to GL_APIENTRY{,P} in both src/mesa/main/api_exec_es{1,2}.c fixes the
> issue.
> 
> Thierry
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glproto: add a new GLXBufferSwapComplete struct that matches the spec

2011-05-19 Thread Maxim Levitsky
On Thu, 2011-05-19 at 13:28 -0700, Jesse Barnes wrote: 
> On Tue, 10 May 2011 17:57:52 -0700
> Eric Anholt  wrote:
> 
> > On Tue, 10 May 2011 12:32:24 -0700, Jesse Barnes  
> > wrote:
> > > On Tue, 10 May 2011 11:59:56 -0700
> > > Eric Anholt  wrote:
> > > 
> > > > On Thu, 5 May 2011 12:39:57 -0700, Jesse Barnes 
> > > >  wrote:
> > > > > Just add a new struct to remain compatible with existing code.
> > > > > 
> > > > > Signed-off-by: Jesse Barnes 
> > > > > 
> > > > > diff --git a/configure.ac b/configure.ac
> > > > > index a3047e4..a6c301c 100644
> > > > > --- a/configure.ac
> > > > > +++ b/configure.ac
> > > > > @@ -1,5 +1,5 @@
> > > > >  AC_PREREQ([2.60])
> > > > > -AC_INIT([GLProto], [1.4.13], 
> > > > > [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
> > > > > +AC_INIT([GLProto], [1.4.14], 
> > > > > [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
> > > > >  AM_INIT_AUTOMAKE([foreign dist-bzip2])
> > > > >  AM_MAINTAINER_MODE
> > > > >  
> > > > > diff --git a/glxproto.h b/glxproto.h
> > > > > index dfa0647..3f9e837 100644
> > > > > --- a/glxproto.h
> > > > > +++ b/glxproto.h
> > > > > @@ -1375,6 +1375,20 @@ typedef struct {
> > > > >  BYTE pad;
> > > > >  CARD16 sequenceNumber B16;
> > > > >  CARD16 event_type B16;
> > > > 
> > > > While this is the compat structure, I'd still like to see the padding
> > > > explicit so I don't worry about it when reading the code ever again.
> > > 
> > > Ok, wanna push your existing patch for that or should I push it with
> > > this stuff?
> > 
> > Meh, just push it with your stuff.
> 
> Ok, I've just pushed the dri2proto and glproto changes.  I'd appreciate
> some testing besides myself before pushing the mesa bits though (which
> work with both old and new X servers, so the delay in getting the X
> bits merged should be fine).
> 
> There's a glx-swap-event test in piglit I've been using.  The -v option
> will give you counts, and you can edit the server to start at a high
> swap count to test the wrapping.


To be honest, I already use the whole patchset for a week from now.
I applied in in small hope it would fix really bad flickering in games
if compiz is running on nouveau stack. It didn't fix it, but nether seem
to break anything. 

-- 
Best regards,
Maxim Levitsky


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Fix return type of _mesa_get_format_bytes() (#37351)

2011-05-19 Thread Ian Romanick
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 05/19/2011 08:14 PM, Adam Jackson wrote:
> Despite that negative values aren't sensible here, making this unsigned
> is dangerous.  Consider get_pointer_generic, which computes a value of
> the form:
> 
> void *base + (int x * int stride + int y) * unsigned bpp
> 
> The usual arithmetic conversions will coerce the (x*stride + y)
> subexpression to unsigned.  Since stride can be negative, this is
> disastrous.
> 
> Fixes at least the following piglit tests on Ironlake:
> 
> fbo/fbo-blit-d24s8
> spec/ARB_depth_texture/fbo-clear-formats
> spec/EXT_packed_depth_stencil/fbo-clear-formats
> 
> Signed-off-by: Adam Jackson 

I don't care which approach we go with.  This will likely fix it
everywhere, but I'd like there to be a comment explaining why the return
type must not be unsigned.  Otherwise someone will come along in the
future and make it unsigned in the name of "code cleanup."

> ---
>  src/mesa/main/formats.c |2 +-
>  src/mesa/main/formats.h |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
> index 60e8ae3..a46633b 100644
> --- a/src/mesa/main/formats.c
> +++ b/src/mesa/main/formats.c
> @@ -1119,7 +1119,7 @@ _mesa_get_format_name(gl_format format)
>   * Normally, a block is 1x1 (a single pixel).  But for compressed formats
>   * a block may be 4x4 or 8x4, etc.
>   */
> -GLuint
> +GLint
>  _mesa_get_format_bytes(gl_format format)
>  {
> const struct gl_format_info *info = _mesa_get_format_info(format);
> diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
> index df9ed70..0640bbc 100644
> --- a/src/mesa/main/formats.h
> +++ b/src/mesa/main/formats.h
> @@ -216,7 +216,7 @@ typedef enum
>  extern const char *
>  _mesa_get_format_name(gl_format format);
>  
> -extern GLuint
> +extern GLint
>  _mesa_get_format_bytes(gl_format format);
>  
>  extern GLint
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3WB0YACgkQX1gOwKyEAw/VVwCeM2EGDlT7pf0zImg++KBQMQ0Y
8zEAniTakBqiEAj0mxCFNypyJ86EhGyl
=NP7k
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa (master): glapi: Implement SET_xxx as inline functions instead of macros.

2011-05-19 Thread Carl-Philip Haensch

Zitat von Jose Fonseca :


Sorry about that.

I don't know if GLAPIENTRY should be part of GL ES headers or not --  
 I'm not even sure there's an ABI defined on Windows.




The OpenGL library has to use the stdcall convention on windows while  
it's cdecl on linux. For ES maybe the same.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Emit definition of GLAPIENTRYP in es_generator.py.

2011-05-19 Thread Thierry Reding
GLES uses GL_APIENTRYP instead of GLAPIENTRYP, which breaks with the
latest API table generation code. This fixes the issue by emitting a
definition for GL_APIENTRYP when generating the GLES files.
---
 src/mesa/main/es_generator.py |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/es_generator.py b/src/mesa/main/es_generator.py
index aa8dab7..a56debe 100644
--- a/src/mesa/main/es_generator.py
+++ b/src/mesa/main/es_generator.py
@@ -195,6 +195,10 @@ print """
 #include "main/api_exec.h"
 
 #if FEATURE_%s
+
+#ifndef GLAPIENTRYP
+#define GLAPIENTRYP GL_APIENTRYP
+#endif
 """ % (versionHeader, versionExtHeader, shortname.upper())
 
 # Everyone needs these types.
-- 
1.7.5.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev