[Mesa-dev] [PATCH] mesa: silence some compilation warnings.

2011-05-12 Thread zhigang gong
glu.h: typedef void (GLAPIENTRYP _GLUfuncptr)(); causes the following
   warning: function declaration isn't a prototype.
egl:   When convert a (void *) to a int type, it's better to
   convert to long firstly, otherwise in 64 bit envirnonment, it
   causes compilation warning.
---
 include/GL/glu.h|2 +-
 src/egl/drivers/dri2/egl_dri2.c |4 ++--
 src/egl/drivers/dri2/platform_drm.c |4 ++--
 src/egl/drivers/dri2/platform_x11.c |2 +-
 src/egl/main/eglapi.c   |2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/GL/glu.h b/include/GL/glu.h
index cd967ac..ba2228d 100644
--- a/include/GL/glu.h
+++ b/include/GL/glu.h
@@ -284,7 +284,7 @@ typedef GLUtesselator GLUtriangulatorObj;
 #define GLU_TESS_MAX_COORD 1.0e150

 /* Internal convenience typedefs */
-typedef void (GLAPIENTRYP _GLUfuncptr)();
+typedef void (GLAPIENTRYP _GLUfuncptr)(void);

 GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
 GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index afab679..f5f5ac3 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay
*disp, _EGLContext *ctx,
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
struct dri2_egl_image *dri2_img;
-   GLuint renderbuffer = (GLuint) buffer;
+   GLuint renderbuffer =  (unsigned long) buffer;

if (renderbuffer == 0) {
   _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
@@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay
*disp, _EGLContext *ctx,

(void) ctx;

-   name = (EGLint) buffer;
+   name = (unsigned long) buffer;

err = _eglParseImageAttribList(&attrs, disp, attr_list);
if (err != EGL_SUCCESS)
diff --git a/src/egl/drivers/dri2/platform_drm.c
b/src/egl/drivers/dri2/platform_drm.c
index 68912e3..cea8418 100644
--- a/src/egl/drivers/dri2/platform_drm.c
+++ b/src/egl/drivers/dri2/platform_drm.c
@@ -596,7 +596,7 @@ dri2_get_device_name(int fd)
   goto out;
}

-   device_name = udev_device_get_devnode(device);
+   device_name = (char*)udev_device_get_devnode(device);
if (!device_name)
   goto out;
device_name = strdup(device_name);
@@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
memset(dri2_dpy, 0, sizeof *dri2_dpy);

disp->DriverData = (void *) dri2_dpy;
-   dri2_dpy->fd = (int) disp->PlatformDisplay;
+   dri2_dpy->fd = (long) disp->PlatformDisplay;

dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
if (dri2_dpy->driver_name == NULL)
diff --git a/src/egl/drivers/dri2/platform_x11.c
b/src/egl/drivers/dri2/platform_x11.c
index 5d4ac6a..90136f4 100644
--- a/src/egl/drivers/dri2/platform_x11.c
+++ b/src/egl/drivers/dri2/platform_x11.c
@@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,
_EGLContext *ctx,

(void) ctx;

-   drawable = (xcb_drawable_t) buffer;
+   drawable = (xcb_drawable_t) (long)buffer;
xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
buffers_cookie =
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 336ec23..9063752 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
 EGLDisplay EGLAPIENTRY
 eglGetDRMDisplayMESA(int fd)
 {
-   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
+   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (long)fd);
return _eglGetDisplayHandle(dpy);
 }

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


[Mesa-dev] [Bug 36738] Openarena crash with r300g, swrastg + llvm > 2.8

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

--- Comment #19 from José Fonseca  2011-05-12 06:07:22 PDT 
---
I have:
- setup a VM with 
  - single vcpu
  - cpuid bits sse3, ssse3, sse4_1, and sse4_2 masked
- booted your ISO (both i686 and x86_64 versions)
- ran openarena 0.8.5
  - tried all maps

But still couldn't reproduce this here...

Could you please:
- boot from bug_36738.i686-0.0.5.iso, 
- enable core dumps by doing 'ulimit -c unlimited',
- reproduce the openarena + llvmpipe crash, and
- provide the generated core dump file.

Thanks.

-- 
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


Re: [Mesa-dev] threads and X.org/AIGLX drivers

2011-05-12 Thread Kristian Høgsberg
On Wed, May 11, 2011 at 2:53 AM, Dave Airlie  wrote:
> Hey,
>
> So we got a bug reported against F15 where we were getting an illegal
> input event type 0, after passing it around the RH X team I eventually
> came to look at it.
>
> The problem appears to be that we are using llvmpipe as our swrast
> renderer and on systems that fallback to that we end up with threads
> inside the X server, that we didn't spawn. It appears SIGIO gets
> delivered to one of these threads while the main thread keeps on
> trucking and fail ensues.
>
> So I'm crossposting this as there are two fixes we can do that aren't
> exclusive but could act as belt and braces on Linux at least (other
> OSes get the belt only).
>
> Fix 1: use F_SETOWN_EX, thank to DrNick and AaronP on irc for digging
> up this nugget, "From  Linux  2.6.32 onwards, use F_SETOWN_EX to
> target SIGIO
>                and SIGURG signals at a particular thread.". So on
> Linux we would use that instead of F_SETOWN to make sure SIGIO only
> goes to the main X process/thread. Though I'm not sure how to get the
> defintion for gettid which we need, though I'll look into this a bit
> more.
>
> Fix 2: block all signals in the gallium thread spawning code, this
> involves using pthread_sigmask around the pthread_create function.
> Calling it once with a full set of signals to block, and get a copy of
> the current signals, then calling it again to put back the current
> signals. I think this might be a good plan for some other things, as I
> can't see a good reason for a DRI driver to ever get SIGIO, esp as it
> may interfere with the parent app.
>
> I've built a test package with 2 in it for Fedora and am awaiting
> feedback from the tester, but just though I'd raise the subject here
> for some discussion/feedback.

A different solution could be to use the input thread idea and stop
taking SIGIO.

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


Re: [Mesa-dev] [PATCH] mesa: silence some compilation warnings.

2011-05-12 Thread Patrick Baggett
I would be wary of assuming you can typecast long -> pointer, or pointer ->
long. On 64-bit Windows,  sizeof(int) == sizeof(long) == 4 but sizeof(void*)
== 8. On 64-bit Linux (gcc), sizeof(int) == 4, sizeof(long) == sizeof(void*)
== 8. It would be better to use  with uintptr_t -- it was designed
to solve this problem exactly. If you insist on using long, why not use long
long (C99) which is 64-bits on both platforms.



On Thu, May 12, 2011 at 3:49 AM, zhigang gong wrote:

