panfrost: Use sample location LUT

Fixes multisampling issues on Bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
This commit is contained in:
Alyssa Rosenzweig 2021-01-27 15:35:39 -05:00
parent a61fb62966
commit dd3bda22f4
4 changed files with 13 additions and 64 deletions

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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;

View file

@ -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));
}
}