diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 728fe9508c7..eea0f866134 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -908,7 +908,11 @@ static void panfrost_upload_sample_positions_sysval(struct panfrost_batch *batch, struct sysval_uniform *uniform) { - uniform->du[0] = panfrost_emit_sample_locations(batch); + struct panfrost_context *ctx = batch->ctx; + struct panfrost_device *dev = pan_device(ctx->base.screen); + + unsigned samples = util_framebuffer_get_num_samples(&batch->key); + uniform->du[0] = panfrost_sample_positions(dev, panfrost_sample_pattern(samples)); } static void @@ -2120,61 +2124,3 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, panfrost_add_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_TILER, false, vertex, tiler_job, false); } - -/* TODO: stop hardcoding this */ -mali_ptr -panfrost_emit_sample_locations(struct panfrost_batch *batch) -{ - uint16_t locations[] = { - 128, 128, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 0, 256, - 128, 128, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - 0, 0, - }; - - return panfrost_pool_upload_aligned(&batch->pool, locations, 96 * sizeof(uint16_t), 64); -} diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.h b/src/gallium/drivers/panfrost/pan_cmdstream.h index 19ea0d74377..eab653b4d60 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.h +++ b/src/gallium/drivers/panfrost/pan_cmdstream.h @@ -90,9 +90,6 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch, const struct panfrost_ptr *vertex_job, const struct panfrost_ptr *tiler_job); -mali_ptr -panfrost_emit_sample_locations(struct panfrost_batch *batch); - static inline unsigned panfrost_translate_compare_func(enum pipe_compare_func in) { diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index a4dde09ca9b..3eac60d7296 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -975,7 +975,7 @@ panfrost_batch_submit_ioctl(struct panfrost_batch *batch, bo_handles = calloc(panfrost_pool_num_bos(&batch->pool) + panfrost_pool_num_bos(&batch->invisible_pool) + - batch->bos->entries + 1, + batch->bos->entries + 2, sizeof(*bo_handles)); assert(bo_handles); @@ -994,6 +994,9 @@ panfrost_batch_submit_ioctl(struct panfrost_batch *batch, if (batch->scoreboard.first_tiler) bo_handles[submit.bo_handle_count++] = dev->tiler_heap->gem_handle; + /* Always used on Bifrost, occassionally used on Midgard */ + bo_handles[submit.bo_handle_count++] = dev->sample_positions->gem_handle; + submit.bo_handles = (u64) (uintptr_t) bo_handles; if (ctx->is_noop) ret = 0; diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 54e76fcb811..5dc462c94b3 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -492,8 +492,11 @@ panfrost_mfbd_emit_midgard_tiler(struct panfrost_batch *batch, void *fb, static void panfrost_mfbd_emit_bifrost_parameters(struct panfrost_batch *batch, void *fb) { + struct panfrost_device *dev = pan_device(batch->ctx->base.screen); + pan_section_pack(fb, MULTI_TARGET_FRAMEBUFFER, BIFROST_PARAMETERS, params) { - params.sample_locations = panfrost_emit_sample_locations(batch); + unsigned samples = util_framebuffer_get_num_samples(&batch->key); + params.sample_locations = panfrost_sample_positions(dev, panfrost_sample_pattern(samples)); } }