diff options
author | Kristian H. Kristensen <[email protected]> | 2018-10-22 09:35:39 -0700 |
---|---|---|
committer | Rob Clark <[email protected]> | 2018-10-26 18:10:00 -0400 |
commit | edc0f1b10f04a4c4ea0f324b3dd95a7c17aebf69 (patch) | |
tree | 0fc80748cc30a646932bf5fabf2bb27a0a533691 /src/gallium/drivers | |
parent | 3264eb691a9e7c79fffcaab0a52dc3d915db34f2 (diff) |
freedreno/a6xx: Move rasterizer state to state object
Signed-off-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_context.c | 4 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_emit.c | 29 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_emit.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c | 41 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.h | 3 |
5 files changed, 51 insertions, 27 deletions
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_context.c b/src/gallium/drivers/freedreno/a6xx/fd6_context.c index 33f769619f3..b55b6f6934f 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_context.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_context.c @@ -104,6 +104,10 @@ fd6_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags) if (!pctx) return NULL; + /* fd_context_init overwrites delete_rasterizer_state, so set this + * here. */ + pctx->delete_rasterizer_state = fd6_rasterizer_state_delete; + fd6_ctx->vs_pvt_mem = fd_bo_new(screen->dev, 0x2000, DRM_FREEDRENO_GEM_TYPE_KMEM); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c index e2781ce1862..5fb3a04034d 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c @@ -715,33 +715,8 @@ fd6_emit_state(struct fd_ringbuffer *ring, struct fd6_emit *emit) if (dirty & FD_DIRTY_RASTERIZER) { struct fd6_rasterizer_stateobj *rasterizer = fd6_rasterizer_stateobj(ctx->rasterizer); - - OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8000, 1); - OUT_RING(ring, 0x80); - OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8001, 1); - OUT_RING(ring, 0x0); - OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8004, 1); - OUT_RING(ring, 0x0); - - OUT_PKT4(ring, REG_A6XX_GRAS_SU_CNTL, 1); - OUT_RING(ring, rasterizer->gras_su_cntl); - - OUT_PKT4(ring, REG_A6XX_GRAS_SU_POINT_MINMAX, 2); - OUT_RING(ring, rasterizer->gras_su_point_minmax); - OUT_RING(ring, rasterizer->gras_su_point_size); - - OUT_PKT4(ring, REG_A6XX_GRAS_SU_POLY_OFFSET_SCALE, 3); - OUT_RING(ring, rasterizer->gras_su_poly_offset_scale); - OUT_RING(ring, rasterizer->gras_su_poly_offset_offset); - OUT_RING(ring, rasterizer->gras_su_poly_offset_clamp); - -#if 0 - OUT_PKT4(ring, REG_A6XX_PC_RASTER_CNTL, 1); - OUT_RING(ring, rasterizer->pc_raster_cntl); - - OUT_PKT4(ring, REG_A6XX_GRAS_CL_CNTL, 1); - OUT_RING(ring, rasterizer->gras_cl_clip_cntl); -#endif + fd6_emit_add_group(emit, rasterizer->stateobj, + FD6_GROUP_RASTERIZER, 0x7); } /* Since the primitive restart state is not part of a tracked object, we diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h index 7fe6b55736f..745be6a5996 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h @@ -53,6 +53,7 @@ enum fd6_state_id { FD6_GROUP_FS_CONST, FD6_GROUP_VS_TEX, FD6_GROUP_FS_TEX, + FD6_GROUP_RASTERIZER, }; struct fd6_state_group { diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c b/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c index 7f13676799b..26bb567f65c 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.c @@ -38,6 +38,7 @@ void * fd6_rasterizer_state_create(struct pipe_context *pctx, const struct pipe_rasterizer_state *cso) { + struct fd_context *ctx = fd_context(pctx); struct fd6_rasterizer_stateobj *so; float psize_min, psize_max; @@ -101,5 +102,45 @@ fd6_rasterizer_state_create(struct pipe_context *pctx, so->gras_cl_clip_cntl |= A6XX_GRAS_CL_CNTL_ZERO_GB_SCALE_Z; #endif + so->stateobj = fd_ringbuffer_new_object(ctx->pipe, 15 * 4); + struct fd_ringbuffer *ring = so->stateobj; + + OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8000, 1); + OUT_RING(ring, 0x80); + OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8001, 1); + OUT_RING(ring, 0x0); + OUT_PKT4(ring, REG_A6XX_GRAS_UNKNOWN_8004, 1); + OUT_RING(ring, 0x0); + + OUT_PKT4(ring, REG_A6XX_GRAS_SU_CNTL, 1); + OUT_RING(ring, so->gras_su_cntl); + + OUT_PKT4(ring, REG_A6XX_GRAS_SU_POINT_MINMAX, 2); + OUT_RING(ring, so->gras_su_point_minmax); + OUT_RING(ring, so->gras_su_point_size); + + OUT_PKT4(ring, REG_A6XX_GRAS_SU_POLY_OFFSET_SCALE, 3); + OUT_RING(ring, so->gras_su_poly_offset_scale); + OUT_RING(ring, so->gras_su_poly_offset_offset); + OUT_RING(ring, so->gras_su_poly_offset_clamp); + +#if 0 + OUT_PKT4(ring, REG_A6XX_PC_RASTER_CNTL, 1); + OUT_RING(ring, so->pc_raster_cntl); + + OUT_PKT4(ring, REG_A6XX_GRAS_CL_CNTL, 1); + OUT_RING(ring, so->gras_cl_clip_cntl); +#endif + return so; } + +void +fd6_rasterizer_state_delete(struct pipe_context *pctx, void *hwcso) +{ + struct fd6_rasterizer_stateobj *so = hwcso; + + fd_ringbuffer_del(so->stateobj); + FREE(hwcso); +} + diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.h b/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.h index d2020bee377..1fecfb6cd83 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.h +++ b/src/gallium/drivers/freedreno/a6xx/fd6_rasterizer.h @@ -44,6 +44,8 @@ struct fd6_rasterizer_stateobj { uint32_t gras_cl_clip_cntl; uint32_t pc_primitive_cntl; uint32_t pc_raster_cntl; + + struct fd_ringbuffer *stateobj; }; static inline struct fd6_rasterizer_stateobj * @@ -54,5 +56,6 @@ fd6_rasterizer_stateobj(struct pipe_rasterizer_state *rast) void * fd6_rasterizer_state_create(struct pipe_context *pctx, const struct pipe_rasterizer_state *cso); +void fd6_rasterizer_state_delete(struct pipe_context *, void *hwcso); #endif /* FD6_RASTERIZER_H_ */ |