From 0d48a5745214bfdbb7af9ccbdc141e10e424e2be Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 7 Apr 2022 11:19:39 -0400 Subject: [PATCH] panfrost: Adapt viewport/scissor to Valhall Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 34 ++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index cf6df4f..8b8bed3 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -722,24 +722,40 @@ panfrost_emit_viewport(struct panfrost_batch *batch) if (maxx == 0 || maxy == 0) maxx = maxy = minx = miny = 1; + panfrost_batch_union_scissor(batch, minx, miny, maxx, maxy); + batch->scissor_culls_everything = (minx >= maxx || miny >= maxy); + + /* [minx, maxx) and [miny, maxy) are exclusive ranges in the hardware */ + maxx--; + maxy--; + + batch->minimum_z = rast->depth_clip_near ? minz : -INFINITY; + batch->maximum_z = rast->depth_clip_far ? maxz : +INFINITY; + +#if PAN_ARCH <= 7 struct panfrost_ptr T = pan_pool_alloc_desc(&batch->pool.base, VIEWPORT); pan_pack(T.cpu, VIEWPORT, cfg) { - /* [minx, maxx) and [miny, maxy) are exclusive ranges, but - * these are inclusive */ cfg.scissor_minimum_x = minx; cfg.scissor_minimum_y = miny; - cfg.scissor_maximum_x = maxx - 1; - cfg.scissor_maximum_y = maxy - 1; + cfg.scissor_maximum_x = maxx; + cfg.scissor_maximum_y = maxy; - cfg.minimum_z = rast->depth_clip_near ? minz : -INFINITY; - cfg.maximum_z = rast->depth_clip_far ? maxz : INFINITY; + cfg.minimum_z = batch->minimum_z; + cfg.maximum_z = batch->maximum_z; } - panfrost_batch_union_scissor(batch, minx, miny, maxx, maxy); - batch->scissor_culls_everything = (minx >= maxx || miny >= maxy); - return T.gpu; +#else + pan_pack(&batch->scissor, SCISSOR, cfg) { + cfg.scissor_minimum_x = minx; + cfg.scissor_minimum_y = miny; + cfg.scissor_maximum_x = maxx; + cfg.scissor_maximum_y = maxy; + } + + return 0; +#endif } static mali_ptr -- 2.7.4