Re: [Mesa-dev] [PATCH 1/2] i965/skl: Upload qpitch in pixels for 1D textures

2015-02-18 Thread Neil Roberts
Ben Widawsky b...@bwidawsk.net writes:

 I promise to look at this again in more detail tomorrow when I am more
 awake, but meanwhile, I'd be very much in favor of just setting
 mt-qpith for all miptree layout types.

I'm not sure what you mean. Do you mean that we should just always set
mt-qpitch to the actual value that we're going to upload? Yes, that
seems like a good idea. I was originally worried about that because I
had thought that other bits of code were looking at the qpitch to work
out some offsets but that is not the case.

The qpitch seems to also be broken for 3D textures and compressed
textures so I think it might be a good idea to squash this patch into a
general patch which fixes everything. I made a start on that as part of
fixing the copyteximage test for 3D textures here:

https://github.com/bpeel/mesa/commit/fc95546c49f0e5c5805139712c51a0d13b2183c3

I don't want to post the patch to the mailing list yet because it
doesn't fix the test for the GL_RGBA32 format with 3D textures and I'd
like to work out why first.

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


Re: [Mesa-dev] [PATCH 1/2] i965/skl: Upload qpitch in pixels for 1D textures

2015-02-18 Thread Ben Widawsky
On Wed, Feb 18, 2015 at 07:13:54PM +, Neil Roberts wrote:
 Ben Widawsky b...@bwidawsk.net writes:
 
  I promise to look at this again in more detail tomorrow when I am more
  awake, but meanwhile, I'd be very much in favor of just setting
  mt-qpith for all miptree layout types.
 
 I'm not sure what you mean. Do you mean that we should just always set
 mt-qpitch to the actual value that we're going to upload? Yes, that
 seems like a good idea. I was originally worried about that because I
 had thought that other bits of code were looking at the qpitch to work
 out some offsets but that is not the case.
 

That was what I meant - it was very poorly stated.

 The qpitch seems to also be broken for 3D textures and compressed
 textures so I think it might be a good idea to squash this patch into a
 general patch which fixes everything. I made a start on that as part of
 fixing the copyteximage test for 3D textures here:
 
 https://github.com/bpeel/mesa/commit/fc95546c49f0e5c5805139712c51a0d13b2183c3
 
 I don't want to post the patch to the mailing list yet because it
 doesn't fix the test for the GL_RGBA32 format with 3D textures and I'd
 like to work out why first.
 
 Regards,
 - Neil

Okay. I got distracted today trying to help Chris debug TS anyway. A squash
sounds good to me, but I presume it's still worth reviewing these anyway - which
I will do ASAP.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] i965/skl: Upload qpitch in pixels for 1D textures

2015-02-17 Thread Ben Widawsky
On Tue, Feb 17, 2015 at 02:03:36PM +, Neil Roberts wrote:
 According to the bspec since Skylake the qpitch value in the surface
 formats should be measured in pixels rather than rows for 1D textures.
 ---
  src/mesa/drivers/dri/i965/gen8_surface_state.c | 30 
 +++---
  1 file changed, 27 insertions(+), 3 deletions(-)
 
 diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c 
 b/src/mesa/drivers/dri/i965/gen8_surface_state.c
 index d6b870e..4132b9b 100644
 --- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
 +++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
 @@ -145,6 +145,24 @@ gen8_emit_buffer_surface_state(struct brw_context *brw,
 }
  }
  
 +static uint32_t
 +qpitch_for_mt(struct brw_context *brw,
 +  struct intel_mipmap_tree *mt,
 +  uint32_t surf_type)
 +{
 +   uint32_t qpitch = mt-qpitch;
 +
 +   /* On Skylake+ for 1D linear surfaces the qpitch is measured in pixels
 +* rather than rows
 +*/
 +   if (brw-gen = 9 
 +   surf_type == BRW_SURFACE_1D 
 +   mt-tiling == I915_TILING_NONE)
 +  qpitch *= mt-total_width;
 +
 +   return qpitch;
 +}
 +

