aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2019-02-07 00:13:44 -0500
committerMarek Olšák <[email protected]>2019-07-29 17:52:41 -0400
commit187cc07d0561311114fc4b3e1fc9951ff311735b (patch)
tree4a7357722ab8f0587080846d094b59a04a70664d /src/gallium
parentea7646dc13306e96188e7a7fd76e8a926bede13d (diff)
gallium: create multimedia contexts as compute-only if graphics is unsupported
Reviewed-by: Alex Deucher <[email protected]> Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_inlines.h11
-rw-r--r--src/gallium/auxiliary/vl/vl_mpeg12_decoder.c2
-rw-r--r--src/gallium/auxiliary/vl/vl_winsys_dri3.c3
-rw-r--r--src/gallium/state_trackers/omx/bellagio/vid_dec.c2
-rw-r--r--src/gallium/state_trackers/omx/bellagio/vid_enc.c4
-rw-r--r--src/gallium/state_trackers/omx/tizonia/h264dprc.c2
-rw-r--r--src/gallium/state_trackers/omx/tizonia/h264eprc.c4
-rw-r--r--src/gallium/state_trackers/va/context.c3
-rw-r--r--src/gallium/state_trackers/vdpau/device.c2
9 files changed, 21 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index ffd0ea9c7a2..1254e3f9e98 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -731,6 +731,17 @@ util_texrange_covers_whole_level(const struct pipe_resource *tex,
depth == util_num_layers(tex, level);
}
+static inline struct pipe_context *
+pipe_create_multimedia_context(struct pipe_screen *screen)
+{
+ unsigned flags = 0;
+
+ if (!screen->get_param(screen, PIPE_CAP_GRAPHICS))
+ flags |= PIPE_CONTEXT_COMPUTE_ONLY;
+
+ return screen->context_create(screen, NULL, flags);
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
index 6e6f0bd4563..b7ef70f6ced 100644
--- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
+++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c
@@ -1120,7 +1120,7 @@ vl_create_mpeg12_decoder(struct pipe_context *context,
dec->base = *templat;
dec->base.context = context;
- dec->context = context->screen->context_create(context->screen, NULL, 0);
+ dec->context = pipe_create_multimedia_context(context->screen);
dec->base.destroy = vl_mpeg12_destroy;
dec->base.begin_frame = vl_mpeg12_begin_frame;
diff --git a/src/gallium/auxiliary/vl/vl_winsys_dri3.c b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
index 77d1972af2c..56649654011 100644
--- a/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ b/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -832,8 +832,7 @@ vl_dri3_screen_create(Display *display, int screen)
if (!scrn->base.pscreen)
goto release_pipe;
- scrn->pipe = scrn->base.pscreen->context_create(scrn->base.pscreen,
- NULL, 0);
+ scrn->pipe = pipe_create_multimedia_context(scrn->base.pscreen);
if (!scrn->pipe)
goto no_context;
diff --git a/src/gallium/state_trackers/omx/bellagio/vid_dec.c b/src/gallium/state_trackers/omx/bellagio/vid_dec.c
index 65e612a57fe..2eedf937cd9 100644
--- a/src/gallium/state_trackers/omx/bellagio/vid_dec.c
+++ b/src/gallium/state_trackers/omx/bellagio/vid_dec.c
@@ -180,7 +180,7 @@ static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
return OMX_ErrorInsufficientResources;
screen = priv->screen->pscreen;
- priv->pipe = screen->context_create(screen, NULL, 0);
+ priv->pipe = pipe_create_multimedia_context(screen);
if (!priv->pipe)
return OMX_ErrorInsufficientResources;
diff --git a/src/gallium/state_trackers/omx/bellagio/vid_enc.c b/src/gallium/state_trackers/omx/bellagio/vid_enc.c
index 525d2f331d8..9f25be9fafe 100644
--- a/src/gallium/state_trackers/omx/bellagio/vid_enc.c
+++ b/src/gallium/state_trackers/omx/bellagio/vid_enc.c
@@ -157,7 +157,7 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
return OMX_ErrorBadParameter;
- priv->s_pipe = screen->context_create(screen, NULL, 0);
+ priv->s_pipe = pipe_create_multimedia_context(screen);
if (!priv->s_pipe)
return OMX_ErrorInsufficientResources;
@@ -176,7 +176,7 @@ static OMX_ERRORTYPE vid_enc_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING nam
return OMX_ErrorInsufficientResources;
}
- priv->t_pipe = screen->context_create(screen, NULL, 0);
+ priv->t_pipe = pipe_create_multimedia_context(screen);
if (!priv->t_pipe)
return OMX_ErrorInsufficientResources;
diff --git a/src/gallium/state_trackers/omx/tizonia/h264dprc.c b/src/gallium/state_trackers/omx/tizonia/h264dprc.c
index 09248e64a92..b900c75a57d 100644
--- a/src/gallium/state_trackers/omx/tizonia/h264dprc.c
+++ b/src/gallium/state_trackers/omx/tizonia/h264dprc.c
@@ -407,7 +407,7 @@ static OMX_ERRORTYPE h264d_prc_allocate_resources(void *ap_obj, OMX_U32 a_pid)
return OMX_ErrorInsufficientResources;
screen = priv->screen->pscreen;
- priv->pipe = screen->context_create(screen, priv->screen, 0);
+ priv->pipe = pipe_create_multimedia_context(screen);
if (!priv->pipe)
return OMX_ErrorInsufficientResources;
diff --git a/src/gallium/state_trackers/omx/tizonia/h264eprc.c b/src/gallium/state_trackers/omx/tizonia/h264eprc.c
index effff378e8f..b6bba151399 100644
--- a/src/gallium/state_trackers/omx/tizonia/h264eprc.c
+++ b/src/gallium/state_trackers/omx/tizonia/h264eprc.c
@@ -403,7 +403,7 @@ static OMX_ERRORTYPE h264e_prc_create_encoder(void *ap_obj)
PIPE_VIDEO_ENTRYPOINT_ENCODE, PIPE_VIDEO_CAP_SUPPORTED))
return OMX_ErrorBadParameter;
- priv->s_pipe = screen->context_create(screen, NULL, 0);
+ priv->s_pipe = pipe_create_multimedia_context(screen);
if (!priv->s_pipe)
return OMX_ErrorInsufficientResources;
@@ -422,7 +422,7 @@ static OMX_ERRORTYPE h264e_prc_create_encoder(void *ap_obj)
return OMX_ErrorInsufficientResources;
}
- priv->t_pipe = screen->context_create(screen, NULL, 0);
+ priv->t_pipe = pipe_create_multimedia_context(screen);
if (!priv->t_pipe)
return OMX_ErrorInsufficientResources;
diff --git a/src/gallium/state_trackers/va/context.c b/src/gallium/state_trackers/va/context.c
index 9176b7e8c5d..2cb3a6c9268 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -151,8 +151,7 @@ VA_DRIVER_INIT_FUNC(VADriverContextP ctx)
if (!drv->vscreen)
goto error_screen;
- drv->pipe = drv->vscreen->pscreen->context_create(drv->vscreen->pscreen,
- NULL, 0);
+ drv->pipe = pipe_create_multimedia_context(drv->vscreen->pscreen);
if (!drv->pipe)
goto error_pipe;
diff --git a/src/gallium/state_trackers/vdpau/device.c b/src/gallium/state_trackers/vdpau/device.c
index c3f156f0bb4..c5a3eeb6b30 100644
--- a/src/gallium/state_trackers/vdpau/device.c
+++ b/src/gallium/state_trackers/vdpau/device.c
@@ -72,7 +72,7 @@ vdp_imp_device_create_x11(Display *display, int screen, VdpDevice *device,
}
pscreen = dev->vscreen->pscreen;
- dev->context = pscreen->context_create(pscreen, NULL, 0);
+ dev->context = pipe_create_multimedia_context(pscreen);
if (!dev->context) {
ret = VDP_STATUS_RESOURCES;
goto no_context;