-
-
Save tiagovignatti/a6791011a87eef80ff5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/egl/drivers/dri2/Makefile.am b/src/egl/drivers/dri2/Makefile.am | |
index 79a40e8..14b2d60 100644 | |
--- a/src/egl/drivers/dri2/Makefile.am | |
+++ b/src/egl/drivers/dri2/Makefile.am | |
@@ -64,3 +64,8 @@ if HAVE_EGL_PLATFORM_DRM | |
libegl_dri2_la_SOURCES += platform_drm.c | |
AM_CFLAGS += -DHAVE_DRM_PLATFORM | |
endif | |
+ | |
+if HAVE_EGL_PLATFORM_NULL | |
+libegl_dri2_la_SOURCES += platform_null.c | |
+AM_CFLAGS += -DHAVE_NULL_PLATFORM | |
+endif | |
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c | |
index 6306483..4d4fbb4 100644 | |
--- a/src/egl/drivers/dri2/egl_dri2.c | |
+++ b/src/egl/drivers/dri2/egl_dri2.c | |
@@ -534,7 +534,7 @@ dri2_setup_screen(_EGLDisplay *disp) | |
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE; | |
disp->Extensions.KHR_gl_texture_cubemap_image = EGL_TRUE; | |
} | |
-#ifdef HAVE_LIBDRM | |
+#if defined HAVE_LIBDRM || defined(HAVE_NULL_PLATFORM) | |
if (dri2_dpy->image->base.version >= 8 && | |
dri2_dpy->image->createImageFromDmaBufs) { | |
disp->Extensions.EXT_image_dma_buf_import = EGL_TRUE; | |
@@ -632,6 +632,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp) | |
return EGL_FALSE; | |
switch (disp->Platform) { | |
+#ifdef HAVE_NULL_PLATFORM | |
+ case _EGL_PLATFORM_NULL: | |
+ if (disp->Options.TestOnly) | |
+ return EGL_TRUE; | |
+ return dri2_initialize_null(drv, disp); | |
+#endif | |
#ifdef HAVE_X11_PLATFORM | |
case _EGL_PLATFORM_X11: | |
if (disp->Options.TestOnly) | |
@@ -1571,7 +1577,7 @@ dri2_create_wayland_buffer_from_image(_EGLDriver *drv, _EGLDisplay *dpy, | |
return dri2_dpy->vtbl->create_wayland_buffer_from_image(drv, dpy, img); | |
} | |
-#ifdef HAVE_LIBDRM | |
+#if defined HAVE_LIBDRM || defined(HAVE_NULL_PLATFORM) | |
static EGLBoolean | |
dri2_check_dma_buf_attribs(const _EGLImageAttribs *attrs) | |
{ | |
@@ -1829,7 +1835,7 @@ dri2_create_image_khr(_EGLDriver *drv, _EGLDisplay *disp, | |
case EGL_WAYLAND_BUFFER_WL: | |
return dri2_create_image_wayland_wl_buffer(disp, ctx, buffer, attr_list); | |
#endif | |
-#ifdef HAVE_LIBDRM | |
+#if defined HAVE_LIBDRM || defined(HAVE_NULL_PLATFORM) | |
case EGL_LINUX_DMA_BUF_EXT: | |
return dri2_create_image_dma_buf(disp, ctx, buffer, attr_list); | |
#endif | |
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h | |
index 9efe1f7..e206424 100644 | |
--- a/src/egl/drivers/dri2/egl_dri2.h | |
+++ b/src/egl/drivers/dri2/egl_dri2.h | |
@@ -332,6 +332,9 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp); | |
EGLBoolean | |
dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp); | |
+EGLBoolean | |
+dri2_initialize_null(_EGLDriver *drv, _EGLDisplay *disp); | |
+ | |
void | |
dri2_flush_drawable_for_swapbuffers(_EGLDisplay *disp, _EGLSurface *draw); | |
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c | |
index 63ed7ad..ed49b30 100644 | |
--- a/src/mesa/drivers/dri/i965/intel_fbo.c | |
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c | |
@@ -363,13 +363,6 @@ intel_image_target_renderbuffer_storage(struct gl_context *ctx, | |
return; | |
} | |
- /* Buffers originating from outside are for read-only. */ | |
- if (image->dma_buf_imported) { | |
- _mesa_error(ctx, GL_INVALID_OPERATION, | |
- "glEGLImageTargetRenderbufferStorage(dma buffers are read-only)"); | |
- return; | |
- } | |
- | |
/* __DRIimage is opaque to the core so it has to be checked here */ | |
switch (image->format) { | |
case MESA_FORMAT_R8G8B8A8_UNORM: | |
diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c | |
index cea7ddf..1b79987 100644 | |
--- a/src/mesa/drivers/dri/i965/intel_screen.c | |
+++ b/src/mesa/drivers/dri/i965/intel_screen.c | |
@@ -728,7 +728,6 @@ intel_create_image_from_dma_bufs(__DRIscreen *screen, | |
return NULL; | |
} | |
- image->dma_buf_imported = true; | |
image->yuv_color_space = yuv_color_space; | |
image->sample_range = sample_range; | |
image->horizontal_siting = horizontal_siting; | |
diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c | |
index da42fdd..f2ca317 100644 | |
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c | |
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c | |
@@ -317,24 +317,6 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, | |
if (image == NULL) | |
return; | |
- /** | |
- * Images originating via EGL_EXT_image_dma_buf_import can be used only | |
- * with GL_OES_EGL_image_external only. | |
- */ | |
- if (image->dma_buf_imported && target != GL_TEXTURE_EXTERNAL_OES) { | |
- _mesa_error(ctx, GL_INVALID_OPERATION, | |
- "glEGLImageTargetTexture2DOES(dma buffers can be used with " | |
- "GL_OES_EGL_image_external only"); | |
- return; | |
- } | |
- | |
- if (target == GL_TEXTURE_EXTERNAL_OES && !image->dma_buf_imported) { | |
- _mesa_error(ctx, GL_INVALID_OPERATION, | |
- "glEGLImageTargetTexture2DOES(external target is enabled only " | |
- "for images created with EGL_EXT_image_dma_buf_import"); | |
- return; | |
- } | |
- | |
/* Disallow depth/stencil textures: we don't have a way to pass the | |
* separate stencil miptree of a GL_DEPTH_STENCIL texture through. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment