mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-15 22:01:27 +00:00
va: Add helper function va_get_surface_usage_hint()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5210>
This commit is contained in:
parent
a49cd5f94d
commit
0e500ee084
2 changed files with 40 additions and 0 deletions
|
@ -341,3 +341,37 @@ va_copy_surface (GstVaDisplay * display, VASurfaceID dst, VASurfaceID src)
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
va_get_surface_usage_hint (GstVaDisplay * display, VAEntrypoint entrypoint,
|
||||||
|
GstPadDirection dir, gboolean is_dma)
|
||||||
|
{
|
||||||
|
switch (entrypoint) {
|
||||||
|
case VAEntrypointVideoProc:{
|
||||||
|
/* For DMA kind caps, we use VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ |
|
||||||
|
VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE to detect the modifiers.
|
||||||
|
And in runtime, we should use the same flags in order to keep
|
||||||
|
the same modifiers. */
|
||||||
|
if (is_dma)
|
||||||
|
return VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ |
|
||||||
|
VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
|
||||||
|
|
||||||
|
if (dir == GST_PAD_SINK)
|
||||||
|
return VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ;
|
||||||
|
else if (dir == GST_PAD_SRC)
|
||||||
|
return VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case VAEntrypointVLD:
|
||||||
|
return VA_SURFACE_ATTRIB_USAGE_HINT_DECODER;
|
||||||
|
case VAEntrypointEncSlice:
|
||||||
|
case VAEntrypointEncSliceLP:
|
||||||
|
case VAEntrypointEncPicture:
|
||||||
|
return VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC;
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,12 @@ gboolean va_copy_surface (GstVaDisplay * displa
|
||||||
VASurfaceID dst,
|
VASurfaceID dst,
|
||||||
VASurfaceID src);
|
VASurfaceID src);
|
||||||
|
|
||||||
|
GST_VA_API
|
||||||
|
guint va_get_surface_usage_hint (GstVaDisplay * display,
|
||||||
|
VAEntrypoint entrypoint,
|
||||||
|
GstPadDirection dir,
|
||||||
|
gboolean is_dma);
|
||||||
|
|
||||||
/* images */
|
/* images */
|
||||||
gboolean va_create_image (GstVaDisplay * display,
|
gboolean va_create_image (GstVaDisplay * display,
|
||||||
GstVideoFormat format,
|
GstVideoFormat format,
|
||||||
|
|
Loading…
Reference in a new issue