[Mesa-dev] [PATCH] i965: Fix depth field setting in surface state for raw buffer on Gen7/8
Kristian Høgsberg
krh at bitplanet.net
Tue Apr 7 09:18:08 PDT 2015
On Mon, Apr 6, 2015 at 10:51 PM, Zhenyu Wang <zhenyuw at linux.intel.com> wrote:
> On Gen7/8 for RAW surface format, the depth field (surf[3]) in surface
> state means [30:21] bits of number of entries which is different from
> other surface format which uses [26:21] bits field.
>
> Signed-off-by: Zhenyu Wang <zhenyuw at linux.intel.com>
Is there a bugzilla that this fixes we can link from the commit
message? Either way, this looks good.
Reviewed-by: Kristian Høgsberg <krh at bitplanet.net>
> ---
> src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 7 +++++--
> src/mesa/drivers/dri/i965/gen8_surface_state.c | 7 +++++--
> 2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> index d9361d3..18bcb8a 100644
> --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> @@ -238,8 +238,11 @@ gen7_emit_buffer_surface_state(struct brw_context *brw,
> surf[1] = (bo ? bo->offset64 : 0) + buffer_offset; /* reloc */
> surf[2] = SET_FIELD((buffer_size - 1) & 0x7f, GEN7_SURFACE_WIDTH) |
> SET_FIELD(((buffer_size - 1) >> 7) & 0x3fff, GEN7_SURFACE_HEIGHT);
> - surf[3] = SET_FIELD(((buffer_size - 1) >> 21) & 0x3f, BRW_SURFACE_DEPTH) |
> - (pitch - 1);
> + if (surface_format == BRW_SURFACEFORMAT_RAW)
> + surf[3] = SET_FIELD(((buffer_size - 1) >> 21) & 0x3ff, BRW_SURFACE_DEPTH);
> + else
> + surf[3] = SET_FIELD(((buffer_size - 1) >> 21) & 0x3f, BRW_SURFACE_DEPTH);
> + surf[3] |= (pitch - 1);
>
> surf[5] = SET_FIELD(GEN7_MOCS_L3, GEN7_SURFACE_MOCS);
>
> diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> index 0007c95..ba59b05 100644
> --- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
> @@ -129,8 +129,11 @@ gen8_emit_buffer_surface_state(struct brw_context *brw,
>
> surf[2] = SET_FIELD((buffer_size - 1) & 0x7f, GEN7_SURFACE_WIDTH) |
> SET_FIELD(((buffer_size - 1) >> 7) & 0x3fff, GEN7_SURFACE_HEIGHT);
> - surf[3] = SET_FIELD(((buffer_size - 1) >> 21) & 0x3f, BRW_SURFACE_DEPTH) |
> - (pitch - 1);
> + if (surface_format == BRW_SURFACEFORMAT_RAW)
> + surf[3] = SET_FIELD(((buffer_size - 1) >> 21) & 0x3ff, BRW_SURFACE_DEPTH);
> + else
> + surf[3] = SET_FIELD(((buffer_size - 1) >> 21) & 0x3f, BRW_SURFACE_DEPTH);
> + surf[3] |= (pitch - 1);
> surf[7] = SET_FIELD(HSW_SCS_RED, GEN7_SURFACE_SCS_R) |
> SET_FIELD(HSW_SCS_GREEN, GEN7_SURFACE_SCS_G) |
> SET_FIELD(HSW_SCS_BLUE, GEN7_SURFACE_SCS_B) |
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list