va: baseenc: 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:
He Junyan 2023-08-21 16:54:31 +08:00 committed by Víctor Manuel Jáquez Leal
parent 696d81f6f8
commit 1b43baf3c8
2 changed files with 13 additions and 3 deletions

View file

@ -196,7 +196,7 @@ _get_sinkpad_pool (GstVaBaseEnc * base)
{
GstAllocator *allocator;
GstAllocationParams params = { 0, };
guint size, usage_hint = 0;
guint size, usage_hint;
GArray *surface_formats = NULL;
GstCaps *caps = NULL;
@ -216,6 +216,9 @@ _get_sinkpad_pool (GstVaBaseEnc * base)
allocator = gst_va_allocator_new (base->display, surface_formats);
usage_hint = va_get_surface_usage_hint (base->display,
VAEntrypointEncSlice, GST_PAD_SINK, FALSE);
base->priv->raw_pool = gst_va_pool_new_with_config (caps, size, 1, 0,
usage_hint, GST_VA_FEATURE_AUTO, allocator, &params);
gst_clear_caps (&caps);
@ -405,7 +408,7 @@ gst_va_base_enc_propose_allocation (GstVideoEncoder * venc, GstQuery * query)
GstCaps *caps;
GstVideoInfo info;
gboolean need_pool = FALSE;
guint size, usage_hint = 0;
guint size, usage_hint;
gst_query_parse_allocation (query, &caps, &need_pool);
if (!caps)
@ -416,6 +419,9 @@ gst_va_base_enc_propose_allocation (GstVideoEncoder * venc, GstQuery * query)
return FALSE;
}
usage_hint = va_get_surface_usage_hint (base->display,
VAEntrypointEncSlice, GST_PAD_SINK, gst_video_is_dma_drm_caps (caps));
size = GST_VIDEO_INFO_SIZE (&info);
gst_allocation_params_init (&params);

View file

@ -26,6 +26,7 @@
#include "gstvaencoder.h"
#include <gst/va/gstvavideoformat.h>
#include <gst/va/vasurfaceimage.h>
#include "gstvacaps.h"
#include "gstvaprofile.h"
@ -305,7 +306,7 @@ _create_reconstruct_pool (GstVaDisplay * display, GArray * surface_formats,
guint max_buffers)
{
GstAllocator *allocator = NULL;
guint usage_hint = VA_SURFACE_ATTRIB_USAGE_HINT_ENCODER;
guint usage_hint;
GstVideoInfo info;
GstAllocationParams params = { 0, };
GstBufferPool *pool;
@ -314,6 +315,9 @@ _create_reconstruct_pool (GstVaDisplay * display, GArray * surface_formats,
gst_video_info_set_format (&info, format, coded_width, coded_height);
usage_hint = va_get_surface_usage_hint (display,
VAEntrypointEncSlice, GST_PAD_SINK, FALSE);
size = GST_VIDEO_INFO_SIZE (&info);
caps = gst_video_info_to_caps (&info);