Mesa (main): etnaviv: add support for INTEL_blackhole_render

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 31 17:01:05 UTC 2022


Module: Mesa
Branch: main
Commit: 1d75b459a6f99d7cba989c9434766439d780ef7e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d75b459a6f99d7cba989c9434766439d780ef7e

Author: Christian Gmeiner <christian.gmeiner at gmail.com>
Date:   Sat Jan 29 17:24:29 2022 +0100

etnaviv: add support for INTEL_blackhole_render

Passes the following piglits:
 - spec at intel_blackhole_render@intel_blackhole-draw_gles2
 - spec at intel_blackhole_render@intel_blackhole-draw_gles3

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Reviewed-by: Lucas Stach <l.stach at pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14792>

---

 src/etnaviv/drm/etnaviv_cmd_stream.c          |  9 ++++++---
 src/etnaviv/drm/etnaviv_drmif.h               |  2 +-
 src/gallium/drivers/etnaviv/etnaviv_context.c | 13 ++++++++++++-
 src/gallium/drivers/etnaviv/etnaviv_context.h |  2 ++
 src/gallium/drivers/etnaviv/etnaviv_screen.c  |  1 +
 5 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/etnaviv/drm/etnaviv_cmd_stream.c b/src/etnaviv/drm/etnaviv_cmd_stream.c
index cb1fa7c7818..34daa8de427 100644
--- a/src/etnaviv/drm/etnaviv_cmd_stream.c
+++ b/src/etnaviv/drm/etnaviv_cmd_stream.c
@@ -208,7 +208,7 @@ static uint32_t bo2idx(struct etna_cmd_stream *stream, struct etna_bo *bo,
 }
 
 void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
-		int *out_fence_fd)
+		int *out_fence_fd, bool is_noop)
 {
 	struct etna_cmd_stream_priv *priv = etna_cmd_stream_priv(stream);
 	int ret, id = priv->pipe->id;
@@ -238,8 +238,11 @@ void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
 	if (gpu->dev->use_softpin)
 		req.flags |= ETNA_SUBMIT_SOFTPIN;
 
-	ret = drmCommandWriteRead(gpu->dev->fd, DRM_ETNAVIV_GEM_SUBMIT,
-			&req, sizeof(req));
+	if (unlikely(is_noop))
+		ret = 0;
+	else
+		ret = drmCommandWriteRead(gpu->dev->fd, DRM_ETNAVIV_GEM_SUBMIT,
+				&req, sizeof(req));
 
 	if (ret)
 		ERROR_MSG("submit failed: %d (%s)", ret, strerror(errno));
diff --git a/src/etnaviv/drm/etnaviv_drmif.h b/src/etnaviv/drm/etnaviv_drmif.h
index ac65d6185a2..1ad2a2e97fb 100644
--- a/src/etnaviv/drm/etnaviv_drmif.h
+++ b/src/etnaviv/drm/etnaviv_drmif.h
@@ -151,7 +151,7 @@ struct etna_cmd_stream *etna_cmd_stream_new(struct etna_pipe *pipe, uint32_t siz
 void etna_cmd_stream_del(struct etna_cmd_stream *stream);
 uint32_t etna_cmd_stream_timestamp(struct etna_cmd_stream *stream);
 void etna_cmd_stream_flush(struct etna_cmd_stream *stream, int in_fence_fd,
-			    int *out_fence_fd);
+			    int *out_fence_fd, bool is_noop);
 void etna_cmd_stream_force_flush(struct etna_cmd_stream *stream);
 
 static inline uint32_t etna_cmd_stream_avail(struct etna_cmd_stream *stream)
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index 08fe502e195..fc03dab3d3a 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -88,6 +88,15 @@ etna_emit_string_marker(struct pipe_context *pctx, const char *string, int len)
    }
 }
 
+static void
+etna_set_frontend_noop(struct pipe_context *pctx, bool enable)
+{
+   struct etna_context *ctx = etna_context(pctx);
+
+   pctx->flush(pctx, NULL, 0);
+   ctx->is_noop = enable;
+}
+
 static void
 etna_context_destroy(struct pipe_context *pctx)
 {
@@ -542,7 +551,8 @@ etna_flush(struct pipe_context *pctx, struct pipe_fence_handle **fence,
    _mesa_set_clear(ctx->flush_resources, NULL);
 
    etna_cmd_stream_flush(ctx->stream, ctx->in_fence_fd,
-                          (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : NULL);
+                          (flags & PIPE_FLUSH_FENCE_FD) ? &out_fence_fd : NULL,
+                          ctx->is_noop);
 
    list_for_each_entry(struct etna_acc_query, aq, &ctx->active_acc_queries, node)
       etna_acc_query_resume(aq, ctx);
@@ -671,6 +681,7 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
    pctx->create_fence_fd = etna_create_fence_fd;
    pctx->fence_server_sync = etna_fence_server_sync;
    pctx->emit_string_marker = etna_emit_string_marker;
+   pctx->set_frontend_noop = etna_set_frontend_noop;
 
    /* creation of compile states */
    pctx->create_blend_state = etna_blend_state_create;
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.h b/src/gallium/drivers/etnaviv/etnaviv_context.h
index 1da6a2127f3..4d1f209b7af 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.h
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.h
@@ -205,6 +205,8 @@ struct etna_context {
    /* resources that must be flushed implicitly at the context flush time */
    struct set *flush_resources;
 
+   bool is_noop;
+
    mtx_t lock;
 };
 
diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c
index 44e94edd5ac..04d0d3c4c7f 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_screen.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c
@@ -155,6 +155,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
    case PIPE_CAP_MIXED_COLOR_DEPTH_BITS:
    case PIPE_CAP_MIXED_FRAMEBUFFER_SIZES:
    case PIPE_CAP_STRING_MARKER:
+   case PIPE_CAP_FRONTEND_NOOP:
       return 1;
    case PIPE_CAP_NATIVE_FENCE_FD:
       return screen->drm_version >= ETNA_DRM_VERSION_FENCE_FD;



More information about the mesa-commit mailing list