From f55649d20b4b0263245f047db6239a46890e04a4 Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Thu, 21 Jan 2021 16:22:35 +1300 Subject: [PATCH] panfrost: Add support for INTEL_blackhole_render Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 9 +++++++++ src/gallium/drivers/panfrost/pan_context.h | 2 ++ src/gallium/drivers/panfrost/pan_job.c | 5 ++++- src/gallium/drivers/panfrost/pan_screen.c | 1 + 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 54a279e..f857014 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -185,6 +185,14 @@ panfrost_texture_barrier(struct pipe_context *pipe, unsigned flags) panfrost_flush_all_batches(ctx); } +static void +panfrost_set_frontend_noop(struct pipe_context *pipe, bool enable) +{ + struct panfrost_context *ctx = pan_context(pipe); + panfrost_flush_all_batches(ctx); + ctx->is_noop = enable; +} + #define DEFINE_CASE(c) case PIPE_PRIM_##c: return MALI_DRAW_MODE_##c; static int @@ -1583,6 +1591,7 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags) gallium->clear = panfrost_clear; gallium->draw_vbo = panfrost_draw_vbo; gallium->texture_barrier = panfrost_texture_barrier; + gallium->set_frontend_noop = panfrost_set_frontend_noop; gallium->set_vertex_buffers = panfrost_set_vertex_buffers; gallium->set_constant_buffer = panfrost_set_constant_buffer; diff --git a/src/gallium/drivers/panfrost/pan_context.h b/src/gallium/drivers/panfrost/pan_context.h index a65442a..39ee218 100644 --- a/src/gallium/drivers/panfrost/pan_context.h +++ b/src/gallium/drivers/panfrost/pan_context.h @@ -181,6 +181,8 @@ struct panfrost_context { struct panfrost_query *cond_query; bool cond_cond; enum pipe_render_cond_flag cond_mode; + + bool is_noop; }; /* Corresponds to the CSO */ diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 301ce45..32f3ff2 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -983,7 +983,10 @@ panfrost_batch_submit_ioctl(struct panfrost_batch *batch, bo_handles[submit.bo_handle_count++] = dev->tiler_heap->gem_handle; submit.bo_handles = (u64) (uintptr_t) bo_handles; - ret = drmIoctl(dev->fd, DRM_IOCTL_PANFROST_SUBMIT, &submit); + if (ctx->is_noop) + ret = 0; + else + ret = drmIoctl(dev->fd, DRM_IOCTL_PANFROST_SUBMIT, &submit); free(bo_handles); if (ret) { diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 83c23bf..49d2f1e 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -116,6 +116,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_DEPTH_CLIP_DISABLE_SEPARATE: case PIPE_CAP_MIXED_COLORBUFFER_FORMATS: case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES: + case PIPE_CAP_FRONTEND_NOOP: return 1; case PIPE_CAP_MAX_RENDER_TARGETS: -- 2.7.4