[Mesa-dev] [PATCH 1/2] r600: define some values for the fetch constant offsets.
Edward O'Callaghan
edward.ocallaghan at koparo.com
Fri Sep 11 03:15:19 PDT 2015
Reviewed-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
--
Edward O'Callaghan
edward.ocallaghan at koparo.com
On Fri, Sep 11, 2015, at 02:43 PM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This just puts these in one place and #defines them.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/drivers/r600/evergreen_state.c | 30
> +++++++++++++++++-------------
> src/gallium/drivers/r600/evergreend.h | 8 ++++++++
> src/gallium/drivers/r600/r600_state.c | 25
> +++++++++++--------------
> src/gallium/drivers/r600/r600d.h | 11 +++++++++++
> 4 files changed, 47 insertions(+), 27 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/evergreen_state.c
> b/src/gallium/drivers/r600/evergreen_state.c
> index 0c54a3f..52f4dc8 100644
> --- a/src/gallium/drivers/r600/evergreen_state.c
> +++ b/src/gallium/drivers/r600/evergreen_state.c
> @@ -1888,12 +1888,12 @@ static void evergreen_emit_vertex_buffers(struct
> r600_context *rctx,
>
> static void evergreen_fs_emit_vertex_buffers(struct r600_context *rctx,
> struct r600_atom * atom)
> {
> - evergreen_emit_vertex_buffers(rctx, &rctx->vertex_buffer_state,
> 992, 0);
> + evergreen_emit_vertex_buffers(rctx, &rctx->vertex_buffer_state,
> EG_FETCH_CONSTANTS_OFFSET_FS, 0);
> }
>
> static void evergreen_cs_emit_vertex_buffers(struct r600_context *rctx,
> struct r600_atom * atom)
> {
> - evergreen_emit_vertex_buffers(rctx,
> &rctx->cs_vertex_buffer_state, 816,
> + evergreen_emit_vertex_buffers(rctx,
> &rctx->cs_vertex_buffer_state, EG_FETCH_CONSTANTS_OFFSET_CS,
> RADEON_CP_PACKET3_COMPUTE_MODE);
> }
>
> @@ -1963,7 +1963,8 @@ static void evergreen_emit_constant_buffers(struct
> r600_context *rctx,
>
> static void evergreen_emit_vs_constant_buffers(struct r600_context
> *rctx, struct r600_atom *atom)
> {
> - evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_VERTEX], 176,
> + evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_VERTEX],
> + EG_FETCH_CONSTANTS_OFFSET_VS,
> R_028180_ALU_CONST_BUFFER_SIZE_VS_0,
> R_028980_ALU_CONST_CACHE_VS_0,
> 0 /* PKT3 flags */);
> @@ -1971,7 +1972,8 @@ static void
> evergreen_emit_vs_constant_buffers(struct r600_context *rctx, struct
>
> static void evergreen_emit_gs_constant_buffers(struct r600_context
> *rctx, struct r600_atom *atom)
> {
> - evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_GEOMETRY], 336,
> + evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_GEOMETRY],
> + EG_FETCH_CONSTANTS_OFFSET_GS,
> R_0281C0_ALU_CONST_BUFFER_SIZE_GS_0,
> R_0289C0_ALU_CONST_CACHE_GS_0,
> 0 /* PKT3 flags */);
> @@ -1979,15 +1981,17 @@ static void
> evergreen_emit_gs_constant_buffers(struct r600_context *rctx, struct
>
> static void evergreen_emit_ps_constant_buffers(struct r600_context
> *rctx, struct r600_atom *atom)
> {
> - evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_FRAGMENT], 0,
> -
> R_028140_ALU_CONST_BUFFER_SIZE_PS_0,
> - R_028940_ALU_CONST_CACHE_PS_0,
> - 0 /* PKT3 flags */);
> + evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_FRAGMENT],
> + EG_FETCH_CONSTANTS_OFFSET_PS,
> +
> R_028140_ALU_CONST_BUFFER_SIZE_PS_0,
> + R_028940_ALU_CONST_CACHE_PS_0,
> + 0 /* PKT3 flags */);
> }
>
> static void evergreen_emit_cs_constant_buffers(struct r600_context
> *rctx, struct r600_atom *atom)
> {
> - evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_COMPUTE], 816,
> + evergreen_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_COMPUTE],
> + EG_FETCH_CONSTANTS_OFFSET_CS,
> R_028FC0_ALU_CONST_BUFFER_SIZE_LS_0,
> R_028F40_ALU_CONST_CACHE_LS_0,
> RADEON_CP_PACKET3_COMPUTE_MODE);
> @@ -2031,25 +2035,25 @@ static void evergreen_emit_sampler_views(struct
> r600_context *rctx,
> static void evergreen_emit_vs_sampler_views(struct r600_context *rctx,
> struct r600_atom *atom)
> {
> evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_VERTEX].views,
> - 176 + R600_MAX_CONST_BUFFERS, 0);
> + EG_FETCH_CONSTANTS_OFFSET_VS +
> R600_MAX_CONST_BUFFERS, 0);
> }
>
> static void evergreen_emit_gs_sampler_views(struct r600_context *rctx,
> struct r600_atom *atom)
> {
> evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_GEOMETRY].views,
> - 336 + R600_MAX_CONST_BUFFERS, 0);
> + EG_FETCH_CONSTANTS_OFFSET_GS +
> R600_MAX_CONST_BUFFERS, 0);
> }
>
> static void evergreen_emit_ps_sampler_views(struct r600_context *rctx,
> struct r600_atom *atom)
> {
> evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_FRAGMENT].views,
> - R600_MAX_CONST_BUFFERS, 0);
> + EG_FETCH_CONSTANTS_OFFSET_PS +
> R600_MAX_CONST_BUFFERS, 0);
> }
>
> static void evergreen_emit_cs_sampler_views(struct r600_context *rctx,
> struct r600_atom *atom)
> {
> evergreen_emit_sampler_views(rctx, &rctx->samplers[PIPE_SHADER_COMPUTE].views,
> - 816 + 2,
> RADEON_CP_PACKET3_COMPUTE_MODE);
> + EG_FETCH_CONSTANTS_OFFSET_CS + 2,
> RADEON_CP_PACKET3_COMPUTE_MODE);
> }
>
> static void evergreen_emit_sampler_states(struct r600_context *rctx,
> diff --git a/src/gallium/drivers/r600/evergreend.h
> b/src/gallium/drivers/r600/evergreend.h
> index ad6ad43..937ffcb 100644
> --- a/src/gallium/drivers/r600/evergreend.h
> +++ b/src/gallium/drivers/r600/evergreend.h
> @@ -2496,4 +2496,12 @@
> #define DMA_PACKET_CONSTANT_FILL 0xd
> #define DMA_PACKET_NOP 0xf
>
> +#define EG_FETCH_CONSTANTS_OFFSET_PS 0
> +#define EG_FETCH_CONSTANTS_OFFSET_VS 176
> +#define EG_FETCH_CONSTANTS_OFFSET_GS 336
> +#define EG_FETCH_CONSTANTS_OFFSET_HS 496
> +#define EG_FETCH_CONSTANTS_OFFSET_LS 656
> +#define EG_FETCH_CONSTANTS_OFFSET_CS 816
> +#define EG_FETCH_CONSTANTS_OFFSET_FS 992
> +
> #endif
> diff --git a/src/gallium/drivers/r600/r600_state.c
> b/src/gallium/drivers/r600/r600_state.c
> index 3464c38..7084c5f 100644
> --- a/src/gallium/drivers/r600/r600_state.c
> +++ b/src/gallium/drivers/r600/r600_state.c
> @@ -1705,9 +1705,9 @@ static void r600_emit_vertex_buffers(struct
> r600_context *rctx, struct r600_atom
>
> offset = vb->buffer_offset;
>
> - /* fetch resources start at index 320 */
> + /* fetch resources start at index 320 (OFFSET_FS) */
> radeon_emit(cs, PKT3(PKT3_SET_RESOURCE, 7, 0));
> - radeon_emit(cs, (320 + buffer_index) * 7);
> + radeon_emit(cs, (R600_FETCH_CONSTANTS_OFFSET_FS +
> buffer_index) * 7);
> radeon_emit(cs, offset); /* RESOURCEi_WORD0 */
> radeon_emit(cs, rbuffer->b.b.width0 - offset - 1); /* RESOURCEi_WORD1 */
> radeon_emit(cs, /* RESOURCEi_WORD2 */
> @@ -1778,21 +1778,24 @@ static void r600_emit_constant_buffers(struct
> r600_context *rctx,
>
> static void r600_emit_vs_constant_buffers(struct r600_context *rctx,
> struct r600_atom *atom)
> {
> - r600_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_VERTEX], 160,
> + r600_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_VERTEX],
> + R600_FETCH_CONSTANTS_OFFSET_VS,
> R_028180_ALU_CONST_BUFFER_SIZE_VS_0,
> R_028980_ALU_CONST_CACHE_VS_0);
> }
>
> static void r600_emit_gs_constant_buffers(struct r600_context *rctx,
> struct r600_atom *atom)
> {
> - r600_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_GEOMETRY], 336,
> + r600_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_GEOMETRY],
> + R600_FETCH_CONSTANTS_OFFSET_GS,
> R_0281C0_ALU_CONST_BUFFER_SIZE_GS_0,
> R_0289C0_ALU_CONST_CACHE_GS_0);
> }
>
> static void r600_emit_ps_constant_buffers(struct r600_context *rctx,
> struct r600_atom *atom)
> {
> - r600_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_FRAGMENT], 0,
> + r600_emit_constant_buffers(rctx,
> &rctx->constbuf_state[PIPE_SHADER_FRAGMENT],
> + R600_FETCH_CONSTANTS_OFFSET_PS,
> R_028140_ALU_CONST_BUFFER_SIZE_PS_0,
> R_028940_ALU_CONST_CACHE_PS_0);
> }
> @@ -1829,26 +1832,20 @@ static void r600_emit_sampler_views(struct
> r600_context *rctx,
> state->dirty_mask = 0;
> }
>
> -/* Resource IDs:
> - * PS: 0 .. +160
> - * VS: 160 .. +160
> - * FS: 320 .. +16
> - * GS: 336 .. +160
> - */
>
> static void r600_emit_vs_sampler_views(struct r600_context *rctx, struct
> r600_atom *atom)
> {
> - r600_emit_sampler_views(rctx,
> &rctx->samplers[PIPE_SHADER_VERTEX].views, 160 + R600_MAX_CONST_BUFFERS);
> + r600_emit_sampler_views(rctx,
> &rctx->samplers[PIPE_SHADER_VERTEX].views, R600_FETCH_CONSTANTS_OFFSET_VS
> + R600_MAX_CONST_BUFFERS);
> }
>
> static void r600_emit_gs_sampler_views(struct r600_context *rctx, struct
> r600_atom *atom)
> {
> - r600_emit_sampler_views(rctx,
> &rctx->samplers[PIPE_SHADER_GEOMETRY].views, 336 +
> R600_MAX_CONST_BUFFERS);
> + r600_emit_sampler_views(rctx,
> &rctx->samplers[PIPE_SHADER_GEOMETRY].views,
> R600_FETCH_CONSTANTS_OFFSET_GS + R600_MAX_CONST_BUFFERS);
> }
>
> static void r600_emit_ps_sampler_views(struct r600_context *rctx, struct
> r600_atom *atom)
> {
> - r600_emit_sampler_views(rctx,
> &rctx->samplers[PIPE_SHADER_FRAGMENT].views, R600_MAX_CONST_BUFFERS);
> + r600_emit_sampler_views(rctx,
> &rctx->samplers[PIPE_SHADER_FRAGMENT].views,
> R600_FETCH_CONSTANTS_OFFSET_PS + R600_MAX_CONST_BUFFERS);
> }
>
> static void r600_emit_sampler_states(struct r600_context *rctx,
> diff --git a/src/gallium/drivers/r600/r600d.h
> b/src/gallium/drivers/r600/r600d.h
> index 3c08ba5..6bba88c 100644
> --- a/src/gallium/drivers/r600/r600d.h
> +++ b/src/gallium/drivers/r600/r600d.h
> @@ -3783,4 +3783,15 @@
> #define DMA_PACKET_CONSTANT_FILL 0xd /* 7xx only */
> #define DMA_PACKET_NOP 0xf
>
> +
> +/* Resource IDs:
> + * PS: 0 .. +160
> + * VS: 160 .. +160
> + * FS: 320 .. +16
> + * GS: 336 .. +160
> + */
> +#define R600_FETCH_CONSTANTS_OFFSET_PS 0
> +#define R600_FETCH_CONSTANTS_OFFSET_VS 160
> +#define R600_FETCH_CONSTANTS_OFFSET_FS 320
> +#define R600_FETCH_CONSTANTS_OFFSET_GS 336
> #endif
> --
> 2.4.3
>
> _______________________________________________
> 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