egl: Mark memory as not mappable if it isn't
This commit is contained in:
parent
0a5ff713e7
commit
a47f52bb96
@ -1540,7 +1540,8 @@ gst_eglglessink_init_egl_display (GstEglGlesSink * eglglessink)
|
|||||||
|
|
||||||
#ifdef USE_EGL_RPI
|
#ifdef USE_EGL_RPI
|
||||||
/* See https://github.com/raspberrypi/firmware/issues/99 */
|
/* 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");
|
got_egl_error ("eglMakeCurrent");
|
||||||
GST_ERROR_OBJECT (eglglessink, "Couldn't unbind context");
|
GST_ERROR_OBJECT (eglglessink, "Couldn't unbind context");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -3048,8 +3049,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
||||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB, size, data,
|
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
|
||||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
(gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
|
||||||
|
size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
n_mem = 1;
|
n_mem = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3111,8 +3113,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
||||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB, size, data,
|
image, GST_EGL_IMAGE_MEMORY_TYPE_RGB,
|
||||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
(gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
|
||||||
|
size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
n_mem = 1;
|
n_mem = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3203,7 +3206,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||||||
image,
|
image,
|
||||||
(i ==
|
(i ==
|
||||||
0 ? GST_EGL_IMAGE_MEMORY_TYPE_LUMINANCE :
|
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);
|
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3303,7 +3308,9 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||||||
mem[i] =
|
mem[i] =
|
||||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
(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);
|
(GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3375,8 +3382,10 @@ gst_eglglessink_allocate_eglimage (GstEglGlesSink * eglglessink,
|
|||||||
mem[0] =
|
mem[0] =
|
||||||
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
gst_egl_image_allocator_wrap (GST_EGL_IMAGE_BUFFER_POOL
|
||||||
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
(eglglessink->pool)->allocator, eglglessink->eglglesctx.display,
|
||||||
image, GST_EGL_IMAGE_MEMORY_TYPE_RGBA, size, data,
|
image, GST_EGL_IMAGE_MEMORY_TYPE_RGBA,
|
||||||
(GDestroyNotify) gst_egl_gles_image_data_free);
|
(gst_egl_image_memory_can_map ()? 0 : GST_MEMORY_FLAG_NOT_MAPPABLE),
|
||||||
|
size, data, (GDestroyNotify) gst_egl_gles_image_data_free);
|
||||||
|
|
||||||
n_mem = 1;
|
n_mem = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -237,7 +237,8 @@ gst_egl_image_allocator_alloc (GstAllocator * allocator,
|
|||||||
GstMemory *
|
GstMemory *
|
||||||
gst_egl_image_allocator_wrap (GstAllocator * allocator,
|
gst_egl_image_allocator_wrap (GstAllocator * allocator,
|
||||||
GstEGLDisplay * display, EGLImageKHR image, GstEGLImageType type,
|
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;
|
GstEGLImageMemory *mem;
|
||||||
|
|
||||||
@ -250,7 +251,8 @@ gst_egl_image_allocator_wrap (GstAllocator * allocator,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mem = g_slice_new (GstEGLImageMemory);
|
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->display = gst_egl_display_ref (display);
|
||||||
mem->image = image;
|
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 */
|
/* Generic EGLImage allocator that doesn't support mapping, copying or anything */
|
||||||
GstAllocator * gst_egl_image_allocator_obtain (void);
|
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_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 */
|
/* EGLDisplay wrapper with refcount, connection is closed after last ref is gone */
|
||||||
GstEGLDisplay * gst_egl_display_new (EGLDisplay display);
|
GstEGLDisplay * gst_egl_display_new (EGLDisplay display);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user