the bare minimum to get a20x running with kmscube and some glmark2 scenes: different CP_DRAW_INDX format and the different clear color register
Signed-off-by: Jonathan Marek <jonat...@marek.ca> --- src/gallium/drivers/freedreno/a2xx/fd2_draw.c | 15 +++++++-- src/gallium/drivers/freedreno/a2xx/fd2_emit.c | 10 ++++++ .../drivers/freedreno/freedreno_draw.h | 32 ++++++++++++------- .../drivers/freedreno/freedreno_screen.c | 1 + .../drivers/freedreno/freedreno_screen.h | 6 ++++ 5 files changed, 50 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c index ef9daddfcf..c12047628c 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_draw.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_draw.c @@ -155,9 +155,18 @@ fd2_clear(struct fd_context *ctx, unsigned buffers, OUT_PKT0(ring, REG_A2XX_TC_CNTL_STATUS, 1); OUT_RING(ring, A2XX_TC_CNTL_STATUS_L2_INVALIDATE); - OUT_PKT3(ring, CP_SET_CONSTANT, 2); - OUT_RING(ring, CP_REG(REG_A2XX_CLEAR_COLOR)); - OUT_RING(ring, colr); + if (is_a20x(ctx->screen)) { + OUT_PKT3(ring, CP_SET_CONSTANT, 5); + OUT_RING(ring, 0x00000480); + OUT_RING(ring, color->ui[0]); + OUT_RING(ring, color->ui[1]); + OUT_RING(ring, color->ui[2]); + OUT_RING(ring, color->ui[3]); + } else { + OUT_PKT3(ring, CP_SET_CONSTANT, 2); + OUT_RING(ring, CP_REG(REG_A2XX_CLEAR_COLOR)); + OUT_RING(ring, colr); + } OUT_PKT3(ring, CP_SET_CONSTANT, 2); OUT_RING(ring, CP_REG(REG_A2XX_A220_RB_LRZ_VSC_CONTROL)); diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c index 6927fa87fd..2b28bb23a3 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_emit.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_emit.c @@ -415,6 +415,16 @@ fd2_emit_state_for_clear(struct fd_context *ctx) void fd2_emit_restore(struct fd_context *ctx, struct fd_ringbuffer *ring) { + if (is_a20x(ctx->screen)) { + OUT_PKT0(ring, REG_A2XX_RB_BC_CONTROL, 1); + OUT_RING(ring, + A2XX_RB_BC_CONTROL_ACCUM_TIMEOUT_SELECT(3) | + A2XX_RB_BC_CONTROL_DISABLE_LZ_NULL_ZCMD_DROP | + A2XX_RB_BC_CONTROL_ENABLE_CRC_UPDATE | + A2XX_RB_BC_CONTROL_ACCUM_DATA_FIFO_LIMIT(8) | + A2XX_RB_BC_CONTROL_MEM_EXPORT_TIMEOUT_SELECT(3)); + } + OUT_PKT0(ring, REG_A2XX_TP0_CHICKEN, 1); OUT_RING(ring, 0x00000002); diff --git a/src/gallium/drivers/freedreno/freedreno_draw.h b/src/gallium/drivers/freedreno/freedreno_draw.h index b293f73b82..ec4b47898d 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.h +++ b/src/gallium/drivers/freedreno/freedreno_draw.h @@ -51,6 +51,8 @@ fd_draw(struct fd_batch *batch, struct fd_ringbuffer *ring, uint32_t idx_size, uint32_t idx_offset, struct pipe_resource *idx_buffer) { + uint32_t cnt, draw; + /* for debug after a lock up, write a unique counter value * to scratch7 for each draw, to make it easier to match up * register dumps to cmdstream. The combination of IB @@ -74,18 +76,26 @@ fd_draw(struct fd_batch *batch, struct fd_ringbuffer *ring, OUT_RING(ring, 0); } - OUT_PKT3(ring, CP_DRAW_INDX, idx_buffer ? 5 : 3); - OUT_RING(ring, 0x00000000); /* viz query info. */ - if (vismode == USE_VISIBILITY) { - /* leave vis mode blank for now, it will be patched up when - * we know if we are binning or not - */ - OUT_RINGP(ring, DRAW(primtype, src_sel, idx_type, 0, instances), - &batch->draw_patches); - } else { - OUT_RING(ring, DRAW(primtype, src_sel, idx_type, vismode, instances)); + cnt = idx_buffer ? 5 : 3; + draw = DRAW(primtype, src_sel, idx_type, 0, instances); + + if (is_a20x(batch->ctx->screen)) { + /* XXX instances field is overwritten */ + draw &= 0xffff; + draw |= count << 16; + cnt -= 1; } - OUT_RING(ring, count); /* NumIndices */ + + OUT_PKT3(ring, CP_DRAW_INDX, cnt); + OUT_RING(ring, 0x00000000); /* viz query info. */ + if (vismode == USE_VISIBILITY) + OUT_RINGP(ring, draw, &batch->draw_patches); + else + OUT_RING(ring, draw | DRAW(0, 0, 0, vismode, 0)); + + if (!is_a20x(batch->ctx->screen)) + OUT_RING(ring, count); /* NumIndices */ + if (idx_buffer) { OUT_RELOC(ring, fd_resource(idx_buffer)->bo, idx_offset, 0, 0); OUT_RING (ring, idx_size); diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index a414cb6d60..a89a6e69e7 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -869,6 +869,7 @@ fd_screen_create(struct fd_device *dev) * send a patch ;-) */ switch (screen->gpu_id) { + case 205: case 220: fd2_screen_init(pscreen); break; diff --git a/src/gallium/drivers/freedreno/freedreno_screen.h b/src/gallium/drivers/freedreno/freedreno_screen.h index 6be739ae28..013dba1a6d 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.h +++ b/src/gallium/drivers/freedreno/freedreno_screen.h @@ -106,6 +106,12 @@ struct fd_bo * fd_screen_bo_from_handle(struct pipe_screen *pscreen, struct pipe_screen * fd_screen_create(struct fd_device *dev); +static inline boolean +is_a20x(struct fd_screen *screen) +{ + return (screen->gpu_id >= 200) && (screen->gpu_id < 210); +} + /* is a3xx patch revision 0? */ /* TODO a306.0 probably doesn't need this.. be more clever?? */ static inline boolean -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev