}
if (job->first_tiler.gpu || job->clear) {
- struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[0];
- if (surf) {
- struct panfrost_resource *res = pan_resource(surf->texture);
- assert(res->bo);
- panfrost_job_add_bo(job, res->bo);
- }
ret = panfrost_drm_submit_job(ctx, panfrost_fragment_job(ctx, has_draws), PANFROST_JD_REQ_FS);
assert(!ret);
}
/* Mark a surface as written */
static void
-panfrost_initialize_surface(struct pipe_surface *surf)
+panfrost_initialize_surface(
+ struct panfrost_job *batch,
+ struct pipe_surface *surf)
{
unsigned level = surf->u.tex.level;
struct panfrost_resource *rsrc = pan_resource(surf->texture);
rsrc->slices[level].initialized = true;
+
+ assert(rsrc->bo);
+ panfrost_job_add_bo(batch, rsrc->bo);
}
/* Generate a fragment job. This should be called once per frame. (According to
panfrost_sfbd_fragment(ctx, has_draws) :
panfrost_mfbd_fragment(ctx, has_draws);
- /* Mark the affected buffers as initialized, since we're writing to it */
+ /* Mark the affected buffers as initialized, since we're writing to it.
+ * Also, add the surfaces we're writing to to the batch */
+
struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
+ struct panfrost_job *batch = panfrost_get_job_for_fbo(ctx);
for (unsigned i = 0; i < fb->nr_cbufs; ++i) {
- panfrost_initialize_surface(fb->cbufs[i]);
+ panfrost_initialize_surface(batch, fb->cbufs[i]);
}
if (fb->zsbuf)
- panfrost_initialize_surface(fb->zsbuf);
+ panfrost_initialize_surface(batch, fb->zsbuf);
struct mali_job_descriptor_header header = {
.job_type = JOB_TYPE_FRAGMENT,