mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
va: compositor: Use va_get_surface_usage_hint() to get the usage hint
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5210>
This commit is contained in:
parent
1b43baf3c8
commit
c927159f21
1 changed files with 18 additions and 5 deletions
|
@ -47,6 +47,7 @@
|
||||||
#include "gstvacompositor.h"
|
#include "gstvacompositor.h"
|
||||||
|
|
||||||
#include <gst/va/gstva.h>
|
#include <gst/va/gstva.h>
|
||||||
|
#include <gst/va/vasurfaceimage.h>
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
#include <va/va_drmcommon.h>
|
#include <va/va_drmcommon.h>
|
||||||
|
|
||||||
|
@ -562,7 +563,7 @@ gst_va_compositor_propose_allocation (GstAggregator * agg,
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
gboolean update_allocator = FALSE;
|
gboolean update_allocator = FALSE;
|
||||||
guint size, usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_GENERIC;
|
guint size, usage_hint;
|
||||||
|
|
||||||
gst_query_parse_allocation (query, &caps, NULL);
|
gst_query_parse_allocation (query, &caps, NULL);
|
||||||
|
|
||||||
|
@ -575,6 +576,9 @@ gst_va_compositor_propose_allocation (GstAggregator * agg,
|
||||||
if (gst_query_get_n_allocation_pools (query) > 0)
|
if (gst_query_get_n_allocation_pools (query) > 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
usage_hint = va_get_surface_usage_hint (self->display,
|
||||||
|
VAEntrypointVideoProc, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps));
|
||||||
|
|
||||||
size = GST_VIDEO_INFO_SIZE (&info);
|
size = GST_VIDEO_INFO_SIZE (&info);
|
||||||
|
|
||||||
if (gst_query_get_n_allocation_params (query) > 0) {
|
if (gst_query_get_n_allocation_params (query) > 0) {
|
||||||
|
@ -658,7 +662,7 @@ gst_va_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
GstStructure *config;
|
GstStructure *config;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
guint min, max, size = 0, usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_WRITE;
|
guint min, max, size = 0, usage_hint;
|
||||||
gboolean update_pool, update_allocator, has_videometa, copy_frames;
|
gboolean update_pool, update_allocator, has_videometa, copy_frames;
|
||||||
gboolean dont_use_other_pool = FALSE;
|
gboolean dont_use_other_pool = FALSE;
|
||||||
|
|
||||||
|
@ -724,6 +728,9 @@ gst_va_compositor_decide_allocation (GstAggregator * agg, GstQuery * query)
|
||||||
if (!pool)
|
if (!pool)
|
||||||
pool = gst_va_pool_new ();
|
pool = gst_va_pool_new ();
|
||||||
|
|
||||||
|
usage_hint = va_get_surface_usage_hint (self->display,
|
||||||
|
VAEntrypointVideoProc, GST_PAD_SRC, gst_video_is_dma_drm_caps (caps));
|
||||||
|
|
||||||
config = gst_buffer_pool_get_config (pool);
|
config = gst_buffer_pool_get_config (pool);
|
||||||
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
gst_buffer_pool_config_set_allocator (config, allocator, ¶ms);
|
||||||
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||||
|
@ -793,7 +800,7 @@ _get_sinkpad_pool (GstVaCompositor * self, GstVaCompositorPad * pad)
|
||||||
GstAllocationParams params = { 0, };
|
GstAllocationParams params = { 0, };
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
guint size, usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ;
|
guint size, usage_hint;
|
||||||
|
|
||||||
if (pad->pool)
|
if (pad->pool)
|
||||||
return pad->pool;
|
return pad->pool;
|
||||||
|
@ -809,6 +816,9 @@ _get_sinkpad_pool (GstVaCompositor * self, GstVaCompositorPad * pad)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usage_hint = va_get_surface_usage_hint (self->display,
|
||||||
|
VAEntrypointVideoProc, GST_PAD_SINK, FALSE);
|
||||||
|
|
||||||
size = GST_VIDEO_INFO_SIZE (&info);
|
size = GST_VIDEO_INFO_SIZE (&info);
|
||||||
|
|
||||||
allocator = gst_va_compositor_allocator_from_caps (self, caps);
|
allocator = gst_va_compositor_allocator_from_caps (self, caps);
|
||||||
|
@ -862,7 +872,7 @@ _try_import_dmabuf_unlocked (GstVaCompositor * self, GstVideoInfo * info,
|
||||||
{
|
{
|
||||||
GstVideoMeta *meta;
|
GstVideoMeta *meta;
|
||||||
GstMemory *mems[GST_VIDEO_MAX_PLANES];
|
GstMemory *mems[GST_VIDEO_MAX_PLANES];
|
||||||
guint i, n_mem, n_planes;
|
guint i, n_mem, n_planes, usage_hint;
|
||||||
gsize offset[GST_VIDEO_MAX_PLANES];
|
gsize offset[GST_VIDEO_MAX_PLANES];
|
||||||
uintptr_t fd[GST_VIDEO_MAX_PLANES];
|
uintptr_t fd[GST_VIDEO_MAX_PLANES];
|
||||||
|
|
||||||
|
@ -916,9 +926,12 @@ _try_import_dmabuf_unlocked (GstVaCompositor * self, GstVideoInfo * info,
|
||||||
fd[i] = gst_dmabuf_memory_get_fd (mems[i]);
|
fd[i] = gst_dmabuf_memory_get_fd (mems[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usage_hint = va_get_surface_usage_hint (self->display,
|
||||||
|
VAEntrypointVideoProc, GST_PAD_SINK, TRUE);
|
||||||
|
|
||||||
/* Now create a VASurfaceID for the buffer */
|
/* Now create a VASurfaceID for the buffer */
|
||||||
return gst_va_dmabuf_memories_setup (self->display, info, n_planes,
|
return gst_va_dmabuf_memories_setup (self->display, info, n_planes,
|
||||||
mems, fd, offset, VA_SURFACE_ATTRIB_USAGE_HINT_VPP_READ);
|
mems, fd, offset, usage_hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern GRecMutex GST_VA_SHARED_LOCK;
|
extern GRecMutex GST_VA_SHARED_LOCK;
|
||||||
|
|
Loading…
Reference in a new issue