etnaviv: add support for INTEL_blackhole_render

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

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14792>
This commit is contained in:
Christian Gmeiner 2022-01-29 17:24:29 +01:00 committed by Marge Bot
parent a4c8508c37
commit 1d75b459a6
5 changed files with 22 additions and 5 deletions

View file

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

View file

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

View file

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

View file

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

View file

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