mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 23:36:38 +00:00
egl: Mark memory as not mappable if it isn't
This commit is contained in:
parent
0a5ff713e7
commit
a47f52bb96
3 changed files with 23 additions and 12 deletions
|
@ -1540,7 +1540,8 @@ gst_eglglessink_init_egl_display (GstEglGlesSink * eglglessink)
|
|||
|
||||
#ifdef USE_EGL_RPI
|
||||
/* See https://github.com/raspberrypi/firmware/issues/99 */
|
||||
if (!eglMakeCurrent ((EGLDisplay) 1, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)) {
|
||||
if (!eglMakeCurrent ((EGLDisplay) 1, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||
EGL_NO_CONTEXT)) {
|
||||
got_egl_error ("eglMakeCurrent");
|
||||
GST_ERROR_OBJECT (eglglessink, "Couldn't unbind context");
|
||||
return FALSE;
|
||||
|
@ -3048,8 +3049,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||
mem[0] =
|
||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB, size, data,
|
||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
|
||||
(gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
|
||||
size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
n_mem = 1;
|
||||
}
|
||||
break;
|
||||
|
@ -3111,8 +3113,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||
mem[0] =
|
||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB, size, data,
|
||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
|
||||
(gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
|
||||
size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
n_mem = 1;
|
||||
}
|
||||
break;
|
||||
|
@ -3203,7 +3206,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||
image,
|
||||
(i ==
|
||||
0 ? GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE :
|
||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE_ALPHA), size[i], data,
|
||||
GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE_ALPHA),
|
||||
(gst_egl_image_memory_can_map ()? 0 :
|
||||
GST_MEMORY_FLAG_NOT_MAPPABLE), size[i], data,
|
||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
}
|
||||
|
||||
|
@ -3303,7 +3308,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||
mem[i] =
|
||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE, size[i], data,
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE,
|
||||
(gst_egl_image_memory_can_map ()? 0 :
|
||||
GST_MEMORY_FLAG_NOT_MAPPABLE), size[i], data,
|
||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
}
|
||||
|
||||
|
@ -3375,8 +3382,10 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||
mem[0] =
|
||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGBA, size, data,
|
||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGBA,
|
||||
(gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
|
||||
size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||
|
||||
n_mem = 1;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -237,7 +237,8 @@ gst_egl_image_allocator_alloc (GstAllocator * allocator,
|
|||
GstMemory *
|
||||
gst_egl_image_allocator_wrap (GstAllocator * allocator,
|
||||
GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type,
|
||||
gsize size, gpointer user_data, GDestroyNotify user_data_destroy)
|
||||
GstMemoryFlags flags, gsize size, gpointer user_data,
|
||||
GDestroyNotify user_data_destroy)
|
||||
{
|
||||
GstEGLImageMemory *mem;
|
||||
|
||||
|
@ -250,7 +251,8 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator,
|
|||
}
|
||||
|
||||
mem = g_slice_new (GstEGLImageMemory);
|
||||
gst_memory_init (GST_MEMORY_CAST (mem), 0, allocator, NULL, size, 0, 0, size);
|
||||
gst_memory_init (GST_MEMORY_CAST (mem), flags,
|
||||
allocator, NULL, size, 0, 0, size);
|
||||
|
||||
mem->display = gst_egl_display_ref (display);
|
||||
mem->image = image;
|
||||
|
|
|
@ -54,7 +54,7 @@ GstEGLImageType gst_egl_image_memory_get_type (GstMemory * mem);
|
|||
/* Generic EGLImage allocator that doesn't support mapping, copying or anything */
|
||||
GstAllocator * gst_egl_image_allocator_obtain (void);
|
||||
GstMemory * gst_egl_image_allocator_alloc (GstAllocator * allocator, GstEGLDisplay * display, GstEGLImageType type, gint width, gint height, gsize * size);
|
||||
GstMemory * gst_egl_image_allocator_wrap (GstAllocator * allocator, GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type, gsize size, gpointer user_data, GDestroyNotify user_data_destroy);
|
||||
GstMemory * gst_egl_image_allocator_wrap (GstAllocator * allocator, GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type, GstMemoryFlags flags, gsize size, gpointer user_data, GDestroyNotify user_data_destroy);
|
||||
|
||||
/* EGLDisplay wrapper with refcount, connection is closed after last ref is gone */
|
||||
GstEGLDisplay * gst_egl_display_new (EGLDisplay display);
|
||||
|
|
Loading…
Reference in a new issue