> glu.h: typedef void (GLAPIENTRYP _GLUfuncptr)(); causes the following
>   warning: function declaration isn't a prototype.
> egl:   When convert a (void *) to a int type, it's better to
>   convert to long firstly, otherwise in 64 bit envirnonment, it
>   causes compilation warning.
> ---
>  include/GL/glu.h|2 +-
>  src/egl/drivers/dri2/egl_dri2.c |4 ++--
>  src/egl/drivers/dri2/platform_drm.c |4 ++--
>  src/egl/drivers/dri2/platform_x11.c |2 +-
>  src/egl/main/eglapi.c   |2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/include/GL/glu.h b/include/GL/glu.h
> index cd967ac..ba2228d 100644
> --- a/include/GL/glu.h
> +++ b/include/GL/glu.h
> @@ -284,7 +284,7 @@ typedef GLUtesselator GLUtriangulatorObj;
>  #define GLU_TESS_MAX_COORD 1.0e150
>
>  /* Internal convenience typedefs */
> -typedef void (GLAPIENTRYP _GLUfuncptr)();
> +typedef void (GLAPIENTRYP _GLUfuncptr)(void);
>
>  GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
>  GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
> diff --git a/src/egl/drivers/dri2/egl_dri2.c
> b/src/egl/drivers/dri2/egl_dri2.c
> index afab679..f5f5ac3 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay
> *disp, _EGLContext *ctx,
>struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
>struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
>struct dri2_egl_image *dri2_img;
> -   GLuint renderbuffer = (GLuint) buffer;
> +   GLuint renderbuffer =  (unsigned long) buffer;
>
>if (renderbuffer == 0) {
>   _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
> @@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay
> *disp, _EGLContext *ctx,
>
>(void) ctx;
>
> -   name = (EGLint) buffer;
> +   name = (unsigned long) buffer;
>
>err = _eglParseImageAttribList(&attrs, disp, attr_list);
>if (err != EGL_SUCCESS)
> diff --git a/src/egl/drivers/dri2/platform_drm.c
> b/src/egl/drivers/dri2/platform_drm.c
> index 68912e3..cea8418 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -596,7 +596,7 @@ dri2_get_device_name(int fd)
>   goto out;
>}
>
> -   device_name = udev_device_get_devnode(device);
> +   device_name = (char*)udev_device_get_devnode(device);
>if (!device_name)
>   goto out;
>device_name = strdup(device_name);
> @@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
>memset(dri2_dpy, 0, sizeof *dri2_dpy);
>
>disp->DriverData = (void *) dri2_dpy;
> -   dri2_dpy->fd = (int) disp->PlatformDisplay;
> +   dri2_dpy->fd = (long) disp->PlatformDisplay;
>
>dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
>if (dri2_dpy->driver_name == NULL)
> diff --git a/src/egl/drivers/dri2/platform_x11.c
> b/src/egl/drivers/dri2/platform_x11.c
> index 5d4ac6a..90136f4 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,
> _EGLContext *ctx,
>
>(void) ctx;
>
> -   drawable = (xcb_drawable_t) buffer;
> +   drawable = (xcb_drawable_t) (long)buffer;
>xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
>attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
>buffers_cookie =
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 336ec23..9063752 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA
> mode)
>  EGLDisplay EGLAPIENTRY
>  eglGetDRMDisplayMESA(int fd)
>  {
> -   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
> +   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *)
> (long)fd);
>return _eglGetDisplayHandle(dpy);
>  }
>
> --
> 1.7.3.1
> ___
> 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] threads and X.org/AIGLX drivers

2011-05-12 Thread Daniel Stone
On Thu, May 12, 2011 at 09:45:14AM -0400, Kristian Høgsberg wrote:
> A different solution could be to use the input thread idea and stop
> taking SIGIO.

The input thread needs a lot of work though - we don't do any locking at
all.  So try doing device creation/destruction in a loop, or changing
the device hierachy, or, or, or, while generating input events at the
same time.  It won't end well.

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


Re: [Mesa-dev] [PATCH] mesa: silence some compilation warnings.

2011-05-12 Thread Jose Fonseca
I agree with Patrick concerning the int casts. 

Zhigang, I've commited your changes have tweaking the int casts. Plus a few 
other warning fixes. 

I did only a test compile here, so let me know if I broke anything. 

Jose 

- Original Message -

> I would be wary of assuming you can typecast long -> pointer, or
> pointer -> long. On 64-bit Windows, sizeof(int) == sizeof(long) == 4
> but sizeof(void*) == 8. On 64-bit Linux (gcc), sizeof(int) == 4,
> sizeof(long) == sizeof(void*) == 8. It would be better to use
>  with uintptr_t -- it was designed to solve this problem
> exactly. If you insist on using long, why not use long long (C99)
> which is 64-bits on both platforms.

> On Thu, May 12, 2011 at 3:49 AM, zhigang gong <
> zhigang.g...@gmail.com > wrote:

> > glu.h: typedef void (GLAPIENTRYP _GLUfuncptr)(); causes the
> > following
> 
> > warning: function declaration isn't a prototype.
> 
> > egl: When convert a (void *) to a int type, it's better to
> 
> > convert to long firstly, otherwise in 64 bit envirnonment, it
> 
> > causes compilation warning.
> 
> > ---
> 
> > include/GL/glu.h | 2 +-
> 
> > src/egl/drivers/dri2/egl_dri2.c | 4 ++--
> 
> > src/egl/drivers/dri2/platform_drm.c | 4 ++--
> 
> > src/egl/drivers/dri2/platform_x11.c | 2 +-
> 
> > src/egl/main/eglapi.c | 2 +-
> 
> > 5 files changed, 7 insertions(+), 7 deletions(-)
> 

> > diff --git a/include/GL/glu.h b/include/GL/glu.h
> 
> > index cd967ac..ba2228d 100644
> 
> > --- a/include/GL/glu.h
> 
> > +++ b/include/GL/glu.h
> 
> > @@ -284,7 +284,7 @@ typedef GLUtesselator GLUtriangulatorObj;
> 
> > #define GLU_TESS_MAX_COORD 1.0e150
> 

> > /* Internal convenience typedefs */
> 
> > -typedef void (GLAPIENTRYP _GLUfuncptr)();
> 
> > +typedef void (GLAPIENTRYP _GLUfuncptr)(void);
> 

> > GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
> 
> > GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
> 
> > diff --git a/src/egl/drivers/dri2/egl_dri2.c
> > b/src/egl/drivers/dri2/egl_dri2.c
> 
> > index afab679..f5f5ac3 100644
> 
> > --- a/src/egl/drivers/dri2/egl_dri2.c
> 
> > +++ b/src/egl/drivers/dri2/egl_dri2.c
> 
> > @@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay
> 
> > *disp, _EGLContext *ctx,
> 
> > struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> 
> > struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
> 
> > struct dri2_egl_image *dri2_img;
> 
> > - GLuint renderbuffer = (GLuint) buffer;
> 
> > + GLuint renderbuffer = (unsigned long) buffer;
> 

> > if (renderbuffer == 0) {
> 
> > _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
> 
> > @@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay
> 
> > *disp, _EGLContext *ctx,
> 

> > (void) ctx;
> 

> > - name = (EGLint) buffer;
> 
> > + name = (unsigned long) buffer;
> 

> > err = _eglParseImageAttribList(&attrs, disp, attr_list);
> 
> > if (err != EGL_SUCCESS)
> 
> > diff --git a/src/egl/drivers/dri2/platform_drm.c
> 
> > b/src/egl/drivers/dri2/platform_drm.c
> 
> > index 68912e3..cea8418 100644
> 
> > --- a/src/egl/drivers/dri2/platform_drm.c
> 
> > +++ b/src/egl/drivers/dri2/platform_drm.c
> 
> > @@ -596,7 +596,7 @@ dri2_get_device_name(int fd)
> 
> > goto out;
> 
> > }
> 

> > - device_name = udev_device_get_devnode(device);
> 
> > + device_name = (char*)udev_device_get_devnode(device);
> 
> > if (!device_name)
> 
> > goto out;
> 
> > device_name = strdup(device_name);
> 
> > @@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv,
> > _EGLDisplay
> > *disp)
> 
> > memset(dri2_dpy, 0, sizeof *dri2_dpy);
> 

> > disp->DriverData = (void *) dri2_dpy;
> 
> > - dri2_dpy->fd = (int) disp->PlatformDisplay;
> 
> > + dri2_dpy->fd = (long) disp->PlatformDisplay;
> 

> > dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
> 
> > if (dri2_dpy->driver_name == NULL)
> 
> > diff --git a/src/egl/drivers/dri2/platform_x11.c
> 
> > b/src/egl/drivers/dri2/platform_x11.c
> 
> > index 5d4ac6a..90136f4 100644
> 
> > --- a/src/egl/drivers/dri2/platform_x11.c
> 
> > +++ b/src/egl/drivers/dri2/platform_x11.c
> 
> > @@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,
> 
> > _EGLContext *ctx,
> 

> > (void) ctx;
> 

> > - drawable = (xcb_drawable_t) buffer;
> 
> > + drawable = (xcb_drawable_t) (long)buffer;
> 
> > xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
> 
> > attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
> 
> > buffers_cookie =
> 
> > diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> 
> > index 336ec23..9063752 100644
> 
> > --- a/src/egl/main/eglapi.c
> 
> > +++ b/src/egl/main/eglapi.c
> 
> > @@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy,
> > EGLModeMESA mode)
> 
> > EGLDisplay EGLAPIENTRY
> 
> > eglGetDRMDisplayMESA(int fd)
> 
> > {
> 
> > - _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *)
> > fd);
> 
> > + _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *)
> > (long)fd);
> 
> > return _eglGetDisplayHandle(dpy);
> 
> > }
> 

> > --
> 
> > 1.7.3

Re: [Mesa-dev] [PATCH] mesa: silence some compilation warnings.

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

On 05/12/2011 01:49 AM, zhigang gong wrote:
> glu.h: typedef void (GLAPIENTRYP _GLUfuncptr)(); causes the following
>warning: function declaration isn't a prototype.
> egl:   When convert a (void *) to a int type, it's better to
>convert to long firstly, otherwise in 64 bit envirnonment, it
>causes compilation warning.

I would suggest using either uintptr_t / intptr_t (preferable) or
ptrdiff_t for this purpose.

> ---
>  include/GL/glu.h|2 +-
>  src/egl/drivers/dri2/egl_dri2.c |4 ++--
>  src/egl/drivers/dri2/platform_drm.c |4 ++--
>  src/egl/drivers/dri2/platform_x11.c |2 +-
>  src/egl/main/eglapi.c   |2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/GL/glu.h b/include/GL/glu.h
> index cd967ac..ba2228d 100644
> --- a/include/GL/glu.h
> +++ b/include/GL/glu.h
> @@ -284,7 +284,7 @@ typedef GLUtesselator GLUtriangulatorObj;
>  #define GLU_TESS_MAX_COORD 1.0e150
> 
>  /* Internal convenience typedefs */
> -typedef void (GLAPIENTRYP _GLUfuncptr)();
> +typedef void (GLAPIENTRYP _GLUfuncptr)(void);
> 
>  GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
>  GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index afab679..f5f5ac3 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay
> *disp, _EGLContext *ctx,
> struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
> struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
> struct dri2_egl_image *dri2_img;
> -   GLuint renderbuffer = (GLuint) buffer;
> +   GLuint renderbuffer =  (unsigned long) buffer;
> 
> if (renderbuffer == 0) {
>_eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
> @@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay
> *disp, _EGLContext *ctx,
> 
> (void) ctx;
> 
> -   name = (EGLint) buffer;
> +   name = (unsigned long) buffer;
> 
> err = _eglParseImageAttribList(&attrs, disp, attr_list);
> if (err != EGL_SUCCESS)
> diff --git a/src/egl/drivers/dri2/platform_drm.c
> b/src/egl/drivers/dri2/platform_drm.c
> index 68912e3..cea8418 100644
> --- a/src/egl/drivers/dri2/platform_drm.c
> +++ b/src/egl/drivers/dri2/platform_drm.c
> @@ -596,7 +596,7 @@ dri2_get_device_name(int fd)
>goto out;
> }
> 
> -   device_name = udev_device_get_devnode(device);
> +   device_name = (char*)udev_device_get_devnode(device);
> if (!device_name)
>goto out;
> device_name = strdup(device_name);
> @@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
> memset(dri2_dpy, 0, sizeof *dri2_dpy);
> 
> disp->DriverData = (void *) dri2_dpy;
> -   dri2_dpy->fd = (int) disp->PlatformDisplay;
> +   dri2_dpy->fd = (long) disp->PlatformDisplay;
> 
> dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
> if (dri2_dpy->driver_name == NULL)
> diff --git a/src/egl/drivers/dri2/platform_x11.c
> b/src/egl/drivers/dri2/platform_x11.c
> index 5d4ac6a..90136f4 100644
> --- a/src/egl/drivers/dri2/platform_x11.c
> +++ b/src/egl/drivers/dri2/platform_x11.c
> @@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,
> _EGLContext *ctx,
> 
> (void) ctx;
> 
> -   drawable = (xcb_drawable_t) buffer;
> +   drawable = (xcb_drawable_t) (long)buffer;
> xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
> attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
> buffers_cookie =
> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
> index 336ec23..9063752 100644
> --- a/src/egl/main/eglapi.c
> +++ b/src/egl/main/eglapi.c
> @@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
>  EGLDisplay EGLAPIENTRY
>  eglGetDRMDisplayMESA(int fd)
>  {
> -   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
> +   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (long)fd);
> return _eglGetDisplayHandle(dpy);
>  }
> 
> --
> 1.7.3.1
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk3MHWwACgkQX1gOwKyEAw8WEwCfeHYZetkzmlLd17uN88sB2mej
pj0AnjJeNbAZ0c0Yu9zmAsA0a5W2+1Aq
=snFW
-END PGP SIGNATURE-
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev



[Mesa-dev] [Bug 37147] New: Compile error in nouveau if --enable-shared-dricore is set

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

   Summary: Compile error in nouveau if --enable-shared-dricore is
set
   Product: Mesa
   Version: git
  Platform: Other
OS/Version: All
Status: NEW
  Severity: blocker
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: johannesoberm...@gmx.de


Created an attachment (id=46645)
 --> (https://bugs.freedesktop.org/attachment.cgi?id=46645)
Complete build log

Without --enable-shared-dricore the include dir for libdrm_nouveau is
determined in src/mesa/drivers/dri/nouveau/Makefile:6.

Somehow this does not work if --enable-shared-dricore is set ...

-- 
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] [Bug 37147] Compile error in nouveau if --enable-shared-dricore is set

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

Johannes Obermayr  changed:

   What|Removed |Added

  Attachment #46645|text/x-log  |text/plain
  mime type||

-- 
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] [Bug 36738] Openarena crash with r300g, swrastg + llvm > 2.8

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

--- Comment #20 from Iaroslav  2011-05-12 13:21:27 PDT ---
(In reply to comment #19)
> I have:
> - setup a VM with 
>   - single vcpu
>   - cpuid bits sse3, ssse3, sse4_1, and sse4_2 masked
> - booted your ISO (both i686 and x86_64 versions)
> - ran openarena 0.8.5
>   - tried all maps
> 
> But still couldn't reproduce this here...
> 
> Could you please:
> - boot from bug_36738.i686-0.0.5.iso, 
> - enable core dumps by doing 'ulimit -c unlimited',
> - reproduce the openarena + llvmpipe crash, and
> - provide the generated core dump file.
> 
> Thanks.

Now everything is clear, I've always used openarenа 0.8.1 from , when i update
openarena to 0.8.5 it actually will work without the problems. In opensuse repo
still 0.8.1, and its complete useless with mesa+llvm > 2.8. Could you test
llvmpipe with openarena 0.8.1 or less?
xscreensaver/crackbeg useless with r300g+llvm too.

openarena don't create the core dump, but crackbeg create. Can I use gdb
generate-core-file and provide it if necessary?

-- 
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] [Bug 36738] Openarena crash with r300g, swrastg + llvm > 2.8

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

