[Mesa-dev] [PATCH 14/24] i965: Define vtbl method that initializes an untyped R/W surface.
Paul Berry
stereotype441 at gmail.com
Thu Sep 19 11:13:21 PDT 2013
On 15 September 2013 00:10, Francisco Jerez <currojerez at riseup.net> wrote:
> And add Gen7 implementation.
> ---
> src/mesa/drivers/dri/i965/brw_context.h | 7 +++++
> src/mesa/drivers/dri/i965/gen7_wm_surface_state.c | 35
> +++++++++++++++++++----
> 2 files changed, 37 insertions(+), 5 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.h
> b/src/mesa/drivers/dri/i965/brw_context.h
> index 108e98c..3003d15 100644
> --- a/src/mesa/drivers/dri/i965/brw_context.h
> +++ b/src/mesa/drivers/dri/i965/brw_context.h
> @@ -895,6 +895,13 @@ struct brw_context
> uint32_t *out_offset,
> bool dword_pitch);
>
> + void (*create_raw_surface)(struct brw_context *brw,
> + drm_intel_bo *bo,
> + uint32_t offset,
> + uint32_t size,
> + uint32_t *out_offset,
> + bool rw);
> +
> /** Upload a SAMPLER_STATE table. */
> void (*upload_sampler_state_table)(struct brw_context *brw,
> struct gl_program *prog,
> 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 8f95abe..8b86387 100644
> --- a/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/gen7_wm_surface_state.c
> @@ -232,7 +232,8 @@ gen7_emit_buffer_surface_state(struct brw_context *brw,
> unsigned surface_format,
> unsigned buffer_size,
> unsigned pitch,
> - unsigned mocs)
> + unsigned mocs,
> + bool rw)
> {
> uint32_t *surf = brw_state_batch(brw, AUB_TRACE_SURFACE_STATE,
> 8 * 4, 32, out_offset);
> @@ -251,7 +252,8 @@ gen7_emit_buffer_surface_state(struct brw_context *brw,
>
> /* Emit relocation to surface contents */
> drm_intel_bo_emit_reloc(brw->batch.bo, *out_offset + 4,
> - bo, buffer_offset, I915_GEM_DOMAIN_SAMPLER, 0);
> + bo, buffer_offset, I915_GEM_DOMAIN_SAMPLER,
> + (rw ? I915_GEM_DOMAIN_SAMPLER : 0));
>
> gen7_check_surface_setup(surf, false /* is_render_target */);
> }
> @@ -348,7 +350,8 @@ gen7_update_buffer_texture_surface(struct gl_context
> *ctx,
> surface_format,
> w,
> texel_size,
> - 0 /* mocs */);
> + 0 /* mocs */,
> + false /* rw */);
> }
>
> static void
> @@ -429,7 +432,27 @@ gen7_create_constant_surface(struct brw_context *brw,
> BRW_SURFACEFORMAT_R32G32B32A32_FLOAT,
> elements - 1,
> stride,
> - 0 /* mocs */);
> + 0 /* mocs */,
> + false /* rw */);
> +}
> +
> +/**
> + * Create a raw surface for untyped R/W access.
> + */
> +static void
> +gen7_create_raw_surface(struct brw_context *brw, drm_intel_bo *bo,
> + uint32_t offset, uint32_t size,
> + uint32_t *out_offset, bool rw)
> +{
> + gen7_emit_buffer_surface_state(brw,
> + out_offset,
> + bo,
> + offset,
> + BRW_SURFACEFORMAT_RAW,
> + size - 1,
>
Note: if you land this patch after Ken's "i965: Fix off by one errors in
texture buffer size calculations.", I believe this will need to be just
"size", not "size - 1".
In any case, this patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> + 1,
> + 0 /* mocs */,
> + true /* rw */);
> }
>
> /**
> @@ -445,7 +468,8 @@ gen7_create_shader_time_surface(struct brw_context
> *brw, uint32_t *out_offset)
> BRW_SURFACEFORMAT_RAW,
> brw->shader_time.bo->size - 1,
> 1,
> - 0 /* mocs */);
> + 0 /* mocs */,
> + true /* rw */);
> }
>
> static void
> @@ -570,4 +594,5 @@ gen7_init_vtable_surface_functions(struct brw_context
> *brw)
> brw->vtbl.update_null_renderbuffer_surface =
> gen7_update_null_renderbuffer_surface;
> brw->vtbl.create_constant_surface = gen7_create_constant_surface;
> + brw->vtbl.create_raw_surface = gen7_create_raw_surface;
> }
> --
> 1.8.3.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130919/7e07fc98/attachment.html>
More information about the mesa-dev
mailing list