mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-26 18:20:44 +00:00
va: Extend the va_create_surfaces() function to accept modifiers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4821>
This commit is contained in:
parent
994ab957c1
commit
7166fd3863
3 changed files with 31 additions and 13 deletions
|
@ -589,8 +589,8 @@ gst_va_dmabuf_allocator_setup_buffer_full (GstAllocator * allocator,
|
|||
|
||||
if (!va_create_surfaces (self->display, rt_format, fourcc,
|
||||
GST_VIDEO_INFO_WIDTH (&self->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, extbuf,
|
||||
&surface, 1))
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, NULL, 1,
|
||||
extbuf, &surface, 1))
|
||||
return FALSE;
|
||||
|
||||
/* workaround for missing layered dmabuf formats in i965 */
|
||||
|
@ -1040,7 +1040,8 @@ gst_va_dmabuf_memories_setup (GstVaDisplay * display, GstVideoInfo * info,
|
|||
}
|
||||
|
||||
ret = va_create_surfaces (display, rt_format, ext_buf.pixel_format,
|
||||
ext_buf.width, ext_buf.height, usage_hint, &ext_buf, &surface, 1);
|
||||
ext_buf.width, ext_buf.height, usage_hint, NULL, 0, &ext_buf, &surface,
|
||||
1);
|
||||
if (!ret)
|
||||
return FALSE;
|
||||
|
||||
|
@ -1236,7 +1237,7 @@ _update_image_info (GstVaAllocator * va_allocator)
|
|||
if (!va_create_surfaces (va_allocator->display, va_allocator->rt_format,
|
||||
va_allocator->fourcc, GST_VIDEO_INFO_WIDTH (&va_allocator->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&va_allocator->info), va_allocator->usage_hint,
|
||||
NULL, &surface, 1)) {
|
||||
NULL, 0, NULL, &surface, 1)) {
|
||||
GST_ERROR_OBJECT (va_allocator, "Failed to create a test surface");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1599,7 +1600,7 @@ gst_va_allocator_alloc (GstAllocator * allocator)
|
|||
|
||||
if (!va_create_surfaces (self->display, self->rt_format, self->fourcc,
|
||||
GST_VIDEO_INFO_WIDTH (&self->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, NULL,
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, NULL, 0, NULL,
|
||||
&surface, 1))
|
||||
return NULL;
|
||||
|
||||
|
@ -2066,8 +2067,8 @@ gst_va_buffer_create_aux_surface (GstBuffer * buffer)
|
|||
display = self->display;
|
||||
if (!va_create_surfaces (self->display, rt_format, fourcc,
|
||||
GST_VIDEO_INFO_WIDTH (&self->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, NULL,
|
||||
&surface, 1))
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, NULL, 0,
|
||||
NULL, &surface, 1))
|
||||
return FALSE;
|
||||
} else if (GST_IS_VA_ALLOCATOR (mem->allocator)) {
|
||||
GstVaAllocator *self = GST_VA_ALLOCATOR (mem->allocator);
|
||||
|
@ -2081,8 +2082,8 @@ gst_va_buffer_create_aux_surface (GstBuffer * buffer)
|
|||
format = GST_VIDEO_INFO_FORMAT (&self->info);
|
||||
if (!va_create_surfaces (self->display, self->rt_format, self->fourcc,
|
||||
GST_VIDEO_INFO_WIDTH (&self->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, NULL,
|
||||
&surface, 1))
|
||||
GST_VIDEO_INFO_HEIGHT (&self->info), self->usage_hint, NULL, 0,
|
||||
NULL, &surface, 1))
|
||||
return FALSE;
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
|
|
|
@ -50,13 +50,13 @@ va_destroy_surfaces (GstVaDisplay * display, VASurfaceID * surfaces,
|
|||
|
||||
gboolean
|
||||
va_create_surfaces (GstVaDisplay * display, guint rt_format, guint fourcc,
|
||||
guint width, guint height, gint usage_hint,
|
||||
VASurfaceAttribExternalBuffers * ext_buf, VASurfaceID * surfaces,
|
||||
guint num_surfaces)
|
||||
guint width, guint height, gint usage_hint, guint64 * modifiers,
|
||||
guint num_modifiers, VASurfaceAttribExternalBuffers * ext_buf,
|
||||
VASurfaceID * surfaces, guint num_surfaces)
|
||||
{
|
||||
VADisplay dpy = gst_va_display_get_va_dpy (display);
|
||||
/* *INDENT-OFF* */
|
||||
VASurfaceAttrib attrs[5] = {
|
||||
VASurfaceAttrib attrs[6] = {
|
||||
{
|
||||
.type = VASurfaceAttribUsageHint,
|
||||
.flags = VA_SURFACE_ATTRIB_SETTABLE,
|
||||
|
@ -72,6 +72,10 @@ va_create_surfaces (GstVaDisplay * display, guint rt_format, guint fourcc,
|
|||
: VA_SURFACE_ATTRIB_MEM_TYPE_VA,
|
||||
},
|
||||
};
|
||||
VADRMFormatModifierList modifier_list = {
|
||||
.num_modifiers = num_modifiers,
|
||||
.modifiers = modifiers,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
VAStatus status;
|
||||
guint num_attrs = 2;
|
||||
|
@ -100,6 +104,17 @@ va_create_surfaces (GstVaDisplay * display, guint rt_format, guint fourcc,
|
|||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
if (num_modifiers > 0 && modifiers) {
|
||||
/* *INDENT-OFF* */
|
||||
attrs[num_attrs++] = (VASurfaceAttrib) {
|
||||
.type = VASurfaceAttribDRMFormatModifiers,
|
||||
.flags = VA_SURFACE_ATTRIB_SETTABLE,
|
||||
.value.type = VAGenericValueTypePointer,
|
||||
.value.value.p = &modifier_list,
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
status = vaCreateSurfaces (dpy, rt_format, width, height, surfaces,
|
||||
num_surfaces, attrs, num_attrs);
|
||||
if (status != VA_STATUS_SUCCESS) {
|
||||
|
|
|
@ -32,6 +32,8 @@ gboolean va_create_surfaces (GstVaDisplay * displa
|
|||
guint rt_format, guint fourcc,
|
||||
guint width, guint height,
|
||||
gint usage_hint,
|
||||
guint64 * modifiers,
|
||||
guint num_modifiers,
|
||||
VASurfaceAttribExternalBuffers * ext_buf,
|
||||
VASurfaceID * surfaces,
|
||||
guint num_surfaces);
|
||||
|
|
Loading…
Reference in a new issue