--- Comment #21 from Iaroslav  2011-05-12 13:24:19 PDT ---
> I've always used openarenа 0.8.1 from

I've always used openarenа 0.8.1 from openarena.ws

-- 
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] [Bug 37150] New: sRGB textures are too bright in Starcraft 2

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

   Summary: sRGB textures are too bright in Starcraft 2
   Product: Mesa
   Version: git
  Platform: Other
OS/Version: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Mesa core
AssignedTo: mesa-dev@lists.freedesktop.org
ReportedBy: pavel.ondra...@email.cz


When Starcraft 2 is started menus have normal color, however when I start
a mission and then exit back to the menus, they are overbright. Not the whole
menu is too bright, background is fine, only the user interface is too bright.
The same is true for ingame controls panels, on the first load they are ok,
when starting second game, they are too bright and in each subsequent game this
is getting worse.

Setting MESA_EXTENSION_OVERRIDE="-GL_EXT_texture_sRGB_decode" fixes this.

More info and screenshots in this Wine bug:
http://bugs.winehq.org/show_bug.cgi?id=26752
I had opened bug against Wine since this was introduced by Wine update, but the
offending commit was "wined3d: Use EXT_texture_sRGB_decode to avoid sRGB
texture duplication" and Henri Verbeet indicated this could be as well a mesa
bug. Btw NVIDIA driver is fine.

Setting component to mesa core because llvmpipe is affected as well.

-- 
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] [Bug 37150] sRGB textures are too bright in Starcraft 2

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

--- Comment #1 from Pavel Ondračka  2011-05-12 
14:16:44 PDT ---
I forgot to mention:
OpenGL renderer string: Gallium 0.4 on ATI RV530
OpenGL version string: 2.1 Mesa 7.11-devel (git-32a95cb)

-- 
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] [Bug 36651] mesa requires bison and flex to build but configure does not check for them

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

Brian Paul  changed:

   What|Removed |Added

  Attachment #46450|0   |1
is obsolete||

--- Comment #4 from Brian Paul  2011-05-12 15:31:46 PDT 
---
Created an attachment (id=46650)
 View: https://bugs.freedesktop.org/attachment.cgi?id=46650
 Review: https://bugs.freedesktop.org/review?bug=36651&attachment=46650

updated patch

Thanks for the tips, Dan.  Here's an updated patch.  Note that AC_PATH_PROG
returns "" not "no" when the program is not found.

-- 
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] r600g: reduce flushes so only when texture and CB overlap.

2011-05-12 Thread Dave Airlie
From: Dave Airlie 

We only need to do this when the texture and CB are using the
same memory area.

