[Mesa-dev] [PATCH 3/3] i965: fix the size of HiZ buffers

2014-02-18 Thread Chia-I Wu
Use the formulas defined for HiZ to calculate the size needed.  This normally
results in a HiZ buffer that is one-fourth to one-eighth the size of the
corresponding depth buffer, which is a great save for many games.

For small HiZ buffers, the size may be greater than before because of the
paddings.  But it should be necessary, at least according to the PRM.

No piglit regression on Sandy Bridge and Haswell.

Signed-off-by: Chia-I Wu 
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 59 ---
 1 file changed, 44 insertions(+), 15 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index c40503a..94e063f 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1348,26 +1348,55 @@ bool
 intel_miptree_alloc_hiz(struct brw_context *brw,
struct intel_mipmap_tree *mt)
 {
-   struct intel_mipmap_tree *tmp_hiz_mt;
+   const unsigned hiz_align_j = 8;
+   unsigned hiz_width, hiz_height;
 
assert(mt->hiz_region == NULL);
 
-   tmp_hiz_mt = intel_miptree_create(brw,
- mt->target,
- mt->format,
- mt->first_level,
- mt->last_level,
- mt->logical_width0,
- mt->logical_height0,
- mt->logical_depth0,
- true,
- mt->num_samples,
- INTEL_MIPTREE_TILING_ANY);
-   if (tmp_hiz_mt) {
-  intel_region_reference(&mt->hiz_region, tmp_hiz_mt->region);
-  intel_miptree_release(&tmp_hiz_mt);
+   /*
+* The formulas are described in the Sandy Bridge PRM, Vol2 Part1 7.5.3 and
+* Ivy Bridge PRM, Vol2 Part1 11.5.3.
+*
+* Since the HiZ buffer is opaque, all we care about is to allocate a
+* buffer that is large enough.  On GEN7, the formulas are pretty much
+* followed.
+*
+* On GEN6, we use the formulas defined for GEN7.  This is because GEN6
+* does not support mipmapped HiZ buffers directly, and the formulas
+* defined for GEN7 are good enough (that is, large enough) on GEN6.  When
+* rendering, we will play with Coordinate Offset X/Y and etc. to point to
+* the destination slice directly.
+*/
+   hiz_width = ALIGN(mt->physical_width0, 16);
+
+   if (mt->target == GL_TEXTURE_3D) {
+  hiz_height = 0;
+
+  for (unsigned l = mt->first_level; l <= mt->last_level; l++) {
+ const unsigned h = ALIGN(minify(mt->physical_height0, l), 
hiz_align_j);
+ hiz_height += h * minify(mt->physical_depth0, l);
+  }
+
+  hiz_height /= 2;
+   } else {
+  /*
+   * We probably could simply set qpitch to h0 if the mt is non-mipmapped
+   * and non-array.
+   */
+  const unsigned h0 = ALIGN(mt->physical_height0, hiz_align_j);
+  const unsigned h1 = ALIGN(minify(mt->physical_height0, 1), hiz_align_j);
+  const unsigned qpitch = h0 + h1 +
+ (brw->gen >= 7 ? 12 : 11) * hiz_align_j;
+
+  hiz_height = ALIGN(qpitch * mt->physical_depth0 / 2, 8);
}
 
+   mt->hiz_region = intel_region_alloc(brw->intelScreen,
+   I915_TILING_Y,
+   1,
+   hiz_width,
+   hiz_height,
+   true);
if (!mt->hiz_region)
   return false;
 
-- 
1.8.5.3

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


[Mesa-dev] [PATCH 2/3] i965: replace hiz_mt by hiz_region

2014-02-18 Thread Chia-I Wu
HiZ buffers are opaque to the driver, and keeping the miptree around does not
gain us anything.

Signed-off-by: Chia-I Wu 
---
 src/mesa/drivers/dri/i965/brw_misc_state.c|  9 -
 src/mesa/drivers/dri/i965/gen6_blorp.cpp  |  2 +-
 src/mesa/drivers/dri/i965/gen7_blorp.cpp  |  2 +-
 src/mesa/drivers/dri/i965/gen7_misc_state.c   |  5 ++---
 src/mesa/drivers/dri/i965/intel_fbo.c |  4 ++--
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 17 -
 src/mesa/drivers/dri/i965/intel_mipmap_tree.h | 18 --
 7 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index 4e95c27..c3d3ad3 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -215,7 +215,7 @@ brw_get_depthstencil_tile_masks(struct intel_mipmap_tree 
*depth_mt,
 
   if (intel_miptree_slice_has_hiz(depth_mt, depth_level, depth_layer)) {
  uint32_t hiz_tile_mask_x, hiz_tile_mask_y;
- intel_region_get_tile_masks(depth_mt->hiz_mt->region,
+ intel_region_get_tile_masks(depth_mt->hiz_region,
  &hiz_tile_mask_x, &hiz_tile_mask_y, 
false);
 
  /* Each HiZ row represents 2 rows of pixels */
@@ -483,7 +483,7 @@ brw_workaround_depthstencil_alignment(struct brw_context 
*brw,
  false);
   if (intel_renderbuffer_has_hiz(depth_irb)) {
  brw->depthstencil.hiz_offset =
-intel_region_get_aligned_offset(depth_mt->hiz_mt->region,
+intel_region_get_aligned_offset(depth_mt->hiz_region,
 depth_irb->draw_x & ~tile_mask_x,
 (depth_irb->draw_y & ~tile_mask_y) 
/
 2,
@@ -671,11 +671,10 @@ brw_emit_depth_stencil_hiz(struct brw_context *brw,
 
   /* Emit hiz buffer. */
   if (hiz) {
- struct intel_mipmap_tree *hiz_mt = depth_mt->hiz_mt;
 BEGIN_BATCH(3);
 OUT_BATCH((_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
-OUT_BATCH(hiz_mt->region->pitch - 1);
-OUT_RELOC(hiz_mt->region->bo,
+OUT_BATCH(depth_mt->hiz_region->pitch - 1);
+OUT_RELOC(depth_mt->hiz_region->bo,
   I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER,
   brw->depthstencil.hiz_offset);
 ADVANCE_BATCH();
diff --git a/src/mesa/drivers/dri/i965/gen6_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
index 4222fa8..8cc2df1 100644
--- a/src/mesa/drivers/dri/i965/gen6_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen6_blorp.cpp
@@ -856,7 +856,7 @@ gen6_blorp_emit_depth_stencil_config(struct brw_context 
*brw,
 
/* 3DSTATE_HIER_DEPTH_BUFFER */
{
-  struct intel_region *hiz_region = params->depth.mt->hiz_mt->region;
+  struct intel_region *hiz_region = params->depth.mt->hiz_region;
   uint32_t hiz_offset =
  intel_region_get_aligned_offset(hiz_region,
  draw_x & ~tile_mask_x,
diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index 4bf9396..b1c4461 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -753,7 +753,7 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context 
*brw,
 
/* 3DSTATE_HIER_DEPTH_BUFFER */
{
-  struct intel_region *hiz_region = params->depth.mt->hiz_mt->region;
+  struct intel_region *hiz_region = params->depth.mt->hiz_region;
 
   BEGIN_BATCH(3);
   OUT_BATCH((GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16) | (3 - 2));
diff --git a/src/mesa/drivers/dri/i965/gen7_misc_state.c 
b/src/mesa/drivers/dri/i965/gen7_misc_state.c
index 8fb0eec..0fa0ed6 100644
--- a/src/mesa/drivers/dri/i965/gen7_misc_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_misc_state.c
@@ -143,12 +143,11 @@ gen7_emit_depth_stencil_hiz(struct brw_context *brw,
   OUT_BATCH(0);
   ADVANCE_BATCH();
} else {
-  struct intel_mipmap_tree *hiz_mt = depth_mt->hiz_mt;
   BEGIN_BATCH(3);
   OUT_BATCH(GEN7_3DSTATE_HIER_DEPTH_BUFFER << 16 | (3 - 2));
   OUT_BATCH((mocs << 25) |
-(hiz_mt->region->pitch - 1));
-  OUT_RELOC(hiz_mt->region->bo,
+(depth_mt->hiz_region->pitch - 1));
+  OUT_RELOC(depth_mt->hiz_region->bo,
 I915_GEM_DOMAIN_RENDER,
 I915_GEM_DOMAIN_RENDER,
 0);
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c 
b/src/mesa/drivers/dri/i965/intel_fbo.c
index cd148f0..61c570a 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -442,9 +442,9 @@ intel_renderbuffer_update_wrapper(struct brw_context *brw,
 
intel_renderbuffer_set_draw_offset(irb);
 
-   if (mt->hiz_mt == NULL && brw_is_hiz_depth_format(brw, rb->Format)) {
+   if (mt->hiz_reg

[Mesa-dev] [PATCH 1/3] i965: calculate hiz offset from hiz region

2014-02-18 Thread Chia-I Wu
It worked only because depth region and hiz region have the same cpp, tiling,
and pitch.

Signed-off-by: Chia-I Wu 
---
 src/mesa/drivers/dri/i965/brw_misc_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c 
b/src/mesa/drivers/dri/i965/brw_misc_state.c
index ca88b94..4e95c27 100644
--- a/src/mesa/drivers/dri/i965/brw_misc_state.c
+++ b/src/mesa/drivers/dri/i965/brw_misc_state.c
@@ -483,7 +483,7 @@ brw_workaround_depthstencil_alignment(struct brw_context 
*brw,
  false);
   if (intel_renderbuffer_has_hiz(depth_irb)) {
  brw->depthstencil.hiz_offset =
-intel_region_get_aligned_offset(depth_mt->region,
+intel_region_get_aligned_offset(depth_mt->hiz_mt->region,
 depth_irb->draw_x & ~tile_mask_x,
 (depth_irb->draw_y & ~tile_mask_y) 
/
 2,
-- 
1.8.5.3

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


Re: [Mesa-dev] [PATCH 04/10] egl: Unhide functionality in _eglInitSync()

2014-02-18 Thread Juha-Pekka Heikkilä
On Tue, Feb 18, 2014 at 9:40 AM, Chia-I Wu  wrote:
> On Tue, Feb 18, 2014 at 12:21 AM, Juha-Pekka Heikkila
>  wrote:
>> _eglInitResource() was used to memset entire _EGLSync by
>> writing more than size of pointed target. This does work
>> as long as Resource is the first element in _EGLSync,
>> this patch fixes such dependency.
> _EGLSync is a subclass of _EGLResource so the dependency always holds.
>  _eglInitResource is made to be able to initialize any class derived
> from _EGLResource, by requiring the size of the derived class to be
> specified.
>

ah, ok. I of course saw the intention but did not notice comment about
it. Maybe you could consider reverting these two:

498d10e egl: Unhide functionality in _eglInitSurface()
1456ed8 egl: Unhide functionality in _eglInitContext()

They do the same for _EGLSurface and _EGLContext as I was doing here
for _EGLSync.

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


Re: [Mesa-dev] [PATCH] r600g, radeonsi: Consolidate logic for short-circuiting flushes

2014-02-18 Thread Marek Olšák
Reviewed-by: Marek Olšák 

Marek

On Tue, Feb 18, 2014 at 3:11 AM, Michel Dänzer  wrote:
> From: Michel Daenzer 
>
> Fixes radeonsi emitting command streams to the kernel even when there
> have been no draw calls before a flush, potentially powering up the GPU
> needlessly.
>
> Incidentally, this also cuts the runtime of piglit gpu.py in about half
> on my Kaveri system, probably because an X11 client going away no longer
> always results in a command stream being submitted to the kernel via
> glamor.
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=65761
> Cc: "10.1" mesa-sta...@lists.freedesktop.org
> Signed-off-by: Michel Dänzer 
> ---
>  src/gallium/drivers/r600/r600_hw_context.c  | 2 +-
>  src/gallium/drivers/r600/r600_pipe.c| 4 ++--
>  src/gallium/drivers/r600/r600_pipe.h| 1 -
>  src/gallium/drivers/radeon/r600_buffer_common.c | 2 +-
>  src/gallium/drivers/radeon/r600_pipe_common.h   | 1 +
>  src/gallium/drivers/radeonsi/si_hw_context.c| 6 +++---
>  6 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_hw_context.c 
> b/src/gallium/drivers/r600/r600_hw_context.c
> index dc3c221..ef077b2 100644
> --- a/src/gallium/drivers/r600/r600_hw_context.c
> +++ b/src/gallium/drivers/r600/r600_hw_context.c
> @@ -355,7 +355,7 @@ void r600_begin_new_cs(struct r600_context *ctx)
> ctx->last_primitive_type = -1;
> ctx->last_start_instance = -1;
>
> -   ctx->initial_gfx_cs_size = ctx->b.rings.gfx.cs->cdw;
> +   ctx->b.initial_gfx_cs_size = ctx->b.rings.gfx.cs->cdw;
>  }
>
>  /* The max number of bytes to copy per packet. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c 
> b/src/gallium/drivers/r600/r600_pipe.c
> index 8ea192a..0f75a53 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -74,7 +74,7 @@ static void r600_flush(struct pipe_context *ctx, unsigned 
> flags)
> unsigned render_cond_mode = 0;
> boolean render_cond_cond = FALSE;
>
> -   if (rctx->b.rings.gfx.cs->cdw == rctx->initial_gfx_cs_size)
> +   if (rctx->b.rings.gfx.cs->cdw == rctx->b.initial_gfx_cs_size)
> return;
>
> rctx->b.rings.gfx.flushing = true;
> @@ -95,7 +95,7 @@ static void r600_flush(struct pipe_context *ctx, unsigned 
> flags)
> ctx->render_condition(ctx, render_cond, render_cond_cond, 
> render_cond_mode);
> }
>
> -   rctx->initial_gfx_cs_size = rctx->b.rings.gfx.cs->cdw;
> +   rctx->b.initial_gfx_cs_size = rctx->b.rings.gfx.cs->cdw;
>  }
>
>  static void r600_flush_from_st(struct pipe_context *ctx,
> diff --git a/src/gallium/drivers/r600/r600_pipe.h 
> b/src/gallium/drivers/r600/r600_pipe.h
> index 15052da..83b0e4f 100644
> --- a/src/gallium/drivers/r600/r600_pipe.h
> +++ b/src/gallium/drivers/r600/r600_pipe.h
> @@ -377,7 +377,6 @@ struct r600_context {
> struct r600_screen  *screen;
> struct blitter_context  *blitter;
> struct u_suballocator   *allocator_fetch_shader;
> -   unsignedinitial_gfx_cs_size;
>
> /* Hardware info. */
> boolean has_vertex_cache;
> diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c 
> b/src/gallium/drivers/radeon/r600_buffer_common.c
> index 068141c..e75b337 100644
> --- a/src/gallium/drivers/radeon/r600_buffer_common.c
> +++ b/src/gallium/drivers/radeon/r600_buffer_common.c
> @@ -60,7 +60,7 @@ void *r600_buffer_map_sync_with_rings(struct 
> r600_common_context *ctx,
> rusage = RADEON_USAGE_WRITE;
> }
>
> -   if (ctx->rings.gfx.cs->cdw &&
> +   if (ctx->rings.gfx.cs->cdw != ctx->initial_gfx_cs_size &&
> ctx->ws->cs_is_buffer_referenced(ctx->rings.gfx.cs,
>  resource->cs_buf, rusage)) {
> if (usage & PIPE_TRANSFER_DONTBLOCK) {
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
> b/src/gallium/drivers/radeon/r600_pipe_common.h
> index 2fbc6a3..d604f65 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -241,6 +241,7 @@ struct r600_common_context {
> enum radeon_family  family;
> enum chip_class chip_class;
> struct r600_rings   rings;
> +   unsignedinitial_gfx_cs_size;
>
> struct u_upload_mgr *uploader;
> struct u_suballocator   *allocator_so_filled_size;
> diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c 
> b/src/gallium/drivers/radeonsi/si_hw_context.c
> index 7e40255..639659c 100644
> --- a/src/gallium/drivers/radeonsi/si_hw_context.c
> +++ b/src/gallium/drivers/radeonsi/si_hw_context.c
> @@ -79,9 +79,7 @@ void si_need_cs_space(struct si_context *ctx, unsigned 
> num_dw,
>
>  void si_context_flush(struct si_context *ctx, unsigned flag

Re: [Mesa-dev] [PATCH 04/10] egl: Unhide functionality in _eglInitSync()

2014-02-18 Thread Chia-I Wu
On Tue, Feb 18, 2014 at 5:02 PM, Juha-Pekka Heikkilä
 wrote:
> On Tue, Feb 18, 2014 at 9:40 AM, Chia-I Wu  wrote:
>> On Tue, Feb 18, 2014 at 12:21 AM, Juha-Pekka Heikkila
>>  wrote:
>>> _eglInitResource() was used to memset entire _EGLSync by
>>> writing more than size of pointed target. This does work
>>> as long as Resource is the first element in _EGLSync,
>>> this patch fixes such dependency.
>> _EGLSync is a subclass of _EGLResource so the dependency always holds.
>>  _eglInitResource is made to be able to initialize any class derived
>> from _EGLResource, by requiring the size of the derived class to be
>> specified.
>>
>
> ah, ok. I of course saw the intention but did not notice comment about
> it. Maybe you could consider reverting these two:
>
> 498d10e egl: Unhide functionality in _eglInitSurface()
> 1456ed8 egl: Unhide functionality in _eglInitContext()
>
> They do the same for _EGLSurface and _EGLContext as I was doing here
> for _EGLSync.
Thanks for the notices.  I will revert them and improve the comments
of _eglInitResource tomorrow if there is no objection.

>
> /Juha-Pekka



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


[Mesa-dev] [Bug 67676] Transparent windows no longer work

2014-02-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=67676

Sjoerd Simons  changed:

   What|Removed |Added

  Attachment #93777|0   |1
is obsolete||

--- Comment #7 from Sjoerd Simons  ---
Created attachment 94274
  --> https://bugs.freedesktop.org/attachment.cgi?id=94274&action=edit
Updated patch

>From comments by daniels, check for EGL_DONT_CARE in the matching criteria for
consistency

-- 
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 75061] bug in clearing color buffer

2014-02-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75061

--- Comment #2 from Maxim  ---
Created attachment 94275
  --> https://bugs.freedesktop.org/attachment.cgi?id=94275&action=edit
gdb full backtrace

-- 
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 75061] bug in clearing color buffer

2014-02-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75061

--- Comment #3 from Maxim  ---
Created attachment 94276
  --> https://bugs.freedesktop.org/attachment.cgi?id=94276&action=edit
valgrind + hellgrind

-- 
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 75061] bug in clearing color buffer

2014-02-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75061

--- Comment #4 from Maxim  ---
Created attachment 94277
  --> https://bugs.freedesktop.org/attachment.cgi?id=94277&action=edit
valgrind only

-- 
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] drm/radeon: fix CP semaphores on CIK

2014-02-18 Thread Christian König
From: Christian König 

The CP semaphore queue on CIK has a bug that triggers if uncompleted
waits use the same address while a signal is still pending. Work around
this by using different addresses for each sync.

Signed-off-by: Christian König 
Cc: sta...@vger.kernel.org
---
 drivers/gpu/drm/radeon/radeon.h   |  4 +++-
 drivers/gpu/drm/radeon/radeon_ring.c  |  2 +-
 drivers/gpu/drm/radeon/radeon_semaphore.c | 19 ---
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 4a8ac1c..024db37 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -135,6 +135,9 @@ extern int radeon_hard_reset;
 /* R600+ */
 #define R600_RING_TYPE_UVD_INDEX   5
 
+/* number of hw syncs before falling back on blocking */
+#define RADEON_NUM_SYNCS   4
+
 /* hardcode those limit for now */
 #define RADEON_VA_IB_OFFSET(1 << 20)
 #define RADEON_VA_RESERVED_SIZE(8 << 20)
@@ -554,7 +557,6 @@ int radeon_mode_dumb_mmap(struct drm_file *filp,
 /*
  * Semaphores.
  */
-/* everything here is constant */
 struct radeon_semaphore {
struct radeon_sa_bo *sa_bo;
signed  waiters;
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c 
b/drivers/gpu/drm/radeon/radeon_ring.c
index 1b783f0..15e44a7 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -139,7 +139,7 @@ int radeon_ib_schedule(struct radeon_device *rdev, struct 
radeon_ib *ib,
}
 
/* 64 dwords should be enough for fence too */
-   r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_RINGS * 8);
+   r = radeon_ring_lock(rdev, ring, 64 + RADEON_NUM_SYNCS * 8);
if (r) {
dev_err(rdev->dev, "scheduling IB failed (%d).\n", r);
return r;
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c 
b/drivers/gpu/drm/radeon/radeon_semaphore.c
index 2b42aa1..9006b32 100644
--- a/drivers/gpu/drm/radeon/radeon_semaphore.c
+++ b/drivers/gpu/drm/radeon/radeon_semaphore.c
@@ -34,14 +34,15 @@
 int radeon_semaphore_create(struct radeon_device *rdev,
struct radeon_semaphore **semaphore)
 {
+   uint32_t *cpu_addr;
int i, r;
 
*semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL);
if (*semaphore == NULL) {
return -ENOMEM;
}
-   r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo,
-&(*semaphore)->sa_bo, 8, 8, true);
+   r = radeon_sa_bo_new(rdev, &rdev->ring_tmp_bo, &(*semaphore)->sa_bo,
+8 * RADEON_NUM_SYNCS, 8, true);
if (r) {
kfree(*semaphore);
*semaphore = NULL;
@@ -49,7 +50,10 @@ int radeon_semaphore_create(struct radeon_device *rdev,
}
(*semaphore)->waiters = 0;
(*semaphore)->gpu_addr = radeon_sa_bo_gpu_addr((*semaphore)->sa_bo);
-   *((uint64_t*)radeon_sa_bo_cpu_addr((*semaphore)->sa_bo)) = 0;
+
+   cpu_addr = radeon_sa_bo_cpu_addr((*semaphore)->sa_bo);
+   for (i = 0; i < RADEON_NUM_SYNCS; ++i)
+   cpu_addr[i] = 0;
 
for (i = 0; i < RADEON_NUM_RINGS; ++i)
(*semaphore)->sync_to[i] = NULL;
@@ -125,6 +129,7 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev,
struct radeon_semaphore *semaphore,
int ring)
 {
+   unsigned count = 0;
int i, r;
 
 for (i = 0; i < RADEON_NUM_RINGS; ++i) {
@@ -140,6 +145,12 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev,
return -EINVAL;
}
 
+   if (++count > RADEON_NUM_SYNCS) {
+   /* not enough room, wait manually */
+   radeon_fence_wait_locked(fence);
+   continue;
+   }
+
/* allocate enough space for sync command */
r = radeon_ring_alloc(rdev, &rdev->ring[i], 16);
if (r) {
@@ -164,6 +175,8 @@ int radeon_semaphore_sync_rings(struct radeon_device *rdev,
 
radeon_ring_commit(rdev, &rdev->ring[i]);
radeon_fence_note_sync(fence, ring);
+
+   semaphore->gpu_addr += 8;
}
 
return 0;
-- 
1.8.3.2

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


[Mesa-dev] [Bug 59941] glxinfo segfault with GL_ARB_uniform_buffer_object

2014-02-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=59941

Iaroslav  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #3 from Iaroslav  ---
(In reply to comment #2)
> Does this bug still occur?  I'm not able to reproduce it.

All work fine for a long time.

-- 
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] st/xvmc: fix tests so that they pass

2014-02-18 Thread Tom Stellard
On Sun, Feb 16, 2014 at 02:26:33AM -0500, Ilia Mirkin wrote:
> Signed-off-by: Ilia Mirkin 
> ---
> 
> Tom, any objections to enabling xvmc by default again? You turned it off in
> commit 6a19bb56e ("configure: Disable xvmc by default") complaining about the
> tests failing. These all pass for me now on nouveau.
>

If make check passes when you build all the drivers, then I have no
objections to enabling xvmc by default.

Also, it might be good to cc stable on this patch.

-Tom

>  src/gallium/state_trackers/xvmc/tests/test_rendering.c  | 12 +---
>  src/gallium/state_trackers/xvmc/tests/test_subpicture.c |  8 ++--
>  src/gallium/state_trackers/xvmc/tests/testlib.c |  2 +-
>  3 files changed, 12 insertions(+), 10 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_rendering.c 
> b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> index 2ea557a..5bfbea7 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_rendering.c
> @@ -50,9 +50,7 @@
>  #define DEFAULT_OUTPUT_HEIGHTINPUT_HEIGHT
>  #define DEFAULT_ACCEPTABLE_ERR   0.01
>  
> -void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned 
> int *output_height, double *acceptable_error, int *prompt);
> -
> -void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned 
> int *output_height, double *acceptable_error, int *prompt)
> +static void ParseArgs(int argc, char **argv, unsigned int *output_width, 
> unsigned int *output_height, double *acceptable_error, int *prompt)
>  {
>   int fail = 0;
>   int i;
> @@ -60,7 +58,7 @@ void ParseArgs(int argc, char **argv, unsigned int 
> *output_width, unsigned int *
>   *output_width = DEFAULT_OUTPUT_WIDTH;
>   *output_height = DEFAULT_OUTPUT_HEIGHT;
>   *acceptable_error = DEFAULT_ACCEPTABLE_ERR;
> - *prompt = 1;
> + *prompt = 0;
>  
>   for (i = 1; i < argc && !fail; ++i)
>   {
> @@ -79,8 +77,8 @@ void ParseArgs(int argc, char **argv, unsigned int 
> *output_width, unsigned int *
>   if (sscanf(argv[++i], "%lf", acceptable_error) != 1)
>   fail = 1;
>   }
> - else if (strcmp(argv[i], "-n"))
> - *prompt = 0;
> + else if (!strcmp(argv[i], "-p"))
> + *prompt = 1;
>   else
>   fail = 1;
>   }
> @@ -95,7 +93,7 @@ void ParseArgs(int argc, char **argv, unsigned int 
> *output_width, unsigned int *
>   "\t-w \tOutput width\n"
>   "\t-h \tOutput height\n"
>   "\t-e \tAcceptable margin of error per pixel, 
> from 0 to 1\n"
> - "\t-n\tDon't prompt for quit\n",
> + "\t-p\tPrompt for quit\n",
>   argv[0]
>   );
>  }
> diff --git a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c 
> b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> index 89af093..9149879 100644
> --- a/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> +++ b/src/gallium/state_trackers/xvmc/tests/test_subpicture.c
> @@ -165,8 +165,12 @@ int main(int argc, char **argv)
>   assert(subpicture.xvimage_id == subpics[i].id);
>   /* Test width & height assigned and correct */
>   assert(subpicture.width == width && subpicture.height == 
> height);
> - /* Test no palette support */
> - assert(subpicture.num_palette_entries == 0 && 
> subpicture.entry_bytes == 0);
> +if (subpics[i].type == XvRGB)
> +   /* Test no palette support */
> +   assert(subpicture.num_palette_entries == 0 && 
> subpicture.entry_bytes == 0);
> +else
> +   /* Test palette support */
> +   assert(subpicture.num_palette_entries == 16 && 
> subpicture.entry_bytes == 4);
>   /* Test valid params */
>   assert(XvMCDestroySubpicture(display, &subpicture) == Success);
>   }
> diff --git a/src/gallium/state_trackers/xvmc/tests/testlib.c 
> b/src/gallium/state_trackers/xvmc/tests/testlib.c
> index 3bae978..a943f6b 100644
> --- a/src/gallium/state_trackers/xvmc/tests/testlib.c
> +++ b/src/gallium/state_trackers/xvmc/tests/testlib.c
> @@ -85,7 +85,7 @@ int GetPort
>   {
>   for (k = 0; k < num_mc_types && 
> !found_port; ++k)
>   {
> - if 
> (surface_info[j].mc_type == mc_types[k])
> + if 
> ((surface_info[j].mc_type & mc_types[k]) == mc_types[k])
>   {
>   for (l = 0; l < 
> adaptor

[Mesa-dev] [PATCH v2 0/4] i965: refactor DRI image code

2014-02-18 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira 

Hi,

This is an attempt to refactor the DRI image implementation in the
i965. While the main motivation for this was to make it possible to
compile that code independently, this also simplifies the format
handling (there is one less format field in __DRIimageRec) and takes
the bulk of DRI image out of intel_screen.c

Thanks,
Ander


Ander Conselvan de Oliveira (4):
  i965: Support allocation of subregions of an intel_region
  i965: Change intel_region interface to not depend on intelScreen
  i965: Make names of DRI image extension functions more consistent
  i965: Refactor DRI image code

 include/GL/internal/dri_interface.h   |   4 +
 src/mesa/drivers/dri/common/dri_util.c|  46 +++
 src/mesa/drivers/dri/common/dri_util.h|   6 +
 src/mesa/drivers/dri/i965/Makefile.sources|   1 +
 src/mesa/drivers/dri/i965/brw_context.c   |  10 +-
 src/mesa/drivers/dri/i965/intel_fbo.c |  23 +-
 src/mesa/drivers/dri/i965/intel_image.c   | 348 
 src/mesa/drivers/dri/i965/intel_image.h   |  70 
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c |   4 +-
 src/mesa/drivers/dri/i965/intel_regions.c |  48 ++-
 src/mesa/drivers/dri/i965/intel_regions.h |  35 +-
 src/mesa/drivers/dri/i965/intel_screen.c  | 571 +++---
 src/mesa/drivers/dri/i965/intel_tex_image.c   |  25 +-
 13 files changed, 729 insertions(+), 462 deletions(-)
 create mode 100644 src/mesa/drivers/dri/i965/intel_image.c
 create mode 100644 src/mesa/drivers/dri/i965/intel_image.h

-- 
1.8.3.2

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


[Mesa-dev] [PATCH 3/4] i965: Make names of DRI image extension functions more consistent

2014-02-18 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira 

Prefix everything with intel_dri_image.
---
 src/mesa/drivers/dri/i965/intel_screen.c | 116 ---
 1 file changed, 59 insertions(+), 57 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 768338b..5ef654e 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -358,9 +358,9 @@ intel_setup_image_from_dimensions(__DRIimage *image)
 }
 
 static __DRIimage *
-intel_create_image_from_name(__DRIscreen *screen,
-int width, int height, int format,
-int name, int pitch, void *loaderPrivate)
+intel_dri_image_create_from_name(__DRIscreen *screen,
+ int width, int height, int format,
+ int name, int pitch, void *loaderPrivate)
 {
 struct intel_screen *intelScreen = screen->driverPrivate;
 __DRIimage *image;
@@ -388,8 +388,9 @@ intel_create_image_from_name(__DRIscreen *screen,
 }
 
 static __DRIimage *
-intel_create_image_from_renderbuffer(__DRIcontext *context,
-int renderbuffer, void *loaderPrivate)
+intel_dri_image_create_from_renderbuffer(__DRIcontext *context,
+ int renderbuffer,
+ void *loaderPrivate)
 {
__DRIimage *image;
struct brw_context *brw = context->driverPrivate;
@@ -422,11 +423,11 @@ intel_create_image_from_renderbuffer(__DRIcontext 
*context,
 }
 
 static __DRIimage *
-intel_create_image_from_texture(__DRIcontext *context, int target,
-unsigned texture, int zoffset,
-int level,
-unsigned *error,
-void *loaderPrivate)
+intel_dri_image_create_from_texture(__DRIcontext *context, int target,
+unsigned texture, int zoffset,
+int level,
+unsigned *error,
+void *loaderPrivate)
 {
__DRIimage *image;
struct brw_context *brw = context->driverPrivate;
@@ -482,17 +483,17 @@ intel_create_image_from_texture(__DRIcontext *context, 
int target,
 }
 
 static void
-intel_destroy_image(__DRIimage *image)
+intel_dri_image_destroy(__DRIimage *image)
 {
 intel_region_release(&image->region);
 free(image);
 }
 
 static __DRIimage *
-intel_create_image(__DRIscreen *screen,
-  int width, int height, int format,
-  unsigned int use,
-  void *loaderPrivate)
+intel_dri_image_create(__DRIscreen *screen,
+   int width, int height, int format,
+   unsigned int use,
+   void *loaderPrivate)
 {
__DRIimage *image;
struct intel_screen *intelScreen = screen->driverPrivate;
@@ -528,7 +529,7 @@ intel_create_image(__DRIscreen *screen,
 }
 
 static GLboolean
-intel_query_image(__DRIimage *image, int attrib, int *value)
+intel_dri_image_query(__DRIimage *image, int attrib, int *value)
 {
switch (attrib) {
case __DRI_IMAGE_ATTRIB_STRIDE:
@@ -563,7 +564,7 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
 }
 
 static __DRIimage *
-intel_dup_image(__DRIimage *orig_image, void *loaderPrivate)
+intel_dri_image_dup(__DRIimage *orig_image, void *loaderPrivate)
 {
__DRIimage *image;
 
@@ -591,7 +592,7 @@ intel_dup_image(__DRIimage *orig_image, void *loaderPrivate)
 }
 
 static GLboolean
-intel_validate_usage(__DRIimage *image, unsigned int use)
+intel_dri_image_validate_usage(__DRIimage *image, unsigned int use)
 {
if (use & __DRI_IMAGE_USE_CURSOR) {
   if (image->region->width != 64 || image->region->height != 64)
@@ -602,11 +603,11 @@ intel_validate_usage(__DRIimage *image, unsigned int use)
 }
 
 static __DRIimage *
-intel_create_image_from_names(__DRIscreen *screen,
-  int width, int height, int fourcc,
-  int *names, int num_names,
-  int *strides, int *offsets,
-  void *loaderPrivate)
+intel_dri_image_create_from_names(__DRIscreen *screen,
+  int width, int height, int fourcc,
+  int *names, int num_names,
+  int *strides, int *offsets,
+  void *loaderPrivate)
 {
 struct intel_image_format *f = NULL;
 __DRIimage *image;
@@ -619,10 +620,10 @@ intel_create_image_from_names(__DRIscreen *screen,
 if (f == NULL)
 return NULL;
 
-image = intel_create_image_from_name(screen, width, height,
- __DRI_IMAGE_FORMAT_NONE,
- names[0], strides[0],
-

[Mesa-dev] [PATCH 1/4] i965: Support allocation of subregions of an intel_region

2014-02-18 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira 

Both __DRIimage and intel_region have width and height fields. They
actually differ when an image is created for a texture but are the
same in all the other cases. For images created from a planar image,
a special intel_region that represents only a part of the storage used
by the image is used. It references the same bo but contains offset
information plus different dimensions and pitch.

This patch adds an entry point for creating an intel_region that
represents a sub region of another intel_region. This entry point is
then used when creating images from textures or from planar images.
This lets us remove the duplicate width and height fields from
__DRIimage and move the offset, tile_x and tile_y field into
intel_region.
---
 src/mesa/drivers/dri/i965/brw_context.c |  8 ++--
 src/mesa/drivers/dri/i965/intel_fbo.c   |  2 +-
 src/mesa/drivers/dri/i965/intel_regions.c   | 28 ++
 src/mesa/drivers/dri/i965/intel_regions.h   | 16 +---
 src/mesa/drivers/dri/i965/intel_screen.c| 60 -
 src/mesa/drivers/dri/i965/intel_tex_image.c |  7 ++--
 6 files changed, 72 insertions(+), 49 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index 021287e..ae267d8 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1402,8 +1402,8 @@ intel_update_image_buffers(struct brw_context *brw, 
__DRIdrawable *drawable)
 &images);
 
if (images.image_mask & __DRI_IMAGE_BUFFER_FRONT) {
-  drawable->w = images.front->width;
-  drawable->h = images.front->height;
+  drawable->w = images.front->region->width;
+  drawable->h = images.front->region->height;
   intel_update_image_buffer(brw,
 drawable,
 front_rb,
@@ -1411,8 +1411,8 @@ intel_update_image_buffers(struct brw_context *brw, 
__DRIdrawable *drawable)
 __DRI_IMAGE_BUFFER_FRONT);
}
if (images.image_mask & __DRI_IMAGE_BUFFER_BACK) {
-  drawable->w = images.back->width;
-  drawable->h = images.back->height;
+  drawable->w = images.back->region->width;
+  drawable->h = images.back->region->height;
   intel_update_image_buffer(brw,
 drawable,
 back_rb,
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c 
b/src/mesa/drivers/dri/i965/intel_fbo.c
index cd148f0..4c101f8 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -283,7 +283,7 @@ intel_image_target_renderbuffer_storage(struct gl_context 
*ctx,
irb->mt = intel_miptree_create_for_bo(brw,
  image->region->bo,
  image->format,
- image->offset,
+ image->region->offset,
  image->region->width,
  image->region->height,
  image->region->pitch,
diff --git a/src/mesa/drivers/dri/i965/intel_regions.c 
b/src/mesa/drivers/dri/i965/intel_regions.c
index a845683..2ab36fc 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.c
+++ b/src/mesa/drivers/dri/i965/intel_regions.c
@@ -238,6 +238,34 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
return region;
 }
 
+struct intel_region *
+intel_region_alloc_subregion(struct intel_region *parent_region,
+ GLuint cpp,
+ GLuint width, GLuint height, GLuint pitch,
+ GLuint offset, GLuint tile_x, GLuint tile_y)
+{
+   struct intel_region *region;
+
+   region = calloc(1, sizeof *region);
+   if (region == NULL)
+  return NULL;
+
+   region->bo = parent_region->bo;
+   drm_intel_bo_reference(region->bo);
+
+   region->cpp = cpp;
+   region->width = width;
+   region->height = height;
+   region->pitch = pitch;
+   region->refcount = 1;
+   region->tiling = parent_region->tiling;
+   region->offset = offset;
+   region->tile_x = tile_x;
+   region->tile_y = tile_y;
+
+   return region;
+}
+
 void
 intel_region_reference(struct intel_region **dst, struct intel_region *src)
 {
diff --git a/src/mesa/drivers/dri/i965/intel_regions.h 
b/src/mesa/drivers/dri/i965/intel_regions.h
index c301f23..2d3f4d1 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.h
+++ b/src/mesa/drivers/dri/i965/intel_regions.h
@@ -70,6 +70,11 @@ struct intel_region
uint32_t tiling; /**< Which tiling mode the region is in */
 
uint32_t name; /**< Global name for the bo */
+
+   /** Describe the offset of the region within the bo */
+   uint32_t offset;
+   GLuint tile_x;
+   GLuint tile_y;
 };
 
 
@@ -95,6 +100,12 @@ intel_region_alloc_for_fd(struct intel_screen *screen,
  

[Mesa-dev] [PATCH 2/4] i965: Change intel_region interface to not depend on intelScreen

2014-02-18 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira 

The only field from intelScreen used by the intel_region code is the
drm_intel_bufmgr, so take that as a parameter instead of the whole
screen.
---
 src/mesa/drivers/dri/i965/brw_context.c   |  2 +-
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c |  4 ++--
 src/mesa/drivers/dri/i965/intel_regions.c | 20 ++--
 src/mesa/drivers/dri/i965/intel_regions.h |  7 +++
 src/mesa/drivers/dri/i965/intel_screen.c  |  9 +
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index ae267d8..f5b2e39 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -1285,7 +1285,7 @@ intel_process_dri2_buffer(struct brw_context *brw,
}
 
intel_miptree_release(&rb->mt);
-   region = intel_region_alloc_for_handle(brw->intelScreen,
+   region = intel_region_alloc_for_handle(brw->intelScreen->bufmgr,
   buffer->cpp,
   drawable->w,
   drawable->h,
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index c9f5bb3..13cde04 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -565,7 +565,7 @@ intel_miptree_create(struct brw_context *brw,
bool y_or_x = tiling == (I915_TILING_Y | I915_TILING_X);
 
mt->etc_format = etc_format;
-   mt->region = intel_region_alloc(brw->intelScreen,
+   mt->region = intel_region_alloc(brw->intelScreen->bufmgr,
   y_or_x ? I915_TILING_Y : tiling,
   mt->cpp,
   total_width,
@@ -581,7 +581,7 @@ intel_miptree_create(struct brw_context *brw,
  mt->total_width, mt->total_height);
   intel_region_release(&mt->region);
 
-  mt->region = intel_region_alloc(brw->intelScreen,
+  mt->region = intel_region_alloc(brw->intelScreen->bufmgr,
   I915_TILING_X,
   mt->cpp,
   total_width,
diff --git a/src/mesa/drivers/dri/i965/intel_regions.c 
b/src/mesa/drivers/dri/i965/intel_regions.c
index 2ab36fc..3e85a75 100644
--- a/src/mesa/drivers/dri/i965/intel_regions.c
+++ b/src/mesa/drivers/dri/i965/intel_regions.c
@@ -105,7 +105,7 @@ debug_backtrace(void)
 #endif
 
 static struct intel_region *
-intel_region_alloc_internal(struct intel_screen *screen,
+intel_region_alloc_internal(drm_intel_bufmgr *bufmgr,
GLuint cpp,
GLuint width, GLuint height, GLuint pitch,
uint32_t tiling, drm_intel_bo *buffer)
@@ -129,7 +129,7 @@ intel_region_alloc_internal(struct intel_screen *screen,
 }
 
 struct intel_region *
-intel_region_alloc(struct intel_screen *screen,
+intel_region_alloc(drm_intel_bufmgr *bufmgr,
   uint32_t tiling,
GLuint cpp, GLuint width, GLuint height,
   bool expect_accelerated_upload)
@@ -142,13 +142,13 @@ intel_region_alloc(struct intel_screen *screen,
if (expect_accelerated_upload)
   flags |= BO_ALLOC_FOR_RENDER;
 
-   buffer = drm_intel_bo_alloc_tiled(screen->bufmgr, "region",
+   buffer = drm_intel_bo_alloc_tiled(bufmgr, "region",
 width, height, cpp,
 &tiling, &aligned_pitch, flags);
if (buffer == NULL)
   return NULL;
 
-   region = intel_region_alloc_internal(screen, cpp, width, height,
+   region = intel_region_alloc_internal(bufmgr, cpp, width, height,
 aligned_pitch, tiling, buffer);
if (region == NULL) {
   drm_intel_bo_unreference(buffer);
@@ -172,7 +172,7 @@ intel_region_flink(struct intel_region *region, uint32_t 
*name)
 }
 
 struct intel_region *
-intel_region_alloc_for_handle(struct intel_screen *screen,
+intel_region_alloc_for_handle(drm_intel_bufmgr *bufmgr,
  GLuint cpp,
  GLuint width, GLuint height, GLuint pitch,
  GLuint handle, const char *name)
@@ -182,7 +182,7 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
int ret;
uint32_t bit_6_swizzle, tiling;
 
-   buffer = intel_bo_gem_create_from_name(screen->bufmgr, name, handle);
+   buffer = intel_bo_gem_create_from_name(bufmgr, name, handle);
if (buffer == NULL)
   return NULL;
ret = drm_intel_bo_get_tiling(buffer, &tiling, &bit_6_swizzle);
@@ -193,7 +193,7 @@ intel_region_alloc_for_handle(struct intel_screen *screen,
   return NULL;
}
 
-   region = intel_region_alloc_internal(screen, cpp,
+   region = intel_region_alloc_internal(bufmgr, cpp,
   

Re: [Mesa-dev] [PATCH] clover: Don't call pipe_loader_release() when deleting a device

2014-02-18 Thread Francisco Jerez
Tom Stellard  writes:

> From: Tom Stellard 
>
> After pipe_loader_release() is called, if any of the pipe_* objects
> try to call into the gallium API the application will segfault.
>
> The only time devices are deleted is when the global _clover_platform
> object is deleted by the static destructor.  However,  since application
> objects that are deleted by the static destructor *after*
> _clover_platform might try to make a CL API calls from their destructor,
> it is never safe to call pipe_loader_release().

Please have a look at the clover-internal-ref-counting branch [1] of my
mesa tree, it should fix a number of memory management-related bugs,
possibly the one you've encountered too, without the negative side
effects of dropping the call to pipe_loader_release().

Thanks.

[1] 
http://cgit.freedesktop.org/~currojerez/mesa/log/?h=clover-internal-ref-counting

> ---
>  src/gallium/state_trackers/clover/core/device.cpp | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
> b/src/gallium/state_trackers/clover/core/device.cpp
> index 76a49d0..2290366 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -48,8 +48,6 @@ device::device(clover::platform &platform, 
> pipe_loader_device *ldev) :
>  device::~device() {
> if (pipe)
>pipe->destroy(pipe);
> -   if (ldev)
> -  pipe_loader_release(&ldev, 1);
>  }
>  
>  bool
> -- 
> 1.8.1.4


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


Re: [Mesa-dev] [PATCH] mesa: Fix error code generation in glReadPixels()

2014-02-18 Thread Anuj Phogat
On Fri, Feb 14, 2014 at 7:00 PM, Ian Romanick  wrote:
> On 02/14/2014 04:49 PM, Anuj Phogat wrote:
>> Section 4.3.1, page 220, of OpenGL 3.3 specification explains
>> the error conditions for glreadPixels():
>>
>>"If the format is DEPTH_STENCIL, then values are taken from
>> both the depth buffer and the stencil buffer. If there is
>> no depth buffer or if there is no stencil buffer, then the
>> error INVALID_OPERATION occurs. If the type parameter is
>> not UNSIGNED_INT_24_8 or FLOAT_32_UNSIGNED_INT_24_8_REV,
>> then the error INVALID_ENUM occurs."
>
> Add this quotation to the code with an extra comment "OpenGL ES still
> generates GL_INVALID_OPERATION because glReadPixels cannot be used to
> read depth or stencil in that API."
>
>> Fixes failing Khronos CTS test packed_depth_stencil_error.test
>>
>> Cc: 
>> Signed-off-by: Anuj Phogat 
>> ---
>>  src/mesa/main/glformats.c | 9 -
>>  1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
>> index 77cf263..b797900 100644
>> --- a/src/mesa/main/glformats.c
>> +++ b/src/mesa/main/glformats.c
>> @@ -1257,6 +1257,9 @@ _mesa_error_check_format_and_type(const struct 
>> gl_context *ctx,
>>ctx->Extensions.ARB_texture_rgb10_a2ui) {
>>   break; /* OK */
>>}
>> +  if (format == GL_DEPTH_STENCIL && _mesa_is_desktop_gl(ctx)) {
>> + return GL_INVALID_ENUM;
>> +  }
>
> Wouldn't it be easier to just add the following before the
> switch-statement?
>
Yes, that'll avoid code duplication. I'll use your suggestion.

>/* Section 4.3.1, page 220, of OpenGL 3.3 specification explains
> * the error conditions for glreadPixels():
> *
> * "If the format is DEPTH_STENCIL, then values are taken from both
> * the depth buffer and the stencil buffer. If there is no depth
> * buffer or if there is no stencil buffer, then the error
> * INVALID_OPERATION occurs. If the type parameter is not
> * UNSIGNED_INT_24_8 or FLOAT_32_UNSIGNED_INT_24_8_REV, then the
> * error INVALID_ENUM occurs."
> *
> * OpenGL ES still generates GL_INVALID_OPERATION because glReadPixels
> * cannot be used to read depth or stencil in that API.
> */
>if (_mesa_is_desktop_gl(ctx) && format == GL_DEPTH_STENCIL
>&& type != GL_UNSIGNED_INT_24_8
>&& type != GL_FLOAT_32_UNSIGNED_INT_24_8_REV)
>   return GL_INVALID_ENUM;
>
>>return GL_INVALID_OPERATION;
>>
>> case GL_UNSIGNED_SHORT_4_4_4_4:
>> @@ -1280,6 +1283,9 @@ _mesa_error_check_format_and_type(const struct 
>> gl_context *ctx,
>>ctx->API == API_OPENGLES2) {
>>   break; /* OK by GL_EXT_texture_type_2_10_10_10_REV */
>>}
>> +  if (format == GL_DEPTH_STENCIL && _mesa_is_desktop_gl(ctx)) {
>> + return GL_INVALID_ENUM;
>> +  }
>>return GL_INVALID_OPERATION;
>>
>> case GL_UNSIGNED_INT_24_8:
>> @@ -1298,7 +1304,8 @@ _mesa_error_check_format_and_type(const struct 
>> gl_context *ctx,
>>return GL_NO_ERROR;
>>
>> case GL_UNSIGNED_INT_10F_11F_11F_REV:
>> -  if (!ctx->Extensions.EXT_packed_float) {
>> +  if (!ctx->Extensions.EXT_packed_float ||
>> +  (format == GL_DEPTH_STENCIL && _mesa_is_desktop_gl(ctx))) {
>>   return GL_INVALID_ENUM;
>>}
>>if (format != GL_RGB) {
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/8] i965: Simplify intel_miptree_updownsample.

2014-02-18 Thread Eric Anholt
Kenneth Graunke  writes:

> On 02/14/2014 03:00 PM, Eric Anholt wrote:
>> Pretty silly to pass in values dereferenced out of one of the arguments.
>> ---
>>  src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 35 
>> +--
>>  1 file changed, 11 insertions(+), 24 deletions(-)
>> 
>> diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c 
>> b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> index 08b8475..86a3887 100644
>> --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
>> @@ -1619,32 +1619,25 @@ intel_offset_S8(uint32_t stride, uint32_t x, 
>> uint32_t y, bool swizzled)
>>  static void
>>  intel_miptree_updownsample(struct brw_context *brw,
>> struct intel_mipmap_tree *src,
>> -   struct intel_mipmap_tree *dst,
>> -   unsigned width,
>> -   unsigned height)
>> +   struct intel_mipmap_tree *dst)
>>  {
>> -   int src_x0 = 0;
>> -   int src_y0 = 0;
>> -   int dst_x0 = 0;
>> -   int dst_y0 = 0;
>> -
>
> It would be great to add a comment here stating that the use of src's
> logical dimensions in both cases is intentional.  Otherwise, it looks
> like a cut and paste bug to the casual observer.

I just switched to using the dst mt for destination size.  No sense
being weird-looking just because the callers happen to always have src
== dst size.


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


Re: [Mesa-dev] [PATCH 6/8] i965: Drop some duplicated code in DRI winsys BO updates.

2014-02-18 Thread Eric Anholt
Kenneth Graunke  writes:

> On 02/14/2014 03:00 PM, Eric Anholt wrote:
> [snip]
>> @@ -666,78 +667,6 @@ intel_miptree_create_for_bo(struct brw_context *brw,
>> return mt;
>>  }
>>  
>> -
>> -/**
>> - * For a singlesample DRI2 buffer, this simply wraps the given region with 
>> a miptree.
>> - *
>> - * For a multisample DRI2 buffer, this wraps the given region with
>> - * a singlesample miptree, then creates a multisample miptree into which the
>> - * singlesample miptree is embedded as a child.
>> - */
>> -struct intel_mipmap_tree*
>> -intel_miptree_create_for_dri2_buffer(struct brw_context *brw,
>> - unsigned dri_attachment,
>> - mesa_format format,
>> - uint32_t num_samples,
>> - struct intel_region *region)
>> -{
>> -   struct intel_mipmap_tree *singlesample_mt = NULL;
>> -   struct intel_mipmap_tree *multisample_mt = NULL;
>> -
>> -   /* Only the front and back buffers, which are color buffers, are shared
>> -* through DRI2.
>> -*/
>> -   assert(dri_attachment == __DRI_BUFFER_BACK_LEFT ||
>> -  dri_attachment == __DRI_BUFFER_FRONT_LEFT ||
>> -  dri_attachment == __DRI_BUFFER_FAKE_FRONT_LEFT);
>> -   assert(_mesa_get_format_base_format(format) == GL_RGB ||
>> -  _mesa_get_format_base_format(format) == GL_RGBA);
>> -
>> -   singlesample_mt = intel_miptree_create_for_bo(brw,
>> - region->bo,
>> - format,
>> - 0,
>> - region->width,
>> - region->height,
>> - region->pitch,
>> - region->tiling);
>> -   if (!singlesample_mt)
>> -  return NULL;
>> -   singlesample_mt->region->name = region->name;
>
> The singlesample_mt->region->name = region->name line is missing from
> the new code.  I doubt it actually matters, but figured I'd point it out
> in case it wasn't intentional.

It wasn't intentional, and it would have broken the optimization in
intel_process_dri2_buffer().  Thanks!


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


[Mesa-dev] [Bug 75165] New: compute.c:464:49: error: function definition is not allowed here

2014-02-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75165

  Priority: medium
Bug ID: 75165
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: compute.c:464:49: error: function definition is not
allowed here
  Severity: blocker
Classification: Unclassified
OS: All
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: unspecified
 Component: Other
   Product: Mesa

mesa: 20d14ef2633215c5d24741de76b5d59aa3dcbc22 (master)

Build error with clang when enabling gallium tests.

  CC   compute.o
compute.c:464:49: error: function definition is not allowed here
void init(void *p, int s, int x, int y) {
^
compute.c:496:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 0, expect, NULL);
  ^
compute.c:522:50: error: function definition is not allowed here
void init0(void *p, int s, int x, int y) {
 ^
compute.c:538:26: error: use of undeclared identifier 'init1'; did you mean
  'init0'?
 60, 12, init1);
 ^
 init0
compute.c:522:14: note: 'init0' declared here
void init0(void *p, int s, int x, int y) {
 ^
compute.c:541:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 1, expect, NULL);
  ^
compute.c:588:49: error: function definition is not allowed here
void init(void *p, int s, int x, int y) {
^
compute.c:602:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 0, expect, NULL);
  ^
compute.c:624:49: error: function definition is not allowed here
void init(void *p, int s, int x, int y) {
^
compute.c:641:39: error: use of undeclared identifier 'input'
 (uint32_t *[]){ &input[1], &input[3],
  ^
compute.c:641:50: error: use of undeclared identifier 'input'
 (uint32_t *[]){ &input[1], &input[3],
 ^
compute.c:642:39: error: use of undeclared identifier 'input'
 &input[5], &input[7] });
  ^
compute.c:642:50: error: use of undeclared identifier 'input'
 &input[5], &input[7] });
 ^
compute.c:643:69: error: use of undeclared identifier 'input'
launch_grid(ctx, (uint []){4, 1, 1}, (uint []){1, 1, 1}, 0, input);
^
compute.c:644:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 0, expect, NULL);
  ^
compute.c:645:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 1, expect, NULL);
  ^
compute.c:646:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 2, expect, NULL);
  ^
compute.c:647:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 3, expect, NULL);
  ^
compute.c:694:49: error: function definition is not allowed here
void init(void *p, int s, int x, int y) {
^
compute.c:708:27: error: use of undeclared identifier 'expect'
check_tex(ctx, 0, expect, NULL);
  ^

-- 
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 3/3] glsl: Silence "type qualifiers ignored on function return type" warning

2014-02-18 Thread Ian Romanick
From: Ian Romanick 

The const in

   const unsigned foo(void);

is meaningless.  Removing it silences this warning:

src/glsl/ast_to_hir.cpp:1802:56: warning: type qualifiers ignored on function 
return type [-Wignored-qualifiers]

Signed-off-by: Ian Romanick 
---
 src/glsl/ast_to_hir.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 6549ca7..e731d83 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1797,7 +1797,7 @@ ast_compound_statement::hir(exec_list *instructions,
  * Evaluate the given exec_node (which should be an ast_node representing
  * a single array dimension) and return its integer value.
  */
-static const unsigned
+static unsigned
 process_array_size(exec_node *node,
struct _mesa_glsl_parse_state *state)
 {
-- 
1.8.1.4

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


[Mesa-dev] [PATCH 1/3] glcpp: Only warn for macro names containing __

2014-02-18 Thread Ian Romanick
From: Ian Romanick 

Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and the
GLSL ES spec (all versions) say:

"All macro names containing two consecutive underscores ( __ ) are
reserved for future use as predefined macro names. All macro names
prefixed with "GL_" ("GL" followed by a single underscore) are also
reserved."

The intention is that names containing __ are reserved for internal use
by the implementation, and names prefixed with GL_ are reserved for use
by Khronos.  Since every extension adds a name prefixed with GL_ (i.e.,
the name of the extension), that should be an error.  Names simply
containing __ are dangerous to use, but should be allowed.  In similar
cases, the C++ preprocessor specification says, "no diagnostic is
required."

Per the Khronos bug mentioned below, a future version of the GLSL
specification will clarify this.

Signed-off-by: Ian Romanick 
Cc: "9.2 10.0 10.1" 
Cc: Tapani Pälli 
Cc: Kenneth Graunke 
Cc: Darius Spitznagel 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
Bugzilla: Khronos #11702
---
 src/glsl/glcpp/glcpp-parse.y   | 22 +++---
 .../tests/086-reserved-macro-names.c.expected  |  4 ++--
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 5bb2891..bdc598f 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -1770,11 +1770,27 @@ static void
 _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc,
const char *identifier)
 {
-   /* According to the GLSL specification, macro names starting with "__"
-* or "GL_" are reserved for future use.  So, don't allow them.
+   /* Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and
+* the GLSL ES spec (all versions) say:
+*
+* "All macro names containing two consecutive underscores ( __ )
+* are reserved for future use as predefined macro names. All
+* macro names prefixed with "GL_" ("GL" followed by a single
+* underscore) are also reserved."
+*
+* The intention is that names containing __ are reserved for internal
+* use by the implementation, and names prefixed with GL_ are reserved
+* for use by Khronos.  Since every extension adds a name prefixed
+* with GL_ (i.e., the name of the extension), that should be an
+* error.  Names simply containing __ are dangerous to use, but should
+* be allowed.
+*
+* A future version of the GLSL specification will clarify this.
 */
if (strstr(identifier, "__")) {
-   glcpp_error (loc, parser, "Macro names containing \"__\" are 
reserved.\n");
+   glcpp_warning(loc, parser,
+ "Macro names containing \"__\" are reserved "
+ "for use by the implementation.\n");
}
if (strncmp(identifier, "GL_", 3) == 0) {
glcpp_error (loc, parser, "Macro names starting with \"GL_\" 
are reserved.\n");
diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected 
b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
index d8aa9f0..5ca42a9 100644
--- a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
+++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
@@ -1,8 +1,8 @@
-0:1(10): preprocessor error: Macro names containing "__" are reserved.
+0:1(10): preprocessor warning: Macro names containing "__" are reserved for 
use by the implementation.
 
 0:2(9): preprocessor error: Macro names starting with "GL_" are reserved.
 
-0:3(9): preprocessor error: Macro names containing "__" are reserved.
+0:3(9): preprocessor warning: Macro names containing "__" are reserved for use 
by the implementation.
 
 
 
-- 
1.8.1.4

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


[Mesa-dev] [PATCH 2/3] glsl: Only warn for macro names containing __

2014-02-18 Thread Ian Romanick
From: Ian Romanick 

From page 14 (page 20 of the PDF) of the GLSL 1.10 spec:

"In addition, all identifiers containing two consecutive underscores
 (__) are reserved as possible future keywords."

The intention is that names containing __ are reserved for internal use
by the implementation, and names prefixed with GL_ are reserved for use
by Khronos.  Names simply containing __ are dangerous to use, but should
be allowed.

Per the Khronos bug mentioned below, a future version of the GLSL
specification will clarify this.

Signed-off-by: Ian Romanick 
Cc: "9.2 10.0 10.1" 
Cc: Tapani Pälli 
Cc: Kenneth Graunke 
Cc: Darius Spitznagel 
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
Bugzilla: Khronos #11702
---
 src/glsl/ast_to_hir.cpp | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 6de73f4..6549ca7 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2928,10 +2928,17 @@ validate_identifier(const char *identifier, YYLTYPE loc,
* "In addition, all identifiers containing two
*  consecutive underscores (__) are reserved as
*  possible future keywords."
+   *
+   * The intention is that names containing __ are reserved for internal
+   * use by the implementation, and names prefixed with GL_ are reserved
+   * for use by Khronos.  Names simply containing __ are dangerous to use,
+   * but should be allowed.
+   *
+   * A future version of the GLSL specification will clarify this.
*/
-  _mesa_glsl_error(&loc, state,
-   "identifier `%s' uses reserved `__' string",
-   identifier);
+  _mesa_glsl_warning(&loc, state,
+ "identifier `%s' uses reserved `__' string",
+ identifier);
}
 }
 
-- 
1.8.1.4

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


Re: [Mesa-dev] [PATCH] glsl: Fix condition to generate shader link error

2014-02-18 Thread Ian Romanick
On 12/19/2013 03:12 PM, Anuj Phogat wrote:
> GL_ARB_ES2_compatibility don't say anything about shader linking
> when one of the shaders (vertex or fragment shader) is absent.
> So, the extention shouldn't change the behavior specified in
> GLSL specification.

If you add the above text to the comment in the code,

Reviewed-by: Ian Romanick 

Otherwise, someone will eventually come along and "fix" the code back to
its original form. :)

> Tested the behavior on proprietary linux drivers of NVIDIA and AMD.
> Both of them allow linking a version 100 shader program in OpenGL
> context, when one of the shaders is absent.
> 
> Makes following Khronos CTS tests to pass:
> successfulcompilevert_linkprogram.test
> successfulcompilefrag_linkprogram.test
> 
> Cc: mesa-sta...@lists.freedesktop.org
> Signed-off-by: Anuj Phogat 
> ---
>  src/glsl/linker.cpp | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index a6133ea..f84d364 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -2382,11 +2382,9 @@ link_shaders(struct gl_context *ctx, struct 
> gl_shader_program *prog)
>goto done;
>  
> /* OpenGL ES requires that a vertex shader and a fragment shader both be
> -* present in a linked program.  By checking prog->IsES, we also
> -* catch the GL_ARB_ES2_compatibility case.
> +* present in a linked program.
>  */
> -   if (!prog->InternalSeparateShader &&
> -   (ctx->API == API_OPENGLES2 || prog->IsES)) {
> +   if (!prog->InternalSeparateShader && ctx->API == API_OPENGLES2) {
>if (prog->_LinkedShaders[MESA_SHADER_VERTEX] == NULL) {
>linker_error(prog, "program lacks a vertex shader\n");
>} else if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] == NULL) {

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


Re: [Mesa-dev] [PATCH] mesa: Fix valgrind uninitialized variable warning

2014-02-18 Thread Ian Romanick
On 02/17/2014 04:21 PM, Courtney Goeltzenleuchter wrote:
> I've updated the patch to set the flipped flag as well.
> 
> I verified that all the flags were being set. As for the data in the
> rest of the structure that is filled in from the compressed data using
> whatever technique was coded in the compressed data. I don't think it's
> necessary to zero out the full structure, just the flags.

Okay.  The updated patch is

Reviewed-by: Ian Romanick 

> Courtney
> 
> 
> On Fri, Feb 14, 2014 at 1:51 PM, Ian Romanick  > wrote:
> 
> On 02/14/2014 08:05 AM, Courtney Goeltzenleuchter wrote:
> > Initialize field to eliminate valgrind warning.
> 
> There are a couple other fields that aren't set it all paths (e.g.,
> flipped).  I want to suggest just memseting the whole structure, but
> it's not obvious to me how it's used throughout the code.
> 
> I suspect the code was more clear before ETC2 support was added...
> 
> > Signed-off-by: Courtney Goeltzenleuchter 
> > ---
> >  src/mesa/main/texcompress_etc.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/src/mesa/main/texcompress_etc.c
> b/src/mesa/main/texcompress_etc.c
> > index f9234b0..97adc86 100644
> > --- a/src/mesa/main/texcompress_etc.c
> > +++ b/src/mesa/main/texcompress_etc.c
> > @@ -350,6 +350,7 @@ etc2_rgb8_parse_block(struct etc2_block *block,
> > block->is_t_mode = false;
> > block->is_h_mode = false;
> > block->is_planar_mode = false;
> > +   block->opaque = false;
> >
> > if (punchthrough_alpha)
> >block->opaque = src[3] & 0x2;
> >
> 
> 
> 
> 
> -- 
> Courtney Goeltzenleuchter
> LunarG
> 

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


Re: [Mesa-dev] [PATCH 1/3] glsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord

2014-02-18 Thread Ian Romanick
On 02/10/2014 05:29 PM, Anuj Phogat wrote:
> GLSL 1.50 spec says:
>"If gl_FragCoord is redeclared in any fragment shader in a program,
> it must be redeclared in all the fragment shaders in that
> program that have a static use gl_FragCoord. All redeclarations of
> gl_FragCoord in all fragment shaders in a single program must
> have the same set of qualifiers."
> 
> This patch makes the glsl compiler to generate an error if we have a
> fragment shader defined with conflicting layout qualifier declarations
> for gl_FragCoord. For example:
> 
> layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> layout(pixel_center_integer) in vec4 gl_FragCoord;
> void main()
> {
>gl_FragColor = gl_FragCoord.xyzz;
> }
> 
> Cc: 
> Signed-off-by: Anuj Phogat 
> ---
>  src/glsl/ast_to_hir.cpp | 39 +++
>  src/glsl/glsl_parser_extras.cpp |  3 +++
>  src/glsl/glsl_parser_extras.h   | 10 ++
>  3 files changed, 52 insertions(+)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index c89a26b..7d7d89b 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -2374,6 +2374,45 @@ apply_type_qualifier_to_variable(const struct 
> ast_type_qualifier *qual,
>  qual_string);
> }
>  
> +   /* Make sure all gl_FragCoord redeclarations specify the same layout
> +* qualifier type.
> +*/
> +   bool conflicting_pixel_center_integer =
> +  state->fs_pixel_center_integer &&
> +  !qual->flags.q.pixel_center_integer;
> +
> +   bool conflicting_origin_upper_left =
> +  state->fs_origin_upper_left &&
> +  !qual->flags.q.origin_upper_left;

I don't think this catches all the cases.  What about

layout(origin_upper_left  ) in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

> +
> +   if (conflicting_pixel_center_integer || conflicting_origin_upper_left) {
> +  const char *const qual_string =
> + (conflicting_pixel_center_integer && conflicting_origin_upper_left) 
> ?
> + "pixel_center_integer, origin_upper_left" :
> + (conflicting_pixel_center_integer ?
> + "origin_upper_left" : "pixel_center_integer");
> +
> +  const char *const state_string =
> + (state->fs_pixel_center_integer &&
> +  state->fs_origin_upper_left) ?
> + "pixel_center_integer, origin_upper_left" :
> + (state->fs_origin_upper_left ?
> + "origin_upper_left" : "pixel_center_integer");
> +
> +  _mesa_glsl_error(loc, state,
> +   "different layout qualifiers were specified with "
> +   "`gl_FragCoord' (%s) and (%s) "
> +   "redeclare fragment shader input `gl_FragCoord'",
> +   state_string,
> +   qual_string);
> +   }
> +
> +   if (qual->flags.q.pixel_center_integer)
> +  state->fs_pixel_center_integer = true;
> +
> +   if (qual->flags.q.origin_upper_left)
> +  state->fs_origin_upper_left = true;
> +
> if (qual->flags.q.explicit_location) {
>validate_explicit_location(qual, var, state, loc);
> } else if (qual->flags.q.explicit_index) {
> diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
> index b822d22..b06337e 100644
> --- a/src/glsl/glsl_parser_extras.cpp
> +++ b/src/glsl/glsl_parser_extras.cpp
> @@ -193,6 +193,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
> gl_context *_ctx,
> this->default_uniform_qualifier->flags.q.shared = 1;
> this->default_uniform_qualifier->flags.q.column_major = 1;
>  
> +   this->fs_origin_upper_left = false;
> +   this->fs_pixel_center_integer = false;
> +
> this->gs_input_prim_type_specified = false;
> this->gs_input_prim_type = GL_POINTS;
> this->gs_input_size = 0;
> diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
> index 7d66147..674dae5 100644
> --- a/src/glsl/glsl_parser_extras.h
> +++ b/src/glsl/glsl_parser_extras.h
> @@ -182,6 +182,16 @@ struct _mesa_glsl_parse_state {
> struct ast_type_qualifier *default_uniform_qualifier;
>  
> /**
> +* True if a fragment shader has an input layout for redeclaring the
> +* built-in variable gl_FragCoord.
> +*
> +* Note: this value is computed at ast_to_hir time rather than at parse
> +* time.
> +*/
> +   bool fs_origin_upper_left;
> +   bool fs_pixel_center_integer;
> +
> +   /**
>  * True if a geometry shader input primitive type was specified using a
>  * layout directive.
>  *
> 

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


Re: [Mesa-dev] [PATCH 3/3] i965: Bump MaxTexMbytes from 1GB to 1.5GB.

2014-02-18 Thread Jordan Justen
Series
Reviewed-by: Jordan Justen 

On Sun, Feb 2, 2014 at 3:16 AM, Kenneth Graunke  wrote:
> Even with the other limits raised, TestProxyTexImage would still reject
> textures > 1GB in size.  This is an artificial limit; nothing prevents
> us from having a larger texture.  I stayed shy of 2GB to avoid the
> larger-than-aperture situation.
>
> For 3D textures, this raises the effective limit:
>  - RGBA8:   645 -> 738
>  - RGBA16:  512 -> 586
>  - RGBA32F: 406 -> 465
>
> Cc: i...@freedesktop.org
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74130
> Signed-off-by: Kenneth Graunke 
> ---
>  src/mesa/drivers/dri/i965/brw_context.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index 17b75e1..66d6ccb 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -306,6 +306,7 @@ brw_initialize_context_constants(struct brw_context *brw)
>ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
> ctx->Const.Max3DTextureLevels = 12; /* 2048 */
> ctx->Const.MaxCubeTextureLevels = 14; /* 8192 */
> +   ctx->Const.MaxTextureMbytes = 1536;
>
> if (brw->gen >= 7)
>ctx->Const.MaxArrayTextureLayers = 2048;
> --
> 1.8.5.2
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] i965/fs: Add an optimization pass to remove rendant flags movs.

2014-02-18 Thread Matt Turner
On Fri, Feb 14, 2014 at 4:48 PM, Eric Anholt  wrote:
> We generate steaming piles of these for the centroid workaround, and this
> quickly cleans them up.
>
> total instructions in shared programs: 1591228 -> 1590047 (-0.07%)
> instructions in affected programs: 26111 -> 24930 (-4.52%)

Nice. I'd just added this to my todo list the other day.

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


Re: [Mesa-dev] [PATCH] clover: Pass buffer offsets to the driver in set_global_binding()

2014-02-18 Thread Tom Stellard
On Sat, Feb 15, 2014 at 12:22:45PM +0100, Francisco Jerez wrote:
> Tom Stellard  writes:
> 
> > From: Tom Stellard 
> >
> > The offsets will be stored in the handles parameter.  This makes
> > it possible to use sub-buffers.
> > ---
> >  src/gallium/drivers/r600/evergreen_compute.c  |  2 +-
> >  src/gallium/drivers/radeonsi/si_compute.c |  1 +
> >  src/gallium/include/pipe/p_context.h  |  9 ++---
> >  src/gallium/state_trackers/clover/core/kernel.cpp | 11 +--
> >  4 files changed, 17 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
> > b/src/gallium/drivers/r600/evergreen_compute.c
> > index 70efe5c..ee00a24 100644
> > --- a/src/gallium/drivers/r600/evergreen_compute.c
> > +++ b/src/gallium/drivers/r600/evergreen_compute.c
> > @@ -665,7 +665,7 @@ static void evergreen_set_global_binding(
> > assert(resources[i]->target == PIPE_BUFFER);
> > assert(resources[i]->bind & PIPE_BIND_GLOBAL);
> >  
> > -   *(handles[i]) = buffers[i]->chunk->start_in_dw * 4;
> > +   *(handles[i]) += buffers[i]->chunk->start_in_dw * 4;
> > }
> >  
> > evergreen_set_rat(ctx->cs_shader_state.shader, 0, pool->bo, 0, 
> > pool->size_in_dw * 4);
> > diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
> > b/src/gallium/drivers/radeonsi/si_compute.c
> > index a7f49e7..e0e6bb4 100644
> > --- a/src/gallium/drivers/radeonsi/si_compute.c
> > +++ b/src/gallium/drivers/radeonsi/si_compute.c
> > @@ -109,6 +109,7 @@ static void si_set_global_binding(
> > uint64_t va;
> > program->global_buffers[i] = resources[i];
> > va = r600_resource_va(ctx->screen, resources[i]);
> > +   va += *handles[i];
> > memcpy(handles[i], &va, sizeof(va));
> > }
> >  }
> > diff --git a/src/gallium/include/pipe/p_context.h 
> > b/src/gallium/include/pipe/p_context.h
> > index 8ef6e27..eef0a63 100644
> > --- a/src/gallium/include/pipe/p_context.h
> > +++ b/src/gallium/include/pipe/p_context.h
> > @@ -461,9 +461,12 @@ struct pipe_context {
> >  *   resources will be bound.
> >  * \param handlesarray of pointers to the memory locations that
> >  *   will be filled with the respective base
> > -*   addresses each buffer will be mapped to.  It
> > -*   should contain at least \a count elements,
> > -*   unless \a resources is NULL in which case \a
> > +*   addresses each buffer will be mapped to.  When
> > +*   this function is called, the value at these memory
> > +*   locations will be the offset in bytes from
> > +*   the start of the buffer that should be used to
> > +*   compute the handle.  It should contain at least \a 
> > count
> > +*   elements, unless \a resources is NULL in which 
> > case \a
> >  *   handles should be NULL as well.
> >  *
> 
> Maybe something like this would be easier to understand?
> 
> |* \param handlesarray of pointers to the memory locations that
> |*   will be updated with the address each buffer
> |*   will be mapped to.  The base memory address of
> |*   each of the buffers will be added to the value
> |*   pointed to by its corresponding handle to form
> |*   the final address argument.  It should contain
> |*   at least \a count elements, unless \a
> |*   resources is NULL in which case \a handles
> |*   should be NULL as well.
> 
> >  * Note that the driver isn't required to make any guarantees about
> > diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp 
> > b/src/gallium/state_trackers/clover/core/kernel.cpp
> > index 6d894cd..06eff85 100644
> > --- a/src/gallium/state_trackers/clover/core/kernel.cpp
> > +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
> > @@ -337,8 +337,15 @@ kernel::global_argument::bind(exec_context &ctx,
> > align(ctx.input, marg.target_align);
> >  
> > if (buf) {
> > -  ctx.g_handles.push_back(allocate(ctx.input, marg.target_size));
> > -  ctx.g_buffers.push_back(buf->resource(*ctx.q).pipe);
> > +  resource &r = buf->resource(*ctx.q);
> 
> This could be 'const resource &'.
> 
> > +  ctx.g_handles.push_back(ctx.input.size());
> > +  ctx.g_buffers.push_back(r.pipe);
> > +
> > +  // XXX: How to handle multi-demensional offsets?
> 
> They're not an issue, you can safely assume that the offset is
> one-dimensional because CL doesn't support sub-images, only sub-buffers.
> 
> > +  assert(!r.offset[1] && !r.offset[2]);
> > +  std::vector offset = bytes(r.offset[0]);
> 
> 'auto v' for consistency?
> 
> > +  extend(offset, marg.ext_type, marg.target_s

Re: [Mesa-dev] [PATCH] i965: Avoid dependency hints on math opcodes

2014-02-18 Thread Eric Anholt
m...@lunarg.com writes:

> From: Mike Stroyan 
>
>   Putting NoDDClr and NoDDChk dependency control on instruction
> sequences that include math opcodes can cause corruption of channels.
> Treat math opcodes like send opcodes and suppress dependency hinting.
>
> Signed-off-by: Mike Stroyan 
> Tested-by: Tony Bertapelli 

I think we need a testcase for this and some sort of explanation of
what's going on.  Why is math special?


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


Re: [Mesa-dev] [PATCH 6/8] i965: Implement HiZ resolves on Broadwell.

2014-02-18 Thread Eric Anholt
Kenneth Graunke  writes:

> Broadwell's 3DSTATE_WM_HZ_OP packet makes this much easier.
>
> Instead of programming the whole pipeline, we simply have to emit the
> depth/stencil packets, a state override, and a pipe control.  Then
> arrange for the state to be put back.  This is easily done from a single
> function.
>
> Signed-off-by: Kenneth Graunke 
> ---
>  src/mesa/drivers/dri/i965/brw_blorp.cpp  |   8 +-
>  src/mesa/drivers/dri/i965/brw_context.h  |   4 +
>  src/mesa/drivers/dri/i965/gen8_depth_state.c | 105 
> +++
>  3 files changed, 115 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp 
> b/src/mesa/drivers/dri/i965/brw_blorp.cpp
> index 76537c8..4a5001d 100644
> --- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
> @@ -195,8 +195,12 @@ intel_hiz_exec(struct brw_context *brw, struct 
> intel_mipmap_tree *mt,
> DBG("%s %s to mt %p level %d layer %d\n",
> __FUNCTION__, opname, mt, level, layer);
>  
> -   brw_hiz_op_params params(mt, level, layer, op);
> -   brw_blorp_exec(brw, ¶ms);
> +   if (brw->gen >= 8) {
> +  gen8_hiz_exec(brw, mt, level, layer, op);
> +   } else {
> +  brw_hiz_op_params params(mt, level, layer, op);
> +  brw_blorp_exec(brw, ¶ms);
> +   }
>  }
>  
>  } /* extern "C" */
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
> b/src/mesa/drivers/dri/i965/brw_context.h
> index cf0fe98..c107683 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -61,6 +61,7 @@ extern "C" {
>  #include "intel_debug.h"
>  #include "intel_screen.h"
>  #include "intel_tex_obj.h"
> +#include "intel_resolve_map.h"
>  
>  /* Glossary:
>   *
> @@ -1891,6 +1892,9 @@ gen8_emit_depth_stencil_hiz(struct brw_context *brw,
>  uint32_t width, uint32_t height,
>  uint32_t tile_x, uint32_t tile_y);
>  
> +void gen8_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
> +   unsigned int level, unsigned int layer, enum gen6_hiz_op 
> op);
> +
>  extern const GLuint prim_to_hw_prim[GL_TRIANGLE_STRIP_ADJACENCY+1];
>  
>  void
> diff --git a/src/mesa/drivers/dri/i965/gen8_depth_state.c 
> b/src/mesa/drivers/dri/i965/gen8_depth_state.c
> index f30ff28..3fa20c8 100644
> --- a/src/mesa/drivers/dri/i965/gen8_depth_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_depth_state.c
> @@ -203,3 +203,108 @@ gen8_emit_depth_stencil_hiz(struct brw_context *brw,
>brw->depthstencil.stencil_offset,
>hiz, width, height, depth, lod, min_array_element);
>  }
> +
> +/**
> + * Emit packets to perform a depth/HiZ resolve or fast depth/stencil clear.
> + *
> + * See the "Optimized Depth Buffer Clear and/or Stencil Buffer Clear" section
> + * of the hardware documentation for details.
> + */
> +void
> +gen8_hiz_exec(struct brw_context *brw, struct intel_mipmap_tree *mt,
> +  unsigned int level, unsigned int layer, enum gen6_hiz_op op)
> +{
> +   if (op == GEN6_HIZ_OP_NONE)
> +  return;
> +
> +   assert(mt->first_level == 0);
> +
> +   struct intel_mipmap_level *miplevel = &mt->level[level];
> +
> +   /* The basic algorithm is:
> +* - If needed, emit 3DSTATE_{DEPTH,HIER_DEPTH,STENCIL}_BUFFER and
> +*   3DSTATE_CLEAR_PARAMS packets to set up the relevant buffers.
> +* - If needed, emit 3DSTATE_DRAWING_RECTANGLE.
> +* - Emit 3DSTATE_WM_HZ_OP with a bit set for the particular operation.
> +* - Do a special PIPE_CONTROL to trigger an implicit rectangle primitive.
> +* - Emit 3DSTATE_WM_HZ_OP with no bits set to return to normal rendering.
> +*/
> +   emit_depth_packets(brw, mt,
> +  brw_depth_format(brw, mt->format),
> +  BRW_SURFACE_2D,
> +  true, /* depth writes */
> +  NULL, false, 0, /* no stencil for now */
> +  true, /* hiz */
> +  mt->logical_width0,
> +  mt->logical_height0,
> +  MAX2(mt->logical_depth0, 1),

Is logical_depth0 ever 0?  That seems like a bug.

> +  level,
> +  layer); /* min_array_element */
> +
> +   BEGIN_BATCH(4);
> +   OUT_BATCH(_3DSTATE_DRAWING_RECTANGLE << 16 | (4 - 2));
> +   OUT_BATCH(0);
> +   OUT_BATCH(((mt->logical_width0 - 1) & 0x) |
> + ((mt->logical_height0 - 1) << 16));
> +   OUT_BATCH(0);
> +   ADVANCE_BATCH();

The drawing rectangle should be using the level's size, not the level 0
size.

> +   uint32_t sample_mask = 0x;
> +   if (mt->num_samples > 0) {
> +  dw1 |= SET_FIELD(ffs(mt->num_samples) - 1, GEN8_WM_HZ_NUM_SAMPLES);
> +  sample_mask = gen6_determine_sample_mask(brw);
> +   }

I don't think we want the user-set sample mask stuff to change the
samples affected by our hiz/depth resolves.  I think you can just drop
the if b

Re: [Mesa-dev] [PATCH] clover: Pass buffer offsets to the driver in set_global_binding()

2014-02-18 Thread Francisco Jerez
Tom Stellard  writes:

> On Sat, Feb 15, 2014 at 12:22:45PM +0100, Francisco Jerez wrote:
>> Tom Stellard  writes:
>> 
>> > From: Tom Stellard 
>> >
>> > The offsets will be stored in the handles parameter.  This makes
>> > it possible to use sub-buffers.
>> > ---
>> >  src/gallium/drivers/r600/evergreen_compute.c  |  2 +-
>> >  src/gallium/drivers/radeonsi/si_compute.c |  1 +
>> >  src/gallium/include/pipe/p_context.h  |  9 ++---
>> >  src/gallium/state_trackers/clover/core/kernel.cpp | 11 +--
>> >  4 files changed, 17 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/src/gallium/drivers/r600/evergreen_compute.c 
>> > b/src/gallium/drivers/r600/evergreen_compute.c
>> > index 70efe5c..ee00a24 100644
>> > --- a/src/gallium/drivers/r600/evergreen_compute.c
>> > +++ b/src/gallium/drivers/r600/evergreen_compute.c
>> > @@ -665,7 +665,7 @@ static void evergreen_set_global_binding(
>> >assert(resources[i]->target == PIPE_BUFFER);
>> >assert(resources[i]->bind & PIPE_BIND_GLOBAL);
>> >  
>> > -  *(handles[i]) = buffers[i]->chunk->start_in_dw * 4;
>> > +  *(handles[i]) += buffers[i]->chunk->start_in_dw * 4;
>> >}
>> >  
>> >evergreen_set_rat(ctx->cs_shader_state.shader, 0, pool->bo, 0, 
>> > pool->size_in_dw * 4);
>> > diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
>> > b/src/gallium/drivers/radeonsi/si_compute.c
>> > index a7f49e7..e0e6bb4 100644
>> > --- a/src/gallium/drivers/radeonsi/si_compute.c
>> > +++ b/src/gallium/drivers/radeonsi/si_compute.c
>> > @@ -109,6 +109,7 @@ static void si_set_global_binding(
>> >uint64_t va;
>> >program->global_buffers[i] = resources[i];
>> >va = r600_resource_va(ctx->screen, resources[i]);
>> > +  va += *handles[i];
>> >memcpy(handles[i], &va, sizeof(va));
>> >}
>> >  }
>> > diff --git a/src/gallium/include/pipe/p_context.h 
>> > b/src/gallium/include/pipe/p_context.h
>> > index 8ef6e27..eef0a63 100644
>> > --- a/src/gallium/include/pipe/p_context.h
>> > +++ b/src/gallium/include/pipe/p_context.h
>> > @@ -461,9 +461,12 @@ struct pipe_context {
>> >  *   resources will be bound.
>> >  * \param handlesarray of pointers to the memory locations that
>> >  *   will be filled with the respective base
>> > -*   addresses each buffer will be mapped to.  It
>> > -*   should contain at least \a count elements,
>> > -*   unless \a resources is NULL in which case \a
>> > +*   addresses each buffer will be mapped to.  When
>> > +*   this function is called, the value at these memory
>> > +*   locations will be the offset in bytes from
>> > +*   the start of the buffer that should be used to
>> > +*   compute the handle.  It should contain at least 
>> > \a count
>> > +*   elements, unless \a resources is NULL in which 
>> > case \a
>> >  *   handles should be NULL as well.
>> >  *
>> 
>> Maybe something like this would be easier to understand?
>> 
>> |* \param handlesarray of pointers to the memory locations that
>> |*   will be updated with the address each buffer
>> |*   will be mapped to.  The base memory address of
>> |*   each of the buffers will be added to the value
>> |*   pointed to by its corresponding handle to form
>> |*   the final address argument.  It should contain
>> |*   at least \a count elements, unless \a
>> |*   resources is NULL in which case \a handles
>> |*   should be NULL as well.
>> 
>> >  * Note that the driver isn't required to make any guarantees about
>> > diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp 
>> > b/src/gallium/state_trackers/clover/core/kernel.cpp
>> > index 6d894cd..06eff85 100644
>> > --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>> > +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>> > @@ -337,8 +337,15 @@ kernel::global_argument::bind(exec_context &ctx,
>> > align(ctx.input, marg.target_align);
>> >  
>> > if (buf) {
>> > -  ctx.g_handles.push_back(allocate(ctx.input, marg.target_size));
>> > -  ctx.g_buffers.push_back(buf->resource(*ctx.q).pipe);
>> > +  resource &r = buf->resource(*ctx.q);
>> 
>> This could be 'const resource &'.
>> 
>> > +  ctx.g_handles.push_back(ctx.input.size());
>> > +  ctx.g_buffers.push_back(r.pipe);
>> > +
>> > +  // XXX: How to handle multi-demensional offsets?
>> 
>> They're not an issue, you can safely assume that the offset is
>> one-dimensional because CL doesn't support sub-images, only sub-buffers.
>> 
>> > +  assert(!r.offset[1] && !r.offset[2]);
>> > +  std::vector of

Re: [Mesa-dev] [PATCH] glx: Fix the default values for GLXFBConfig attributes

2014-02-18 Thread Dave Airlie
On Tue, Feb 18, 2014 at 8:10 AM, Fredrik Höglund  wrote:
> The default values for GLX_DRAWABLE_TYPE and GLX_RENDER_TYPE are
> GLX_WINDOW_BIT and GLX_RGBA_BIT respectively, as specified in
> the GLX 1.4 specification.
>
> This fixes the glx-choosefbconfig-defaults piglit test.

Looks good to me, I can also confirm this fixes glxinfo from mesa
libGL to nvidia libGL.

Reviewed-by: Dave Airlie 

Dave.

>
> Cc: "9.2 10.0 10.1" 
> ---
>  src/glx/glxcmds.c | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
> index 38a5262..43c473b 100644
> --- a/src/glx/glxcmds.c
> +++ b/src/glx/glxcmds.c
> @@ -925,13 +925,10 @@ init_fbconfig_for_chooser(struct glx_config * config,
> if (fbconfig_style_tags) {
>config->rgbMode = GL_TRUE;
>config->doubleBufferMode = GLX_DONT_CARE;
> -  /* allow any kind of drawable, including those for off-screen buffers 
> */
> -  config->drawableType = 0;
> -   } else {
> -   /* allow configs which support on-screen drawing */
> -   config->drawableType = GLX_WINDOW_BIT;
> +  config->renderType = GLX_RGBA_BIT;
> }
>
> +   config->drawableType = GLX_WINDOW_BIT;
> config->visualRating = GLX_DONT_CARE;
> config->transparentPixel = GLX_NONE;
> config->transparentRed = GLX_DONT_CARE;
> @@ -940,8 +937,6 @@ init_fbconfig_for_chooser(struct glx_config * config,
> config->transparentAlpha = GLX_DONT_CARE;
> config->transparentIndex = GLX_DONT_CARE;
>
> -   /* Set GLX_RENDER_TYPE property to not expect any flags by default. */
> -   config->renderType = 0;
> config->xRenderable = GLX_DONT_CARE;
> config->fbconfigID = (GLXFBConfigID) (GLX_DONT_CARE);
>
> --
> 1.8.5.3
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/3] i965: Bump MAX_3D_TEXTURE_SIZE to 2048.

2014-02-18 Thread Ian Romanick
I just realized that I never actually sent my R-b after we discussed
this series.

Reviewed-by: Ian Romanick 

On 02/02/2014 03:16 AM, Kenneth Graunke wrote:
> It's highly unlikely that there will be enough memory in the system to
> allocate enough space for this, but we should still expose the hardware
> limit.  It's what the Intel Windows driver does, and it seems most other
> vendors do likewise.
> 
> Cc: i...@freedesktop.org
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74130
> Signed-off-by: Kenneth Graunke 
> ---
>  src/mesa/drivers/dri/i965/brw_context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
> b/src/mesa/drivers/dri/i965/brw_context.c
> index d9d1ae5..c54c818 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.c
> +++ b/src/mesa/drivers/dri/i965/brw_context.c
> @@ -304,7 +304,7 @@ brw_initialize_context_constants(struct brw_context *brw)
> ctx->Const.MaxTextureLevels = 14; /* 8192 */
> if (ctx->Const.MaxTextureLevels > MAX_TEXTURE_LEVELS)
>ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
> -   ctx->Const.Max3DTextureLevels = 9;
> +   ctx->Const.Max3DTextureLevels = 12; /* 2048 */
> ctx->Const.MaxCubeTextureLevels = 12;
>  
> if (brw->gen >= 7)
> 

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


Re: [Mesa-dev] [PATCH] clover: Don't call pipe_loader_release() when deleting a device

2014-02-18 Thread Bruno Jimenez
On Tue, 2014-02-18 at 17:50 +0100, Francisco Jerez wrote:
> Tom Stellard  writes:
> 
> > From: Tom Stellard 
> >
> > After pipe_loader_release() is called, if any of the pipe_* objects
> > try to call into the gallium API the application will segfault.
> >
> > The only time devices are deleted is when the global _clover_platform
> > object is deleted by the static destructor.  However,  since application
> > objects that are deleted by the static destructor *after*
> > _clover_platform might try to make a CL API calls from their destructor,
> > it is never safe to call pipe_loader_release().
> 
> Please have a look at the clover-internal-ref-counting branch [1] of my
> mesa tree, it should fix a number of memory management-related bugs,
> possibly the one you've encountered too, without the negative side
> effects of dropping the call to pipe_loader_release().
> 
> Thanks.

Hi,

I have tested your branch to see if it solved a problem I was having
with OpenCL (opencv_test_ocl throws a segfault although it passes all
the tests) and, as well as with Tom's patch, it doesn't happen any more.
So your branch fixes that bug.

Thanks!
Bruno

> 
> [1] 
> http://cgit.freedesktop.org/~currojerez/mesa/log/?h=clover-internal-ref-counting
> 
> > ---
> >  src/gallium/state_trackers/clover/core/device.cpp | 2 --
> >  1 file changed, 2 deletions(-)
> >
> > diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
> > b/src/gallium/state_trackers/clover/core/device.cpp
> > index 76a49d0..2290366 100644
> > --- a/src/gallium/state_trackers/clover/core/device.cpp
> > +++ b/src/gallium/state_trackers/clover/core/device.cpp
> > @@ -48,8 +48,6 @@ device::device(clover::platform &platform, 
> > pipe_loader_device *ldev) :
> >  device::~device() {
> > if (pipe)
> >pipe->destroy(pipe);
> > -   if (ldev)
> > -  pipe_loader_release(&ldev, 1);
> >  }
> >  
> >  bool
> > -- 
> > 1.8.1.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


Re: [Mesa-dev] [PATCH] glx: Fix the default values for GLXFBConfig attributes

2014-02-18 Thread Ian Romanick
On 02/17/2014 02:10 PM, Fredrik Höglund wrote:
> The default values for GLX_DRAWABLE_TYPE and GLX_RENDER_TYPE are
> GLX_WINDOW_BIT and GLX_RGBA_BIT respectively, as specified in
> the GLX 1.4 specification.
> 
> This fixes the glx-choosefbconfig-defaults piglit test.

I've forward this patch to the guys that wrote the code in
init_fbconfig_for_chooser that's being modified.  I'm waiting to hear
back.  It looks good to me, but I'd like a little to hear from them.

Reviewed-by: Ian Romanick 

> Cc: "9.2 10.0 10.1" 
> ---
>  src/glx/glxcmds.c | 9 ++---
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
> index 38a5262..43c473b 100644
> --- a/src/glx/glxcmds.c
> +++ b/src/glx/glxcmds.c
> @@ -925,13 +925,10 @@ init_fbconfig_for_chooser(struct glx_config * config,
> if (fbconfig_style_tags) {
>config->rgbMode = GL_TRUE;
>config->doubleBufferMode = GLX_DONT_CARE;
> -  /* allow any kind of drawable, including those for off-screen buffers 
> */
> -  config->drawableType = 0;
> -   } else {
> -   /* allow configs which support on-screen drawing */
> -   config->drawableType = GLX_WINDOW_BIT;
> +  config->renderType = GLX_RGBA_BIT;
> }
>  
> +   config->drawableType = GLX_WINDOW_BIT;
> config->visualRating = GLX_DONT_CARE;
> config->transparentPixel = GLX_NONE;
> config->transparentRed = GLX_DONT_CARE;
> @@ -940,8 +937,6 @@ init_fbconfig_for_chooser(struct glx_config * config,
> config->transparentAlpha = GLX_DONT_CARE;
> config->transparentIndex = GLX_DONT_CARE;
>  
> -   /* Set GLX_RENDER_TYPE property to not expect any flags by default. */
> -   config->renderType = 0;
> config->xRenderable = GLX_DONT_CARE;
> config->fbconfigID = (GLXFBConfigID) (GLX_DONT_CARE);
>  
> 

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


Re: [Mesa-dev] [PATCH 1/3] glsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord

2014-02-18 Thread Anuj Phogat
On Tue, Feb 18, 2014 at 11:01 AM, Ian Romanick  wrote:
> On 02/10/2014 05:29 PM, Anuj Phogat wrote:
>> GLSL 1.50 spec says:
>>"If gl_FragCoord is redeclared in any fragment shader in a program,
>> it must be redeclared in all the fragment shaders in that
>> program that have a static use gl_FragCoord. All redeclarations of
>> gl_FragCoord in all fragment shaders in a single program must
>> have the same set of qualifiers."
>>
>> This patch makes the glsl compiler to generate an error if we have a
>> fragment shader defined with conflicting layout qualifier declarations
>> for gl_FragCoord. For example:
>>
>> layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
>> layout(pixel_center_integer) in vec4 gl_FragCoord;
>> void main()
>> {
>>gl_FragColor = gl_FragCoord.xyzz;
>> }
>>
>> Cc: 
>> Signed-off-by: Anuj Phogat 
>> ---
>>  src/glsl/ast_to_hir.cpp | 39 +++
>>  src/glsl/glsl_parser_extras.cpp |  3 +++
>>  src/glsl/glsl_parser_extras.h   | 10 ++
>>  3 files changed, 52 insertions(+)
>>
>> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
>> index c89a26b..7d7d89b 100644
>> --- a/src/glsl/ast_to_hir.cpp
>> +++ b/src/glsl/ast_to_hir.cpp
>> @@ -2374,6 +2374,45 @@ apply_type_qualifier_to_variable(const struct 
>> ast_type_qualifier *qual,
>>  qual_string);
>> }
>>
>> +   /* Make sure all gl_FragCoord redeclarations specify the same layout
>> +* qualifier type.
>> +*/
>> +   bool conflicting_pixel_center_integer =
>> +  state->fs_pixel_center_integer &&
>> +  !qual->flags.q.pixel_center_integer;
>> +
>> +   bool conflicting_origin_upper_left =
>> +  state->fs_origin_upper_left &&
>> +  !qual->flags.q.origin_upper_left;
>
> I don't think this catches all the cases.  What about
>
> layout(origin_upper_left  ) in vec4 gl_FragCoord;
> layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
>
Nice catch. I'll update my patch to include this case. What do you think
about following two cases?
case 1:
in vec4 gl_FragCoord;
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;

AMD produces no compilation error. This patch matches the behavior.

case 2:
layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
in vec4 gl_FragCoord;

AMD produces compilation error. This patch matches the behavior.

>> +
>> +   if (conflicting_pixel_center_integer || conflicting_origin_upper_left) {
>> +  const char *const qual_string =
>> + (conflicting_pixel_center_integer && 
>> conflicting_origin_upper_left) ?
>> + "pixel_center_integer, origin_upper_left" :
>> + (conflicting_pixel_center_integer ?
>> + "origin_upper_left" : "pixel_center_integer");
>> +
>> +  const char *const state_string =
>> + (state->fs_pixel_center_integer &&
>> +  state->fs_origin_upper_left) ?
>> + "pixel_center_integer, origin_upper_left" :
>> + (state->fs_origin_upper_left ?
>> + "origin_upper_left" : "pixel_center_integer");
>> +
>> +  _mesa_glsl_error(loc, state,
>> +   "different layout qualifiers were specified with "
>> +   "`gl_FragCoord' (%s) and (%s) "
>> +   "redeclare fragment shader input `gl_FragCoord'",
>> +   state_string,
>> +   qual_string);
>> +   }
>> +
>> +   if (qual->flags.q.pixel_center_integer)
>> +  state->fs_pixel_center_integer = true;
>> +
>> +   if (qual->flags.q.origin_upper_left)
>> +  state->fs_origin_upper_left = true;
>> +
>> if (qual->flags.q.explicit_location) {
>>validate_explicit_location(qual, var, state, loc);
>> } else if (qual->flags.q.explicit_index) {
>> diff --git a/src/glsl/glsl_parser_extras.cpp 
>> b/src/glsl/glsl_parser_extras.cpp
>> index b822d22..b06337e 100644
>> --- a/src/glsl/glsl_parser_extras.cpp
>> +++ b/src/glsl/glsl_parser_extras.cpp
>> @@ -193,6 +193,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct 
>> gl_context *_ctx,
>> this->default_uniform_qualifier->flags.q.shared = 1;
>> this->default_uniform_qualifier->flags.q.column_major = 1;
>>
>> +   this->fs_origin_upper_left = false;
>> +   this->fs_pixel_center_integer = false;
>> +
>> this->gs_input_prim_type_specified = false;
>> this->gs_input_prim_type = GL_POINTS;
>> this->gs_input_size = 0;
>> diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
>> index 7d66147..674dae5 100644
>> --- a/src/glsl/glsl_parser_extras.h
>> +++ b/src/glsl/glsl_parser_extras.h
>> @@ -182,6 +182,16 @@ struct _mesa_glsl_parse_state {
>> struct ast_type_qualifier *default_uniform_qualifier;
>>
>> /**
>> +* True if a fragment shader has an input layout for redeclaring the
>> +* built-in variable gl_FragCoord.
>> +*
>> +* Note: this value is computed at ast_to_hir time rather than at 

Re: [Mesa-dev] [PATCH 2/3] glsl: Only warn for macro names containing __

2014-02-18 Thread Kenneth Graunke
On 02/18/2014 10:19 AM, Ian Romanick wrote:
> From: Ian Romanick 
> 
> From page 14 (page 20 of the PDF) of the GLSL 1.10 spec:
> 
> "In addition, all identifiers containing two consecutive underscores
>  (__) are reserved as possible future keywords."
> 
> The intention is that names containing __ are reserved for internal use
> by the implementation, and names prefixed with GL_ are reserved for use
> by Khronos.  Names simply containing __ are dangerous to use, but should
> be allowed.
> 
> Per the Khronos bug mentioned below, a future version of the GLSL
> specification will clarify this.
> 
> Signed-off-by: Ian Romanick 
> Cc: "9.2 10.0 10.1" 
> Cc: Tapani Pälli 
> Cc: Kenneth Graunke 
> Cc: Darius Spitznagel 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
> Bugzilla: Khronos #11702
> ---
>  src/glsl/ast_to_hir.cpp | 13 ++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 6de73f4..6549ca7 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -2928,10 +2928,17 @@ validate_identifier(const char *identifier, YYLTYPE 
> loc,
> * "In addition, all identifiers containing two
> *  consecutive underscores (__) are reserved as
> *  possible future keywords."
> +   *
> +   * The intention is that names containing __ are reserved for internal
> +   * use by the implementation, and names prefixed with GL_ are reserved
> +   * for use by Khronos.  Names simply containing __ are dangerous to 
> use,
> +   * but should be allowed.
> +   *
> +   * A future version of the GLSL specification will clarify this.
> */
> -  _mesa_glsl_error(&loc, state,
> -   "identifier `%s' uses reserved `__' string",
> -   identifier);
> +  _mesa_glsl_warning(&loc, state,
> + "identifier `%s' uses reserved `__' string",
> + identifier);
> }
>  }
>  
> 

All three patches are:
Reviewed-by: Kenneth Graunke 



signature.asc
Description: OpenPGP digital signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] specs: MESA_query_renderer.spec resolve a couple of typos

2014-02-18 Thread Emil Velikov
Cc: Ian Romanick 
Cc: 10.0 10.1 
Signed-off-by: Emil Velikov 
---
 docs/specs/MESA_query_renderer.spec | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/docs/specs/MESA_query_renderer.spec 
b/docs/specs/MESA_query_renderer.spec
index bf09756..2845545 100644
--- a/docs/specs/MESA_query_renderer.spec
+++ b/docs/specs/MESA_query_renderer.spec
@@ -20,7 +20,7 @@ Status
 
 Version
 
-Version 6, 7-November-2013
+Version 8, 14-February-2014
 
 Number
 
@@ -211,7 +211,7 @@ Additions to the GLX 1.4 Specification
 
 The attribute name GLX_RENDERER_ID_MESA specified the index of the render
 against which the context should be created.  The default value of
-GLX_RENDER_ID_MESA is 0.
+GLX_RENDERER_ID_MESA is 0.
 
 
 [Add to list of errors for glXCreateContextAttribsARB in section section
@@ -373,7 +373,7 @@ Issues
 should make every attempt to return as much information as is
 possible.  For example, if the implementation is running on a non-PCI
 SoC with a Qualcomm GPU, GLX_RENDERER_VENDOR_ID_MESA should return
-0x168C, but GLX_RENDERER_DEVICE_ID_MESA will return 0x.
+0x5143, but GLX_RENDERER_DEVICE_ID_MESA will return 0x.
 
 Revision History
 
@@ -403,3 +403,8 @@ Revision History
 
 Version 7, 2013/11/07 - Fix a couple more typos.  Add issue #17 regarding
 the PCI queries on systems that don't have PCI.
+
+Version 8, 2014/02/14 - Fix a couple typos. GLX_RENDER_ID_MESA should
+read GLX_RENDERER_ID_MESA. The VENDOR/DEVICE_ID
+example given in issue #17 should be 0x5143 and
+0x respectively.
-- 
1.9.0

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


[Mesa-dev] [PATCH] configure: use shared-glapi when more than one gl* API is used

2014-02-18 Thread Emil Velikov
Current behaviour states that shared-glapi is usefull when building
with dri, which is not the case. Shared-glapi is used to dispatch
the gl* functions across the one or more gl api's which can be dri
based but do not need to be.

Fixed the following build

 ./configure --enable-gles2 --disable-dri --enable-gallium-egl \
  --with-egl-platforms=fbdev --with-gallium-drivers=swrast

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75098
Signed-off-by: Emil Velikov 
---
 configure.ac | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0c45f63..8fa9e91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -727,13 +727,16 @@ AC_ARG_ENABLE([shared-glapi],
 [AS_HELP_STRING([--enable-shared-glapi],
 [Enable shared glapi for OpenGL @<:@default=yes@:>@])],
 [enable_shared_glapi="$enableval"],
-[enable_shared_glapi="$enable_dri"])
+[enable_shared_glapi=yes])
 
-# Shared GLAPI is only useful for DRI
-if test "x$enable_dri" = xno; then
-AC_MSG_NOTICE([Shared GLAPI is only useful for DRI, disabling])
-enable_shared_glapi=no
-fi
+case "x$enable_opengl$enable_gles1$enable_gles2" in
+x*yes*yes*)
+if test "x$enable_shared_glapi" = xno; then
+AC_MSG_ERROR([shared GLAPI required when building two or more of
+  the following APIs - opengl, gles1 gles2])
+fi
+;;
+esac
 
 AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
 
-- 
1.9.0

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


[Mesa-dev] [Bug 75098] OpenGL ES2 with fbdev - link error

2014-02-18 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=75098

Emil Velikov  changed:

   What|Removed |Added

  Attachment #94216|0   |1
is obsolete||

--- Comment #3 from Emil Velikov  ---
Created attachment 94319
  --> https://bugs.freedesktop.org/attachment.cgi?id=94319&action=edit
configure: use shared-glapi when more than one gl* API is used

Hmm forcing shared-glapi whenever more than one gl* api is used seems like the
only sensible thing to do imho.

This patch fixes the problem by convering the dri dependency gl*. Feel free to
give the patch a try.

-Emil

-- 
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] specs: MESA_query_renderer.spec resolve a couple of typos

2014-02-18 Thread Ian Romanick
On 02/18/2014 04:43 PM, Emil Velikov wrote:
> Cc: Ian Romanick 

Reviewed-by: Ian Romanick 

> Cc: 10.0 10.1 

I don't think I'd bother with this on the stable branches.  The files
from docs/ aren't installed, and the OpenGL extension registry will be
the official home... once it gets posted. :(

> Signed-off-by: Emil Velikov 
> ---
>  docs/specs/MESA_query_renderer.spec | 11 ---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/docs/specs/MESA_query_renderer.spec 
> b/docs/specs/MESA_query_renderer.spec
> index bf09756..2845545 100644
> --- a/docs/specs/MESA_query_renderer.spec
> +++ b/docs/specs/MESA_query_renderer.spec
> @@ -20,7 +20,7 @@ Status
>  
>  Version
>  
> -Version 6, 7-November-2013
> +Version 8, 14-February-2014
>  
>  Number
>  
> @@ -211,7 +211,7 @@ Additions to the GLX 1.4 Specification
>  
>  The attribute name GLX_RENDERER_ID_MESA specified the index of the render
>  against which the context should be created.  The default value of
> -GLX_RENDER_ID_MESA is 0.
> +GLX_RENDERER_ID_MESA is 0.
>  
>  
>  [Add to list of errors for glXCreateContextAttribsARB in section section
> @@ -373,7 +373,7 @@ Issues
>  should make every attempt to return as much information as is
>  possible.  For example, if the implementation is running on a non-PCI
>  SoC with a Qualcomm GPU, GLX_RENDERER_VENDOR_ID_MESA should return
> -0x168C, but GLX_RENDERER_DEVICE_ID_MESA will return 0x.
> +0x5143, but GLX_RENDERER_DEVICE_ID_MESA will return 0x.
>  
>  Revision History
>  
> @@ -403,3 +403,8 @@ Revision History
>  
>  Version 7, 2013/11/07 - Fix a couple more typos.  Add issue #17 regarding
>  the PCI queries on systems that don't have PCI.
> +
> +Version 8, 2014/02/14 - Fix a couple typos. GLX_RENDER_ID_MESA should
> +read GLX_RENDERER_ID_MESA. The VENDOR/DEVICE_ID
> +example given in issue #17 should be 0x5143 and
> +0x respectively.
> 

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


[Mesa-dev] [PATCH 17/43] dri_util: use the implemented version of __DRIimageDriverExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the headers.

Currently both versions are identical, but that is not
guaranteed to be the case in the future.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/common/dri_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 0873927..aed73c7 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -874,7 +874,7 @@ driImageFormatToGLFormat(uint32_t image_format)
 
 /** Image driver interface */
 const __DRIimageDriverExtension driImageDriverExtension = {
-.base = { __DRI_IMAGE_DRIVER, __DRI_IMAGE_DRIVER_VERSION },
+.base = { __DRI_IMAGE_DRIVER, 1 },
 
 .createNewScreen2   = driCreateNewScreen2,
 .createNewDrawable  = driCreateNewDrawable,
-- 
1.9.0

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


[Mesa-dev] [PATCH 00/43] Constify __DRI*Extension usage and misc cleanup v2

2014-02-18 Thread Emil Velikov
A few changes since v1

 - New patches
03/43- Added yet another version note within dri_interface.h
05/43 - dumps the __DRItexBufferExtension's version to 3 and adds a stub
to prevent compilation problems. 
38-43 - glx/*: explicit assignment of struct members

 - Changes
06/43 - All drivers provide version 3 of __DRItexBufferExtension
30/43 - s/DRM_PRIME/DRI_PRIME
35,36/43 - s/threaded/treated/

 - Dropped const T *u = (const *T)a casts


While some patches may seems like bikeshedding, the constification is
quite nice. Let me know how you feel on topic.

Cheers
-Emil

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


[Mesa-dev] [PATCH 07/43] st/dri: set the implemented version of __DRItexBufferExtension

2014-02-18 Thread Emil Velikov
... over the version number provided by the headers.

Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov 
---
 src/gallium/state_trackers/dri/common/dri_drawable.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c 
b/src/gallium/state_trackers/dri/common/dri_drawable.c
index a399938..074321d 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -258,10 +258,11 @@ dri_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
 }
 
 const __DRItexBufferExtension driTexBufferExtension = {
-{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
-   dri_set_tex_buffer,
-   dri_set_tex_buffer2,
-   NULL,
+   .base = { __DRI_TEX_BUFFER, 2 },
+
+   .setTexBuffer   = dri_set_tex_buffer,
+   .setTexBuffer2  = dri_set_tex_buffer2,
+   .releaseTexBuffer   = NULL,
 };
 
 /**
-- 
1.9.0

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


[Mesa-dev] [PATCH 01/43] dri_util: explicitly set __DRIswrastExtension members.

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/common/dri_util.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index d09d50a..0aa997e 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -768,12 +768,13 @@ const __DRIdri2Extension driDRI2Extension = {
 };
 
 const __DRIswrastExtension driSWRastExtension = {
-{ __DRI_SWRAST, 4 },
-driSWRastCreateNewScreen,
-driCreateNewDrawable,
-driCreateNewContextForAPI,
-driCreateContextAttribs,
-driSWRastCreateNewScreen2,
+.base = { __DRI_SWRAST, 4 },
+
+.createNewScreen= driSWRastCreateNewScreen,
+.createNewDrawable  = driCreateNewDrawable,
+.createNewContextForAPI = driCreateNewContextForAPI,
+.createContextAttribs   = driCreateContextAttribs,
+.createNewScreen2   = driSWRastCreateNewScreen2,
 };
 
 const __DRI2configQueryExtension dri2ConfigQueryExtension = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 08/43] dri_interface: note introduction of __DRIdri2LoaderExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 include/GL/internal/dri_interface.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 8821e73..ae01546 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -857,6 +857,9 @@ struct __DRIdri2LoaderExtensionRec {
  * \param driDrawableDrawable whose front-buffer is to be flushed
  * \param loaderPrivate  Loader's private data that was previously passed
  *   into __DRIdri2ExtensionRec::createNewDrawable
+ *
+ * \since 2
+ *
  */
 void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void *loaderPrivate);
 
@@ -879,6 +882,9 @@ struct __DRIdri2LoaderExtensionRec {
  *   \c attachments.
  * \param loaderPrivate  Loader's private data that was previously passed
  *   into __DRIdri2ExtensionRec::createNewDrawable.
+ *
+ * \since 3
+ *
  */
 __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
 int *width, int *height,
-- 
1.9.0

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


[Mesa-dev] [PATCH 09/43] glx/dri2: set the implemented version of __DRIdri2LoaderExtension

2014-02-18 Thread Emil Velikov
... over the version number provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov 
---
 src/glx/dri2_glx.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 1cb0052..58b7bf1 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -955,17 +955,19 @@ dri2GetSwapInterval(__GLXDRIdrawable *pdraw)
 }
 
 static const __DRIdri2LoaderExtension dri2LoaderExtension = {
-   {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
-   dri2GetBuffers,
-   dri2FlushFrontBuffer,
-   dri2GetBuffersWithFormat,
+   .base = { __DRI_DRI2_LOADER, 3 },
+
+   .getBuffers  = dri2GetBuffers,
+   .flushFrontBuffer= dri2FlushFrontBuffer,
+   .getBuffersWithFormat= dri2GetBuffersWithFormat,
 };
 
 static const __DRIdri2LoaderExtension dri2LoaderExtension_old = {
-   {__DRI_DRI2_LOADER, __DRI_DRI2_LOADER_VERSION},
-   dri2GetBuffers,
-   dri2FlushFrontBuffer,
-   NULL,
+   .base = { __DRI_DRI2_LOADER, 3 },
+
+   .getBuffers  = dri2GetBuffers,
+   .flushFrontBuffer= dri2FlushFrontBuffer,
+   .getBuffersWithFormat= NULL,
 };
 
 static const __DRIuseInvalidateExtension dri2UseInvalidate = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 04/43] dri_interface: note introduction of various __DRItexBufferExtension members

2014-02-18 Thread Emil Velikov
Note the member function releaseTexBuffer was added without
bumping spec version, and currently no drivers implement it.

v2: releaseTexBuffer was introduced by version 3

Signed-off-by: Emil Velikov 
---
 include/GL/internal/dri_interface.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index e0ed7f9..5c520dc 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -251,6 +251,9 @@ struct __DRItexBufferExtensionRec {
  * __DRIdrawable, including the required texture format attribute.
  *
  * For GLX_EXT_texture_from_pixmap with AIGLX.
+ *
+ * \since 2
+ *
  */
 void (*setTexBuffer2)(__DRIcontext *pDRICtx,
  GLint target,
@@ -261,6 +264,9 @@ struct __DRItexBufferExtensionRec {
  * need this.
  *
  * For GLX_EXT_texture_from_pixmap with AIGLX.
+ *
+ * \since 3
+ *
  */
 void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
GLint target,
-- 
1.9.0

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


[Mesa-dev] [PATCH 06/43] drivers/dri: set the implemented version of __DRItexBufferExtension

2014-02-18 Thread Emil Velikov
... over the version number provided by the headers.
Explicitly set extension members to improve clarity.

v2: all drivers 'implement' version 3 of the extension.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/i915/intel_screen.c  |  2 +-
 src/mesa/drivers/dri/i965/intel_screen.c  |  2 +-
 src/mesa/drivers/dri/nouveau/nouveau_screen.c |  8 +---
 src/mesa/drivers/dri/radeon/radeon_screen.c   | 16 ++--
 src/mesa/drivers/dri/swrast/swrast.c  |  8 +---
 5 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 296df16..33853e0 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -146,7 +146,7 @@ aub_dump_bmp(struct gl_context *ctx)
 }
 
 static const __DRItexBufferExtension intelTexBufferExtension = {
-   .base = { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
+   .base = { __DRI_TEX_BUFFER, 3 },
 
.setTexBuffer= intelSetTexBuffer,
.setTexBuffer2   = intelSetTexBuffer2,
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index acdb5f3..b013f5d 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -157,7 +157,7 @@ aub_dump_bmp(struct gl_context *ctx)
 }
 
 static const __DRItexBufferExtension intelTexBufferExtension = {
-   .base = { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
+   .base = { __DRI_TEX_BUFFER, 3 },
 
.setTexBuffer= intelSetTexBuffer,
.setTexBuffer2   = intelSetTexBuffer2,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index a381064..a925029f 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -233,9 +233,11 @@ static const struct __DRI2flushExtensionRec 
nouveau_flush_extension = {
 };
 
 static const struct __DRItexBufferExtensionRec nouveau_texbuffer_extension = {
-{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
-NULL,
-nouveau_set_texbuffer,
+   .base = { __DRI_TEX_BUFFER, 3 },
+
+   .setTexBuffer= NULL,
+   .setTexBuffer2   = nouveau_set_texbuffer,
+   .releaseTexBuffer= NULL,
 };
 
 static const __DRIextension *nouveau_screen_extensions[] = {
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c 
b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 57e866e..70df6de 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -170,15 +170,19 @@ radeonGetParam(__DRIscreen *sPriv, int param, void *value)
 
 #if defined(RADEON_R100)
 static const __DRItexBufferExtension radeonTexBufferExtension = {
-{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
-   radeonSetTexBuffer,
-   radeonSetTexBuffer2,
+   .base = { __DRI_TEX_BUFFER, 3 },
+
+   .setTexBuffer= radeonSetTexBuffer,
+   .setTexBuffer2   = radeonSetTexBuffer2,
+   .releaseTexBuffer= NULL,
 };
 #elif defined(RADEON_R200)
 static const __DRItexBufferExtension r200TexBufferExtension = {
-{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
-   r200SetTexBuffer,
-   r200SetTexBuffer2,
+   .base = { __DRI_TEX_BUFFER, 3 },
+
+   .setTexBuffer= r200SetTexBuffer,
+   .setTexBuffer2   = r200SetTexBuffer2,
+   .releaseTexBuffer= NULL,
 };
 #endif
 
diff --git a/src/mesa/drivers/dri/swrast/swrast.c 
b/src/mesa/drivers/dri/swrast/swrast.c
index 071192c..8881381 100644
--- a/src/mesa/drivers/dri/swrast/swrast.c
+++ b/src/mesa/drivers/dri/swrast/swrast.c
@@ -110,9 +110,11 @@ static void swrastSetTexBuffer(__DRIcontext *pDRICtx, 
GLint target,
 }
 
 static const __DRItexBufferExtension swrastTexBufferExtension = {
-{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
-swrastSetTexBuffer,
-swrastSetTexBuffer2,
+   .base = { __DRI_TEX_BUFFER, 3 },
+
+   .setTexBuffer= swrastSetTexBuffer,
+   .setTexBuffer2   = swrastSetTexBuffer2,
+   .releaseTexBuffer= NULL,
 };
 
 static const __DRIextension *dri_screen_extensions[] = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 05/43] dri_interface: Update __DRItexBufferExtensionRec to version 3

2014-02-18 Thread Emil Velikov
Commit e59fa4c46c8("dri2: release texture image.") updated the extension
without bumping the version number. This commit handles this, adding a
stub for _eglReleaseTexImage() to prevent compilation issues.

Note that with this patch glXReleaseTexImageEXT and eglReleaseTexImage
will use slighly higher CPU usage as up-to now those were empty stubs,
while now the driver implementation will be executed assuming any driver
has one.

Signed-off-by: Emil Velikov 
---
 include/GL/internal/dri_interface.h |  2 +-
 src/egl/drivers/dri2/egl_dri2.c |  9 +
 src/egl/main/eglsurface.c   | 11 +++
 src/egl/main/eglsurface.h   |  3 +++
 src/glx/dri2_glx.c  |  2 --
 src/glx/drisw_glx.c |  2 --
 6 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 5c520dc..8821e73 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -231,7 +231,7 @@ struct __DRItexOffsetExtensionRec {
 #define __DRI_TEXTURE_FORMAT_RGBA0x20DA
 
 #define __DRI_TEX_BUFFER "DRI_TexBuffer"
-#define __DRI_TEX_BUFFER_VERSION 2
+#define __DRI_TEX_BUFFER_VERSION 3
 struct __DRItexBufferExtensionRec {
 __DRIextension base;
 
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 892f1f4..2c2a893 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1088,7 +1088,6 @@ static EGLBoolean
 dri2_release_tex_image(_EGLDriver *drv,
   _EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
 {
-#if __DRI_TEX_BUFFER_VERSION >= 3
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(surf);
struct dri2_egl_context *dri2_ctx;
@@ -1108,11 +1107,13 @@ dri2_release_tex_image(_EGLDriver *drv,
default:
   assert(0);
}
-   if (dri2_dpy->tex_buffer->releaseTexBuffer!=NULL)
-(*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context,
+
+   if (dri2_dpy->tex_buffer->base.version >= 3 &&
+   dri2_dpy->tex_buffer->releaseTexBuffer != NULL) {
+  (*dri2_dpy->tex_buffer->releaseTexBuffer)(dri2_ctx->dri_context,
  target,
  dri2_surf->dri_drawable);
-#endif
+   }
 
return EGL_TRUE;
 }
diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c
index 1dca3e0..b97eb7a 100644
--- a/src/egl/main/eglsurface.c
+++ b/src/egl/main/eglsurface.c
@@ -533,6 +533,17 @@ _eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surface,
return EGL_TRUE;
 }
 
+EGLBoolean
+_eglReleaseTexImage(_EGLDriver *drv,
+_EGLDisplay *disp, _EGLSurface *surf, EGLint buffer)
+{
+   /* TODO: do basic error checking and return success/fail.
+* Drivers must implement the real stuff.
+*/
+
+  return EGL_TRUE;
+}
+
 
 EGLBoolean
 _eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf,
diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h
index a954123..d13d301 100644
--- a/src/egl/main/eglsurface.h
+++ b/src/egl/main/eglsurface.h
@@ -94,6 +94,9 @@ _eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, 
_EGLSurface *surf, EGLint a
 PUBLIC extern EGLBoolean
 _eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint 
buffer);
 
+PUBLIC extern EGLBoolean
+_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, 
EGLint buffer);
+
 
 extern EGLBoolean
 _eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint 
interval);
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 67fe9c1..1cb0052 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1032,7 +1032,6 @@ dri2_bind_tex_image(Display * dpy,
 static void
 dri2_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
 {
-#if __DRI_TEX_BUFFER_VERSION >= 3
struct glx_context *gc = __glXGetCurrentContext();
struct dri2_context *pcp = (struct dri2_context *) gc;
__GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable);
@@ -1052,7 +1051,6 @@ dri2_release_tex_image(Display * dpy, GLXDrawable 
drawable, int buffer)
pdraw->driDrawable);
   }
}
-#endif
 }
 
 static const struct glx_context_vtable dri2_context_vtable = {
diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 13a4b96..9e49838 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -341,7 +341,6 @@ drisw_bind_tex_image(Display * dpy,
 static void
 drisw_release_tex_image(Display * dpy, GLXDrawable drawable, int buffer)
 {
-#if __DRI_TEX_BUFFER_VERSION >= 3
struct glx_context *gc = __glXGetCurrentContext();
struct dri2_context *pcp = (struct dri2_context *) gc;
__GLXDRIdrawable *base = GetGLXDRIDrawable(dpy, drawable);
@@ -362,7 +361,6 @@ drisw_release_tex_image(Display * dpy, GLXDrawable 
drawable, int buffer)
   

[Mesa-dev] [PATCH 02/43] dri_util: explicitly set __DRIcopySubBufferExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/common/dri_util.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index 0aa997e..0873927 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -893,6 +893,7 @@ static void driCopySubBuffer(__DRIdrawable *pdp, int x, int 
y,
 
 /* for swrast only */
 const __DRIcopySubBufferExtension driCopySubBufferExtension = {
-   { __DRI_COPY_SUB_BUFFER, 1 },
-   .copySubBuffer = driCopySubBuffer,
+   .base = { __DRI_COPY_SUB_BUFFER, 1 },
+
+   .copySubBuffer   = driCopySubBuffer,
 };
-- 
1.9.0

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


[Mesa-dev] [PATCH 25/43] dri/radeon: explicitly set __DRIimageExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/radeon/radeon_screen.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c 
b/src/mesa/drivers/dri/radeon/radeon_screen.c
index d6ec090..6de3d4f 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -378,12 +378,13 @@ radeon_query_image(__DRIimage *image, int attrib, int 
*value)
 }
 
 static struct __DRIimageExtensionRec radeonImageExtension = {
-{ __DRI_IMAGE, 1 },
-   radeon_create_image_from_name,
-   radeon_create_image_from_renderbuffer,
-   radeon_destroy_image,
-   radeon_create_image,
-   radeon_query_image
+   .base = { __DRI_IMAGE, 1 },
+
+   .createImageFromName = radeon_create_image_from_name,
+   .createImageFromRenderbuffer = radeon_create_image_from_renderbuffer,
+   .destroyImage= radeon_destroy_image,
+   .createImage = radeon_create_image,
+   .queryImage  = radeon_query_image
 };
 
 static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id)
-- 
1.9.0

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


[Mesa-dev] [PATCH 20/43] glx/dri: use the implemented version of __DRIdamageExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov 
---
 src/glx/dri_glx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index 8593750..3b7502d 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -271,8 +271,9 @@ __glXReportDamage(__DRIdrawable * driDraw,
 }
 
 static const __DRIdamageExtension damageExtension = {
-   {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
-   __glXReportDamage,
+   .base = {__DRI_DAMAGE, 1 },
+
+   .reportDamage= __glXReportDamage,
 };
 
 #endif
-- 
1.9.0

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


[Mesa-dev] [PATCH 14/43] egl/wayland: explicitly set __DRIimageLoaderExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/platform_wayland.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_wayland.c 
b/src/egl/drivers/dri2/platform_wayland.c
index 50750a9..a9c067f 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -495,9 +495,10 @@ dri2_flush_front_buffer(__DRIdrawable * driDrawable, void 
*loaderPrivate)
 }
 
 static const __DRIimageLoaderExtension image_loader_extension = {
-   { __DRI_IMAGE_LOADER, 1 },
-   image_get_buffers,
-   dri2_flush_front_buffer
+   .base = { __DRI_IMAGE_LOADER, 1 },
+
+   .getBuffers  = image_get_buffers,
+   .flushFrontBuffer= dri2_flush_front_buffer,
 };
 
 static void
-- 
1.9.0

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


[Mesa-dev] [PATCH 13/43] st/dri: set the implemented version of __DRI2throttleExtension

2014-02-18 Thread Emil Velikov
... over the version number provided by the headers.

Signed-off-by: Emil Velikov 
---
 src/gallium/state_trackers/dri/common/dri_drawable.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c 
b/src/gallium/state_trackers/dri/common/dri_drawable.c
index 074321d..b7df053 100644
--- a/src/gallium/state_trackers/dri/common/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
@@ -562,8 +562,9 @@ dri_throttle(__DRIcontext *cPriv, __DRIdrawable *dPriv,
 
 
 const __DRI2throttleExtension dri2ThrottleExtension = {
-.base = { __DRI2_THROTTLE, __DRI2_THROTTLE_VERSION },
-.throttle = dri_throttle,
+.base = { __DRI2_THROTTLE, 1 },
+
+.throttle  = dri_throttle,
 };
 
 
-- 
1.9.0

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


[Mesa-dev] [PATCH 30/43] st/dri/drm: constify __DRI*Extension pointers

2014-02-18 Thread Emil Velikov
Note: the __DRIimageExtension should not be made const
as it's modified at runtime.

v2: s/DRM_PRIME/DRI_PRIME/

Signed-off-by: Emil Velikov 
---
 src/gallium/state_trackers/dri/drm/dri2.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 45b52c7..b75a45e 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -80,7 +80,7 @@ dri2_drawable_get_buffers(struct dri_drawable *drawable,
   unsigned *count)
 {
__DRIdrawable *dri_drawable = drawable->dPriv;
-   struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader;
+   const __DRIdri2LoaderExtension *loader = drawable->sPriv->dri2.loader;
boolean with_format;
__DRIbuffer *buffers;
int num_buffers;
@@ -484,7 +484,7 @@ dri2_flush_frontbuffer(struct dri_context *ctx,
enum st_attachment_type statt)
 {
__DRIdrawable *dri_drawable = drawable->dPriv;
-   struct __DRIdri2LoaderExtensionRec *loader = drawable->sPriv->dri2.loader;
+   const __DRIdri2LoaderExtension *loader = drawable->sPriv->dri2.loader;
struct pipe_context *pipe = ctx->st->pipe;
 
if (statt != ST_ATTACHMENT_FRONT_LEFT)
@@ -519,7 +519,7 @@ dri2_update_tex_buffer(struct dri_drawable *drawable,
 static __DRIimage *
 dri2_lookup_egl_image(struct dri_screen *screen, void *handle)
 {
-   __DRIimageLookupExtension *loader = screen->sPriv->dri2.image;
+   const __DRIimageLookupExtension *loader = screen->sPriv->dri2.image;
__DRIimage *img;
 
if (!loader->lookupEGLImage)
@@ -993,7 +993,8 @@ dri2_destroy_image(__DRIimage *img)
FREE(img);
 }
 
-static const __DRIimageExtension dri2ImageExtension = {
+/* The extension is modified during runtime if DRI_PRIME is detected */
+static __DRIimageExtension dri2ImageExtension = {
 .base = { __DRI_IMAGE, 6 },
 
 .createImageFromName  = dri2_create_image_from_name,
-- 
1.9.0

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


[Mesa-dev] [PATCH 32/43] dri/i9*5: use typecast'ed name and constify __DRI2rendererQueryExtension

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/i915/intel_screen.c | 2 +-
 src/mesa/drivers/dri/i965/intel_screen.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 74e90c2..a564224 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -782,7 +782,7 @@ i915_query_renderer_string(__DRIscreen *psp, int param, 
const char **value)
return -1;
 }
 
-static struct __DRI2rendererQueryExtensionRec intelRendererQueryExtension = {
+static const __DRI2rendererQueryExtension intelRendererQueryExtension = {
.base = { __DRI2_RENDERER_QUERY, 1 },
 
.queryInteger = i915_query_renderer_integer,
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 78a8ade..070c1af 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -885,7 +885,7 @@ brw_query_renderer_string(__DRIscreen *psp, int param, 
const char **value)
return -1;
 }
 
-static struct __DRI2rendererQueryExtensionRec intelRendererQueryExtension = {
+static const __DRI2rendererQueryExtension intelRendererQueryExtension = {
.base = { __DRI2_RENDERER_QUERY, 1 },
 
.queryInteger = brw_query_renderer_integer,
-- 
1.9.0

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


[Mesa-dev] [PATCH 10/43] gbm: explicitly set __DRIdri2LoaderExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/gbm/backends/dri/gbm_dri.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index e013980..5a0dad0 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -133,10 +133,11 @@ static const __DRIimageLookupExtension 
image_lookup_extension = {
 };
 
 static const __DRIdri2LoaderExtension dri2_loader_extension = {
-   { __DRI_DRI2_LOADER, 3 },
-   dri_get_buffers,
-   dri_flush_front_buffer,
-   dri_get_buffers_with_format,
+   .base = { __DRI_DRI2_LOADER, 3 },
+
+   .getBuffers  = dri_get_buffers,
+   .flushFrontBuffer= dri_flush_front_buffer,
+   .getBuffersWithFormat= dri_get_buffers_with_format,
 };
 
 static const __DRIimageLoaderExtension image_loader_extension = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 28/43] dri/i965: explicitly set __DRIrobustnessExtension members

2014-02-18 Thread Emil Velikov
Use typecast'ed type while we're here.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/i965/intel_screen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index b013f5d..3b3fe9f 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -892,8 +892,8 @@ static struct __DRI2rendererQueryExtensionRec 
intelRendererQueryExtension = {
.queryString = brw_query_renderer_string
 };
 
-static const struct __DRIrobustnessExtensionRec dri2Robustness = {
-   { __DRI2_ROBUSTNESS, 1 }
+static const __DRIrobustnessExtension dri2Robustness = {
+   .base = { __DRI2_ROBUSTNESS, 1 }
 };
 
 static const __DRIextension *intelScreenExtensions[] = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 35/43] gbm/dri: constify remaining __DRI*Extensions

2014-02-18 Thread Emil Velikov
Already treated as such, but stored as non-const.

Signed-off-by: Emil Velikov 
---
 src/gbm/backends/dri/gbm_driint.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_driint.h 
b/src/gbm/backends/dri/gbm_driint.h
index fdf694d..36a6d34 100644
--- a/src/gbm/backends/dri/gbm_driint.h
+++ b/src/gbm/backends/dri/gbm_driint.h
@@ -44,11 +44,11 @@ struct gbm_dri_device {
 
__DRIscreen *screen;
 
-   __DRIcoreExtension   *core;
-   __DRIdri2Extension   *dri2;
-   __DRIimageExtension  *image;
-   __DRI2flushExtension *flush;
-   __DRIdri2LoaderExtension *loader;
+   const __DRIcoreExtension   *core;
+   const __DRIdri2Extension   *dri2;
+   const __DRIimageExtension  *image;
+   const __DRI2flushExtension *flush;
+   const __DRIdri2LoaderExtension *loader;
 
const __DRIconfig   **driver_configs;
const __DRIextension *extensions[5];
-- 
1.9.0

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


[Mesa-dev] [PATCH 24/43] st/dri: explicitly set __DRIimageExtension members

2014-02-18 Thread Emil Velikov
While we're here use the typcast'ed name and constify.

Signed-off-by: Emil Velikov 
---
 src/gallium/state_trackers/dri/drm/dri2.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 7f48baa..45b52c7 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -993,18 +993,19 @@ dri2_destroy_image(__DRIimage *img)
FREE(img);
 }
 
-static struct __DRIimageExtensionRec dri2ImageExtension = {
-{ __DRI_IMAGE, 6 },
-dri2_create_image_from_name,
-dri2_create_image_from_renderbuffer,
-dri2_destroy_image,
-dri2_create_image,
-dri2_query_image,
-dri2_dup_image,
-dri2_validate_usage,
-dri2_from_names,
-dri2_from_planar,
-dri2_create_from_texture,
+static const __DRIimageExtension dri2ImageExtension = {
+.base = { __DRI_IMAGE, 6 },
+
+.createImageFromName  = dri2_create_image_from_name,
+.createImageFromRenderbuffer  = dri2_create_image_from_renderbuffer,
+.destroyImage = dri2_destroy_image,
+.createImage  = dri2_create_image,
+.queryImage   = dri2_query_image,
+.dupImage = dri2_dup_image,
+.validateUsage= dri2_validate_usage,
+.createImageFromNames = dri2_from_names,
+.fromPlanar   = dri2_from_planar,
+.createImageFromTexture   = dri2_create_from_texture,
 };
 
 /*
-- 
1.9.0

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


[Mesa-dev] [PATCH 21/43] glx/drisw: use the implemented version of __DRIswrastLoaderExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov 
---
 src/glx/drisw_glx.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 9e49838..173ba22 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -240,11 +240,12 @@ swrastGetImage(__DRIdrawable * read,
 }
 
 static const __DRIswrastLoaderExtension swrastLoaderExtension = {
-   {__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
-   swrastGetDrawableInfo,
-   swrastPutImage,
-   swrastGetImage,
-   swrastPutImage2,
+   .base = {__DRI_SWRAST_LOADER, 2 },
+
+   .getDrawableInfo = swrastGetDrawableInfo,
+   .putImage= swrastPutImage,
+   .getImage= swrastGetImage,
+   .putImage2   = swrastPutImage2,
 };
 
 static const __DRIextension *loader_extensions[] = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 12/43] drivers/dri: explicitly set __DRI2flushExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/nouveau/nouveau_screen.c | 7 ---
 src/mesa/drivers/dri/radeon/radeon_screen.c   | 7 ---
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
index a925029f..aec2f72 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
@@ -227,9 +227,10 @@ nouveau_drawable_flush(__DRIdrawable *draw)
 }
 
 static const struct __DRI2flushExtensionRec nouveau_flush_extension = {
-{ __DRI2_FLUSH, 3 },
-nouveau_drawable_flush,
-dri2InvalidateDrawable,
+   .base = { __DRI2_FLUSH, 3 },
+
+   .flush   = nouveau_drawable_flush,
+   .invalidate  = dri2InvalidateDrawable,
 };
 
 static const struct __DRItexBufferExtensionRec nouveau_texbuffer_extension = {
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c 
b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 70df6de..d6ec090 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -196,9 +196,10 @@ radeonDRI2Flush(__DRIdrawable *drawable)
 }
 
 static const struct __DRI2flushExtensionRec radeonFlushExtension = {
-{ __DRI2_FLUSH, 3 },
-radeonDRI2Flush,
-dri2InvalidateDrawable,
+   .base = { __DRI2_FLUSH, 3 },
+
+   .flush   = radeonDRI2Flush,
+   .invalidate  = dri2InvalidateDrawable,
 };
 
 static __DRIimage *
-- 
1.9.0

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


[Mesa-dev] [PATCH 15/43] gbm: explicitly set __DRIimageLoaderExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/gbm/backends/dri/gbm_dri.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 5a0dad0..5b9998f 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -141,9 +141,10 @@ static const __DRIdri2LoaderExtension 
dri2_loader_extension = {
 };
 
 static const __DRIimageLoaderExtension image_loader_extension = {
-   { __DRI_IMAGE_LOADER, 1 },
-   image_get_buffers,
-   dri_flush_front_buffer,
+   .base = { __DRI_IMAGE_LOADER, 1 },
+
+   .getBuffers  = image_get_buffers,
+   .flushFrontBuffer= dri_flush_front_buffer,
 };
 
 
-- 
1.9.0

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


[Mesa-dev] [PATCH 19/43] glx/dri_common: use the implemented version of __DRIsystemTimeExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov 
---
 src/glx/dri_common.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 012c8f4..8bf4705 100644
--- a/src/glx/dri_common.c
+++ b/src/glx/dri_common.c
@@ -192,9 +192,10 @@ __driGetMSCRate(__DRIdrawable *draw,
 }
 
 _X_HIDDEN const __DRIsystemTimeExtension systemTimeExtension = {
-   {__DRI_SYSTEM_TIME, __DRI_SYSTEM_TIME_VERSION},
-   __glXGetUST,
-   __driGetMSCRate
+   .base = {__DRI_SYSTEM_TIME, 1 },
+
+   .getUST  = __glXGetUST,
+   .getMSCRate  = __driGetMSCRate
 };
 
 #define __ATTRIB(attrib, field) \
-- 
1.9.0

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


[Mesa-dev] [PATCH 41/43] glx/dri2: explicitly assign struct components for glx_*_vtable

2014-02-18 Thread Emil Velikov
... to improve readability of code.

Signed-off-by: Emil Velikov 
---
 src/glx/dri2_glx.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 16b9b0a..6d3749b 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -1056,15 +1056,15 @@ dri2_release_tex_image(Display * dpy, GLXDrawable 
drawable, int buffer)
 }
 
 static const struct glx_context_vtable dri2_context_vtable = {
-   dri2_destroy_context,
-   dri2_bind_context,
-   dri2_unbind_context,
-   dri2_wait_gl,
-   dri2_wait_x,
-   DRI_glXUseXFont,
-   dri2_bind_tex_image,
-   dri2_release_tex_image,
-   NULL, /* get_proc_address */
+   .destroy = dri2_destroy_context,
+   .bind= dri2_bind_context,
+   .unbind  = dri2_unbind_context,
+   .wait_gl = dri2_wait_gl,
+   .wait_x  = dri2_wait_x,
+   .use_x_font  = DRI_glXUseXFont,
+   .bind_tex_image  = dri2_bind_tex_image,
+   .release_tex_image   = dri2_release_tex_image,
+   .get_proc_address= NULL,
 };
 
 static void
@@ -1148,10 +1148,10 @@ dri2BindExtensions(struct dri2_screen *psc, struct 
glx_display * priv,
 }
 
 static const struct glx_screen_vtable dri2_screen_vtable = {
-   dri2_create_context,
-   dri2_create_context_attribs,
-   dri2_query_renderer_integer,
-   dri2_query_renderer_string,
+   .create_context = dri2_create_context,
+   .create_context_attribs = dri2_create_context_attribs,
+   .query_renderer_integer = dri2_query_renderer_integer,
+   .query_renderer_string  = dri2_query_renderer_string,
 };
 
 static struct glx_screen *
-- 
1.9.0

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


[Mesa-dev] [PATCH 38/43] glx/apple: explicitly assign struct components for glx_*_vtable

2014-02-18 Thread Emil Velikov
... to improve readability of code. Set applegl_screen_vtable as a static const.

Signed-off-by: Emil Velikov 
---
 src/glx/applegl_glx.c | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/glx/applegl_glx.c b/src/glx/applegl_glx.c
index a67416e..4e2d5d0 100644
--- a/src/glx/applegl_glx.c
+++ b/src/glx/applegl_glx.c
@@ -109,15 +109,15 @@ applegl_get_proc_address(const char *symbol)
 }
 
 static const struct glx_context_vtable applegl_context_vtable = {
-   applegl_destroy_context,
-   applegl_bind_context,
-   applegl_unbind_context,
-   applegl_wait_gl,
-   applegl_wait_x,
-   DRI_glXUseXFont,
-   NULL, /* bind_tex_image, */
-   NULL, /* release_tex_image, */
-   applegl_get_proc_address,
+   .destroy = applegl_destroy_context,
+   .bind= applegl_bind_context,
+   .unbind  = applegl_unbind_context,
+   .wait_gl = applegl_wait_gl,
+   .wait_x  = applegl_wait_x,
+   .use_x_font  = DRI_glXUseXFont,
+   .bind_tex_image  = NULL,
+   .release_tex_image   = NULL,
+   .get_proc_address= applegl_get_proc_address,
 };
 
 struct glx_context *
@@ -164,8 +164,11 @@ applegl_create_context(struct glx_screen *psc,
return gc;
 }
 
-struct glx_screen_vtable applegl_screen_vtable = {
-   applegl_create_context
+static const struct glx_screen_vtable applegl_screen_vtable = {
+   .create_context = applegl_create_context,
+   .create_context_attribs = NULL,
+   .query_renderer_integer = NULL,
+   .query_renderer_string  = NULL,
 };
 
 _X_HIDDEN struct glx_screen *
-- 
1.9.0

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


[Mesa-dev] [PATCH 23/43] glx/dri2: use the implemented version of __DRIuseInvalidateExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov 
---
 src/glx/dri2_glx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 58b7bf1..16b9b0a 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -971,7 +971,7 @@ static const __DRIdri2LoaderExtension 
dri2LoaderExtension_old = {
 };
 
 static const __DRIuseInvalidateExtension dri2UseInvalidate = {
-   { __DRI_USE_INVALIDATE, __DRI_USE_INVALIDATE_VERSION }
+   .base = { __DRI_USE_INVALIDATE, 1 }
 };
 
 _X_HIDDEN void
-- 
1.9.0

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


[Mesa-dev] [PATCH 26/43] egl_dri gbm: explicitly set __DRIimageLookupExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/egl_dri2.c | 5 +++--
 src/gbm/backends/dri/gbm_dri.c  | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 6711bd3..1040a27 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -296,8 +296,9 @@ dri2_lookup_egl_image(__DRIscreen *screen, void *image, 
void *data)
 }
 
 const __DRIimageLookupExtension image_lookup_extension = {
-   { __DRI_IMAGE_LOOKUP, 1 },
-   dri2_lookup_egl_image
+   .base = { __DRI_IMAGE_LOOKUP, 1 },
+
+   .lookupEGLImage   = dri2_lookup_egl_image
 };
 
 static const char dri_driver_path[] = DEFAULT_DRIVER_DIR;
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 6ce896e..bb52958 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -128,8 +128,9 @@ static const __DRIuseInvalidateExtension use_invalidate = {
 };
 
 static const __DRIimageLookupExtension image_lookup_extension = {
-   { __DRI_IMAGE_LOOKUP, 1 },
-   dri_lookup_egl_image
+   .base = { __DRI_IMAGE_LOOKUP, 1 },
+
+   .lookupEGLImage  = dri_lookup_egl_image
 };
 
 static const __DRIdri2LoaderExtension dri2_loader_extension = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 36/43] egl_dri2: constify remaining __DRI*Extensions

2014-02-18 Thread Emil Velikov
Already treated as such, but stored as non-const.

The loader extensions - __DRIdri2LoaderExtension and __DRIdri2LoaderExtension
are set up by the platform backends.

Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/egl_dri2.c |  4 ++--
 src/egl/drivers/dri2/egl_dri2.h | 16 
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1040a27..798bfea 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -587,10 +587,10 @@ dri2_create_screen(_EGLDisplay *disp)
 
   for (i = 0; extensions[i]; i++) {
 if (strcmp(extensions[i]->name, __DRI2_ROBUSTNESS) == 0) {
-dri2_dpy->robustness = (__DRIrobustnessExtension *) extensions[i];
+dri2_dpy->robustness = (const __DRIrobustnessExtension *) 
extensions[i];
 }
 if (strcmp(extensions[i]->name, __DRI2_CONFIG_QUERY) == 0) {
-   dri2_dpy->config = (__DRI2configQueryExtension *) extensions[i];
+   dri2_dpy->config = (const __DRI2configQueryExtension *) 
extensions[i];
 }
   }
} else {
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index dfc5927..a20a827 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -92,14 +92,14 @@ struct dri2_egl_display
int   own_dri_screen;
const __DRIconfig   **driver_configs;
void *driver;
-   __DRIcoreExtension   *core;
-   __DRIdri2Extension   *dri2;
-   __DRIswrastExtension *swrast;
-   __DRI2flushExtension *flush;
-   __DRItexBufferExtension  *tex_buffer;
-   __DRIimageExtension  *image;
-   __DRIrobustnessExtension *robustness;
-   __DRI2configQueryExtension *config;
+   const __DRIcoreExtension   *core;
+   const __DRIdri2Extension   *dri2;
+   const __DRIswrastExtension *swrast;
+   const __DRI2flushExtension *flush;
+   const __DRItexBufferExtension  *tex_buffer;
+   const __DRIimageExtension  *image;
+   const __DRIrobustnessExtension *robustness;
+   const __DRI2configQueryExtension *config;
int   fd;
 
int   own_device;
-- 
1.9.0

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


[Mesa-dev] [PATCH 27/43] dri_util: use the implemented version of __DRI2configQueryExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the headers.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/common/dri_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index aed73c7..c4ff9c7 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -778,7 +778,7 @@ const __DRIswrastExtension driSWRastExtension = {
 };
 
 const __DRI2configQueryExtension dri2ConfigQueryExtension = {
-   .base = { __DRI2_CONFIG_QUERY, __DRI2_CONFIG_QUERY_VERSION },
+   .base = { __DRI2_CONFIG_QUERY, 1 },
 
.configQueryb= dri2ConfigQueryb,
.configQueryi= dri2ConfigQueryi,
-- 
1.9.0

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


[Mesa-dev] [PATCH 03/43] dri_interface: Note the version introducing __DRIswrastLoaderExtensionRec::putImage2

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 include/GL/internal/dri_interface.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/GL/internal/dri_interface.h 
b/include/GL/internal/dri_interface.h
index 9e82904..e0ed7f9 100644
--- a/include/GL/internal/dri_interface.h
+++ b/include/GL/internal/dri_interface.h
@@ -464,6 +464,9 @@ struct __DRIswrastLoaderExtensionRec {
 
 /**
  * Put image to drawable
+ *
+ * \since 2
+ *
  */
 void (*putImage2)(__DRIdrawable *drawable, int op,
   int x, int y, int width, int height, int stride,
-- 
1.9.0

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


[Mesa-dev] [PATCH 22/43] egl_dri gbm: explicitly set __DRIuseInvalidateExtension members

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/egl/drivers/dri2/egl_dri2.c | 2 +-
 src/gbm/backends/dri/gbm_dri.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2c2a893..6711bd3 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -49,7 +49,7 @@
 #endif
 
 const __DRIuseInvalidateExtension use_invalidate = {
-   { __DRI_USE_INVALIDATE, 1 }
+   .base = { __DRI_USE_INVALIDATE, 1 }
 };
 
 EGLint dri2_to_egl_attribute_map[] = {
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 5b9998f..6ce896e 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -124,7 +124,7 @@ image_get_buffers(__DRIdrawable *driDrawable,
 }
 
 static const __DRIuseInvalidateExtension use_invalidate = {
-   { __DRI_USE_INVALIDATE, 1 }
+   .base = { __DRI_USE_INVALIDATE, 1 }
 };
 
 static const __DRIimageLookupExtension image_lookup_extension = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 34/43] dri_util: constify remaining __DRI*Extensions

2014-02-18 Thread Emil Velikov
Already treated as such, but stored as non-const.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/common/dri_util.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.h 
b/src/mesa/drivers/dri/common/dri_util.h
index a37a0bb..1138bf1 100644
--- a/src/mesa/drivers/dri/common/dri_util.h
+++ b/src/mesa/drivers/dri/common/dri_util.h
@@ -174,13 +174,13 @@ struct __DRIscreenRec {
 struct {
/* Flag to indicate that this is a DRI2 screen.  Many of the above
 * fields will not be valid or initializaed in that case. */
-   __DRIdri2LoaderExtension *loader;
-   __DRIimageLookupExtension *image;
-   __DRIuseInvalidateExtension *useInvalidate;
+   const __DRIdri2LoaderExtension *loader;
+   const __DRIimageLookupExtension *image;
+   const __DRIuseInvalidateExtension *useInvalidate;
 } dri2;
 
 struct {
-__DRIimageLoaderExtension *loader;
+const __DRIimageLoaderExtension *loader;
 } image;
 
 driOptionCache optionInfo;
-- 
1.9.0

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


[Mesa-dev] [PATCH 31/43] drivers/dri: use typecast'ed name and constify __DRIimageExtension

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/i915/intel_screen.c| 2 +-
 src/mesa/drivers/dri/i965/intel_screen.c| 2 +-
 src/mesa/drivers/dri/radeon/radeon_screen.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
b/src/mesa/drivers/dri/i915/intel_screen.c
index 33853e0..74e90c2 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -689,7 +689,7 @@ intel_from_planar(__DRIimage *parent, int plane, void 
*loaderPrivate)
 return image;
 }
 
-static struct __DRIimageExtensionRec intelImageExtension = {
+static const __DRIimageExtension intelImageExtension = {
 .base = { __DRI_IMAGE, 7 },
 
 .createImageFromName= intel_create_image_from_name,
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 3b3fe9f..78a8ade 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -790,7 +790,7 @@ intel_from_planar(__DRIimage *parent, int plane, void 
*loaderPrivate)
 return image;
 }
 
-static struct __DRIimageExtensionRec intelImageExtension = {
+static const __DRIimageExtension intelImageExtension = {
 .base = { __DRI_IMAGE, 8 },
 
 .createImageFromName= intel_create_image_from_name,
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c 
b/src/mesa/drivers/dri/radeon/radeon_screen.c
index 6de3d4f..dd94038 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -377,7 +377,7 @@ radeon_query_image(__DRIimage *image, int attrib, int 
*value)
}
 }
 
-static struct __DRIimageExtensionRec radeonImageExtension = {
+static const __DRIimageExtension radeonImageExtension = {
.base = { __DRI_IMAGE, 1 },
 
.createImageFromName = radeon_create_image_from_name,
-- 
1.9.0

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


[Mesa-dev] [PATCH 29/43] glx/tests: explicitly set __DRI2rendererQueryExtension members

2014-02-18 Thread Emil Velikov
While we're here use the typcast'ed name and constify.

Signed-off-by: Emil Velikov 
---
 src/glx/tests/query_renderer_implementation_unittest.cpp | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/glx/tests/query_renderer_implementation_unittest.cpp 
b/src/glx/tests/query_renderer_implementation_unittest.cpp
index 4749089..bfe21f6 100644
--- a/src/glx/tests/query_renderer_implementation_unittest.cpp
+++ b/src/glx/tests/query_renderer_implementation_unittest.cpp
@@ -139,11 +139,11 @@ fake_queryString(__DRIscreen *screen, int attribute, 
const char **val)
return -1;
 }
 
-struct __DRI2rendererQueryExtensionRec rendererQueryExt = {
-   { __DRI2_RENDERER_QUERY, 1 },
+static const __DRI2rendererQueryExtension rendererQueryExt = {
+   .base = { __DRI2_RENDERER_QUERY, 1 },
 
-   fake_queryInteger,
-   fake_queryString
+   .queryInteger = fake_queryInteger,
+   .queryString = fake_queryString
 };
 
 void dri2_query_renderer_string_test::SetUp()
-- 
1.9.0

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


[Mesa-dev] [PATCH 40/43] glx/dri: explicitly assign struct components for glx_*_vtable

2014-02-18 Thread Emil Velikov
... to improve readability of code.

Signed-off-by: Emil Velikov 
---
 src/glx/dri_glx.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index 3b7502d..04a0847 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -90,8 +90,6 @@ struct dri_drawable
__DRIdrawable *driDrawable;
 };
 
-static const struct glx_context_vtable dri_context_vtable;
-
 /*
  * Given a display pointer and screen number, determine the name of
  * the DRI driver for the screen (i.e., "i965", "radeon", "nouveau", etc).
@@ -569,15 +567,15 @@ dri_unbind_context(struct glx_context *context, struct 
glx_context *new)
 }
 
 static const struct glx_context_vtable dri_context_vtable = {
-   dri_destroy_context,
-   dri_bind_context,
-   dri_unbind_context,
-   NULL,
-   NULL,
-   DRI_glXUseXFont,
-   NULL,
-   NULL,
-   NULL, /* get_proc_address */
+   .destroy = dri_destroy_context,
+   .bind= dri_bind_context,
+   .unbind  = dri_unbind_context,
+   .wait_gl = NULL,
+   .wait_x  = NULL,
+   .use_x_font  = DRI_glXUseXFont,
+   .bind_tex_image  = NULL,
+   .release_tex_image   = NULL,
+   .get_proc_address= NULL,
 };
 
 static struct glx_context *
@@ -808,8 +806,10 @@ driBindExtensions(struct dri_screen *psc, const 
__DRIextension **extensions)
 }
 
 static const struct glx_screen_vtable dri_screen_vtable = {
-   dri_create_context,
-   NULL
+   .create_context = dri_create_context,
+   .create_context_attribs = NULL,
+   .query_renderer_integer = NULL,
+   .query_renderer_string  = NULL,
 };
 
 static struct glx_screen *
-- 
1.9.0

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


[Mesa-dev] [PATCH 43/43] glx/drisw: explicitly assign struct components for glx_*_vtable

2014-02-18 Thread Emil Velikov
... to improve readability of code.

Signed-off-by: Emil Velikov 
---
 src/glx/drisw_glx.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/glx/drisw_glx.c b/src/glx/drisw_glx.c
index 173ba22..0ca6d14 100644
--- a/src/glx/drisw_glx.c
+++ b/src/glx/drisw_glx.c
@@ -365,15 +365,15 @@ drisw_release_tex_image(Display * dpy, GLXDrawable 
drawable, int buffer)
 }
 
 static const struct glx_context_vtable drisw_context_vtable = {
-   drisw_destroy_context,
-   drisw_bind_context,
-   drisw_unbind_context,
-   NULL,
-   NULL,
-   DRI_glXUseXFont,
-   drisw_bind_tex_image,
-   drisw_release_tex_image,
-   NULL, /* get_proc_address */
+   .destroy = drisw_destroy_context,
+   .bind= drisw_bind_context,
+   .unbind  = drisw_unbind_context,
+   .wait_gl = NULL,
+   .wait_x  = NULL,
+   .use_x_font  = DRI_glXUseXFont,
+   .bind_tex_image  = drisw_bind_tex_image,
+   .release_tex_image   = drisw_release_tex_image,
+   .get_proc_address= NULL,
 };
 
 static struct glx_context *
@@ -635,8 +635,10 @@ driOpenSwrast(void)
 }
 
 static const struct glx_screen_vtable drisw_screen_vtable = {
-   drisw_create_context,
-   drisw_create_context_attribs
+   .create_context = drisw_create_context,
+   .create_context_attribs = drisw_create_context_attribs,
+   .query_renderer_integer = NULL,
+   .query_renderer_string  = NULL,
 };
 
 static void
-- 
1.9.0

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


[Mesa-dev] [PATCH 37/43] dri/radeon: use a const __DRIextension array

2014-02-18 Thread Emil Velikov
Rather than keeping a separate and used copy of the screen extensions
within the raderon screen, move to use a constant array that can be
fed directly to the __DRIscreen.

Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/radeon/radeon_screen.c | 29 ++---
 src/mesa/drivers/dri/radeon/radeon_screen.h |  2 --
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c 
b/src/mesa/drivers/dri/radeon/radeon_screen.c
index dd94038..fe72b77 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.c
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
@@ -481,11 +481,23 @@ static int radeon_set_screen_flags(radeonScreenPtr 
screen, int device_id)
return 0;
 }
 
+
+static const __DRIextension *radeon_screen_extensions[] = {
+&dri2ConfigQueryExtension.base,
+#if defined(RADEON_R100)
+&radeonTexBufferExtension.base,
+#elif defined(RADEON_R200)
+&r200TexBufferExtension.base,
+#endif
+&radeonFlushExtension.base,
+&radeonImageExtension.base,
+NULL
+};
+
 static radeonScreenPtr
 radeonCreateScreen2(__DRIscreen *sPriv)
 {
radeonScreenPtr screen;
-   int i;
int ret;
uint32_t device_id = 0;
 
@@ -522,20 +534,7 @@ radeonCreateScreen2(__DRIscreen *sPriv)
if (getenv("RADEON_NO_TCL"))
   screen->chip_flags &= ~RADEON_CHIPSET_TCL;
 
-   i = 0;
-   screen->extensions[i++] = &dri2ConfigQueryExtension.base;
-
-#if defined(RADEON_R100)
-   screen->extensions[i++] = &radeonTexBufferExtension.base;
-#elif defined(RADEON_R200)
-   screen->extensions[i++] = &r200TexBufferExtension.base;
-#endif
-
-   screen->extensions[i++] = &radeonFlushExtension.base;
-   screen->extensions[i++] = &radeonImageExtension.base;
-
-   screen->extensions[i++] = NULL;
-   sPriv->extensions = screen->extensions;
+   sPriv->extensions = radeon_screen_extensions;
 
screen->driScreen = sPriv;
screen->bom = radeon_bo_manager_gem_ctor(sPriv->fd);
diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.h 
b/src/mesa/drivers/dri/radeon/radeon_screen.h
index 03abb2a..76fa1ec 100644
--- a/src/mesa/drivers/dri/radeon/radeon_screen.h
+++ b/src/mesa/drivers/dri/radeon/radeon_screen.h
@@ -97,8 +97,6 @@ typedef struct radeon_screen {
/* Configuration cache with default values for all contexts */
driOptionCache optionCache;
 
-   const __DRIextension *extensions[17];
-
int num_gb_pipes;
int num_z_pipes;
drm_radeon_sarea_t *sarea;  /* Private SAREA data */
-- 
1.9.0

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


[Mesa-dev] [PATCH 33/43] dri/nouveau: constify usage of __DRIdri2LoaderExtension

2014-02-18 Thread Emil Velikov
Signed-off-by: Emil Velikov 
---
 src/mesa/drivers/dri/nouveau/nouveau_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c 
b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
index 809b5ff..1a8afa2 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
@@ -65,7 +65,7 @@ nouveau_flush(struct gl_context *ctx)
if (_mesa_is_winsys_fbo(ctx->DrawBuffer) &&
ctx->DrawBuffer->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) {
__DRIscreen *screen = nctx->screen->dri_screen;
-   __DRIdri2LoaderExtension *dri2 = screen->dri2.loader;
+   const __DRIdri2LoaderExtension *dri2 = screen->dri2.loader;
__DRIdrawable *drawable = nctx->dri_context->driDrawablePriv;
 
if (drawable && drawable->loaderPrivate)
-- 
1.9.0

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


[Mesa-dev] [PATCH 16/43] glx/dri3: set the implemented version of __DRIimageLoaderExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the spec.
Currently both versions are identical, but that is not
guaranteed to be the case in the future.

Signed-off-by: Emil Velikov 
---
 src/glx/dri3_glx.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 70ec057..8fbf125 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -1307,9 +1307,10 @@ dri3_get_buffers(__DRIdrawable *driDrawable,
 /* The image loader extension record for DRI3
  */
 static const __DRIimageLoaderExtension imageLoaderExtension = {
-   {__DRI_IMAGE_LOADER, __DRI_IMAGE_LOADER_VERSION},
-   .getBuffers = dri3_get_buffers,
-   .flushFrontBuffer = dri3_flush_front_buffer,
+   .base = { __DRI_IMAGE_LOADER, 1 },
+
+   .getBuffers  = dri3_get_buffers,
+   .flushFrontBuffer= dri3_flush_front_buffer,
 };
 
 /** dri3_swap_buffers
-- 
1.9.0

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


[Mesa-dev] [PATCH 42/43] glx/dri3: explicitly assign struct components for glx_*_vtable

2014-02-18 Thread Emil Velikov
... to improve readability of code.

Signed-off-by: Emil Velikov 
---
 src/glx/dri3_glx.c | 24 +---
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 8fbf125..c014c40 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -1524,15 +1524,15 @@ dri3_release_tex_image(Display * dpy, GLXDrawable 
drawable, int buffer)
 }
 
 static const struct glx_context_vtable dri3_context_vtable = {
-   dri3_destroy_context,
-   dri3_bind_context,
-   dri3_unbind_context,
-   dri3_wait_gl,
-   dri3_wait_x,
-   DRI_glXUseXFont,
-   dri3_bind_tex_image,
-   dri3_release_tex_image,
-   NULL, /* get_proc_address */
+   .destroy = dri3_destroy_context,
+   .bind= dri3_bind_context,
+   .unbind  = dri3_unbind_context,
+   .wait_gl = dri3_wait_gl,
+   .wait_x  = dri3_wait_x,
+   .use_x_font  = DRI_glXUseXFont,
+   .bind_tex_image  = dri3_bind_tex_image,
+   .release_tex_image   = dri3_release_tex_image,
+   .get_proc_address= NULL,
 };
 
 /** dri3_bind_extensions
@@ -1585,8 +1585,10 @@ dri3_bind_extensions(struct dri3_screen *psc, struct 
glx_display * priv,
 }
 
 static const struct glx_screen_vtable dri3_screen_vtable = {
-   dri3_create_context,
-   dri3_create_context_attribs
+   .create_context = dri3_create_context,
+   .create_context_attribs = dri3_create_context_attribs,
+   .query_renderer_integer = NULL,
+   .query_renderer_string  = NULL,
 };
 
 /** dri3_create_screen
-- 
1.9.0

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


[Mesa-dev] [PATCH 18/43] glx/dri: use the implemented version of __DRIgetDrawableInfoExtension

2014-02-18 Thread Emil Velikov
... over the one provided by the headers.

Signed-off-by: Emil Velikov 
---
 src/glx/dri_glx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index 03ecc5b..8593750 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -299,8 +299,9 @@ __glXDRIGetDrawableInfo(__DRIdrawable * drawable,
 }
 
 static const __DRIgetDrawableInfoExtension getDrawableInfoExtension = {
-   {__DRI_GET_DRAWABLE_INFO, __DRI_GET_DRAWABLE_INFO_VERSION},
-   __glXDRIGetDrawableInfo
+   .base = {__DRI_GET_DRAWABLE_INFO, 1 },
+
+   .getDrawableInfo = __glXDRIGetDrawableInfo
 };
 
 static const __DRIextension *loader_extensions[] = {
-- 
1.9.0

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


[Mesa-dev] [PATCH 11/43] st/dri: set the implemented version of __DRI2flushExtension

2014-02-18 Thread Emil Velikov
over the version number provided by the headers.
Explicitly set extension members to improve clarity.

Signed-off-by: Emil Velikov 
---
 src/gallium/state_trackers/dri/drm/dri2.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri2.c 
b/src/gallium/state_trackers/dri/drm/dri2.c
index 973773c..7f48baa 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -64,10 +64,11 @@ dri2_invalidate_drawable(__DRIdrawable *dPriv)
 }
 
 static const __DRI2flushExtension dri2FlushExtension = {
-{ __DRI2_FLUSH, __DRI2_FLUSH_VERSION },
-dri2_flush_drawable,
-dri2_invalidate_drawable,
-dri_flush,
+.base = { __DRI2_FLUSH, 4 },
+
+.flush= dri2_flush_drawable,
+.invalidate   = dri2_invalidate_drawable,
+.flush_with_flags = dri_flush,
 };
 
 /**
-- 
1.9.0

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


[Mesa-dev] [PATCH 39/43] glx/indirect: explicitly assign struct components for glx_*_vtable

2014-02-18 Thread Emil Velikov
... to improve readability of code. Set indirect_screen_vtable as a static 
const.

Signed-off-by: Emil Velikov 
---
 src/glx/indirect_glx.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/glx/indirect_glx.c b/src/glx/indirect_glx.c
index 28b8cd0..1bcecda 100644
--- a/src/glx/indirect_glx.c
+++ b/src/glx/indirect_glx.c
@@ -323,15 +323,15 @@ indirect_release_tex_image(Display * dpy, GLXDrawable 
drawable, int buffer)
 }
 
 static const struct glx_context_vtable indirect_context_vtable = {
-   indirect_destroy_context,
-   indirect_bind_context,
-   indirect_unbind_context,
-   indirect_wait_gl,
-   indirect_wait_x,
-   indirect_use_x_font,
-   indirect_bind_tex_image,
-   indirect_release_tex_image,
-   NULL, /* get_proc_address */
+   .destroy = indirect_destroy_context,
+   .bind= indirect_bind_context,
+   .unbind  = indirect_unbind_context,
+   .wait_gl = indirect_wait_gl,
+   .wait_x  = indirect_wait_x,
+   .use_x_font  = indirect_use_x_font,
+   .bind_tex_image  = indirect_bind_tex_image,
+   .release_tex_image   = indirect_release_tex_image,
+   .get_proc_address= NULL,
 };
 
 /**
@@ -467,9 +467,11 @@ indirect_create_context_attribs(struct glx_screen *base,
return indirect_create_context(base, config_base, shareList, renderType);
 }
 
-struct glx_screen_vtable indirect_screen_vtable = {
-   indirect_create_context,
-   indirect_create_context_attribs
+static const struct glx_screen_vtable indirect_screen_vtable = {
+   .create_context = indirect_create_context,
+   .create_context_attribs = indirect_create_context_attribs,
+   .query_renderer_integer = NULL,
+   .query_renderer_string  = NULL,
 };
 
 _X_HIDDEN struct glx_screen *
-- 
1.9.0

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


Re: [Mesa-dev] [PATCH 1/3] glsl: Compile error if fs defines conflicting qualifiers for gl_FragCoord

2014-02-18 Thread Ian Romanick
On 02/18/2014 03:36 PM, Anuj Phogat wrote:
> On Tue, Feb 18, 2014 at 11:01 AM, Ian Romanick  wrote:
>> On 02/10/2014 05:29 PM, Anuj Phogat wrote:
>>> GLSL 1.50 spec says:
>>>"If gl_FragCoord is redeclared in any fragment shader in a program,
>>> it must be redeclared in all the fragment shaders in that
>>> program that have a static use gl_FragCoord. All redeclarations of
>>> gl_FragCoord in all fragment shaders in a single program must
>>> have the same set of qualifiers."
>>>
>>> This patch makes the glsl compiler to generate an error if we have a
>>> fragment shader defined with conflicting layout qualifier declarations
>>> for gl_FragCoord. For example:
>>>
>>> layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
>>> layout(pixel_center_integer) in vec4 gl_FragCoord;
>>> void main()
>>> {
>>>gl_FragColor = gl_FragCoord.xyzz;
>>> }
>>>
>>> Cc: 
>>> Signed-off-by: Anuj Phogat 
>>> ---
>>>  src/glsl/ast_to_hir.cpp | 39 
>>> +++
>>>  src/glsl/glsl_parser_extras.cpp |  3 +++
>>>  src/glsl/glsl_parser_extras.h   | 10 ++
>>>  3 files changed, 52 insertions(+)
>>>
>>> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
>>> index c89a26b..7d7d89b 100644
>>> --- a/src/glsl/ast_to_hir.cpp
>>> +++ b/src/glsl/ast_to_hir.cpp
>>> @@ -2374,6 +2374,45 @@ apply_type_qualifier_to_variable(const struct 
>>> ast_type_qualifier *qual,
>>>  qual_string);
>>> }
>>>
>>> +   /* Make sure all gl_FragCoord redeclarations specify the same layout
>>> +* qualifier type.
>>> +*/
>>> +   bool conflicting_pixel_center_integer =
>>> +  state->fs_pixel_center_integer &&
>>> +  !qual->flags.q.pixel_center_integer;
>>> +
>>> +   bool conflicting_origin_upper_left =
>>> +  state->fs_origin_upper_left &&
>>> +  !qual->flags.q.origin_upper_left;
>>
>> I don't think this catches all the cases.  What about
>>
>> layout(origin_upper_left  ) in vec4 gl_FragCoord;
>> layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
>>
> Nice catch. I'll update my patch to include this case. What do you think
> about following two cases?
> case 1:
> in vec4 gl_FragCoord;
> layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> 
> AMD produces no compilation error. This patch matches the behavior.
> 
> case 2:
> layout(origin_upper_left, pixel_center_integer) in vec4 gl_FragCoord;
> in vec4 gl_FragCoord;
> 
> AMD produces compilation error. This patch matches the behavior.

I don't think that's right.  I think they should both produce an error.
 The spec says, "All redeclarations of gl_FragCoord in all fragment
shaders in a single program must have the same set of qualifiers."  I
can't see any reason to give an error for case 2 but not for case 1.

We should also check NVIDIA.

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


Re: [Mesa-dev] [Mesa-stable] [PATCH 1/3] glcpp: Only warn for macro names containing __

2014-02-18 Thread Anuj Phogat
On Tue, Feb 18, 2014 at 10:19 AM, Ian Romanick  wrote:
>
> From: Ian Romanick 
>
> Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and the
> GLSL ES spec (all versions) say:
>
> "All macro names containing two consecutive underscores ( __ ) are
> reserved for future use as predefined macro names. All macro names
> prefixed with "GL_" ("GL" followed by a single underscore) are also
> reserved."
>
> The intention is that names containing __ are reserved for internal use
> by the implementation, and names prefixed with GL_ are reserved for use
> by Khronos.  Since every extension adds a name prefixed with GL_ (i.e.,
> the name of the extension), that should be an error.  Names simply
> containing __ are dangerous to use, but should be allowed.  In similar
> cases, the C++ preprocessor specification says, "no diagnostic is
> required."
>
> Per the Khronos bug mentioned below, a future version of the GLSL
> specification will clarify this.
>
> Signed-off-by: Ian Romanick 
> Cc: "9.2 10.0 10.1" 
> Cc: Tapani Pälli 
> Cc: Kenneth Graunke 
> Cc: Darius Spitznagel 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71870
> Bugzilla: Khronos #11702
> ---
>  src/glsl/glcpp/glcpp-parse.y   | 22 
> +++---
>  .../tests/086-reserved-macro-names.c.expected  |  4 ++--
>  2 files changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
> index 5bb2891..bdc598f 100644
> --- a/src/glsl/glcpp/glcpp-parse.y
> +++ b/src/glsl/glcpp/glcpp-parse.y
> @@ -1770,11 +1770,27 @@ static void
>  _check_for_reserved_macro_name (glcpp_parser_t *parser, YYLTYPE *loc,
> const char *identifier)
>  {
> -   /* According to the GLSL specification, macro names starting with "__"
> -* or "GL_" are reserved for future use.  So, don't allow them.
> +   /* Section 3.3 (Preprocessor) of the GLSL 1.30 spec (and later) and
> +* the GLSL ES spec (all versions) say:
> +*
> +* "All macro names containing two consecutive underscores ( __ )
> +* are reserved for future use as predefined macro names. All
> +* macro names prefixed with "GL_" ("GL" followed by a single
> +* underscore) are also reserved."
> +*
> +* The intention is that names containing __ are reserved for internal
> +* use by the implementation, and names prefixed with GL_ are reserved
> +* for use by Khronos.  Since every extension adds a name prefixed
> +* with GL_ (i.e., the name of the extension), that should be an
> +* error.  Names simply containing __ are dangerous to use, but should
> +* be allowed.
> +*
> +* A future version of the GLSL specification will clarify this.
>  */
> if (strstr(identifier, "__")) {
> -   glcpp_error (loc, parser, "Macro names containing \"__\" are 
> reserved.\n");
> +   glcpp_warning(loc, parser,
> + "Macro names containing \"__\" are reserved "
> + "for use by the implementation.\n");
> }
> if (strncmp(identifier, "GL_", 3) == 0) {
> glcpp_error (loc, parser, "Macro names starting with \"GL_\" 
> are reserved.\n");
> diff --git a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected 
> b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
> index d8aa9f0..5ca42a9 100644
> --- a/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
> +++ b/src/glsl/glcpp/tests/086-reserved-macro-names.c.expected
> @@ -1,8 +1,8 @@
> -0:1(10): preprocessor error: Macro names containing "__" are reserved.
> +0:1(10): preprocessor warning: Macro names containing "__" are reserved for 
> use by the implementation.
>
>  0:2(9): preprocessor error: Macro names starting with "GL_" are reserved.
>
> -0:3(9): preprocessor error: Macro names containing "__" are reserved.
> +0:3(9): preprocessor warning: Macro names containing "__" are reserved for 
> use by the implementation.
>
>
>
> --
> 1.8.1.4
>
> ___
> mesa-stable mailing list
> mesa-sta...@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-stable

This series is:
Reviewed-by: Anuj Phogat 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] dri: Properly unbind surfaceless contexts

2014-02-18 Thread Alexandros Frantzis
In driUnbindContext(), call the driver UnbindContext function even if
both the draw and read drawables are NULL, since we may be dealing with
a surfaceless context.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74563
---
 src/mesa/drivers/dri/common/dri_util.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/common/dri_util.c 
b/src/mesa/drivers/dri/common/dri_util.c
index d09d50a..20b2c0b 100644
--- a/src/mesa/drivers/dri/common/dri_util.c
+++ b/src/mesa/drivers/dri/common/dri_util.c
@@ -572,15 +572,19 @@ static int driUnbindContext(__DRIcontext *pcp)
 if (pcp == NULL)
return GL_FALSE;
 
+/*
+ * Unbind the context even if pdp and prp are NULL, since
+ * the context may be surfaceless.
+ */
+pcp->driScreenPriv->driver->UnbindContext(pcp);
+
 pdp = pcp->driDrawablePriv;
 prp = pcp->driReadablePriv;
 
-/* already unbound */
+/* already unbound or surfaceless */
 if (!pdp && !prp)
return GL_TRUE;
 
-pcp->driScreenPriv->driver->UnbindContext(pcp);
-
 assert(pdp);
 if (pdp->refcount == 0) {
/* ERROR!!! */
-- 
1.9.rc1

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


Re: [Mesa-dev] [PATCH 04/38] drivers/dri: set the implemented version of __DRItexBufferExtension

2014-02-18 Thread Zhao, Juan J


>-Original Message-
>From: Emil Velikov [mailto:emil.l.veli...@gmail.com]
>Sent: Tuesday, February 18, 2014 7:29 AM
>To: Ilia Mirkin; Zhao, Juan J
>Cc: emil.l.veli...@gmail.com; mesa-dev@lists.freedesktop.org
>Subject: Re: [Mesa-dev] [PATCH 04/38] drivers/dri: set the implemented
>version of __DRItexBufferExtension
>
>On 13/02/14 03:03, Ilia Mirkin wrote:
>> On Wed, Feb 12, 2014 at 9:56 PM, Emil Velikov
> wrote:
>>> On 13/02/14 02:47, Emil Velikov wrote:
 On 13/02/14 02:34, Ilia Mirkin wrote:
> On Wed, Feb 12, 2014 at 8:17 PM, Emil Velikov
> wrote:
>> ... over the version number provided by the headers.
>> Explicitly set extension members to improve clarity.
>
> So... the current value is 2, but I see code that does
>
> src/egl/drivers/dri2/egl_dri2.c:#if __DRI_TEX_BUFFER_VERSION >= 3
> src/glx/dri2_glx.c:#if __DRI_TEX_BUFFER_VERSION >= 3
> src/glx/drisw_glx.c:#if __DRI_TEX_BUFFER_VERSION >= 3
>
> What's that all about?
>
 Chaos wrt documentation and keeping up with it.

 Until git log churns this is the only reasonable thing that I can
>think of:

  - releaseTexBuffer was added with version 3 in mind.
  - no driver implemented the function
  - the version was never bumped or reverted.

>>> Looks like cvs (or whatever was used back in 2009) failure :\
>>>
>>> Eric introduced v2 with commit 66175aac760, bumping the version 1>2
>>> Ian made an update with commit 82634ee8df7, bumping the version 1>2
>>
>> Meh, that's a merge-fail from a long time ago.
>>
>>>
>>> I'll update the header but I'll keep version 2 everywhere (dropping
>>> the null member).
>>
>> releaseTexBuffer was actually introduced with e59fa4c46c8 ("dri2:
>> release texture image."), which also added 2 of the #if's. I'm
>> guessing the third got copy/pasted in.
>>
>Good catch, while the commit effectively adds a new revision of the
>extension if avoids bumping the version number.
>
>At the same time it adds a glx/egl dri2 implementations wrapped in "if
>__DRI_TEX_BUFFER_VERSION >=3". Bumping the version in the header, will
>result in broken build (2) due to missing _eglReleaseTexImage and
>possibly others. With the build issues resolved, the function have some
>runtime cost, despite that no driver implements
>__DRItexBufferExtensionRec::releaseTexBuffer.
>
>
>Juan Zhao
>
>Can you provide some clarity on the case ? Namely with e59fa4c46c8
>("dri2: release texture image.") you've updated the
>__DRItexBufferExtensionRec but the code you've added seems untested.
>
> - Did you deliberately omitted bumping the __DRI_TEX_BUFFER_VERSION,
>what is the idea behind it.
>
> - Is there any plans on implementing _eglReleaseTexImage that is
>required in order to get egl_dri2 building/working ?
>
>IMHO we can safely bump the version in the header, and comment out/drop
>the broken code if no-one is going to step up and clean it.

IIRC, it's to enable texture from pixmap for the TV platform.
It's a patch on 2011, sorry, I cannot remember the details quite well for this 
patch.
Please feel free to make your contribution to make it better.

Best Regards,
Juan

>
>Thanks
>-Emil
>
>
>>   -ilia
>>

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


Re: [Mesa-dev] [PATCH 04/38] drivers/dri: set the implemented version of __DRItexBufferExtension

2014-02-18 Thread Ian Romanick
On 02/12/2014 06:56 PM, Emil Velikov wrote:
> On 13/02/14 02:47, Emil Velikov wrote:
>> On 13/02/14 02:34, Ilia Mirkin wrote:
>>> On Wed, Feb 12, 2014 at 8:17 PM, Emil Velikov  
>>> wrote:
 ... over the version number provided by the headers.
 Explicitly set extension members to improve clarity.
>>>
>>> So... the current value is 2, but I see code that does
>>>
>>> src/egl/drivers/dri2/egl_dri2.c:#if __DRI_TEX_BUFFER_VERSION >= 3
>>> src/glx/dri2_glx.c:#if __DRI_TEX_BUFFER_VERSION >= 3
>>> src/glx/drisw_glx.c:#if __DRI_TEX_BUFFER_VERSION >= 3
>>>
>>> What's that all about?
>>>
>> Chaos wrt documentation and keeping up with it.
>>
>> Until git log churns this is the only reasonable thing that I can think of:
>>
>>  - releaseTexBuffer was added with version 3 in mind.
>>  - no driver implemented the function
>>  - the version was never bumped or reverted.
>>
> Looks like cvs (or whatever was used back in 2009) failure :\
> 
> Eric introduced v2 with commit 66175aac760, bumping the version 1>2
> Ian made an update with commit 82634ee8df7, bumping the version 1>2

These commits each bump something different from 1>2.

It looks like the field was actually added by:

commit e59fa4c46c8857f2e0444dd197464c95b2cb
Author: Juan Zhao 
AuthorDate: Sun Jan 9 12:03:02 2011 -0500
Commit: Kristian Høgsberg 
CommitDate: Sun Jan 9 14:55:16 2011 -0500

dri2: release texture image.

Add release function for texture_from_pixmap extension.
Some platform need to release texture image for texture_from_pixmap
extension, add this interface for those platforms.

Maybe Kristian has some idea?

> I'll update the header but I'll keep version 2 everywhere (dropping the
> null member).
> 
> -Emil
> 
>> -Emil
>>

 Signed-off-by: Emil Velikov 
 ---
  src/mesa/drivers/dri/i915/intel_screen.c  |  2 +-
  src/mesa/drivers/dri/i965/intel_screen.c  |  2 +-
  src/mesa/drivers/dri/nouveau/nouveau_screen.c |  8 +---
  src/mesa/drivers/dri/radeon/radeon_screen.c   | 16 ++--
  src/mesa/drivers/dri/swrast/swrast.c  |  8 +---
  5 files changed, 22 insertions(+), 14 deletions(-)

 diff --git a/src/mesa/drivers/dri/i915/intel_screen.c 
 b/src/mesa/drivers/dri/i915/intel_screen.c
 index 296df16..68ad2b7 100644
 --- a/src/mesa/drivers/dri/i915/intel_screen.c
 +++ b/src/mesa/drivers/dri/i915/intel_screen.c
 @@ -146,7 +146,7 @@ aub_dump_bmp(struct gl_context *ctx)
  }

  static const __DRItexBufferExtension intelTexBufferExtension = {
 -   .base = { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
 +   .base = { __DRI_TEX_BUFFER, 2 },

 .setTexBuffer= intelSetTexBuffer,
 .setTexBuffer2   = intelSetTexBuffer2,
 diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
 b/src/mesa/drivers/dri/i965/intel_screen.c
 index acdb5f3..c7b6c92 100644
 --- a/src/mesa/drivers/dri/i965/intel_screen.c
 +++ b/src/mesa/drivers/dri/i965/intel_screen.c
 @@ -157,7 +157,7 @@ aub_dump_bmp(struct gl_context *ctx)
  }

  static const __DRItexBufferExtension intelTexBufferExtension = {
 -   .base = { __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
 +   .base = { __DRI_TEX_BUFFER, 2 },

 .setTexBuffer= intelSetTexBuffer,
 .setTexBuffer2   = intelSetTexBuffer2,
 diff --git a/src/mesa/drivers/dri/nouveau/nouveau_screen.c 
 b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
 index a381064..3c85918 100644
 --- a/src/mesa/drivers/dri/nouveau/nouveau_screen.c
 +++ b/src/mesa/drivers/dri/nouveau/nouveau_screen.c
 @@ -233,9 +233,11 @@ static const struct __DRI2flushExtensionRec 
 nouveau_flush_extension = {
  };

  static const struct __DRItexBufferExtensionRec 
 nouveau_texbuffer_extension = {
 -{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
 -NULL,
 -nouveau_set_texbuffer,
 +   .base = { __DRI_TEX_BUFFER, 2 },
 +
 +   .setTexBuffer= NULL,
 +   .setTexBuffer2   = nouveau_set_texbuffer,
 +   .releaseTexBuffer= NULL,
  };

  static const __DRIextension *nouveau_screen_extensions[] = {
 diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c 
 b/src/mesa/drivers/dri/radeon/radeon_screen.c
 index 57e866e..8d6840f 100644
 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c
 +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c
 @@ -170,15 +170,19 @@ radeonGetParam(__DRIscreen *sPriv, int param, void 
 *value)

  #if defined(RADEON_R100)
  static const __DRItexBufferExtension radeonTexBufferExtension = {
 -{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
 -   radeonSetTexBuffer,
 -   radeonSetTexBuffer2,
 +   .base = { __DRI_TEX_BUFFER, 2 },
 +
 +   .setTexBuffer= radeonSetTexBuffer,
 +   .setTexBuffer2   = radeonSetTexBuffer2,
 +   .releaseTexBuffer   

Re: [Mesa-dev] [PATCH 03/38] dri_interface: note introduction of various __DRItexBufferExtension members

2014-02-18 Thread Ian Romanick
On 02/12/2014 05:17 PM, Emil Velikov wrote:
> Note the member function releaseTexBuffer was added without
> bumping spec version, and currently no drivers implement it.
> 
> Signed-off-by: Emil Velikov 
> ---
>  include/GL/internal/dri_interface.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/GL/internal/dri_interface.h 
> b/include/GL/internal/dri_interface.h
> index 9e82904..7d22654 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -251,6 +251,9 @@ struct __DRItexBufferExtensionRec {
>   * __DRIdrawable, including the required texture format attribute.
>   *
>   * For GLX_EXT_texture_from_pixmap with AIGLX.
> + *
> + * \since 2
> + *

I'd remove the extra blank line after each of these.  With that changed,

Reviewed-by: Ian Romanick 

>   */
>  void (*setTexBuffer2)(__DRIcontext *pDRICtx,
> GLint target,
> @@ -261,6 +264,9 @@ struct __DRItexBufferExtensionRec {
>   * need this.
>   *
>   * For GLX_EXT_texture_from_pixmap with AIGLX.
> + *
> + * \since 2+ (no specific release)
> + *
>   */
>  void (*releaseTexBuffer)(__DRIcontext *pDRICtx,
>   GLint target,
> 

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


Re: [Mesa-dev] [PATCH 01/38] dri_util: explicitly set __DRIswrastExtension members.

2014-02-18 Thread Ian Romanick
Patches 1 and 2 are

Reviewed-by: Ian Romanick 

On 02/12/2014 05:17 PM, Emil Velikov wrote:
> Signed-off-by: Emil Velikov 
> ---
>  src/mesa/drivers/dri/common/dri_util.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/common/dri_util.c 
> b/src/mesa/drivers/dri/common/dri_util.c
> index d09d50a..0aa997e 100644
> --- a/src/mesa/drivers/dri/common/dri_util.c
> +++ b/src/mesa/drivers/dri/common/dri_util.c
> @@ -768,12 +768,13 @@ const __DRIdri2Extension driDRI2Extension = {
>  };
>  
>  const __DRIswrastExtension driSWRastExtension = {
> -{ __DRI_SWRAST, 4 },
> -driSWRastCreateNewScreen,
> -driCreateNewDrawable,
> -driCreateNewContextForAPI,
> -driCreateContextAttribs,
> -driSWRastCreateNewScreen2,
> +.base = { __DRI_SWRAST, 4 },
> +
> +.createNewScreen= driSWRastCreateNewScreen,
> +.createNewDrawable  = driCreateNewDrawable,
> +.createNewContextForAPI = driCreateNewContextForAPI,
> +.createContextAttribs   = driCreateContextAttribs,
> +.createNewScreen2   = driSWRastCreateNewScreen2,
>  };
>  
>  const __DRI2configQueryExtension dri2ConfigQueryExtension = {
> 

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


Re: [Mesa-dev] [PATCH 06/38] dri_interface: note introduction of __DRIdri2LoaderExtension members

2014-02-18 Thread Ian Romanick
On 02/12/2014 05:17 PM, Emil Velikov wrote:
> Signed-off-by: Emil Velikov 
> ---
>  include/GL/internal/dri_interface.h | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/include/GL/internal/dri_interface.h 
> b/include/GL/internal/dri_interface.h
> index 7d22654..5b333a1 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -854,6 +854,9 @@ struct __DRIdri2LoaderExtensionRec {
>   * \param driDrawableDrawable whose front-buffer is to be flushed
>   * \param loaderPrivate  Loader's private data that was previously passed
>   *   into __DRIdri2ExtensionRec::createNewDrawable
> + *
> + * \since 2
> + *

I'd remove the extra blank line after each of these.  With that changed,

Reviewed-by: Ian Romanick 

>   */
>  void (*flushFrontBuffer)(__DRIdrawable *driDrawable, void 
> *loaderPrivate);
>  
> @@ -876,6 +879,9 @@ struct __DRIdri2LoaderExtensionRec {
>   *   \c attachments.
>   * \param loaderPrivate  Loader's private data that was previously passed
>   *   into __DRIdri2ExtensionRec::createNewDrawable.
> + *
> + * \since 3
> + *
>   */
>  __DRIbuffer *(*getBuffersWithFormat)(__DRIdrawable *driDrawable,
>int *width, int *height,
> 

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


Re: [Mesa-dev] [PATCH 05/38] st/dri: set the implemented version of __DRItexBufferExtension

2014-02-18 Thread Ian Romanick
On 02/12/2014 05:17 PM, Emil Velikov wrote:
> ... over the version number provided by the headers.
> 
> Explicitly set extension members to improve clarity.
> 
> Signed-off-by: Emil Velikov 

Reviewed-by: Ian Romanick 

But you might also wait for an R-b from someone that works on that code.

> ---
>  src/gallium/state_trackers/dri/common/dri_drawable.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c 
> b/src/gallium/state_trackers/dri/common/dri_drawable.c
> index a399938..074321d 100644
> --- a/src/gallium/state_trackers/dri/common/dri_drawable.c
> +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
> @@ -258,10 +258,11 @@ dri_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
>  }
>  
>  const __DRItexBufferExtension driTexBufferExtension = {
> -{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
> -   dri_set_tex_buffer,
> -   dri_set_tex_buffer2,
> -   NULL,
> +   .base = { __DRI_TEX_BUFFER, 2 },
> +
> +   .setTexBuffer   = dri_set_tex_buffer,
> +   .setTexBuffer2  = dri_set_tex_buffer2,
> +   .releaseTexBuffer   = NULL,
>  };
>  
>  /**
> 

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


Re: [Mesa-dev] [PATCH 05/38] st/dri: set the implemented version of __DRItexBufferExtension

2014-02-18 Thread Ian Romanick
On 02/18/2014 06:01 PM, Ian Romanick wrote:
> On 02/12/2014 05:17 PM, Emil Velikov wrote:
>> ... over the version number provided by the headers.
>>
>> Explicitly set extension members to improve clarity.
>>
>> Signed-off-by: Emil Velikov 
> 
> Reviewed-by: Ian Romanick 
> 
> But you might also wait for an R-b from someone that works on that code.

In particular, I think people compile this code with MSVC, and I don't
think it supports designated initializers.

>> ---
>>  src/gallium/state_trackers/dri/common/dri_drawable.c | 9 +
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/gallium/state_trackers/dri/common/dri_drawable.c 
>> b/src/gallium/state_trackers/dri/common/dri_drawable.c
>> index a399938..074321d 100644
>> --- a/src/gallium/state_trackers/dri/common/dri_drawable.c
>> +++ b/src/gallium/state_trackers/dri/common/dri_drawable.c
>> @@ -258,10 +258,11 @@ dri_set_tex_buffer(__DRIcontext *pDRICtx, GLint target,
>>  }
>>  
>>  const __DRItexBufferExtension driTexBufferExtension = {
>> -{ __DRI_TEX_BUFFER, __DRI_TEX_BUFFER_VERSION },
>> -   dri_set_tex_buffer,
>> -   dri_set_tex_buffer2,
>> -   NULL,
>> +   .base = { __DRI_TEX_BUFFER, 2 },
>> +
>> +   .setTexBuffer   = dri_set_tex_buffer,
>> +   .setTexBuffer2  = dri_set_tex_buffer2,
>> +   .releaseTexBuffer   = NULL,
>>  };
>>  
>>  /**
>>
> 

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


Re: [Mesa-dev] [PATCH 18/38] glx/dri: use the implemented version of __DRIdamageExtension

2014-02-18 Thread Ian Romanick
Patches 7 through 19 are

Reviewed-by: Ian Romanick 

with the same caveats on patches 9 and 11 as for patch 5.

On 02/12/2014 05:17 PM, Emil Velikov wrote:
> ... over the one provided by the headers.
> Explicitly set extension members to improve clarity.
> 
> Signed-off-by: Emil Velikov 
> ---
>  src/glx/dri_glx.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
> index 8593750..3b7502d 100644
> --- a/src/glx/dri_glx.c
> +++ b/src/glx/dri_glx.c
> @@ -271,8 +271,9 @@ __glXReportDamage(__DRIdrawable * driDraw,
>  }
>  
>  static const __DRIdamageExtension damageExtension = {
> -   {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
> -   __glXReportDamage,
> +   .base = {__DRI_DAMAGE, 1 },
> +
> +   .reportDamage= __glXReportDamage,
>  };
>  
>  #endif
> 

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


Re: [Mesa-dev] [PATCH 18/38] glx/dri: use the implemented version of __DRIdamageExtension

2014-02-18 Thread Ian Romanick
On 02/18/2014 06:05 PM, Ian Romanick wrote:
> Patches 7 through 19 are
^^ 18

> Reviewed-by: Ian Romanick 
> 
> with the same caveats on patches 9 and 11 as for patch 5.
> 
> On 02/12/2014 05:17 PM, Emil Velikov wrote:
>> ... over the one provided by the headers.
>> Explicitly set extension members to improve clarity.
>>
>> Signed-off-by: Emil Velikov 
>> ---
>>  src/glx/dri_glx.c | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
>> index 8593750..3b7502d 100644
>> --- a/src/glx/dri_glx.c
>> +++ b/src/glx/dri_glx.c
>> @@ -271,8 +271,9 @@ __glXReportDamage(__DRIdrawable * driDraw,
>>  }
>>  
>>  static const __DRIdamageExtension damageExtension = {
>> -   {__DRI_DAMAGE, __DRI_DAMAGE_VERSION},
>> -   __glXReportDamage,
>> +   .base = {__DRI_DAMAGE, 1 },
>> +
>> +   .reportDamage= __glXReportDamage,
>>  };
>>  
>>  #endif
>>
> 

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


  1   2   >