mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 17:30:12 +01:00
etnaviv: Add a separate NPU pipe
Add a separate pipe for the NPU device when the primary device is a GPU. In case of compute-only contexts, prefer to use the separate NPU pipe. This allows to create a compute-only context that uses the NPU pipe on a screen that has a 3D GPU as primary device. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28921>
This commit is contained in:
parent
108d2103ea
commit
a4653587cc
3 changed files with 17 additions and 2 deletions
|
|
@ -618,6 +618,8 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||
struct etna_context *ctx = CALLOC_STRUCT(etna_context);
|
||||
struct etna_screen *screen;
|
||||
struct pipe_context *pctx;
|
||||
struct etna_pipe *pipe;
|
||||
bool compute_only = flags & PIPE_CONTEXT_COMPUTE_ONLY;
|
||||
|
||||
if (ctx == NULL)
|
||||
return NULL;
|
||||
|
|
@ -631,7 +633,8 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||
pctx->const_uploader = pctx->stream_uploader;
|
||||
|
||||
screen = etna_screen(pscreen);
|
||||
ctx->stream = etna_cmd_stream_new(screen->pipe, 0x2000,
|
||||
pipe = (compute_only && screen->pipe_nn) ? screen->pipe_nn : screen->pipe;
|
||||
ctx->stream = etna_cmd_stream_new(pipe, 0x2000,
|
||||
&etna_context_force_flush, pctx);
|
||||
if (ctx->stream == NULL)
|
||||
goto fail;
|
||||
|
|
@ -655,7 +658,7 @@ etna_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
|
|||
/* need some sane default in case gallium frontends don't set some state: */
|
||||
ctx->sample_mask = 0xffff;
|
||||
|
||||
ctx->compute_only = flags & PIPE_CONTEXT_COMPUTE_ONLY;
|
||||
ctx->compute_only = compute_only;
|
||||
|
||||
/* Set sensible defaults for state */
|
||||
etna_reset_gpu_state(ctx);
|
||||
|
|
|
|||
|
|
@ -103,6 +103,9 @@ etna_screen_destroy(struct pipe_screen *pscreen)
|
|||
|
||||
etna_shader_screen_fini(pscreen);
|
||||
|
||||
if (screen->pipe_nn)
|
||||
etna_pipe_del(screen->pipe_nn);
|
||||
|
||||
if (screen->pipe)
|
||||
etna_pipe_del(screen->pipe);
|
||||
|
||||
|
|
@ -1092,6 +1095,14 @@ etna_screen_create(struct etna_device *dev, struct etna_gpu *gpu,
|
|||
goto fail;
|
||||
}
|
||||
|
||||
if (gpu != npu) {
|
||||
screen->pipe_nn = etna_pipe_new(npu, ETNA_PIPE_3D);
|
||||
if (!screen->pipe_nn) {
|
||||
DBG("could not create nn pipe");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* apply debug options that disable individual features */
|
||||
if (DBG_ENABLED(ETNA_DBG_NO_EARLY_Z))
|
||||
etna_core_disable_feature(screen->info, ETNA_FEATURE_NO_EARLY_Z);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ struct etna_screen {
|
|||
struct etna_gpu *gpu;
|
||||
struct etna_gpu *npu;
|
||||
struct etna_pipe *pipe;
|
||||
struct etna_pipe *pipe_nn;
|
||||
struct etna_perfmon *perfmon;
|
||||
struct renderonly *ro;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue