va: Use vaMapBuffer2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5467>
This commit is contained in:
David Rosca 2023-10-12 10:39:39 +02:00 committed by GStreamer Marge Bot
parent 25c00b5ba2
commit 8aac08506a
4 changed files with 14 additions and 3 deletions

View file

@ -1430,7 +1430,7 @@ _va_map_unlocked (GstVaMemory * mem, GstMapFlags flags)
goto fail;
}
if (!va_map_buffer (display, mem->image.buf, &mem->mapped_data))
if (!va_map_buffer (display, mem->image.buf, flags, &mem->mapped_data))
goto fail;
success:

View file

@ -242,12 +242,22 @@ va_sync_surface (GstVaDisplay * display, VASurfaceID surface)
}
gboolean
va_map_buffer (GstVaDisplay * display, VABufferID buffer, gpointer * data)
va_map_buffer (GstVaDisplay * display, VABufferID buffer, GstMapFlags flags,
gpointer * data)
{
VADisplay dpy = gst_va_display_get_va_dpy (display);
VAStatus status;
#if VA_CHECK_VERSION(1, 21, 0)
uint32_t vaflags = 0;
if (flags & GST_MAP_READ)
vaflags |= VA_MAPBUFFER_FLAG_READ;
if (flags & GST_MAP_WRITE)
vaflags |= VA_MAPBUFFER_FLAG_WRITE;
status = vaMapBuffer2 (dpy, buffer, data, vaflags);
#else
status = vaMapBuffer (dpy, buffer, data);
#endif
if (status != VA_STATUS_SUCCESS) {
GST_WARNING ("vaMapBuffer: %s", vaErrorStr (status));
return FALSE;

View file

@ -88,6 +88,7 @@ gboolean va_ensure_image (GstVaDisplay * displa
GST_VA_API
gboolean va_map_buffer (GstVaDisplay * display,
VABufferID buffer,
GstMapFlags flags,
gpointer * data);
GST_VA_API
gboolean va_unmap_buffer (GstVaDisplay * display,

View file

@ -288,7 +288,7 @@ gst_va_base_enc_create_output_buffer (GstVaBaseEnc * base,
seg_list = NULL;
if (!va_map_buffer (base->display, picture->coded_buffer,
(gpointer *) & seg_list))
GST_MAP_READ, (gpointer *) & seg_list))
goto error;
if (!seg_list) {