Signed-off-by: Dave Airlie 
---
 src/gallium/winsys/r600/drm/r600_hw_context.c |   23 +++
 src/gallium/winsys/r600/drm/r600_priv.h   |2 ++
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c 
b/src/gallium/winsys/r600/drm/r600_hw_context.c
index a32793c..7c3fd1a 100644
--- a/src/gallium/winsys/r600/drm/r600_hw_context.c
+++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -824,14 +824,17 @@ void r600_context_bo_flush(struct r600_context *ctx, 
unsigned flush_flags,
 G_0085F0_DB_ACTION_ENA(flush_flags))) {
if (ctx->flags & R600_CONTEXT_CHECK_EVENT_FLUSH) {
/* the rv670 seems to fail fbo-generatemipmap unless we 
flush the CB1 dest base ena */
-   if ((ctx->radeon->family == CHIP_RV670) ||
-   (ctx->radeon->family == CHIP_RS780) ||
-   (ctx->radeon->family == CHIP_RS880)) {
-   ctx->pm4[ctx->pm4_cdwords++] = 
PKT3(PKT3_SURFACE_SYNC, 3, ctx->predicate_drawing);
-   ctx->pm4[ctx->pm4_cdwords++] = 
S_0085F0_CB1_DEST_BASE_ENA(1); /* CP_COHER_CNTL */
-   ctx->pm4[ctx->pm4_cdwords++] = 0x;  
/* CP_COHER_SIZE */
-   ctx->pm4[ctx->pm4_cdwords++] = 0;   
/* CP_COHER_BASE */
-   ctx->pm4[ctx->pm4_cdwords++] = 0x000A;  
/* POLL_INTERVAL */
+   if ((bo->binding & BO_BOUND_TEXTURE) &&
+   (flush_flags & S_0085F0_CB_ACTION_ENA(1))) {
+   if ((ctx->radeon->family == CHIP_RV670) ||
+   (ctx->radeon->family == CHIP_RS780) ||
+   (ctx->radeon->family == CHIP_RS880)) {
+   ctx->pm4[ctx->pm4_cdwords++] = 
PKT3(PKT3_SURFACE_SYNC, 3, ctx->predicate_drawing);
+   ctx->pm4[ctx->pm4_cdwords++] = 
S_0085F0_CB1_DEST_BASE_ENA(1); /* CP_COHER_CNTL */
+   ctx->pm4[ctx->pm4_cdwords++] = 
0x;  /* CP_COHER_SIZE */
+   ctx->pm4[ctx->pm4_cdwords++] = 0;   
/* CP_COHER_BASE */
+   ctx->pm4[ctx->pm4_cdwords++] = 
0x000A;  /* POLL_INTERVAL */
+   }
}
 
ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE, 
0, ctx->predicate_drawing);
@@ -964,6 +967,9 @@ void r600_context_pipe_state_set_resource(struct 
r600_context *ctx, struct r600_
block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
if (state == NULL) {
block->status &= ~(R600_BLOCK_STATUS_ENABLED | 
R600_BLOCK_STATUS_DIRTY);
+   if (block->reloc[1].bo)
+   block->reloc[1].bo->bo->binding &= ~BO_BOUND_TEXTURE;
+
r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
LIST_DELINIT(&block->list);
@@ -1017,6 +1023,7 @@ void r600_context_pipe_state_set_resource(struct 
r600_context *ctx, struct r600_
r600_bo_reference(ctx->radeon, &block->reloc[2].bo, 
state->regs[3].bo);
state->regs[2].bo->fence = ctx->radeon->fence;
state->regs[3].bo->fence = ctx->radeon->fence;
+   state->regs[2].bo->bo->binding |= BO_BOUND_TEXTURE;
}
}
r600_context_dirty_block(ctx, block, dirty, num_regs - 1);
diff --git a/src/gallium/winsys/r600/drm/r600_priv.h 
b/src/gallium/winsys/r600/drm/r600_priv.h
index 003fca0..4f7e60c 100644
--- a/src/gallium/winsys/r600/drm/r600_priv.h
+++ b/src/gallium/winsys/r600/drm/r600_priv.h
@@ -73,6 +73,7 @@ struct r600_reg {
unsignedflush_mask;
 };
 
+#define BO_BOUND_TEXTURE 1
 struct radeon_bo {
struct pipe_reference   reference;
unsignedhandle;
@@ -88,6 +89,7 @@ struct radeon_bo {
unsignedreloc_id;
unsignedlast_flush;
unsignedname;
+   unsignedbinding;
 };
 
 struct r600_bo {
-- 
1.7.1

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


[Mesa-dev] [PATCH 05/11] i965/fs: Add support for "if" statements in 16-wide mode.

2011-05-12 Thread Eric Anholt
It turns out there's nothing in the hardware preventing this, it was
just the lame backend we used to have.

Improves glbenchmark Egypt framerate 4.4% +/- 0.3% (n=3), and Pro by
2.6% +/- 0.6% (n=3).
---
 src/mesa/drivers/dri/i965/brw_eu_emit.c |6 +-
 src/mesa/drivers/dri/i965/brw_fs.cpp|9 -
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c 
b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index 859068e..afa1982 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -913,7 +913,11 @@ gen6_IF(struct brw_compile *p, uint32_t conditional,
insn = next_insn(p, BRW_OPCODE_IF);
 
brw_set_dest(p, insn, brw_imm_w(0));
-   insn->header.execution_size = BRW_EXECUTE_8;
+   if (p->compressed) {
+  insn->header.execution_size = BRW_EXECUTE_16;
+   } else {
+  insn->header.execution_size = BRW_EXECUTE_8;
+   }
insn->bits1.branch_gen6.jump_count = 0;
brw_set_src0(insn, src0);
brw_set_src1(insn, src1);
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 7db1314..ef51369 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1797,10 +1797,6 @@ fs_visitor::visit(ir_if *ir)
 {
fs_inst *inst;
 
-   if (c->dispatch_width == 16) {
-  fail("Can't support (non-uniform) control flow on 16-wide\n");
-   }
-
/* Don't point the annotation at the if statement, because then it plus
 * the then and else blocks get printed.
 */
@@ -3803,8 +3799,11 @@ fs_visitor::generate_code()
assert(intel->gen >= 6);
if_stack[if_stack_depth] = gen6_IF(p, inst->conditional_mod, 
src[0], src[1]);
 } else {
-   if_stack[if_stack_depth] = brw_IF(p, BRW_EXECUTE_8);
+   if_stack[if_stack_depth] = brw_IF(p, c->dispatch_width == 16 ?
+ BRW_EXECUTE_16 :
+ BRW_EXECUTE_8);
 }
+
 if_depth_in_loop[loop_stack_depth]++;
 if_stack_depth++;
 if (if_stack_array_size <= if_stack_depth) {
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 02/11] i965/fs: Cut an instruction and a temporary from gen6 discard statements.

2011-05-12 Thread Eric Anholt
I thought I was thwarted initially when I couldn't do conditional mod
on a MOV, and couldn't use two immediate constants in one instruction.
But g0 != g0 is also a way to produce a failing comparison.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |   53 +++--
 src/mesa/drivers/dri/i965/brw_fs.h   |6 +--
 2 files changed, 20 insertions(+), 39 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 2e7f810..a12a885 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1544,12 +1544,9 @@ fs_visitor::visit(ir_swizzle *ir)
 void
 fs_visitor::visit(ir_discard *ir)
 {
-   fs_reg temp = fs_reg(this, glsl_type::uint_type);
-
assert(ir->condition == NULL); /* FINISHME */
 
-   emit(FS_OPCODE_DISCARD_NOT, temp, reg_null_d);
-   emit(FS_OPCODE_DISCARD_AND, reg_null_d, temp);
+   emit(FS_OPCODE_DISCARD);
kill_emitted = true;
 }
 
@@ -2609,51 +2606,40 @@ fs_visitor::generate_ddy(fs_inst *inst, struct brw_reg 
dst, struct brw_reg src)
 }
 
 void
-fs_visitor::generate_discard_not(fs_inst *inst, struct brw_reg mask)
-{
-   if (intel->gen >= 6) {
-  /* Gen6 no longer has the mask reg for us to just read the
-   * active channels from.  However, cmp updates just the channels
-   * of the flag reg that are enabled, so we can get at the
-   * channel enables that way.  In this step, make a reg of ones
-   * we'll compare to.
-   */
-  brw_MOV(p, mask, brw_imm_ud(1));
-   } else {
-  brw_push_insn_state(p);
-  brw_set_mask_control(p, BRW_MASK_DISABLE);
-  brw_set_compression_control(p, BRW_COMPRESSION_NONE);
-  brw_NOT(p, mask, brw_mask_reg(1)); /* IMASK */
-  brw_pop_insn_state(p);
-   }
-}
-
-void
-fs_visitor::generate_discard_and(fs_inst *inst, struct brw_reg mask)
+fs_visitor::generate_discard(fs_inst *inst)
 {
if (intel->gen >= 6) {
   struct brw_reg f0 = brw_flag_reg();
   struct brw_reg g1 = retype(brw_vec1_grf(1, 7), BRW_REGISTER_TYPE_UW);
+  struct brw_reg some_register;
+
+  /* As of gen6, we no longer have the mask register to look at,
+   * so life gets a bit more complicated.
+   */
 
+  /* Load the flag register with all ones. */
   brw_push_insn_state(p);
   brw_set_mask_control(p, BRW_MASK_DISABLE);
-  brw_MOV(p, f0, brw_imm_uw(0x)); /* inactive channels undiscarded */
+  brw_MOV(p, f0, brw_imm_uw(0x));
   brw_pop_insn_state(p);
 
+  /* Do a comparison that should always fail, to produce 0s in the flag
+   * reg where we have active channels.
+   */
+  some_register = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
   brw_CMP(p, retype(brw_null_reg(), BRW_REGISTER_TYPE_UD),
- BRW_CONDITIONAL_Z, mask, brw_imm_ud(0)); /* active channels fail 
test */
+ BRW_CONDITIONAL_NZ, some_register, some_register);
+
   /* Undo CMP's whacking of predication*/
   brw_set_predicate_control(p, BRW_PREDICATE_NONE);
 
   brw_push_insn_state(p);
   brw_set_mask_control(p, BRW_MASK_DISABLE);
-  brw_set_compression_control(p, BRW_COMPRESSION_NONE);
   brw_AND(p, g1, f0, g1);
   brw_pop_insn_state(p);
} else {
   struct brw_reg g0 = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW);
-
-  mask = brw_uw1_reg(mask.file, mask.nr, 0);
+  struct brw_reg mask = brw_uw1_reg(mask.file, mask.nr, 0);
 
   brw_push_insn_state(p);
   brw_set_mask_control(p, BRW_MASK_DISABLE);
@@ -3916,11 +3902,8 @@ fs_visitor::generate_code()
   case FS_OPCODE_TXL:
 generate_tex(inst, dst, src[0]);
 break;
-  case FS_OPCODE_DISCARD_NOT:
-generate_discard_not(inst, dst);
-break;
-  case FS_OPCODE_DISCARD_AND:
-generate_discard_and(inst, src[0]);
+  case FS_OPCODE_DISCARD:
+generate_discard(inst);
 break;
   case FS_OPCODE_DDX:
 generate_ddx(inst, dst, src[0]);
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 518d091..3901207 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -75,8 +75,7 @@ enum fs_opcodes {
FS_OPCODE_TXB,
FS_OPCODE_TXD,
FS_OPCODE_TXL,
-   FS_OPCODE_DISCARD_NOT,
-   FS_OPCODE_DISCARD_AND,
+   FS_OPCODE_DISCARD,
FS_OPCODE_SPILL,
FS_OPCODE_UNSPILL,
FS_OPCODE_PULL_CONSTANT_LOAD,
@@ -500,8 +499,7 @@ public:
 struct brw_reg *src);
void generate_tex(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
void generate_math(fs_inst *inst, struct brw_reg dst, struct brw_reg *src);
-   void generate_discard_not(fs_inst *inst, struct brw_reg temp);
-   void generate_discard_and(fs_inst *inst, struct brw_reg temp);
+   void generate_discard(fs_inst *inst);
void generate_ddx(fs_inst *inst, struct brw_reg dst, struct brw_reg src);
void generate_ddy(fs_inst *inst, struct brw_reg dst, struct brw_reg src);

[Mesa-dev] [PATCH 01/11] i965/fs: Fix compiler warnings about dead code from 963431829055f63ec94d

2011-05-12 Thread Eric Anholt
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |   19 ---
 1 files changed, 0 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 21eb9e4..2e7f810 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -485,8 +485,6 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir)
 {
fs_reg *reg = new(this->mem_ctx) fs_reg(this, ir->type);
fs_reg wpos = *reg;
-   fs_reg neg_y = this->pixel_y;
-   neg_y.negate = true;
bool flip = !ir->origin_upper_left ^ c->key.render_to_fbo;
 
/* gl_FragCoord.x */
@@ -3008,7 +3006,6 @@ fs_visitor::calculate_live_intervals()
int *use = ralloc_array(mem_ctx, int, num_vars);
int loop_depth = 0;
int loop_start = 0;
-   int bb_header_ip = 0;
 
if (this->live_intervals_valid)
   return;
@@ -3068,22 +3065,6 @@ fs_visitor::calculate_live_intervals()
   }
 
   ip++;
-
-  /* Set the basic block header IP.  This is used for determining
-   * if a complete def of single-register virtual GRF in a loop
-   * dominates a use in the same basic block.  It's a quick way to
-   * reduce the live interval range of most register used in a
-   * loop.
-   */
-  if (inst->opcode == BRW_OPCODE_IF ||
- inst->opcode == BRW_OPCODE_ELSE ||
- inst->opcode == BRW_OPCODE_ENDIF ||
- inst->opcode == BRW_OPCODE_DO ||
- inst->opcode == BRW_OPCODE_WHILE ||
- inst->opcode == BRW_OPCODE_BREAK ||
- inst->opcode == BRW_OPCODE_CONTINUE) {
-bb_header_ip = ip;
-  }
}
 
ralloc_free(this->virtual_grf_def);
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 04/11] i965/fs: Fix discard and alpha test in 16-wide.

2011-05-12 Thread Eric Anholt
As of gen6, alt-mode (which we use) MOVs of floats are not raw --
they'll modify infs/nans.  This broke discard and alpha test in
16-wide, where apparently the upper 8 bits of the pixel enables being
set were causing the whole value to get trashed upon being moved.
Treating the values as UD instead of float makes sure they get
preserved.  While I'm here, replace the two 8-wide moves of the halves
of the header with a single compressed move.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36648
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |   14 --
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index a12a885..7db1314 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2255,9 +2255,11 @@ fs_visitor::generate_fb_write(fs_inst *inst)
 
if (inst->header_present) {
   if (intel->gen >= 6) {
+brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED);
 brw_MOV(p,
-brw_message_reg(inst->base_mrf),
-brw_vec8_grf(0, 0));
+retype(brw_message_reg(inst->base_mrf), BRW_REGISTER_TYPE_UD),
+retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UD));
+brw_set_compression_control(p, BRW_COMPRESSION_NONE);
 
 if (inst->target > 0) {
/* Set the render target index for choosing BLEND_STATE. */
@@ -2275,11 +2277,11 @@ fs_visitor::generate_fb_write(fs_inst *inst)
 implied_header = brw_null_reg();
   } else {
 implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
-  }
 
-  brw_MOV(p,
- brw_message_reg(inst->base_mrf + 1),
- brw_vec8_grf(1, 0));
+brw_MOV(p,
+brw_message_reg(inst->base_mrf + 1),
+brw_vec8_grf(1, 0));
+  }
} else {
   implied_header = brw_null_reg();
}
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 03/11] i965/gen6: Fix blending state when no color buffer is bound.

