libs: surface: surfacepool: Add allocation flags in constructors.

This commit is contained in:
Víctor Manuel Jáquez Leal 2020-01-24 22:08:50 +01:00
parent 3ff51a6e52
commit 8c08ef31a5
9 changed files with 25 additions and 15 deletions

View file

@ -171,7 +171,7 @@ context_ensure_surfaces (GstVaapiContext * context)
for (i = context->surfaces->len; i < num_surfaces; i++) { for (i = context->surfaces->len; i < num_surfaces; i++) {
if (format != GST_VIDEO_FORMAT_UNKNOWN) { if (format != GST_VIDEO_FORMAT_UNKNOWN) {
surface = gst_vaapi_surface_new_with_format (display, format, cip->width, surface = gst_vaapi_surface_new_with_format (display, format, cip->width,
cip->height); cip->height, 0);
} else { } else {
surface = gst_vaapi_surface_new (display, cip->chroma_type, cip->width, surface = gst_vaapi_surface_new (display, cip->chroma_type, cip->width,
cip->height); cip->height);
@ -204,7 +204,7 @@ context_create_surfaces (GstVaapiContext * context)
if (!context->surfaces_pool) { if (!context->surfaces_pool) {
context->surfaces_pool = context->surfaces_pool =
gst_vaapi_surface_pool_new_with_chroma_type (display, cip->chroma_type, gst_vaapi_surface_pool_new_with_chroma_type (display, cip->chroma_type,
cip->width, cip->height); cip->width, cip->height, 0);
if (!context->surfaces_pool) if (!context->surfaces_pool)
return FALSE; return FALSE;

View file

@ -426,6 +426,7 @@ error:
* @format: the surface format * @format: the surface format
* @width: the requested surface width * @width: the requested surface width
* @height: the requested surface height * @height: the requested surface height
* @surface_allocation_flags: (optional) allocation flags
* *
* Creates a new #GstVaapiSurface with the specified pixel format and * Creates a new #GstVaapiSurface with the specified pixel format and
* dimensions. * dimensions.
@ -436,12 +437,13 @@ error:
*/ */
GstVaapiSurface * GstVaapiSurface *
gst_vaapi_surface_new_with_format (GstVaapiDisplay * display, gst_vaapi_surface_new_with_format (GstVaapiDisplay * display,
GstVideoFormat format, guint width, guint height) GstVideoFormat format, guint width, guint height,
guint surface_allocation_flags)
{ {
GstVideoInfo vi; GstVideoInfo vi;
gst_video_info_set_format (&vi, format, width, height); gst_video_info_set_format (&vi, format, width, height);
return gst_vaapi_surface_new_full (display, &vi, 0); return gst_vaapi_surface_new_full (display, &vi, surface_allocation_flags);
} }
/** /**

View file

@ -216,7 +216,8 @@ gst_vaapi_surface_new_full (GstVaapiDisplay * display,
GstVaapiSurface * GstVaapiSurface *
gst_vaapi_surface_new_with_format (GstVaapiDisplay * display, gst_vaapi_surface_new_with_format (GstVaapiDisplay * display,
GstVideoFormat format, guint width, guint height); GstVideoFormat format, guint width, guint height,
guint surface_allocation_flags);
GstVaapiSurface * GstVaapiSurface *
gst_vaapi_surface_new_from_buffer_proxy (GstVaapiDisplay * display, gst_vaapi_surface_new_from_buffer_proxy (GstVaapiDisplay * display,

View file

@ -147,7 +147,7 @@ create_surface_from_egl_image (GstVaapiDisplayEGL * display,
GST_VAAPI_CHROMA_TYPE_YUV420, width, height); GST_VAAPI_CHROMA_TYPE_YUV420, width, height);
} else { } else {
out_surface = gst_vaapi_surface_new_with_format (base_display, out_surface = gst_vaapi_surface_new_with_format (base_display,
GST_VIDEO_INFO_FORMAT (vip), width, height); GST_VIDEO_INFO_FORMAT (vip), width, height, 0);
} }
if (!out_surface) if (!out_surface)
goto error_create_surface; goto error_create_surface;

View file

@ -108,6 +108,7 @@ gst_vaapi_surface_pool_class (void)
* @format: a #GstVideoFormat * @format: a #GstVideoFormat
* @width: the desired width, in pixels * @width: the desired width, in pixels
* @height: the desired height, in pixels * @height: the desired height, in pixels
* @surface_allocation_flags: (optional) allocation flags
* *
* Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the specified * Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the specified
* format and dimensions. If @format is GST_VIDEO_FORMAT_ENCODED, then * format and dimensions. If @format is GST_VIDEO_FORMAT_ENCODED, then
@ -118,7 +119,7 @@ gst_vaapi_surface_pool_class (void)
*/ */
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format, gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
guint width, guint height) guint width, guint height, guint surface_allocation_flags)
{ {
GstVideoInfo vi; GstVideoInfo vi;
@ -127,7 +128,8 @@ gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
g_return_val_if_fail (height > 0, NULL); g_return_val_if_fail (height > 0, NULL);
gst_video_info_set_format (&vi, format, width, height); gst_video_info_set_format (&vi, format, width, height);
return gst_vaapi_surface_pool_new_full (display, &vi, 0); return gst_vaapi_surface_pool_new_full (display, &vi,
surface_allocation_flags);
} }
/** /**
@ -176,6 +178,7 @@ error:
* @chroma_type: a #GstVaapiChromatype * @chroma_type: a #GstVaapiChromatype
* @width: the desired width, in pixels * @width: the desired width, in pixels
* @height: the desired height, in pixels * @height: the desired height, in pixels
* @surface_allocation_flags: (optional) allocation flags
* *
* Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the specified * Creates a new #GstVaapiVideoPool of #GstVaapiSurface with the specified
* chroma type and dimensions. The underlying format of the surfaces is * chroma type and dimensions. The underlying format of the surfaces is
@ -185,7 +188,8 @@ error:
*/ */
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display, gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display,
GstVaapiChromaType chroma_type, guint width, guint height) GstVaapiChromaType chroma_type, guint width, guint height,
guint surface_allocation_flags)
{ {
GstVaapiVideoPool *pool; GstVaapiVideoPool *pool;
GstVideoInfo vi; GstVideoInfo vi;
@ -197,7 +201,8 @@ gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display,
gst_video_info_set_format (&vi, GST_VIDEO_FORMAT_ENCODED, width, height); gst_video_info_set_format (&vi, GST_VIDEO_FORMAT_ENCODED, width, height);
pool = gst_vaapi_surface_pool_new_full (display, &vi, 0); pool =
gst_vaapi_surface_pool_new_full (display, &vi, surface_allocation_flags);
if (!pool) if (!pool)
return NULL; return NULL;

View file

@ -38,7 +38,7 @@ typedef struct _GstVaapiSurfacePool GstVaapiSurfacePool;
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format, gst_vaapi_surface_pool_new (GstVaapiDisplay * display, GstVideoFormat format,
guint width, guint height); guint width, guint height, guint surface_allocation_flags);
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display, gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
@ -46,7 +46,8 @@ gst_vaapi_surface_pool_new_full (GstVaapiDisplay * display,
GstVaapiVideoPool * GstVaapiVideoPool *
gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display, gst_vaapi_surface_pool_new_with_chroma_type (GstVaapiDisplay * display,
GstVaapiChromaType chroma_type, guint width, guint height); GstVaapiChromaType chroma_type, guint width, guint height,
guint surface_allocation_flags);
G_END_DECLS G_END_DECLS

View file

@ -109,7 +109,7 @@ ensure_filter_surface_pool (GstVaapiWindow * window)
/* Ensure VA surface pool is created */ /* Ensure VA surface pool is created */
/* XXX: optimize the surface format to use. e.g. YUY2 */ /* XXX: optimize the surface format to use. e.g. YUY2 */
window->surface_pool = gst_vaapi_surface_pool_new (display, window->surface_pool = gst_vaapi_surface_pool_new (display,
GST_VIDEO_FORMAT_NV12, window->width, window->height); GST_VIDEO_FORMAT_NV12, window->width, window->height, 0);
if (!window->surface_pool) { if (!window->surface_pool) {
GST_WARNING ("failed to create surface pool for conversion"); GST_WARNING ("failed to create surface pool for conversion");
return FALSE; return FALSE;

View file

@ -106,7 +106,8 @@ create_test_surface (GstVaapiDisplay * display, guint width, guint height,
goto error_invalid_format; goto error_invalid_format;
} }
surface = gst_vaapi_surface_new_with_format (display, format, width, height); surface =
gst_vaapi_surface_new_with_format (display, format, width, height, 0);
if (!surface) if (!surface)
goto error_create_surface; goto error_create_surface;

View file

@ -60,7 +60,7 @@ main (int argc, char *argv[])
gst_vaapi_surface_unref (surface); gst_vaapi_surface_unref (surface);
pool = gst_vaapi_surface_pool_new (display, GST_VIDEO_FORMAT_ENCODED, pool = gst_vaapi_surface_pool_new (display, GST_VIDEO_FORMAT_ENCODED,
width, height); width, height, 0);
if (!pool) if (!pool)
g_error ("could not create Gst/VA surface pool"); g_error ("could not create Gst/VA surface pool");