I promise to look at this again in more detail tomorrow when I am more awake,
but meanwhile, I'd be very much in favor of just setting mt-qpith for all
miptree layout types.

  static void
  gen8_update_texture_surface(struct gl_context *ctx,
  unsigned unit,
 @@ -197,7 +215,11 @@ gen8_update_texture_surface(struct gl_context *ctx,
  
 uint32_t *surf = allocate_surface_state(brw, surf_offset);
  
 -   surf[0] = translate_tex_target(tObj-Target)  BRW_SURFACE_TYPE_SHIFT |
 +   uint32_t surf_type = translate_tex_target(tObj-Target);
 +
 +   uint32_t qpitch = qpitch_for_mt(brw, mt, surf_type);
 +
 +   surf[0] = surf_type  BRW_SURFACE_TYPE_SHIFT |
   tex_format  BRW_SURFACE_FORMAT_SHIFT |
   vertical_alignment(mt) |
   horizontal_alignment(mt) |
 @@ -211,7 +233,7 @@ gen8_update_texture_surface(struct gl_context *ctx,
 if (mt-logical_depth0  1  tObj-Target != GL_TEXTURE_3D)
surf[0] |= GEN8_SURFACE_IS_ARRAY;
  
 -   surf[1] = SET_FIELD(mocs_wb, GEN8_SURFACE_MOCS) | mt-qpitch  2;
 +   surf[1] = SET_FIELD(mocs_wb, GEN8_SURFACE_MOCS) | qpitch  2;
  
 surf[2] = SET_FIELD(mt-logical_width0 - 1, GEN7_SURFACE_WIDTH) |
   SET_FIELD(mt-logical_height0 - 1, GEN7_SURFACE_HEIGHT);
 @@ -390,6 +412,8 @@ gen8_update_renderbuffer_surface(struct brw_context *brw,
 uint32_t *surf =
allocate_surface_state(brw, brw-wm.base.surf_offset[surf_index]);
  
 +   uint32_t qpitch = qpitch_for_mt(brw, mt, surf_type);
 +
 surf[0] = (surf_type  BRW_SURFACE_TYPE_SHIFT) |
   (is_array ? GEN7_SURFACE_IS_ARRAY : 0) |
   (format  BRW_SURFACE_FORMAT_SHIFT) |
 @@ -397,7 +421,7 @@ gen8_update_renderbuffer_surface(struct brw_context *brw,
   horizontal_alignment(mt) |
   surface_tiling_mode(tiling);
  
 -   surf[1] = SET_FIELD(mocs, GEN8_SURFACE_MOCS) | mt-qpitch  2;
 +   surf[1] = SET_FIELD(mocs, GEN8_SURFACE_MOCS) | qpitch  2;
  
 surf[2] = SET_FIELD(width - 1, GEN7_SURFACE_WIDTH) |
   SET_FIELD(height - 1, GEN7_SURFACE_HEIGHT);
 -- 
 1.9.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


[Mesa-dev] [PATCH 1/2] i965/skl: Upload qpitch in pixels for 1D textures

2015-02-17 Thread Neil Roberts
According to the bspec since Skylake the qpitch value in the surface
formats should be measured in pixels rather than rows for 1D textures.
---
 src/mesa/drivers/dri/i965/gen8_surface_state.c | 30 +++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c 
b/src/mesa/drivers/dri/i965/gen8_surface_state.c
index d6b870e..4132b9b 100644
--- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
@@ -145,6 +145,24 @@ gen8_emit_buffer_surface_state(struct brw_context *brw,
}
 }
 
+static uint32_t
+qpitch_for_mt(struct brw_context *brw,
+  struct intel_mipmap_tree *mt,
+  uint32_t surf_type)
+{
+   uint32_t qpitch = mt-qpitch;
+
+   /* On Skylake+ for 1D linear surfaces the qpitch is measured in pixels
+* rather than rows
+*/
+   if (brw-gen = 9 
+   surf_type == BRW_SURFACE_1D 
+   mt-tiling == I915_TILING_NONE)
+  qpitch *= mt-total_width;
+
+   return qpitch;
+}
+
 static void
 gen8_update_texture_surface(struct gl_context *ctx,
 unsigned unit,
@@ -197,7 +215,11 @@ gen8_update_texture_surface(struct gl_context *ctx,
 
uint32_t *surf = allocate_surface_state(brw, surf_offset);
 
-   surf[0] = translate_tex_target(tObj-Target)  BRW_SURFACE_TYPE_SHIFT |
+   uint32_t surf_type = translate_tex_target(tObj-Target);
+
+   uint32_t qpitch = qpitch_for_mt(brw, mt, surf_type);
+
+   surf[0] = surf_type  BRW_SURFACE_TYPE_SHIFT |
  tex_format  BRW_SURFACE_FORMAT_SHIFT |
  vertical_alignment(mt) |
  horizontal_alignment(mt) |
@@ -211,7 +233,7 @@ gen8_update_texture_surface(struct gl_context *ctx,
if (mt-logical_depth0  1  tObj-Target != GL_TEXTURE_3D)
   surf[0] |= GEN8_SURFACE_IS_ARRAY;
 
-   surf[1] = SET_FIELD(mocs_wb, GEN8_SURFACE_MOCS) | mt-qpitch  2;
+   surf[1] = SET_FIELD(mocs_wb, GEN8_SURFACE_MOCS) | qpitch  2;
 
surf[2] = SET_FIELD(mt-logical_width0 - 1, GEN7_SURFACE_WIDTH) |
  SET_FIELD(mt-logical_height0 - 1, GEN7_SURFACE_HEIGHT);
@@ -390,6 +412,8 @@ gen8_update_renderbuffer_surface(struct brw_context *brw,
uint32_t *surf =
   allocate_surface_state(brw, brw-wm.base.surf_offset[surf_index]);
 
+   uint32_t qpitch = qpitch_for_mt(brw, mt, surf_type);
+
surf[0] = (surf_type  BRW_SURFACE_TYPE_SHIFT) |
  (is_array ? GEN7_SURFACE_IS_ARRAY : 0) |
  (format  BRW_SURFACE_FORMAT_SHIFT) |
@@ -397,7 +421,7 @@ gen8_update_renderbuffer_surface(struct brw_context *brw,
  horizontal_alignment(mt) |
  surface_tiling_mode(tiling);
 
-   surf[1] = SET_FIELD(mocs, GEN8_SURFACE_MOCS) | mt-qpitch  2;
+   surf[1] = SET_FIELD(mocs, GEN8_SURFACE_MOCS) | qpitch  2;
 
surf[2] = SET_FIELD(width - 1, GEN7_SURFACE_WIDTH) |
  SET_FIELD(height - 1, GEN7_SURFACE_HEIGHT);
-- 
1.9.3

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