[Mesa-dev] [wip 2/2] i965/gen7+ Remove tile_x and tile_y dependency in BLORP

2013-12-29 Thread Topi Pohjolainen
From: Abdiel Janulgue 

GEN7+-specific hw-support. This can be copied over to GEN8/Broadwell with few
modifications.

v2 (Topi):

I looked into the piglit failures and compared the surface
setup logic into "gen7_update_texture/renderbuffer_surface()".
Here are some of my findings:

Use the 'is_render_target' argument instead of introducing its
negate 'is_source'.

Keep on using the surface dimensions instead of logical for w-tiled
stencil. Piglit tests revealed cases where the logical dimensions
were 16x16 but dimensions set for the surface were 8x32 and 16x64,
for example.

  ext_framebuffer_multisample-accuracy 4 color depthstencil

Further examination of piglit tests highlighted cases where the
"intel_mipmap_tree::num_samples" is greater than one. In such a
case physical dimensions equaled the dimensions set for the surface
but I thought safer to keep on using the surface dimensions instead
(such as before).

Added the layer settings mimicking the logic in
"gen7_update_renderbuffer_surface()" - needed for 2d_array cases.

  gl-3.2-layered-rendering-clear-color-all-types 2d_array single_level
  gl-3.2-layered-rendering-clear-color-all-types 2d_array mipmapped

Added support for clearing texture_3d - surface type and surface
depth settings.

  gl-3.2-layered-rendering-clear-color-all-types 3d mipmapped

Blitting from layers other zero for texture_3d needs some more work.
I modified 'brw_blorp_blit_miptrees()' to resolve the surface type
the same way I did for clear. That, however, was not sufficient.
If I'm not mistaken one would also need changes in the sampler
message to tell the sampler which layer is to be accessed.

  gl-3.2-layered-rendering-blit -fbo -auto

Signed-off-by: Abdiel Janulgue 
---
 src/mesa/drivers/dri/i965/gen7_blorp.cpp | 36 +++-
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp 
b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
index c687454..c310120 100644
--- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp
@@ -142,15 +142,14 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
   bool is_render_target)
 {
uint32_t wm_surf_offset;
-   uint32_t width = surface->width;
-   uint32_t height = surface->height;
+   uint32_t width = surface->mt->logical_width0;
+   uint32_t height = surface->mt->logical_height0;
/* Note: since gen7 uses INTEL_MSAA_LAYOUT_CMS or INTEL_MSAA_LAYOUT_UMS for
 * color surfaces, width and height are measured in pixels; we don't need
 * to divide them by 2 as we do for Gen6 (see
 * gen6_blorp_emit_surface_state).
 */
struct intel_region *region = surface->mt->region;
-   uint32_t tile_x, tile_y;
const uint8_t mocs = GEN7_MOCS_L3;
 
uint32_t tiling = surface->map_stencil_as_y_tiled
@@ -160,7 +159,7 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
   brw_state_batch(brw, AUB_TRACE_SURFACE_STATE, 8 * 4, 32, 
&wm_surf_offset);
memset(surf, 0, 8 * 4);
 
-   surf[0] = BRW_SURFACE_2D << BRW_SURFACE_TYPE_SHIFT |
+   surf[0] = surface->surftype << BRW_SURFACE_TYPE_SHIFT |
  surface->brw_surfaceformat << BRW_SURFACE_FORMAT_SHIFT |
  gen7_surface_tiling_mode(tiling);
 
@@ -175,27 +174,36 @@ gen7_blorp_emit_surface_state(struct brw_context *brw,
   surf[0] |= GEN7_SURFACE_ARYSPC_FULL;
 
/* reloc */
-   surf[1] =
-  surface->compute_tile_offsets(&tile_x, &tile_y) + region->bo->offset;
+   surf[1] = region->bo->offset;
 
-   /* Note that the low bits of these fields are missing, so
-* there's the possibility of getting in trouble.
+   /* W-tiled stencil buffers that are treated as Y-tiled have corresponding
+* Y-tiling compatible dimensions in the surface - use them instead of
+* logical.
+* Multi-sampled surfaces are also special, use the surface dimensions
+* instead.
 */
-   assert(tile_x % 4 == 0);
-   assert(tile_y % 2 == 0);
-   surf[5] = SET_FIELD(tile_x / 4, BRW_SURFACE_X_OFFSET) |
- SET_FIELD(tile_y / 2, BRW_SURFACE_Y_OFFSET) |
- SET_FIELD(mocs, GEN7_SURFACE_MOCS);
+   if (surface->map_stencil_as_y_tiled || surface->mt->num_samples) {
+  width = surface->width;
+  height = surface->height;
+   }
 
surf[2] = SET_FIELD(width - 1, GEN7_SURFACE_WIDTH) |
  SET_FIELD(height - 1, GEN7_SURFACE_HEIGHT);
 
+   surf[5] = SET_FIELD(mocs, GEN7_SURFACE_MOCS) | surface->level;
+   if (!is_render_target)
+  surf[5] |= SET_FIELD(surface->level, GEN7_SURFACE_MIN_LOD);
+
uint32_t pitch_bytes = region->pitch;
if (surface->map_stencil_as_y_tiled)
   pitch_bytes *= 2;
-   surf[3] = pitch_bytes - 1;
+   surf[3] = SET_FIELD(surface->mt->logical_depth0 - 1, BRW_SURFACE_DEPTH) |
+ (pitch_bytes - 1);
 
surf[4] = gen7_surface_msaa_bits(surface->num_samples, 
surface->msaa_layout);
+   if (is_render_target)
+  surf[4] |= (surface->layer << GEN7_SURFACE_MI

[Mesa-dev] [wip 1/2] i965/blorp: allow clear programs to use surface types other than 2D

2013-12-29 Thread Topi Pohjolainen
Signed-off-by: Topi Pohjolainen 
---
 src/mesa/drivers/dri/i965/brw_blorp.cpp   |  3 ++-
 src/mesa/drivers/dri/i965/brw_blorp.h |  5 +
 src/mesa/drivers/dri/i965/brw_blorp_clear.cpp | 13 +
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_blorp.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp.cpp
index ab3e75c..1e6ff82 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp.cpp
@@ -46,7 +46,8 @@ brw_blorp_mip_info::brw_blorp_mip_info()
 
 brw_blorp_surface_info::brw_blorp_surface_info()
: map_stencil_as_y_tiled(false),
- num_samples(0)
+ num_samples(0),
+ surftype(BRW_SURFACE_2D)
 {
 }
 
diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h 
b/src/mesa/drivers/dri/i965/brw_blorp.h
index 1030e4e..1aa0670 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp.h
+++ b/src/mesa/drivers/dri/i965/brw_blorp.h
@@ -165,6 +165,11 @@ public:
 * surface state for this surface.
 */
intel_msaa_layout msaa_layout;
+
+   /**
+* Defaults to BRW_SURFACE_2D but is explicitly altered for clear programs.
+*/
+   uint32_t surftype;
 };
 
 
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp 
b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
index 072ad55..e42b9e3 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_clear.cpp
@@ -179,6 +179,18 @@ compute_fast_clear_color_bits(const union gl_color_union 
*color)
return bits;
 }
 
+static uint32_t
+resolve_surface_type(const struct gl_renderbuffer *rb)
+{
+   GLenum gl_target = rb->TexImage ? rb->TexImage->TexObject->Target :
+ GL_TEXTURE_2D;
+
+   if (gl_target == GL_TEXTURE_CUBE_MAP_ARRAY ||
+   gl_target == GL_TEXTURE_CUBE_MAP)
+  return BRW_SURFACE_2D;
+
+   return translate_tex_target(gl_target);
+}
 
 brw_blorp_clear_params::brw_blorp_clear_params(struct brw_context *brw,
struct gl_framebuffer *fb,
@@ -191,6 +203,7 @@ brw_blorp_clear_params::brw_blorp_clear_params(struct 
brw_context *brw,
struct intel_renderbuffer *irb = intel_renderbuffer(rb);
 
dst.set(brw, irb->mt, irb->mt_level, layer, true);
+   dst.surftype = resolve_surface_type(rb);
 
/* Override the surface format according to the context's sRGB rules. */
gl_format format = _mesa_get_render_format(ctx, irb->mt->format);
-- 
1.8.3.1

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


[Mesa-dev] [Bug 73136] [BISECTED] commit "mesa: Dynamically allocate the storage for program local parameters." crashes Awesomenauts

2013-12-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=73136

Alexandre Demers  changed:

   What|Removed |Added

   Hardware|Other   |All

-- 
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 73136] New: [BISECTED] commit "mesa: Dynamically allocate the storage for program local parameters." crashes Awesomenauts

2013-12-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=73136

  Priority: medium
Bug ID: 73136
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: [BISECTED] commit "mesa: Dynamically allocate the
storage for program local parameters." crashes
Awesomenauts
  Severity: normal
Classification: Unclassified
OS: All
  Reporter: alexandre.f.dem...@gmail.com
  Hardware: Other
Status: NEW
   Version: git
 Component: Mesa core
   Product: Mesa

Awesomenauts has been crashing on launch since a couple of weeks. I took time
to bisect and I found out tonight where it was coming from.

First bad commit is e5885c119de1e508099cce1c9f8ff00fab88

mesa: Dynamically allocate the storage for program local parameters.
Author
Eric Anholt
Author date
9/20/13 1:13 PM
Parent
mesa: Remove PROGRAM_ENV_PARAM enum.


mesa: Dynamically allocate the storage for program local parameters.

The array was 64kb per struct gl_program, plus we statically stored a copy
of one on disk for _mesa_DummyProgram.  Given that most struct gl_programs
we generate are for GLSL shaders that don't have local parameters, this
was a waste.

Since you can store and fetch parameters beyond what the program actually
uses, we do have to do a late allocation if necessary at
GetProgramLocalParameter time.

Reduces peak memory usage in the dota2 trace I made by 76MB (4.5%)

Reviewed-by: Brian Paul 
Reviewed-by: Ian Romanick 



Tested using latest code for drm and ddx from git on ArchLinux 64bit on an
HD6950

-- 
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 70591] glxext.h:275: error: redefinition of typedef ‘GLXContextID’

2013-12-29 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=70591

Kenneth Graunke  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|FIXED   |---

--- Comment #3 from Kenneth Graunke  ---
Applications such as Allergo rely on this typedef existing in glx.h, and
removing it apparently breaks their application's build.

Mesa builds fine without Vinson's patch for me, using GCC on Linux, so for now
I've gone ahead and reverted it from master.

The typedef is really part of GLX proper, and not an extension, so it seems
like it belongs in glx.h with the others, not glxext.h.

I'm reopening this bug because presumably Vinson's issue is back.  Hopefully we
can come up with another solution.

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