Re: [Mesa-dev] Missing copyright header in dri/common/dri_util.c

2012-03-16 Thread Tomasz Kowal

Thank you Brian for your resposne. I've just checked the latest master and 
copyrights are still missing. Is there a chance it will be checked in anytime 
soon? 

-Tomasz




 From: Brian Paul 
To: Tomasz Kowal  
Cc: "mesa-dev@lists.freedesktop.org" ; Ian 
Romanick  
Sent: Tuesday, 6 March 2012, 18:28
Subject: Re: [Mesa-dev] Missing copyright header in dri/common/dri_util.c
 
On 03/06/2012 02:15 AM, Tomasz Kowal wrote:
> Would it be possible to add missing copyrights to dri_util.c?

The oldest git commits for dri_util.c are from 2004, committed by Ian.

Ian, would copying the blurb from utils.c be OK?

/*
* (C) Copyright IBM Corporation 2002, 2004
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

We could replace "VA LINUX SYSTEM, IBM" with "THE AUTHORS".

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


[Mesa-dev] [PATCH] st/mesa: add null pointer check in st_texture_image_map()

2012-03-16 Thread Brian Paul
If we failed to allocate a memory resource for the texture we'd crash
when we tried to map it.  Now we propogate the NULL back up to the
texstore code and generate GL_OUT_OF_MEMORY.

Fixes a crash with the upcoming piglit max-texture-size test.

NOTE: This is a candidate for the 8.0 branch.
---
 src/mesa/state_tracker/st_texture.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_texture.c 
b/src/mesa/state_tracker/st_texture.c
index 132d7a8..9627a61 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -222,6 +222,9 @@ st_texture_image_map(struct st_context *st, struct 
st_texture_image *stImage,
 
DBG("%s \n", __FUNCTION__);
 
+   if (!stImage->pt)
+  return NULL;
+
if (stObj->pt != stImage->pt)
   level = 0;
else
-- 
1.7.3.4

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


Re: [Mesa-dev] Missing copyright header in dri/common/dri_util.c

2012-03-16 Thread Brian Paul
I have the patch all set to go.  If there's no other feedback I'll 
push it later today.


-Brian

On 03/16/2012 05:19 AM, Tomasz Kowal wrote:


Thank you Brian for your resposne. I've just checked the latest master
and copyrights are still missing. Is there a chance it will be checked
in anytime soon?

-Tomasz

--
*From:* Brian Paul 
*To:* Tomasz Kowal 
*Cc:* "mesa-dev@lists.freedesktop.org"
; Ian Romanick 
*Sent:* Tuesday, 6 March 2012, 18:28
*Subject:* Re: [Mesa-dev] Missing copyright header in
dri/common/dri_util.c

On 03/06/2012 02:15 AM, Tomasz Kowal wrote:
 > Would it be possible to add missing copyrights to dri_util.c?

The oldest git commits for dri_util.c are from 2004, committed by Ian.

Ian, would copying the blurb from utils.c be OK?

/*
* (C) Copyright IBM Corporation 2002, 2004
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
"Software"),
* to deal in the Software without restriction, including without
limitation
* on the rights to use, copy, modify, merge, publish, distribute, sub
* license, and/or sell copies of the Software, and to permit persons
to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the
next
* paragraph) shall be included in all copies or substantial portions
of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

We could replace "VA LINUX SYSTEM, IBM" with "THE AUTHORS".

-Brian




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


Re: [Mesa-dev] [PATCH] st/mesa: add null pointer check in st_texture_image_map()

2012-03-16 Thread Jose Fonseca
Looks good.

Jose

- Original Message -
> If we failed to allocate a memory resource for the texture we'd crash
> when we tried to map it.  Now we propogate the NULL back up to the
> texstore code and generate GL_OUT_OF_MEMORY.
> 
> Fixes a crash with the upcoming piglit max-texture-size test.
> 
> NOTE: This is a candidate for the 8.0 branch.
> ---
>  src/mesa/state_tracker/st_texture.c |3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/state_tracker/st_texture.c
> b/src/mesa/state_tracker/st_texture.c
> index 132d7a8..9627a61 100644
> --- a/src/mesa/state_tracker/st_texture.c
> +++ b/src/mesa/state_tracker/st_texture.c
> @@ -222,6 +222,9 @@ st_texture_image_map(struct st_context *st,
> struct st_texture_image *stImage,
>  
> DBG("%s \n", __FUNCTION__);
>  
> +   if (!stImage->pt)
> +  return NULL;
> +
> if (stObj->pt != stImage->pt)
>level = 0;
> else
> --
> 1.7.3.4
> 
> ___
> 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


[Mesa-dev] [Bug 39588] [bisected] mesa demo xeglgears draw nothing if surface type is a pixmap

2012-03-16 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=39588

Benjamin Franzke  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |

--- Comment #11 from Benjamin Franzke  
2012-03-16 09:23:50 PDT ---
The problem still exists, the NAKed patch was never commited.

-- 
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] [PATCH 1/2] i915: set SPRITE_POINT_ENABLE bit correctly

2012-03-16 Thread Eric Anholt
On Mon, 12 Mar 2012 16:04:00 +0800, Yuanhan Liu  
wrote:
> When SPRITE_POINT_ENABLE bit is set, the texture coord would be
> replaced, and this is only needed when we called something like
> glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE).
> 
> And more,  we currently handle varying inputs as texture coord,
> we would be careful when setting this bit and set it just when
> needed, or you will find the value of varying input is not right
> and changed.
> 
> Thus we do set SPRITE_POINT_ENABLE bit only when all enabled tex
> coord units need do CoordReplace. Or fallback is needed to make
> sure the rendering is right.
> 
> As we need guarantee the CoordReplace changes handled well and
> be able to fallback when finding something wrong, I added another
> function to handle it at intelRunPipepline, where the drawing
> happened here and tnl pipeline hasn't started yet.
> 
> With handling the bit setup at intel_validate_sprite_point_enable(),
> we don't need the relative code at i915Enable then.
> 
> This patch would _really_ fix the webglc point-size.html test case and
> of course, not regress piglit point-sprite and glean-pointSprite testcase.
> 
> NOTE: This is a candidate for stable release branches.
> 
> v2: fallback just when all enabled tex coord units need do
> CoordReplace(Eric).
> 
> Signed-off-by: Yuanhan Liu 
> ---
>  src/mesa/drivers/dri/i915/i915_context.h |1 +
>  src/mesa/drivers/dri/i915/i915_state.c   |   13 +---
>  src/mesa/drivers/dri/i915/intel_tris.c   |   52 
> ++
>  3 files changed, 54 insertions(+), 12 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/i915_context.h 
> b/src/mesa/drivers/dri/i915/i915_context.h
> index 8167137..59eeb6e 100644
> --- a/src/mesa/drivers/dri/i915/i915_context.h
> +++ b/src/mesa/drivers/dri/i915/i915_context.h
> @@ -40,6 +40,7 @@
>  #define I915_FALLBACK_POINT_SMOOTH0x8
>  #define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN   0x10
>  #define I915_FALLBACK_DRAW_OFFSET 0x20
> +#define I915_FALLBACK_COORD_REPLACE   0x40
>  
>  #define I915_UPLOAD_CTX  0x1
>  #define I915_UPLOAD_BUFFERS  0x2
> diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
> b/src/mesa/drivers/dri/i915/i915_state.c
> index 756001f..3c751e4 100644
> --- a/src/mesa/drivers/dri/i915/i915_state.c
> +++ b/src/mesa/drivers/dri/i915/i915_state.c
> @@ -869,18 +869,7 @@ i915Enable(struct gl_context * ctx, GLenum cap, 
> GLboolean state)
>break;
>  
> case GL_POINT_SPRITE:
> -  /* This state change is handled in i915_reduced_primitive_state because
> -   * the hardware bit should only be set when rendering points.
> -   */
> -  dw = i915->state.Ctx[I915_CTXREG_LIS4];
> -  if (state)
> -  dw |= S4_SPRITE_POINT_ENABLE;
> -  else
> -  dw &= ~S4_SPRITE_POINT_ENABLE;
> -  if (dw != i915->state.Ctx[I915_CTXREG_LIS4]) {
> -  i915->state.Ctx[I915_CTXREG_LIS4] = dw;
> -  I915_STATECHANGE(i915, I915_UPLOAD_CTX);
> -  }
> +  /* Handle it at intel_validate_sprite_point_enable() */
>break;
>  
> case GL_POINT_SMOOTH:
> diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
> b/src/mesa/drivers/dri/i915/intel_tris.c
> index a36011a..58f6a59 100644
> --- a/src/mesa/drivers/dri/i915/intel_tris.c
> +++ b/src/mesa/drivers/dri/i915/intel_tris.c
> @@ -1052,6 +1052,48 @@ static const GLenum reduced_prim[GL_POLYGON + 1] = {
> GL_TRIANGLES
>  };
>  
> +static void
> +intel_validate_sprite_point_enable(struct intel_context *intel)
> +{
> +   struct gl_context *ctx = &intel->ctx;
> +   struct i915_fragment_program *p =
> +  (struct i915_fragment_program *) ctx->FragmentProgram._Current;
> +   const GLbitfield64 inputsRead = p->FragProg.Base.InputsRead;
> +   struct i915_context *i915 = i915_context(ctx);
> +   GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
> +   int i;
> +   GLuint coord_replace_bits = 0x0;
> +   GLuint tex_coord_unit_bits = 0x0;
> +
> +   for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
> +  if (ctx->Point.CoordReplace[i] && ctx->Point.PointSprite)
> + coord_replace_bits |= (1 << i);
> +  if (inputsRead & FRAG_BIT_TEX(i))
> + tex_coord_unit_bits |= (1 << i);
> +   }

