[Mesa-dev] [PATCH 01/25] intel/isl: Add some basic info about RENDER_SURFACE_STATE to isl_device

Pohjolainen, Topi topi.pohjolainen at gmail.com
Tue Oct 25 19:44:23 UTC 2016


On Tue, Oct 25, 2016 at 09:13:59AM -0700, Jason Ekstrand wrote:
>    On Oct 25, 2016 2:18 AM, "Pohjolainen, Topi"
>    <[1]topi.pohjolainen at gmail.com> wrote:
>    >
>    > On Sat, Oct 22, 2016 at 10:50:32AM -0700, Jason Ekstrand wrote:
>    > > Signed-off-by: Jason Ekstrand <[2]jason at jlekstrand.net>
>    > > ---
>    > >  src/intel/blorp/blorp_genX_exec.h                | 33
>    ++++----------
>    > >  src/intel/isl/isl.c                              | 19 ++++++++
>    > >  src/intel/isl/isl.h                              | 11 +++++
>    > >  src/intel/vulkan/anv_batch_chain.c               |  4 +-
>    > >  src/intel/vulkan/genX_cmd_buffer.c               |  8 +---
>    > >  src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 56
>    +++++++++++-------------
>    > >  6 files changed, 69 insertions(+), 62 deletions(-)
>    > >
>    > > diff --git a/src/intel/blorp/blorp_genX_exec.h
>    b/src/intel/blorp/blorp_genX_exec.h
>    > > index ec0d022..d455714 100644
>    > > --- a/src/intel/blorp/blorp_genX_exec.h
>    > > +++ b/src/intel/blorp/blorp_genX_exec.h
>    > > @@ -995,28 +995,13 @@ blorp_emit_depth_stencil_state(struct
>    blorp_batch *batch,
>    > >     return offset;
>    > >  }
>    > >
>    > > -struct surface_state_info {
>    > > -   unsigned num_dwords;
>    > > -   unsigned ss_align; /* Required alignment of
>    RENDER_SURFACE_STATE in bytes */
>    > > -   unsigned reloc_dw;
>    > > -   unsigned aux_reloc_dw;
>    > > -};
>    > > -
>    > > -static const struct surface_state_info surface_state_infos[] = {
>    > > -   [6] = {6,  32, 1,  0},
>    > > -   [7] = {8,  32, 1,  6},
>    > > -   [8] = {13, 64, 8,  10},
>    > > -   [9] = {16, 64, 8,  10},
>    > > -};
>    > > -
>    > >  static void
>    > >  blorp_emit_surface_state(struct blorp_batch *batch,
>    > >                           const struct brw_blorp_surface_info
>    *surface,
>    > > -                         uint32_t *state, uint32_t state_offset,
>    > > +                         void *state, uint32_t state_offset,
>    > >                           bool is_render_target)
>    > >  {
>    > > -   const struct surface_state_info ss_info =
>    surface_state_infos[GEN_GEN];
>    > > -
>    > > +   const struct isl_device *isl_dev = batch->blorp->isl_dev;
>    > >     struct isl_surf surf = surface->surf;
>    > >
>    > >     if (surf.dim == ISL_SURF_DIM_1D &&
>    > > @@ -1038,7 +1023,7 @@ blorp_emit_surface_state(struct blorp_batch
>    *batch,
>    > >                         .aux_surf = &surface->aux_surf, .aux_usage
>    = aux_usage,
>    > >                         .mocs = mocs, .clear_color =
>    surface->clear_color);
>    > >
>    > > -   blorp_surface_reloc(batch, state_offset + ss_info.reloc_dw * 4,
>    > > +   blorp_surface_reloc(batch, state_offset +
>    isl_dev->ss.addr_offset,
>    > >                         surface->addr, 0);
>    > >
>    > >     if (aux_usage != ISL_AUX_USAGE_NONE) {
>    > > @@ -1047,8 +1032,9 @@ blorp_emit_surface_state(struct blorp_batch
>    *batch,
>    > >         * surface buffer addresses are always 4K page alinged.
>    > >         */
>    > >        assert((surface->aux_addr.offset & 0xfff) == 0);
>    > > -      blorp_surface_reloc(batch, state_offset +
>    ss_info.aux_reloc_dw * 4,
>    > > -                          surface->aux_addr,
>    state[ss_info.aux_reloc_dw]);
>    > > +      uint32_t *aux_addr = state + isl_dev->ss.aux_addr_offset;
>    >
>    > Previously 'state' got indexed in dwords (ss_info.aux_reloc_dw). Now
>    this
>    > uses 'isl_dev->ss.aux_addr_offset' instead (which is in number of
>    bytes).
>    > Aren't we offsetting four times too far?
> 
>    No. State is now a void* (See above)

Ah, I missed that. I didn't actually know that arithmetic on void pointers
is allowed.


More information about the mesa-dev mailing list