2011-05-12 Thread Eric Anholt
This is part of fixing fbo-alphatest-nocolor -- a regression in
35e8fe5c99b285f348cb8a1bba2931f120f7c0a1 after the initial regression,
that had us using a garbage BLEND_STATE[0] (in particular, the alpha
test enable) if no color buffer was bound.
---
 src/mesa/drivers/dri/i965/gen6_cc.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c 
b/src/mesa/drivers/dri/i965/gen6_cc.c
index 66357f0..2b16d6c 100644
--- a/src/mesa/drivers/dri/i965/gen6_cc.c
+++ b/src/mesa/drivers/dri/i965/gen6_cc.c
@@ -39,8 +39,18 @@ prepare_blend_state(struct brw_context *brw)
struct gen6_blend_state *blend;
int b;
int nr_draw_buffers = ctx->DrawBuffer->_NumColorDrawBuffers;
-   int size = sizeof(*blend) * nr_draw_buffers;
-
+   int size;
+
+   /* We need at least one BLEND_STATE written, because we might do
+* thread dispatch even if _NumColorDrawBuffers is 0 (for example
+* for computed depth or alpha test), which will do an FB write
+* with render target 0, which will reference BLEND_STATE[0] for
+* alpha test enable.
+*/
+   if (nr_draw_buffers == 0 && ctx->Color.AlphaEnabled)
+  nr_draw_buffers = 1;
+
+   size = sizeof(*blend) * nr_draw_buffers;
blend = brw_state_batch(brw, size, 64, &brw->cc.blend_state_offset);
 
memset(blend, 0, size);
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 06/11] i965/fs: Drop the viewport index/rtai clearing in gen6 fb writes.

2011-05-12 Thread Eric Anholt
These fields are documented to be in the payload, and though the FB
write docs say they *aren't* in the payload, for all other fields the
payload and header is structured so that no overwriting is required
except for non-default options.
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index ef51369..4ea9f2b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2264,12 +2264,6 @@ fs_visitor::generate_fb_write(fs_inst *inst)
brw_imm_ud(inst->target));
 }
 
-/* Clear viewport index, render target array index. */
-brw_AND(p, retype(brw_vec1_reg(BRW_MESSAGE_REGISTER_FILE, 0, 0),
-  BRW_REGISTER_TYPE_UD),
-retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UD),
-brw_imm_ud(0xf7ff));
-
 implied_header = brw_null_reg();
   } else {
 implied_header = retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW);
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 08/11] i965/fs: Fix GPU hang on texture2d-bias on pre-Ironlake.

2011-05-12 Thread Eric Anholt
In the 16-wide rework, I missed that we were setting some things to be
SIMD16 mode (corresponding to their setup in emit_texture_gen4()).
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 0d520e2..126081b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2453,11 +2453,8 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg 
dst, struct brw_reg src)
int rlen = 4;
uint32_t simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD8;
 
-   if (c->dispatch_width == 16) {
-  rlen = 8;
-  dst = vec16(dst);
+   if (c->dispatch_width == 16)
   simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD16;
-   }
 
if (intel->gen >= 5) {
   switch (inst->opcode) {
@@ -2526,6 +2523,11 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg 
dst, struct brw_reg src)
}
assert(msg_type != -1);
 
+   if (simd_mode == BRW_SAMPLER_SIMD_MODE_SIMD16) {
+  rlen = 8;
+  dst = vec16(dst);
+   }
+
brw_SAMPLE(p,
  retype(dst, BRW_REGISTER_TYPE_UW),
  inst->base_mrf,
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 07/11] i965: Add support for correct GL_CLAMP behavior by clamping coordinates.

2011-05-12 Thread Eric Anholt
This removes the stupid strict-conformance fallback code I broke when
adding ARB_sampler_objects.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36572
---
 src/mesa/drivers/dri/i965/brw_draw.c |   36 
 src/mesa/drivers/dri/i965/brw_fs.cpp |   17 +++---
 src/mesa/drivers/dri/i965/brw_fs.h   |6 ++-
 src/mesa/drivers/dri/i965/brw_wm.c   |   10 ++
 src/mesa/drivers/dri/i965/brw_wm.h   |2 +-
 src/mesa/drivers/dri/i965/brw_wm_emit.c  |5 +++
 src/mesa/drivers/dri/i965/brw_wm_sampler_state.c |   38 +++---
 7 files changed, 58 insertions(+), 56 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c 