This ignores varyings assigned to texture coordinate inputs.

> +
> +   s4 &= ~S4_SPRITE_POINT_ENABLE;
> +   if (coord_replace_bits) {
> +  if (coord_replace_bits != tex_coord_unit_bits) {
> + /*
> +  * Here we can't enable the SPRITE_POINT_ENABLE bit due to the
> +  * mis-match of tex_coord_unit_bits and coord_replace_bits, or
> +  * this will make all the other non-point-sprite coords be
> +  * replaced to value (0, 0)-(1, 1).
> +  *
> +  * Thus, a fallback is needed.
> +  */
> + FALLBACK(intel, I915_FALLBACK_COORD_REPLACE, true);

Here, if you ever fall back for coordinate replacement, you'll never
exit software fallbacks.

>  /***

Re: [Mesa-dev] Mesa (master): mesa: add back glGetnUniform*v() overflow error reporting

2012-03-16 Thread Ian Romanick

On 03/15/2012 05:09 PM, nobled wrote:

On Thu, Mar 15, 2012 at 5:27 PM, Ian Romanick  wrote:

On 03/15/2012 01:18 PM, Kenneth Graunke wrote:


On 03/15/2012 11:26 AM, Ian Romanick wrote:


On 03/13/2012 11:35 AM, Dylan Noblesmith wrote:


Module: Mesa
Branch: master
Commit: b536ac6b2bc54ad9bb6e58fbd307055e419a288f
URL:

http://cgit.freedesktop.org/mesa/mesa/commit/?id=b536ac6b2bc54ad9bb6e58fbd307055e419a288f



Author: Dylan Noblesmith
Date: Thu Dec 22 21:05:38 2011 +

mesa: add back glGetnUniform*v() overflow error reporting

The error was removed in:

commit 719909698c67c287a393d2380278e7b7495ae018
Author: Ian Romanick
Date: Tue Oct 18 16:01:49 2011 -0700

mesa: Rewrite the way uniforms are tracked and handled

The GL_ARB_robustness spec doesn't say the implementation
should truncate the output, so just return after setting
the required error like it did before the above commit.



This patch is wrong. Please revert. The ARB_robustness spec specifically
says:

"The commands

void GetUniformfv(uint program, int location, float *params);
void GetnUniformfvARB(uint program, int location, sizei bufSize,
float *params);
void GetUniformiv(uint program, int location, int *params);
void GetnUniformivARB(uint program, int location, sizei bufSize,
int *params);
void GetUniformuiv(uint program, int location, uint *params);
void GetnUniformuivARB(uint program, int location, sizei bufSize,
uint *params);
void GetUniformdv(uint program, int location, uint *params);
void GetnUniformdvARB(uint program, int location, sizei bufSize,
uint *params);

return the value or values of the uniform at location location of
the default uniform block for program object program in the array
params. GetnUniformfvARB, GetnUniformivARB, GetnUniformuivARB and
GetnUniformdvARB do not write more than  bytes into."

The "do not write more than  bytes" is the important bit.


And zero is not more than, and we're writing zero bytes here, so

I should have quoted more extensively though, you're right. Specifically:


"Errors

 [...] GetnUniformfvARB,
 GetnUniformivARB, GetnUniformuivARB and GetnUniformdvARB share all the
 errors of their unsized buffer query counterparts with the addition
 that INVALID_OPERATION is generated if the buffer size required to
 fill all the requested data is less than."


Wow.  I read the last bit of that and almost cried.  I've submitted a 
spec bug.  Obviously the above should read "...INVALID_OPERATION is 
generated if the buffer size required to fill all the requested data is 
greater than ."  The text near the Getn functions should also 
be worded differently.  Ugh.



and

"Issues

[...]

 5.  If a new query with an explicit buffer size is called and the buffer
 size is not sufficient to return the data, what happens?

 RESOLVED:  Return an INVALID_OPERATION error and ignore the query."

Sorry for being too vague in the commit log; I should've said the spec
*explicitly forbids* the implementation from doing anything at all
when  is not sufficient.


Okay, that makes sense.  The rationale in the spec also makes sense.  Do 
we have a piglit test for this behavior?



In the future, please wait for at least one Reviewed-by when changing
API behavior, and quote spec language in the code to justify such
changes.



In fairness, those patches had sat on the list for a long time, which
seems to invoke the "silence is consent" rule. We should have reviewed
it earlier.


Yeah... I'm not sure how I missed these.  I also noticed that there was
review on the list from Brian, but that didn't end up as a Reviewed-by in
the commit message.  So, I'll take the last part back. :)

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


Re: [Mesa-dev] [PATCH] intel:i915:i965: enable mipmap layout right mode

2012-03-16 Thread Eric Anholt
On Thu, 15 Mar 2012 14:42:53 +0800, Yuanhan Liu  
wrote:
> There are two mipmap layout modes: below and right. And we currently just
> use _below_ mode. And in some cases, like height is greater than width,
> it would be better to use the _right_ mode for saving memory.
> 
> And it also fix some issues like the gl-max-texture-dimensions.html webglc
> test case on pineview in a hardware way(no fallback). Since when
> rendering with 1x2048 texture using below mode would make the draw
> offset exceed the max allowed size, but will not when using right mode.

I think you should be able to get hardware rendering without changing
layouts by taking advantage of intel_renderbuffer_get_tile_offsets().

> diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c 
> b/src/mesa/drivers/dri/i915/i915_texstate.c
> index 9022548..54f32a4 100644
> --- a/src/mesa/drivers/dri/i915/i915_texstate.c
> +++ b/src/mesa/drivers/dri/i915/i915_texstate.c
> @@ -192,6 +192,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint 
> unit, GLuint ss3)
> (U_FIXED(CLAMP(maxlod, 0.0, 11.0), 2) << MS4_MAX_LOD_SHIFT) |
> ((firstImage->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
>  
> +   if (intel->is_945)
> +  state[I915_TEXREG_MS4] |= intelObj->mt->layout << 
> MS4_MIP_LAYOUT_MODE_SHIFT;
>  
> {
>GLuint minFilt, mipFilt, magFilt;

You're checking 945 here, but your decision to choose right layout
didn't check for 945.

> 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 a3de2e3..b6565fe 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -654,7 +654,7 @@ brw_update_texture_surface( struct gl_context *ctx, 
> GLuint unit )
> 6 * 4, 32, &brw->wm.surf_offset[surf_index]);
>  
> surf[0] = (translate_tex_target(tObj->Target) << BRW_SURFACE_TYPE_SHIFT |
> -   BRW_SURFACE_MIPMAPLAYOUT_BELOW << BRW_SURFACE_MIPLAYOUT_SHIFT |
> +   mt->layout << BRW_SURFACE_MIPLAYOUT_SHIFT |
> BRW_SURFACE_CUBEFACE_ENABLES |
> (translate_tex_format(mt->format,
>   firstImage->InternalFormat,

You didn't update gen7.

> diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h 
> b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
> index 9082864..d175f50 100644
> --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
> +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
> @@ -215,6 +215,10 @@ struct intel_mipmap_tree
> /* These are also refcounted:
>  */
> GLuint refcount;
> +
> +#define INTEL_LAYOUT_BELOW   0
> +#define INTEL_LAYOUT_RIGHT   1
> +   int layout;
>  };

Make it a bool called "miplayout_right" or something instead of
#defines.

> diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.c 
> b/src/mesa/drivers/dri/intel/intel_tex_layout.c
> index 65645bc..4687dd3 100644
> --- a/src/mesa/drivers/dri/intel/intel_tex_layout.c
> +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.c
> @@ -138,7 +138,27 @@ intel_get_texture_alignment_unit(struct intel_context 
> *intel,
> *h = intel_vertical_texture_alignment_unit(intel, format);
>  }
>  
> -void i945_miptree_layout_2d(struct intel_mipmap_tree *mt)
> +static int
> +i945_miptree_choose_layout(struct intel_context *intel, GLenum target,
> +   GLuint width, GLuint height)
> +{
> +   int layout = INTEL_LAYOUT_BELOW; /* Use layout _below_ by default */
> +
> +   /*
> +* INTEL_LAYOUT_RIGHT is only for:
> +*   GL_TEXTURE_1D, GL_TEXTURE_2D [945+, aka all platforms here]
> +*   GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP [gen5+]
> +*/
> +   if (target == GL_TEXTURE_1D || target == GL_TEXTURE_2D ||
> +   (intel->gen >= 5 && target == GL_TEXTURE_CUBE_MAP)) {
> +  if ((height >> 1) >= width)
> + layout = INTEL_LAYOUT_RIGHT;
> +   }
> +
> +   return layout;
> +}

You should explain why the choice is being made here.

> +void i945_miptree_layout_2d(struct intel_context *intel, struct 
> intel_mipmap_tree *mt)
>  {
> GLuint level;
> GLuint x = 0;
> @@ -153,24 +173,32 @@ void i945_miptree_layout_2d(struct intel_mipmap_tree 
> *mt)
> mt->total_width = ALIGN(mt->width0, mt->align_w);
> }
>  
> -   /* May need to adjust width to accomodate the placement of
> -* the 2nd mipmap.  This occurs when the alignment
> -* constraints of mipmap placement push the right edge of the
> -* 2nd mipmap out past the width of its parent.
> -*/
> +   mt->layout = i945_miptree_choose_layout(intel, mt->target, width, height);
> +   /* Determine the max width */
> if (mt->first_level != mt->last_level) {
> -   GLuint mip1_width;
> -
> -   if (mt->compressed) {
> -   mip1_width = ALIGN(minify(mt->width0), mt->align_w)
> -   + ALIGN(minify(minify(mt->width0)), mt->align_w);
> +   GLuint tmp;
> +
> +   if (mt->layout == INTEL_LAYOUT_

[Mesa-dev] [PATCH] shared-glapi: Convert to automake

2012-03-16 Thread Kristian Høgsberg
This fixes a build problem where EGL links to libgbm.la, which encodes
a relative path to it's libglapi.so dependency.  The relative path
breaks when the linker tries to resolve it from src/egl/main instead
of src/gbm.  Typically we silently fall back to the system
libglapi.so, which is wrong and break when there isn't one.

Morale of the story: don't mix mklib and libtool.
---
 configure.ac  |2 +
 src/egl/main/Makefile.am  |1 -
 src/gbm/Makefile.am   |4 +-
 src/glx/Makefile.am   |2 +-
 src/mapi/Android.mk   |4 +-
 src/mapi/es1api/Makefile  |4 +-
 src/mapi/glapi/Makefile   |8 ++--
 src/mapi/mapi/sources.mak |   42 
 src/mapi/shared-glapi/Makefile|   65 -
 src/mapi/shared-glapi/Makefile.am |   23 +
 src/mapi/vgapi/Makefile   |4 +-
 11 files changed, 59 insertions(+), 100 deletions(-)
 delete mode 100644 src/mapi/shared-glapi/Makefile
 create mode 100644 src/mapi/shared-glapi/Makefile.am

diff --git a/configure.ac b/configure.ac
index c0d81c9..519662b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -702,6 +702,7 @@ if test "x$enable_shared_glapi" = xyes; then
 # libGL will use libglapi for function lookups (IN_DRI_DRIVER means to use
 # the remap table)
 DEFINES="$DEFINES -DIN_DRI_DRIVER"
+SRC_DIRS="$SRC_DIRS mapi/shared-glapi"
 fi
 AC_SUBST([SHARED_GLAPI])
 AM_CONDITIONAL(HAVE_SHARED_GLAPI, test $SHARED_GLAPI = 1)
@@ -1985,6 +1986,7 @@ AC_CONFIG_FILES([configs/autoconf
src/egl/wayland/wayland-egl/wayland-egl.pc
src/egl/wayland/wayland-drm/Makefile
src/glx/Makefile
+   src/mapi/shared-glapi/Makefile
src/mesa/drivers/dri/dri.pc
src/mesa/drivers/dri/Makefile
src/mesa/drivers/dri/common/Makefile
diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am
index a8072c1..9c3935b 100644
--- a/src/egl/main/Makefile.am
+++ b/src/egl/main/Makefile.am
@@ -93,7 +93,6 @@ endif
 if HAVE_EGL_PLATFORM_DRM
 AM_CFLAGS += -DHAVE_DRM_PLATFORM
 libEGL_la_LIBADD += ../../gbm/libgbm.la
-libEGL_la_LIBADD += ../../gbm/libgbm.la
 endif
 
 if HAVE_EGL_PLATFORM_FBDEV
diff --git a/src/gbm/Makefile.am b/src/gbm/Makefile.am
index 1dbc9d1..dede5bc 100644
--- a/src/gbm/Makefile.am
+++ b/src/gbm/Makefile.am
@@ -31,8 +31,8 @@ libgbm_dri_la_CFLAGS = \
-DDEFAULT_DRIVER_DIR='"$(DRI_DRIVER_SEARCH_DIR)"' \
$(LIBDRM_CFLAGS)
 
-libgbm_la_LDFLAGS += -L$(top_builddir)/$(LIB_DIR)
-libgbm_la_LIBADD += libgbm_dri.la -lglapi
+libgbm_la_LIBADD += \
+   libgbm_dri.la $(top_builddir)/src/mapi/shared-glapi/libglapi.la
 endif
 
 all-local: libgbm.la
diff --git a/src/glx/Makefile.am b/src/glx/Makefile.am
index 79dc405..a11bd3f 100644
--- a/src/glx/Makefile.am
+++ b/src/glx/Makefile.am
@@ -21,7 +21,7 @@
 
 if HAVE_SHARED_GLAPI
 SHARED_GLAPI_CFLAGS = -DGLX_SHARED_GLAPI
-SHARED_GLAPI_LIBS = -L$(top_builddir)/$(LIB_DIR) -lglapi
+SHARED_GLAPI_LIBS = $(top_builddir)/src/mapi/shared-glapi/libglapi.la
 endif
 
 GLAPI_LIB = ../mapi/glapi/libglapi.a
diff --git a/src/mapi/Android.mk b/src/mapi/Android.mk
index fe9e40e..b75361f 100644
--- a/src/mapi/Android.mk
+++ b/src/mapi/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PATH := $(call my-dir)
 
-# get MAPI_GLAPI_SOURCES
+# get MAPI_GLAPI_FILES
 include $(LOCAL_PATH)/mapi/sources.mak
 
 mapi_abi_headers :=
@@ -38,7 +38,7 @@ include $(CLEAR_VARS)
 
 abi_header := shared-glapi/glapi_mapi_tmp.h
 
-LOCAL_SRC_FILES := $(addprefix mapi/, $(MAPI_GLAPI_SOURCES))
+LOCAL_SRC_FILES := $(MAPI_GLAPI_FILES)
 
 LOCAL_CFLAGS := \
-DMAPI_MODE_GLAPI \
diff --git a/src/mapi/es1api/Makefile b/src/mapi/es1api/Makefile
index 0a0449b..2545dd0 100644
--- a/src/mapi/es1api/Makefile
+++ b/src/mapi/es1api/Makefile
@@ -41,8 +41,8 @@ esapi_CPPFLAGS := \
-DMAPI_ABI_HEADER=\"$(ESAPI)/glapi_mapi_tmp.h\"
 
 include $(MAPI)/sources.mak
-esapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES))
-esapi_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o)
+esapi_SOURCES := $(MAPI_BRIDGE_FILES)
+esapi_OBJECTS := $(esapi_SOURCES:.c=.o)
 esapi_CPPFLAGS += -DMAPI_MODE_BRIDGE
 
 esapi_LIB_DEPS := -L$(TOP)/$(LIB_DIR) -l$(GLAPI_LIB) $(esapi_LIB_DEPS)
diff --git a/src/mapi/glapi/Makefile b/src/mapi/glapi/Makefile
index bb4ed65..bca2432 100644
--- a/src/mapi/glapi/Makefile
+++ b/src/mapi/glapi/Makefile
@@ -19,18 +19,18 @@ ifeq ($(SHARED_GLAPI),1)
 glapi_CPPFLAGS += \
-DMAPI_MODE_BRIDGE \
-DMAPI_ABI_HEADER=\"glapi/glapi_mapi_tmp.h\"
-glapi_SOURCES := $(addprefix $(MAPI)/, $(MAPI_BRIDGE_SOURCES))
+glapi_SOURCES := $(MAPI_BRIDGE_FILES)
 
 glapi_GLAPI_OBJECTS :=
 glapi_ASM_OBJECTS :=
-glapi_MAPI_OBJECTS := $(MAPI_BRIDGE_SOURCES:.c=.o)
+glapi_MAPI_OBJECTS := $(MAPI_BRIDGE_FILES:.c=.o)
 else
 glapi_CPPFLAGS += -DMAPI_MODE_UTIL
-glapi_SOURCES := $(GLAPI_SOURCES) $(addprefix $(MAPI)/, $(MAPI_UTIL_SOURCES))
+glapi_

[Mesa-dev] [PATCH] glsl: Don't include the deprecated structure types in GLSL 1.40.

2012-03-16 Thread Eric Anholt
---
 src/glsl/glsl_types.cpp |   26 ++
 src/glsl/glsl_types.h   |6 +++---
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp
index 4baec41..069ebd1 100644
--- a/src/glsl/glsl_types.cpp
+++ b/src/glsl/glsl_types.cpp
@@ -169,7 +169,7 @@ glsl_type::generate_100ES_types(glsl_symbol_table *symtab)
 }
 
 void
-glsl_type::generate_110_types(glsl_symbol_table *symtab)
+glsl_type::generate_110_types(glsl_symbol_table *symtab, bool add_deprecated)
 {
generate_100ES_types(symtab);
 
@@ -177,16 +177,18 @@ glsl_type::generate_110_types(glsl_symbol_table *symtab)
 Elements(builtin_110_types),
 false);
add_types_to_symbol_table(symtab, &_sampler3D_type, 1, false);
-   add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types,
-Elements(builtin_110_deprecated_structure_types),
-false);
+   if (add_deprecated) {
+  add_types_to_symbol_table(symtab, builtin_110_deprecated_structure_types,
+   
Elements(builtin_110_deprecated_structure_types),
+   false);
+   }
 }
 
 
 void
