mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
surface: add support for GEM buffer exports.
Add support for GEM buffer exports. This will only work with VA drivers based off libdrm, e.g. the Intel HD Graphics VA driver. This is needed to support interop with EGL and the "Desktop" GL specification. Indeed, the EXT_image_dma_buf_import extension is not going to be supported in Desktop GL, due to the lack of support for GL_TEXTURE_EXTERNAL_OES targets there. This is useful for implementing VA/EGL interop with legacy Mesa stacks, in Desktop OpenGL context. https://bugzilla.gnome.org/show_bug.cgi?id=736717
This commit is contained in:
parent
073d6d59e1
commit
f3c58d4ef4
4 changed files with 33 additions and 0 deletions
|
@ -45,6 +45,9 @@ from_GstVaapiBufferMemoryType (guint type)
|
|||
case GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF:
|
||||
va_type = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME;
|
||||
break;
|
||||
case GST_VAAPI_BUFFER_MEMORY_TYPE_GEM_BUF:
|
||||
va_type = VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM;
|
||||
break;
|
||||
default:
|
||||
va_type = 0;
|
||||
break;
|
||||
|
@ -61,6 +64,9 @@ to_GstVaapiBufferMemoryType (guint va_type)
|
|||
case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME:
|
||||
type = GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF;
|
||||
break;
|
||||
case VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM:
|
||||
type = GST_VAAPI_BUFFER_MEMORY_TYPE_GEM_BUF;
|
||||
break;
|
||||
default:
|
||||
type = 0;
|
||||
break;
|
||||
|
|
|
@ -60,11 +60,13 @@ typedef struct _GstVaapiBufferProxy GstVaapiBufferProxy;
|
|||
/**
|
||||
* GstVaapiBufferMemoryType:
|
||||
* @GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF: DRM PRIME buffer memory type.
|
||||
* @GST_VAAPI_BUFFER_MEMORY_TYPE_GEM_BUF: Kernel DRM buffer memory type.
|
||||
*
|
||||
* Set of underlying VA buffer memory types.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF = 1,
|
||||
GST_VAAPI_BUFFER_MEMORY_TYPE_GEM_BUF,
|
||||
} GstVaapiBufferMemoryType;
|
||||
|
||||
GstVaapiBufferProxy *
|
||||
|
|
|
@ -75,3 +75,25 @@ gst_vaapi_surface_get_dma_buf_handle (GstVaapiSurface * surface)
|
|||
return gst_vaapi_surface_get_drm_buf_handle (surface,
|
||||
GST_VAAPI_BUFFER_MEMORY_TYPE_DMA_BUF);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_surface_get_gem_buf_handle:
|
||||
* @surface: a #GstVaapiSurface
|
||||
*
|
||||
* If the underlying VA driver implementation supports it, this
|
||||
* function allows for returning a suitable GEM buffer handle as a
|
||||
* #GstVaapiBufferProxy instance. The resulting buffer handle is live
|
||||
* until the last reference to the proxy gets released. Besides, any
|
||||
* further change to the parent VA @surface may fail.
|
||||
*
|
||||
* Return value: the underlying buffer as a #GstVaapiBufferProxy
|
||||
* instance.
|
||||
*/
|
||||
GstVaapiBufferProxy *
|
||||
gst_vaapi_surface_get_gem_buf_handle (GstVaapiSurface * surface)
|
||||
{
|
||||
g_return_val_if_fail (surface != NULL, NULL);
|
||||
|
||||
return gst_vaapi_surface_get_drm_buf_handle (surface,
|
||||
GST_VAAPI_BUFFER_MEMORY_TYPE_GEM_BUF);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ G_BEGIN_DECLS
|
|||
GstVaapiBufferProxy *
|
||||
gst_vaapi_surface_get_dma_buf_handle (GstVaapiSurface * surface);
|
||||
|
||||
GstVaapiBufferProxy *
|
||||
gst_vaapi_surface_get_gem_buf_handle (GstVaapiSurface * surface);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_VAAPI_SURFACE_DRM_H */
|
||||
|
|
Loading…
Reference in a new issue