mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-25 15:36:42 +00:00
vaapivideomemory: add direct upload flag
Adds the direct-upload flag in the GstVaapiVideoAllocator and GstVaapiVideoMemory. It still doesn't apply any functional change.
This commit is contained in:
parent
e988298782
commit
7c692265d8
2 changed files with 18 additions and 2 deletions
|
@ -76,6 +76,12 @@ use_direct_rendering (GstVaapiImageUsageFlags flag)
|
||||||
return flag == GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER;
|
return flag == GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
use_direct_uploading (GstVaapiImageUsageFlags flag)
|
||||||
|
{
|
||||||
|
return flag == GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_UPLOAD;
|
||||||
|
}
|
||||||
|
|
||||||
static guchar *
|
static guchar *
|
||||||
get_image_data (GstVaapiImage * image)
|
get_image_data (GstVaapiImage * image)
|
||||||
{
|
{
|
||||||
|
@ -707,7 +713,7 @@ allocator_configure_surface_info (GstVaapiDisplay * display,
|
||||||
const GstVideoInfo *vinfo;
|
const GstVideoInfo *vinfo;
|
||||||
GstVaapiSurface *surface = NULL;
|
GstVaapiSurface *surface = NULL;
|
||||||
GstVaapiImage *image = NULL;
|
GstVaapiImage *image = NULL;
|
||||||
gboolean updated, has_direct_rendering;
|
gboolean updated, has_direct_uploading, has_direct_rendering;
|
||||||
GstVideoFormat fmt;
|
GstVideoFormat fmt;
|
||||||
|
|
||||||
vinfo = &allocator->video_info;
|
vinfo = &allocator->video_info;
|
||||||
|
@ -735,15 +741,22 @@ allocator_configure_surface_info (GstVaapiDisplay * display,
|
||||||
|
|
||||||
has_direct_rendering = updated && use_direct_rendering (req_usage_flag)
|
has_direct_rendering = updated && use_direct_rendering (req_usage_flag)
|
||||||
&& (GST_VAAPI_IMAGE_FORMAT (image) == GST_VIDEO_INFO_FORMAT (vinfo));
|
&& (GST_VAAPI_IMAGE_FORMAT (image) == GST_VIDEO_INFO_FORMAT (vinfo));
|
||||||
|
has_direct_uploading = updated && use_direct_uploading (req_usage_flag)
|
||||||
|
&& (GST_VAAPI_IMAGE_FORMAT (image) == GST_VIDEO_INFO_FORMAT (vinfo));
|
||||||
|
|
||||||
gst_vaapi_image_unmap (image);
|
gst_vaapi_image_unmap (image);
|
||||||
|
|
||||||
GST_INFO_OBJECT (allocator, "has %sdirect-rendering for %s surfaces",
|
GST_INFO_OBJECT (allocator, "has %sdirect-rendering for %s surfaces",
|
||||||
has_direct_rendering ? "" : "no ",
|
has_direct_rendering ? "" : "no ",
|
||||||
GST_VIDEO_INFO_FORMAT_STRING (&allocator->surface_info));
|
GST_VIDEO_INFO_FORMAT_STRING (&allocator->surface_info));
|
||||||
|
GST_INFO_OBJECT (allocator, "has %sdirect-uploading for %s surfaces",
|
||||||
|
has_direct_uploading ? "" : "no ",
|
||||||
|
GST_VIDEO_INFO_FORMAT_STRING (&allocator->surface_info));
|
||||||
|
|
||||||
if (has_direct_rendering)
|
if (has_direct_rendering && !has_direct_uploading)
|
||||||
allocator->usage_flag = GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER;
|
allocator->usage_flag = GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER;
|
||||||
|
else if (!has_direct_rendering && has_direct_uploading)
|
||||||
|
allocator->usage_flag = GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_UPLOAD;
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
if (image)
|
if (image)
|
||||||
|
|
|
@ -94,6 +94,8 @@ typedef enum
|
||||||
* GstVaapiImageUsageFlags:
|
* GstVaapiImageUsageFlags:
|
||||||
* @GST_VAAPI_IMAGE_USAGE_FLAG_NATIVE_FORMATS: will use vaCreateImage +
|
* @GST_VAAPI_IMAGE_USAGE_FLAG_NATIVE_FORMATS: will use vaCreateImage +
|
||||||
* va{Put,Get}Image when writing or reading onto the system memory.
|
* va{Put,Get}Image when writing or reading onto the system memory.
|
||||||
|
* @GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_UPLOAD: will try to use
|
||||||
|
* vaDeriveImage when writing data from the system memory.
|
||||||
* @GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER: will try to use
|
* @GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER: will try to use
|
||||||
* vaDeriveImage with reading data onto the system memory.
|
* vaDeriveImage with reading data onto the system memory.
|
||||||
*
|
*
|
||||||
|
@ -101,6 +103,7 @@ typedef enum
|
||||||
**/
|
**/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_VAAPI_IMAGE_USAGE_FLAG_NATIVE_FORMATS,
|
GST_VAAPI_IMAGE_USAGE_FLAG_NATIVE_FORMATS,
|
||||||
|
GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_UPLOAD,
|
||||||
GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER,
|
GST_VAAPI_IMAGE_USAGE_FLAG_DIRECT_RENDER,
|
||||||
} GstVaapiImageUsageFlags;
|
} GstVaapiImageUsageFlags;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue