#include "pan_cmdstream.h"
#include "pan_util.h"
#include "pandecode/decode.h"
+#include "util/pan_lower_framebuffer.h"
struct midgard_tiler_descriptor
panfrost_emit_midg_tiler(struct panfrost_batch *batch, unsigned vertex_count)
pandecode_next_frame();
}
+static void
+panfrost_texture_barrier(struct pipe_context *pipe, unsigned flags)
+{
+ struct panfrost_context *ctx = pan_context(pipe);
+ panfrost_flush_all_batches(ctx, false);
+}
+
#define DEFINE_CASE(c) case PIPE_PRIM_##c: return MALI_##c;
static int
if ((fb->nr_cbufs > i) && fb->cbufs[i])
fmt = fb->cbufs[i]->format;
+ const struct util_format_description *desc =
+ util_format_description(fmt);
+
+ if (pan_format_class_load(desc, dev->quirks) == PAN_FORMAT_NATIVE)
+ fmt = PIPE_FORMAT_NONE;
+
if (variant->rt_formats[i] != fmt)
return false;
}
if ((fb->nr_cbufs > i) && fb->cbufs[i])
fmt = fb->cbufs[i]->format;
+ const struct util_format_description *desc =
+ util_format_description(fmt);
+
+ if (pan_format_class_load(desc, dev->quirks) == PAN_FORMAT_NATIVE)
+ fmt = PIPE_FORMAT_NONE;
+
v->rt_formats[i] = fmt;
}
{
struct panfrost_device *device = pan_device(pctx->screen);
struct panfrost_resource *prsrc = (struct panfrost_resource *)texture;
+ enum pipe_format format = so->base.format;
assert(prsrc->bo);
+ /* Format to access the stencil portion of a Z32_S8 texture */
+ if (so->base.format == PIPE_FORMAT_X32_S8X24_UINT) {
+ assert(prsrc->separate_stencil);
+ texture = &prsrc->separate_stencil->base;
+ prsrc = (struct panfrost_resource *)texture;
+ format = texture->format;
+ }
+
so->texture_bo = prsrc->bo->gpu;
so->layout = prsrc->layout;
if (device->quirks & IS_BIFROST) {
const struct util_format_description *desc =
- util_format_description(so->base.format);
+ util_format_description(format);
unsigned char composed_swizzle[4];
util_format_compose_swizzles(desc->swizzle, user_swizzle, composed_swizzle);
so->base.u.tex.last_level,
so->base.u.tex.first_layer,
so->base.u.tex.last_layer,
+ texture->nr_samples,
type, prsrc->layout);
so->bo = panfrost_bo_create(device, size, 0);
so->bifrost_descriptor,
texture->width0, texture->height0,
depth, array_size,
- so->base.format,
+ format,
type, prsrc->layout,
so->base.u.tex.first_level,
so->base.u.tex.last_level,
so->base.u.tex.last_level,
so->base.u.tex.first_layer,
so->base.u.tex.last_layer,
+ texture->nr_samples,
type, prsrc->layout);
size += sizeof(struct mali_texture_descriptor);
so->bo->cpu,
texture->width0, texture->height0,
depth, array_size,
- so->base.format,
+ format,
type, prsrc->layout,
so->base.u.tex.first_level,
so->base.u.tex.last_level,
util_copy_framebuffer_state(&ctx->pipe_framebuffer, fb);
ctx->batch = NULL;
panfrost_invalidate_frame(ctx);
+
+ /* We may need to generate a new variant if the fragment shader is
+ * keyed to the framebuffer format (due to EXT_framebuffer_fetch) */
+ struct panfrost_shader_variants *fs = ctx->shader[PIPE_SHADER_FRAGMENT];
+
+ if (fs && fs->variant_count && fs->variants[fs->active_variant].outputs_read)
+ ctx->base.bind_fs_state(&ctx->base, fs);
}
static void *
ctx->sample_mask = sample_mask;
}
+static void
+panfrost_set_min_samples(struct pipe_context *pipe,
+ unsigned min_samples)
+{
+ struct panfrost_context *ctx = pan_context(pipe);
+ ctx->min_samples = min_samples;
+}
+
+
static void
panfrost_set_clip_state(struct pipe_context *pipe,
const struct pipe_clip_state *clip)
case PIPE_QUERY_OCCLUSION_PREDICATE:
case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
panfrost_flush_batches_accessing_bo(ctx, query->bo, PAN_BO_ACCESS_WRITE);
- panfrost_bo_wait(query->bo, INT64_MAX, PAN_BO_ACCESS_WRITE);
+ panfrost_bo_wait(query->bo, INT64_MAX, false);
/* Read back the query results */
unsigned *result = (unsigned *) query->bo->cpu;
gallium->flush = panfrost_flush;
gallium->clear = panfrost_clear;
gallium->draw_vbo = panfrost_draw_vbo;
+ gallium->texture_barrier = panfrost_texture_barrier;
gallium->set_vertex_buffers = panfrost_set_vertex_buffers;
gallium->set_constant_buffer = panfrost_set_constant_buffer;
gallium->delete_depth_stencil_alpha_state = panfrost_delete_depth_stencil_state;
gallium->set_sample_mask = panfrost_set_sample_mask;
+ gallium->set_min_samples = panfrost_set_min_samples;
gallium->set_clip_state = panfrost_set_clip_state;
gallium->set_viewport_states = panfrost_set_viewport_states;
panfrost_batch_init(ctx);
panfrost_invalidate_frame(ctx);
+ if (!(dev->quirks & IS_BIFROST)) {
+ for (unsigned c = 0; c < PIPE_MAX_COLOR_BUFS; ++c)
+ ctx->blit_blend.rt[c].shaders = _mesa_hash_table_u64_create(ctx);
+ }
+
/* By default mask everything on */
ctx->sample_mask = ~0;