b/src/mesa/drivers/dri/i965/brw_draw.c
index 9ab5331..2c3c373 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -270,42 +270,6 @@ static GLboolean check_fallbacks( struct brw_context *brw,
return GL_TRUE;
}
 
-   /* BRW hardware doesn't handle GL_CLAMP texturing correctly;
-* brw_wm_sampler_state:translate_wrap_mode() treats GL_CLAMP
-* as GL_CLAMP_TO_EDGE instead.  If we're using GL_CLAMP, and
-* we want strict conformance, force the fallback.
-* Right now, we only do this for 2D textures.
-*/
-   {
-  int u;
-  for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
-
- if (texUnit->Enabled) {
-   struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, u);
-
-if (texUnit->Enabled & TEXTURE_1D_BIT) {
-   if (sampler->WrapS == GL_CLAMP) {
-   return GL_TRUE;
-   }
-}
-if (texUnit->Enabled & TEXTURE_2D_BIT) {
-   if (sampler->WrapS == GL_CLAMP ||
-   sampler->WrapT == GL_CLAMP) {
-   return GL_TRUE;
-   }
-}
-if (texUnit->Enabled & TEXTURE_3D_BIT) {
-   if (sampler->WrapS == GL_CLAMP ||
-   sampler->WrapT == GL_CLAMP ||
-   sampler->WrapR == GL_CLAMP) {
-   return GL_TRUE;
-   }
-}
- }
-  }
-   }
-  
/* Nothing stopping us from the fast path now */
return GL_FALSE;
 }
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 4ea9f2b..0d520e2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1172,7 +1172,8 @@ fs_visitor::visit(ir_assignment *ir)
 }
 
 fs_inst *
-fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate)
+fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate,
+ int sampler)
 {
int mlen;
int base_mrf = 1;
@@ -1184,7 +1185,12 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg 
dst, fs_reg coordinate)
 
if (ir->shadow_comparitor) {
   for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
-emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i), coordinate);
+fs_inst *inst = emit(BRW_OPCODE_MOV,
+ fs_reg(MRF, base_mrf + mlen + i), coordinate);
+
+if (i < 3 && c->key.gl_clamp_mask[i] & (1 << sampler))
+   inst->saturate = true;
+
 coordinate.reg_offset++;
   }
   /* gen4's SIMD8 sampler always has the slots for u,v,r present. */
@@ -1298,7 +1304,8 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, 
fs_reg coordinate)
  * surprising in the disassembly.
  */
 fs_inst *
-fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate)
+fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate,
+ int sampler)
 {
int mlen = 1; /* g0 header always present. */
int base_mrf = 1;
@@ -1457,9 +1464,9 @@ fs_visitor::visit(ir_texture *ir)
fs_reg dst = fs_reg(this, glsl_type::vec4_type);
 
if (intel->gen < 5) {
-  inst = emit_texture_gen4(ir, dst, coordinate);
+  inst = emit_texture_gen4(ir, dst, coordinate, sampler);
} else {
-  inst = emit_texture_gen5(ir, dst, coordinate);
+  inst = emit_texture_gen5(ir, dst, coordinate, sampler);
}
 
/* If there's an offset, we already set up m1.  To avoid the implied move,
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h 
b/src/mesa/drivers/dri/i965/brw_fs.h
index 3901207..dd63777 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -512,8 +512,10 @@ public:
fs_reg *emit_general_interpolation(ir_variable *ir);
void emit_interpolation_setup_gen4();
void emit_interpolation_setup_gen6();
-   fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate);
-   fs_inst *emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate);
+   fs_inst *emit_texture_gen4(ir_texture *ir, fs_reg dst, f

[Mesa-dev] [PATCH 09/11] i965/fs: Don't emit a header on gen5+ sample messages unless required.

2011-05-12 Thread Eric Anholt
Improves glbenchmark egypt performance 0.6% +/- 0.4% (n=6).
---
 src/mesa/drivers/dri/i965/brw_fs.cpp |   26 +++---
 1 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 126081b..d9ecc6f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1283,6 +1283,7 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, 
fs_reg coordinate,
}
inst->base_mrf = base_mrf;
inst->mlen = mlen;
+   inst->header_present = true;
 
if (simd16) {
   for (int i = 0; i < 4; i++) {
@@ -1307,9 +1308,19 @@ fs_inst *
 fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, fs_reg coordinate,
  int sampler)
 {
-   int mlen = 1; /* g0 header always present. */
-   int base_mrf = 1;
+   int mlen = 0;
+   int base_mrf = 2;
int reg_width = c->dispatch_width / 8;
+   bool header_present = false;
+
+   if (ir->offset) {
+  /* The TXD offsets set up by the ir_texture visitor are in the
+   * m1 header, so we can't go headerless.
+   */
+  header_present = true;
+  mlen++;
+  base_mrf--;
+   }
 
for (int i = 0; i < ir->coordinate->type->vector_elements; i++) {
   emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen + i * reg_width),
@@ -1319,7 +1330,7 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, 
fs_reg coordinate,
mlen += ir->coordinate->type->vector_elements * reg_width;
 
if (ir->shadow_comparitor) {
-  mlen = MAX2(mlen, 1 + 4 * reg_width);
+  mlen = MAX2(mlen, header_present + 4 * reg_width);
 
   ir->shadow_comparitor->accept(this);
   emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result);
@@ -1333,7 +1344,7 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, 
fs_reg coordinate,
   break;
case ir_txb:
   ir->lod_info.bias->accept(this);
-  mlen = MAX2(mlen, 1 + 4 * reg_width);
+  mlen = MAX2(mlen, header_present + 4 * reg_width);
   emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result);
   mlen += reg_width;
 
@@ -1342,7 +1353,7 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, 
fs_reg coordinate,
   break;
case ir_txl:
   ir->lod_info.lod->accept(this);
-  mlen = MAX2(mlen, 1 + 4 * reg_width);
+  mlen = MAX2(mlen, header_present + 4 * reg_width);
   emit(BRW_OPCODE_MOV, fs_reg(MRF, base_mrf + mlen), this->result);
   mlen += reg_width;
 
@@ -1355,6 +1366,7 @@ fs_visitor::emit_texture_gen5(ir_texture *ir, fs_reg dst, 
fs_reg coordinate,
}
inst->base_mrf = base_mrf;
inst->mlen = mlen;
+   inst->header_present = header_present;
 
if (mlen > 11) {
   fail("Message length >11 disallowed by hardware\n");
@@ -1472,7 +1484,7 @@ fs_visitor::visit(ir_texture *ir)
/* If there's an offset, we already set up m1.  To avoid the implied move,
 * use the null register.  Otherwise, we want an implied move from g0.
 */
-   if (ir->offset != NULL)
+   if (ir->offset != NULL || !inst->header_present)
   inst->src[0] = fs_reg(brw_null_reg());
else
   inst->src[0] = fs_reg(retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW));
@@ -2539,7 +2551,7 @@ fs_visitor::generate_tex(fs_inst *inst, struct brw_reg 
dst, struct brw_reg src)
  rlen,
  inst->mlen,
  0,
- 1,
+ inst->header_present,
  simd_mode);
 }
 
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 10/11] i965/gen6: Add support for point min/max size from ARB_point_parameters.

2011-05-12 Thread Eric Anholt
Fixes glean pointAtten.
---
 src/mesa/drivers/dri/i965/gen6_sf_state.c |9 +++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c 