-glsl_type::generate_120_types(glsl_symbol_table *symtab)
+glsl_type::generate_120_types(glsl_symbol_table *symtab, bool add_deprecated)
 {
-   generate_110_types(symtab);
+   generate_110_types(symtab, add_deprecated);
 
add_types_to_symbol_table(symtab, builtin_120_types,
 Elements(builtin_120_types), false);
@@ -194,9 +196,9 @@ glsl_type::generate_120_types(glsl_symbol_table *symtab)
 
 
 void
-glsl_type::generate_130_types(glsl_symbol_table *symtab)
+glsl_type::generate_130_types(glsl_symbol_table *symtab, bool add_deprecated)
 {
-   generate_120_types(symtab);
+   generate_120_types(symtab, add_deprecated);
 
add_types_to_symbol_table(symtab, builtin_130_types,
 Elements(builtin_130_types), false);
@@ -207,7 +209,7 @@ glsl_type::generate_130_types(glsl_symbol_table *symtab)
 void
 glsl_type::generate_140_types(glsl_symbol_table *symtab)
 {
-   generate_130_types(symtab);
+   generate_130_types(symtab, false);
 
add_types_to_symbol_table(symtab, builtin_140_types,
 Elements(builtin_140_types), false);
@@ -259,13 +261,13 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state 
*state)
   glsl_type::generate_100ES_types(state->symbols);
   break;
case 110:
-  glsl_type::generate_110_types(state->symbols);
+  glsl_type::generate_110_types(state->symbols, true);
   break;
case 120:
-  glsl_type::generate_120_types(state->symbols);
+  glsl_type::generate_120_types(state->symbols, true);
   break;
case 130:
-  glsl_type::generate_130_types(state->symbols);
+  glsl_type::generate_130_types(state->symbols, true);
   break;
case 140:
   glsl_type::generate_140_types(state->symbols);
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h
index 8f2a3ff..48d41d7 100644
--- a/src/glsl/glsl_types.h
+++ b/src/glsl/glsl_types.h
@@ -515,9 +515,9 @@ private:
 */
/*@{*/
static void generate_100ES_types(glsl_symbol_table *);
-   static void generate_110_types(glsl_symbol_table *);
-   static void generate_120_types(glsl_symbol_table *);
-   static void generate_130_types(glsl_symbol_table *);
+   static void generate_110_types(glsl_symbol_table *, bool add_deprecated);
+   static void generate_120_types(glsl_symbol_table *, bool add_deprecated);
+   static void generate_130_types(glsl_symbol_table *, bool add_deprecated);
static void generate_140_types(glsl_symbol_table *);
static void generate_ARB_texture_rectangle_types(glsl_symbol_table *, bool);
static void generate_EXT_texture_array_types(glsl_symbol_table *, bool);
-- 
1.7.9.1

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


Re: [Mesa-dev] [PATCH] shared-glapi: Convert to automake

2012-03-16 Thread Eric Anholt
On Fri, 16 Mar 2012 16:29:32 -0400, Kristian Høgsberg  
wrote:
> This fixes a build problem where EGL links to libgbm.la, which encodes
> a relative path to it's libglapi.so dependency.  The relative path
> breaks when the linker tries to resolve it from src/egl/main instead
> of src/gbm.  Typically we silently fall back to the system
> libglapi.so, which is wrong and break when there isn't one.
> 
> Morale of the story: don't mix mklib and libtool.

> diff --git a/src/mapi/shared-glapi/Makefile.am 
> b/src/mapi/shared-glapi/Makefile.am
> new file mode 100644
> index 000..d24a57e
> --- /dev/null
> +++ b/src/mapi/shared-glapi/Makefile.am
> @@ -0,0 +1,23 @@
> +# Used by OpenGL ES or when --enable-shared-glapi is specified
> +
> +TOP := ../../..
> +GLAPI = $(top_srcdir)/src/mapi/glapi
> +include $(top_srcdir)/src/mapi/mapi/sources.mak
> +
> +lib_LTLIBRARIES = libglapi.la
> +libglapi_la_SOURCES = $(MAPI_GLAPI_FILES)
> +
> +include $(GLAPI)/gen/glapi_gen.mk
> +glapi_mapi_tmp.h : $(GLAPI)/gen/gl_and_es_API.xml $(glapi_gen_mapi_deps)
> + $(call glapi_gen_mapi,$<,shared-glapi)

This file should be included in BUILT_SOURCES in order to make
dependency generation work right.

(http://www.gnu.org/software/automake/manual/automake.html#Sources)

Other than that,

Reviewed-by: Eric Anholt 


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


[Mesa-dev] New libdrm features: AUB dump and unsynced maps.

2012-03-16 Thread Eric Anholt
Here's the series of code I'd been delaying for the new libdrm release
I just pushed out.  The unsynchronized maps have been seen here before
but didn't get much review, so I'm giving them another chance.

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


[Mesa-dev] [PATCH 1/6] intel: Bump libdrm requirement to 2.4.32.

2012-03-16 Thread Eric Anholt
We'll need this for AUB dumping and unsynchronized maps.
---
 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index c0d81c9..728acdf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ USER_CXXFLAGS="$CXXFLAGS"
 dnl Versions for external dependencies
 LIBDRM_REQUIRED=2.4.24
 LIBDRM_RADEON_REQUIRED=2.4.31
-LIBDRM_INTEL_REQUIRED=2.4.30
+LIBDRM_INTEL_REQUIRED=2.4.32
 LIBDRM_NOUVEAU_REQUIRED=0.6
 DRI2PROTO_REQUIRED=2.6
 GLPROTO_REQUIRED=1.4.14
-- 
1.7.9.1

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


[Mesa-dev] [PATCH 4/6] i965: Avoid flushing the batch for busy BOs for ARB_mbr with INVALIDATE_BUFFER.

2012-03-16 Thread Eric Anholt
Unigine Tropics uses INVALIDATE_BUFFER and not UNSYNCHRONIZED to reset
the buffer object when its streaming wraps.  Don't penalize it by
flushing the batch at the wrap point, just allocate a new BO and get
to using it.
---
 src/mesa/drivers/dri/intel/intel_buffer_objects.c |   35 -
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c 
b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 600f01c..e55a8fe 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -314,27 +314,32 @@ intel_bufferobj_map_range(struct gl_context * ctx,
   intel_obj->sys_buffer = NULL;
}
 
-   /* If the mapping is synchronized with other GL operations, flush
-* the batchbuffer so that GEM knows about the buffer access for later
-* syncing.
-*/
-   if (!(access & GL_MAP_UNSYNCHRONIZED_BIT) &&
-   drm_intel_bo_references(intel->batch.bo, intel_obj->buffer))
-  intel_flush(ctx);
-
if (intel_obj->buffer == NULL) {
   obj->Pointer = NULL;
   return NULL;
}
 
-   /* If the user doesn't care about existing buffer contents and mapping
-* would cause us to block, then throw out the old buffer.
+   /* If the access is synchronized (like a normal buffer mapping), then get
+* things flushed out so the later mapping syncs appropriately through GEM.
+* If the user doesn't care about existing buffer contents and mapping would
+* cause us to block, then throw out the old buffer.
+*
+* If they set INVALIDATE_BUFFER, we can pitch the current contents to
+* achieve the required synchronization.
 */
-   if (!(access & GL_MAP_UNSYNCHRONIZED_BIT) &&
-   (access & GL_MAP_INVALIDATE_BUFFER_BIT) &&
-   drm_intel_bo_busy(intel_obj->buffer)) {
-  drm_intel_bo_unreference(intel_obj->buffer);
-  intel_bufferobj_alloc_buffer(intel, intel_obj);
+   if (!(access & GL_MAP_UNSYNCHRONIZED_BIT)) {
+  if (drm_intel_bo_references(intel->batch.bo, intel_obj->buffer)) {
+if (access & GL_MAP_INVALIDATE_BUFFER_BIT) {
+   drm_intel_bo_unreference(intel_obj->buffer);
+   intel_bufferobj_alloc_buffer(intel, intel_obj);
+} else {
+   intel_flush(ctx);
+}
+  } else if (drm_intel_bo_busy(intel_obj->buffer) &&
+(access & GL_MAP_INVALIDATE_BUFFER_BIT)) {
+drm_intel_bo_unreference(intel_obj->buffer);
+intel_bufferobj_alloc_buffer(intel, intel_obj);
+  }
}
 
/* If the user is mapping a range of an active buffer object but
-- 
1.7.9.1

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


[Mesa-dev] [PATCH 3/6] intel: Handle devid overrides using libdrm.

2012-03-16 Thread Eric Anholt
---
 src/mesa/drivers/dri/intel/intel_screen.c |   23 ---
 1 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 7939c4d..3f1ef87 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -624,8 +624,7 @@ intel_init_bufmgr(struct intel_screen *intelScreen)
__DRIscreen *spriv = intelScreen->driScrnPriv;
int num_fences = 0;
 
-   intelScreen->no_hw = (getenv("INTEL_NO_HW") != NULL ||
-getenv("INTEL_DEVID_OVERRIDE") != NULL);
+   intelScreen->no_hw = getenv("INTEL_NO_HW") != NULL;
 
intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ);
if (intelScreen->bufmgr == NULL) {
@@ -736,7 +735,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
GLenum fb_format[3];
GLenum fb_type[3];
unsigned int api_mask;
-   char *devid_override;
 
static const GLenum back_buffer_modes[] = {
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
@@ -758,20 +756,10 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
intelScreen->driScrnPriv = psp;
psp->driverPrivate = (void *) intelScreen;
 
-   /* Determine chipset ID */
-   if (!intel_get_param(psp, I915_PARAM_CHIPSET_ID,
-   &intelScreen->deviceID))
-  return false;
+   if (!intel_init_bufmgr(intelScreen))
+   return false;
 
-   /* Allow an override of the device ID for the purpose of making the
-* driver produce dumps for debugging of new chipset enablement.
-* This implies INTEL_NO_HW, to avoid programming your actual GPU
-* incorrectly.
-*/
-   devid_override = getenv("INTEL_DEVID_OVERRIDE");
-   if (devid_override) {
-  intelScreen->deviceID = strtod(devid_override, NULL);
-   }
+   intelScreen->deviceID = drm_intel_bufmgr_gem_get_devid(intelScreen->bufmgr);
 
intelScreen->kernel_has_gen7_sol_reset =
   intel_get_boolean(intelScreen->driScrnPriv,
@@ -818,9 +806,6 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
if (IS_9XX(intelScreen->deviceID) || IS_965(intelScreen->deviceID))
   psp->api_mask = api_mask;
 
-   if (!intel_init_bufmgr(intelScreen))
-   return false;
-
intelScreen->hw_has_swizzling = intel_detect_swizzling(intelScreen);
 
psp->extensions = intelScreenExtensions;
-- 
1.7.9.1

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


[Mesa-dev] [PATCH 2/6] intel: Ask libdrm to dump an AUB file if INTEL_DEBUG=aub.

2012-03-16 Thread Eric Anholt
It also asks for BMPs in the aub file at SwapBuffers time.
---
 src/mesa/drivers/dri/intel/intel_context.c |4 +++
 src/mesa/drivers/dri/intel/intel_context.h |1 +
 src/mesa/drivers/dri/intel/intel_screen.c  |   32 
 3 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index 7b2bdad..ff721fb 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -477,6 +477,7 @@ static const struct dri_debug_control debug_control[] = {
{ "urb",   DEBUG_URB },
{ "vs",DEBUG_VS },
{ "clip",  DEBUG_CLIP },
+   { "aub",   DEBUG_AUB },
{ NULL,0 }
 };
 
@@ -754,6 +755,9 @@ intelInitContext(struct intel_context *intel,
if (INTEL_DEBUG & DEBUG_BUFMGR)
   dri_bufmgr_set_debug(intel->bufmgr, true);
 
+   if (INTEL_DEBUG & DEBUG_AUB)
+  drm_intel_bufmgr_gem_set_aub_dump(intel->bufmgr, true);
+
intel_batchbuffer_init(intel);
 
intel_fbo_init(intel);
diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
b/src/mesa/drivers/dri/intel/intel_context.h
index ef024b1..7b42009 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -472,6 +472,7 @@ extern int INTEL_DEBUG;
 #define DEBUG_URB   0x80
 #define DEBUG_VS0x100
 #define DEBUG_CLIP  0x200
+#define DEBUG_AUB   0x400
 
 #define DBG(...) do {  \
if (unlikely(INTEL_DEBUG & FILE_DEBUG_FLAG))\
diff --git a/src/mesa/drivers/dri/intel/intel_screen.c 
b/src/mesa/drivers/dri/intel/intel_screen.c
index 48762d0..7939c4d 100644
--- a/src/mesa/drivers/dri/intel/intel_screen.c
+++ b/src/mesa/drivers/dri/intel/intel_screen.c
@@ -125,6 +125,38 @@ intelDRI2Flush(__DRIdrawable *drawable)
 
if (intel->batch.used)
   intel_batchbuffer_flush(intel);
+
+   if (INTEL_DEBUG & DEBUG_AUB) {
+  struct gl_framebuffer *fb = ctx->DrawBuffer;
+
+  for (int i = 0; i < fb->_NumColorDrawBuffers; i++) {
+struct intel_renderbuffer *irb =
+   intel_renderbuffer(fb->_ColorDrawBuffers[i]);
+
+if (irb && irb->mt) {
+   enum aub_dump_bmp_format format;
+
+   switch (irb->Base.Base.Format) {
+   case MESA_FORMAT_ARGB:
+   case MESA_FORMAT_XRGB:
+  format = AUB_DUMP_BMP_FORMAT_ARGB_;
+  break;
+   default:
+  continue;
+   }
+
+   drm_intel_gem_bo_aub_dump_bmp(irb->mt->region->bo,
+ irb->draw_x,
+ irb->draw_y,
+ irb->Base.Base.Width,
+ irb->Base.Base.Height,
+ format,
+ irb->mt->region->pitch *
+ irb->mt->region->cpp,
+ 0);
+}
+  }
+   }
 }
 
 static const struct __DRI2flushExtensionRec intelFlushExtension = {
-- 
1.7.9.1

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


[Mesa-dev] [PATCH 6/6] intel: Make use of the new GPU-unsynchronized map functionality in libdrm.

2012-03-16 Thread Eric Anholt
Improves Unigine Tropics performance at 1024x768 by 2.06236% +/-
0.50272% (n=11).

Reviewed-by: Chris Wilson 
---
 src/mesa/drivers/dri/intel/intel_buffer_objects.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c 
b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index 26f23fd0..d2a0709 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -367,7 +367,9 @@ intel_bufferobj_map_range(struct gl_context * ctx,
   return obj->Pointer;
}
 
-   if (!(access & GL_MAP_READ_BIT)) {
+   if (access & GL_MAP_UNSYNCHRONIZED_BIT)
+  drm_intel_gem_bo_map_unsynchronized(intel_obj->buffer);
+   else if (!(access & GL_MAP_READ_BIT)) {
   drm_intel_gem_bo_map_gtt(intel_obj->buffer);
} else {
   drm_intel_bo_map(intel_obj->buffer, (access & GL_MAP_WRITE_BIT) != 0);
-- 
1.7.9.1

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


[Mesa-dev] [PATCH 5/6] intel: Drop the tracking of bo_map vs bo_map_gtt for unmapping.

2012-03-16 Thread Eric Anholt
drm_intel_bo_unmap() supports both in the current libdrm version.
---
 src/mesa/drivers/dri/intel/intel_buffer_objects.c |   16 ++--
 src/mesa/drivers/dri/intel/intel_buffer_objects.h |1 -
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c 
b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
index e55a8fe..26f23fd0 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c
@@ -358,11 +358,9 @@ intel_bufferobj_map_range(struct gl_context * ctx,
  length, 64);
 if (!(access & GL_MAP_READ_BIT)) {
drm_intel_gem_bo_map_gtt(intel_obj->range_map_bo);
-   intel_obj->mapped_gtt = true;
 } else {
drm_intel_bo_map(intel_obj->range_map_bo,
 (access & GL_MAP_WRITE_BIT) != 0);
-   intel_obj->mapped_gtt = false;
 }
 obj->Pointer = intel_obj->range_map_bo->virtual;
   }
@@ -371,10 +369,8 @@ intel_bufferobj_map_range(struct gl_context * ctx,
 
if (!(access & GL_MAP_READ_BIT)) {
   drm_intel_gem_bo_map_gtt(intel_obj->buffer);
-  intel_obj->mapped_gtt = true;
} else {
   drm_intel_bo_map(intel_obj->buffer, (access & GL_MAP_WRITE_BIT) != 0);
-  intel_obj->mapped_gtt = false;
}
 
obj->Pointer = intel_obj->buffer->virtual + offset;
@@ -440,11 +436,7 @@ intel_bufferobj_unmap(struct gl_context * ctx, struct 
gl_buffer_object *obj)
   free(intel_obj->range_map_buffer);
   intel_obj->range_map_buffer = NULL;
} else if (intel_obj->range_map_bo != NULL) {
-  if (intel_obj->mapped_gtt) {
-drm_intel_gem_bo_unmap_gtt(intel_obj->range_map_bo);
-  } else {
-drm_intel_bo_unmap(intel_obj->range_map_bo);
-  }
+  drm_intel_bo_unmap(intel_obj->range_map_bo);
 
   intel_emit_linear_blit(intel,
 intel_obj->buffer, obj->Offset,
@@ -461,11 +453,7 @@ intel_bufferobj_unmap(struct gl_context * ctx, struct 
gl_buffer_object *obj)
   drm_intel_bo_unreference(intel_obj->range_map_bo);
   intel_obj->range_map_bo = NULL;
} else if (intel_obj->buffer != NULL) {
-  if (intel_obj->mapped_gtt) {
-drm_intel_gem_bo_unmap_gtt(intel_obj->buffer);
-  } else {
-drm_intel_bo_unmap(intel_obj->buffer);
-  }
+  drm_intel_bo_unmap(intel_obj->buffer);
}
obj->Pointer = NULL;
obj->Offset = 0;
diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.h 
b/src/mesa/drivers/dri/intel/intel_buffer_objects.h
index a487b5b..92a4121 100644
--- a/src/mesa/drivers/dri/intel/intel_buffer_objects.h
+++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.h
@@ -51,7 +51,6 @@ struct intel_buffer_object
unsigned int range_map_offset;
GLsizei range_map_size;
 
-   bool mapped_gtt;
bool source;
 };
 
-- 
1.7.9.1

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


Re: [Mesa-dev] [PATCH] glsl: Don't include the deprecated structure types in GLSL 1.40.

2012-03-16 Thread Kenneth Graunke

On 03/16/2012 01:56 PM, Eric Anholt wrote:

---
  src/glsl/glsl_types.cpp |   26 ++
  src/glsl/glsl_types.h   |6 +++---
  2 files changed, 17 insertions(+), 15 deletions(-)


Reviewed-by: Kenneth Graunke 

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


Re: [Mesa-dev] Doing 8.0.1 release?

2012-03-16 Thread Jeremy Huddleston
Please make sure to include python-generated C files in the 8.0.2 tarball.  
They were not there in 8.0.1's:

python -t -O -O main/es_generator.py -S main/APIspec.xml -V GLES1.1 > 
main/api_exec_es1.c
Traceback (most recent call last):
  File "main/es_generator.py", line 26, in 
import APIspecutil as apiutil
  File 
"/private/tmp/X11libs_trunk.roots/X11libs_trunk~obj/mesa/Mesa-8.0.1/src/mesa/main/APIspecutil.py",
 line 28, in 
import libxml2
ImportError: No module named libxml2



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


Re: [Mesa-dev] [PATCH 1/2] i915: set SPRITE_POINT_ENABLE bit correctly

2012-03-16 Thread Liu Aleaxander
On Sat, Mar 17, 2012 at 1:57 AM, Eric Anholt  wrote:
> On Mon, 12 Mar 2012 16:04:00 +0800, Yuanhan Liu  
> wrote:
>> When SPRITE_POINT_ENABLE bit is set, the texture coord would be
>> replaced, and this is only needed when we called something like
>> glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE).
>>
>> And more,  we currently handle varying inputs as texture coord,
>> we would be careful when setting this bit and set it just when
>> needed, or you will find the value of varying input is not right
>> and changed.
>>
>> Thus we do set SPRITE_POINT_ENABLE bit only when all enabled tex
>> coord units need do CoordReplace. Or fallback is needed to make
>> sure the rendering is right.
>>
>> As we need guarantee the CoordReplace changes handled well and
>> be able to fallback when finding something wrong, I added another
>> function to handle it at intelRunPipepline, where the drawing
>> happened here and tnl pipeline hasn't started yet.
>>
>> With handling the bit setup at intel_validate_sprite_point_enable(),
>> we don't need the relative code at i915Enable then.
>>
>> This patch would _really_ fix the webglc point-size.html test case and
>> of course, not regress piglit point-sprite and glean-pointSprite testcase.
>>
>> NOTE: This is a candidate for stable release branches.
>>
>> v2: fallback just when all enabled tex coord units need do
>>     CoordReplace(Eric).
>>
>> Signed-off-by: Yuanhan Liu 
>> ---
>>  src/mesa/drivers/dri/i915/i915_context.h |    1 +
>>  src/mesa/drivers/dri/i915/i915_state.c   |   13 +---
>>  src/mesa/drivers/dri/i915/intel_tris.c   |   52 
>> ++
>>  3 files changed, 54 insertions(+), 12 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/i915/i915_context.h 
>> b/src/mesa/drivers/dri/i915/i915_context.h
>> index 8167137..59eeb6e 100644
>> --- a/src/mesa/drivers/dri/i915/i915_context.h
>> +++ b/src/mesa/drivers/dri/i915/i915_context.h
>> @@ -40,6 +40,7 @@
>>  #define I915_FALLBACK_POINT_SMOOTH    0x8
>>  #define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN       0x10
>>  #define I915_FALLBACK_DRAW_OFFSET     0x20
>> +#define I915_FALLBACK_COORD_REPLACE   0x40
>>
>>  #define I915_UPLOAD_CTX              0x1
>>  #define I915_UPLOAD_BUFFERS          0x2
>> diff --git a/src/mesa/drivers/dri/i915/i915_state.c 
>> b/src/mesa/drivers/dri/i915/i915_state.c
>> index 756001f..3c751e4 100644
>> --- a/src/mesa/drivers/dri/i915/i915_state.c
>> +++ b/src/mesa/drivers/dri/i915/i915_state.c
>> @@ -869,18 +869,7 @@ i915Enable(struct gl_context * ctx, GLenum cap, 
>> GLboolean state)
>>        break;
>>
>>     case GL_POINT_SPRITE:
>> -      /* This state change is handled in i915_reduced_primitive_state 
>> because
>> -       * the hardware bit should only be set when rendering points.
>> -       */
>> -      dw = i915->state.Ctx[I915_CTXREG_LIS4];
>> -      if (state)
>> -      dw |= S4_SPRITE_POINT_ENABLE;
>> -      else
>> -      dw &= ~S4_SPRITE_POINT_ENABLE;
>> -      if (dw != i915->state.Ctx[I915_CTXREG_LIS4]) {
>> -      i915->state.Ctx[I915_CTXREG_LIS4] = dw;
>> -      I915_STATECHANGE(i915, I915_UPLOAD_CTX);
>> -      }
>> +      /* Handle it at intel_validate_sprite_point_enable() */
>>        break;
>>
>>     case GL_POINT_SMOOTH:
>> diff --git a/src/mesa/drivers/dri/i915/intel_tris.c 
>> b/src/mesa/drivers/dri/i915/intel_tris.c
>> index a36011a..58f6a59 100644
>> --- a/src/mesa/drivers/dri/i915/intel_tris.c
>> +++ b/src/mesa/drivers/dri/i915/intel_tris.c
>> @@ -1052,6 +1052,48 @@ static const GLenum reduced_prim[GL_POLYGON + 1] = {
>>     GL_TRIANGLES
>>  };
>>
>> +static void
>> +intel_validate_sprite_point_enable(struct intel_context *intel)
>> +{
>> +   struct gl_context *ctx = &intel->ctx;
>> +   struct i915_fragment_program *p =
>> +      (struct i915_fragment_program *) ctx->FragmentProgram._Current;
>> +   const GLbitfield64 inputsRead = p->FragProg.Base.InputsRead;
>> +   struct i915_context *i915 = i915_context(ctx);
>> +   GLuint s4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_VFMT_MASK;
>> +   int i;
>> +   GLuint coord_replace_bits = 0x0;
>> +   GLuint tex_coord_unit_bits = 0x0;
>> +
>> +   for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
>> +      if (ctx->Point.CoordReplace[i] && ctx->Point.PointSprite)
>> +         coord_replace_bits |= (1 << i);
>> +      if (inputsRead & FRAG_BIT_TEX(i))
>> +         tex_coord_unit_bits |= (1 << i);
>> +   }
>
> This ignores varyings assigned to texture coordinate inputs.

Yes, and I did it on purpose, since we want to check the mis-match
case of coord_replace_bits and tex_coord_unit_bits. You can see the
following comments why I did this.

>
>> +
>> +   s4 &= ~S4_SPRITE_POINT_ENABLE;
>> +   if (coord_replace_bits) {
>> +      if (coord_replace_bits != tex_coord_unit_bits) {
>> +         /*
>> +          * Here we can't enable the SPRITE_POINT_ENABLE bit due to the
>> +          * mis-match of tex_coord_unit_bits and coord_replace_bits, or
>> +          * this will make all the other