b/src/mesa/drivers/dri/i965/gen6_sf_state.c
index 50a5ad3..f96cfe5 100644
--- a/src/mesa/drivers/dri/i965/gen6_sf_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c
@@ -103,6 +103,7 @@ upload_sf_state(struct brw_context *brw)
int attr = 0;
int urb_start;
int two_side_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide);
+   float point_size;
 
/* _NEW_TRANSFORM */
if (ctx->Transform.ClipPlanesEnabled)
@@ -209,8 +210,12 @@ upload_sf_state(struct brw_context *brw)
 ctx->Point._Attenuated))
   dw4 |= GEN6_SF_USE_STATE_POINT_WIDTH;
 
-   dw4 |= U_FIXED(CLAMP(ctx->Point.Size, 0.125, 255.875), 3) <<
-  GEN6_SF_POINT_WIDTH_SHIFT;
+   /* Clamp to ARB_point_parameters user limits */
+   point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize);
+
+   /* Clamp to the hardware limits, in fixed point */
+   dw4 |= CLAMP(U_FIXED(point_size, 3), 1, 0x7ff);
+
if (ctx->Point.SpriteOrigin == GL_LOWER_LEFT)
   dw1 |= GEN6_SF_POINT_SPRITE_LOWERLEFT;
 
-- 
1.7.5.1

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


[Mesa-dev] [PATCH 11/11] i965: Instead of fallback on missing region, just bind a null renderbuffer.

2011-05-12 Thread Eric Anholt
The change for GPU hanging in 13bab58f04c1ec6d0d52760eab490a0997d9abe2
fell back even when rb == NULL, which is wrong for GLES2 and caused
segfaulting in GLES2 conformance.  For the GPU hang case (where the
broken 2D driver failed to allocate a BO for the window system
renderbuffer), it also would assertion fail/segfault immediately after
the fallback setup when the renderbuffer map failed.

Fixes GLES2 conformance packed_depth_stencil.
---
 src/mesa/drivers/dri/i965/brw_wm_surface_state.c |8 ++--
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c 
b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 47b8b51..9b2072a 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -554,12 +554,8 @@ prepare_wm_surfaces(struct brw_context *brw)
 struct intel_renderbuffer *irb = intel_renderbuffer(rb);
 struct intel_region *region = irb ? irb->region : NULL;
 
-if (region == NULL || region->buffer == NULL) {
-   brw->intel.Fallback = GL_TRUE; /* boolean, not bitfield */
-   return;
-}
-
-brw_add_validated_bo(brw, region->buffer);
+if (region)
+   brw_add_validated_bo(brw, region->buffer);
 nr_surfaces = SURF_INDEX_DRAW(i) + 1;
   }
}
-- 
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: silence some compilation warnings.

2011-05-12 Thread zhigang gong
Thanks for your suggestion. Jose already revised my patch to use
uintptr_t instead of long.

On Fri, May 13, 2011 at 1:48 AM, Ian Romanick  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 05/12/2011 01:49 AM, zhigang gong wrote:
>> glu.h: typedef void (GLAPIENTRYP _GLUfuncptr)(); causes the following
>>        warning: function declaration isn't a prototype.
>> egl:   When convert a (void *) to a int type, it's better to
>>        convert to long firstly, otherwise in 64 bit envirnonment, it
>>        causes compilation warning.
>
> I would suggest using either uintptr_t / intptr_t (preferable) or
> ptrdiff_t for this purpose.
>
>> ---
>>  include/GL/glu.h                    |    2 +-
>>  src/egl/drivers/dri2/egl_dri2.c     |    4 ++--
>>  src/egl/drivers/dri2/platform_drm.c |    4 ++--
>>  src/egl/drivers/dri2/platform_x11.c |    2 +-
>>  src/egl/main/eglapi.c               |    2 +-
>>  5 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/GL/glu.h b/include/GL/glu.h
>> index cd967ac..ba2228d 100644
>> --- a/include/GL/glu.h
>> +++ b/include/GL/glu.h
>> @@ -284,7 +284,7 @@ typedef GLUtesselator GLUtriangulatorObj;
>>  #define GLU_TESS_MAX_COORD 1.0e150
>>
>>  /* Internal convenience typedefs */
>> -typedef void (GLAPIENTRYP _GLUfuncptr)();
>> +typedef void (GLAPIENTRYP _GLUfuncptr)(void);
>>
>>  GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);
>>  GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);
>> diff --git a/src/egl/drivers/dri2/egl_dri2.c 
>> b/src/egl/drivers/dri2/egl_dri2.c
>> index afab679..f5f5ac3 100644
>> --- a/src/egl/drivers/dri2/egl_dri2.c
>> +++ b/src/egl/drivers/dri2/egl_dri2.c
>> @@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay
>> *disp, _EGLContext *ctx,
>>     struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
>>     struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
>>     struct dri2_egl_image *dri2_img;
>> -   GLuint renderbuffer = (GLuint) buffer;
>> +   GLuint renderbuffer =  (unsigned long) buffer;
>>
>>     if (renderbuffer == 0) {
>>        _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
>> @@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay
>> *disp, _EGLContext *ctx,
>>
>>     (void) ctx;
>>
>> -   name = (EGLint) buffer;
>> +   name = (unsigned long) buffer;
>>
>>     err = _eglParseImageAttribList(&attrs, disp, attr_list);
>>     if (err != EGL_SUCCESS)
>> diff --git a/src/egl/drivers/dri2/platform_drm.c
>> b/src/egl/drivers/dri2/platform_drm.c
>> index 68912e3..cea8418 100644
>> --- a/src/egl/drivers/dri2/platform_drm.c
>> +++ b/src/egl/drivers/dri2/platform_drm.c
>> @@ -596,7 +596,7 @@ dri2_get_device_name(int fd)
>>        goto out;
>>     }
>>
>> -   device_name = udev_device_get_devnode(device);
>> +   device_name = (char*)udev_device_get_devnode(device);
>>     if (!device_name)
>>            goto out;
>>     device_name = strdup(device_name);
>> @@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
>>     memset(dri2_dpy, 0, sizeof *dri2_dpy);
>>
>>     disp->DriverData = (void *) dri2_dpy;
>> -   dri2_dpy->fd = (int) disp->PlatformDisplay;
>> +   dri2_dpy->fd = (long) disp->PlatformDisplay;
>>
>>     dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
>>     if (dri2_dpy->driver_name == NULL)
>> diff --git a/src/egl/drivers/dri2/platform_x11.c
>> b/src/egl/drivers/dri2/platform_x11.c
>> index 5d4ac6a..90136f4 100644
>> --- a/src/egl/drivers/dri2/platform_x11.c
>> +++ b/src/egl/drivers/dri2/platform_x11.c
>> @@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,
>> _EGLContext *ctx,
>>
>>     (void) ctx;
>>
>> -   drawable = (xcb_drawable_t) buffer;
>> +   drawable = (xcb_drawable_t) (long)buffer;
>>     xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
>>     attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
>>     buffers_cookie =
>> diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
>> index 336ec23..9063752 100644
>> --- a/src/egl/main/eglapi.c
>> +++ b/src/egl/main/eglapi.c
>> @@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA 
>> mode)
>>  EGLDisplay EGLAPIENTRY
>>  eglGetDRMDisplayMESA(int fd)
>>  {
>> -   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
>> +   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (long)fd);
>>     return _eglGetDisplayHandle(dpy);
>>  }
>>
>> --
>> 1.7.3.1
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk3MHWwACgkQX1gOwKyEAw8WEwCfeHYZetkzmlLd17uN88sB2mej
> pj0AnjJeNbAZ0c0Yu9zmAsA0a5W2+1Aq
> =snFW
> -END PGP SIGNATURE-
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lis