diff options
Diffstat (limited to 'src/egl/main')
-rw-r--r-- | src/egl/main/Android.mk | 86 | ||||
-rw-r--r-- | src/egl/main/Makefile.am | 102 | ||||
-rw-r--r-- | src/egl/main/Makefile.sources | 31 | ||||
-rw-r--r-- | src/egl/main/SConscript | 52 | ||||
-rw-r--r-- | src/egl/main/eglapi.c | 92 | ||||
-rw-r--r-- | src/egl/main/eglapi.h | 24 | ||||
-rw-r--r-- | src/egl/main/eglarray.c | 3 | ||||
-rw-r--r-- | src/egl/main/eglconfig.c | 3 | ||||
-rw-r--r-- | src/egl/main/eglcontext.c | 33 | ||||
-rw-r--r-- | src/egl/main/egldisplay.c | 2 | ||||
-rw-r--r-- | src/egl/main/egldisplay.h | 50 | ||||
-rw-r--r-- | src/egl/main/egldriver.c | 8 | ||||
-rw-r--r-- | src/egl/main/eglfallbacks.c | 6 | ||||
-rw-r--r-- | src/egl/main/eglglobals.c | 4 | ||||
-rw-r--r-- | src/egl/main/egllog.c | 5 | ||||
-rw-r--r-- | src/egl/main/eglstring.c | 54 | ||||
-rw-r--r-- | src/egl/main/eglstring.h | 50 | ||||
-rw-r--r-- | src/egl/main/eglsurface.c | 27 | ||||
-rw-r--r-- | src/egl/main/eglsurface.h | 1 |
19 files changed, 121 insertions, 512 deletions
diff --git a/src/egl/main/Android.mk b/src/egl/main/Android.mk deleted file mode 100644 index 0ba72953960..00000000000 --- a/src/egl/main/Android.mk +++ /dev/null @@ -1,86 +0,0 @@ -# Mesa 3-D graphics library -# -# Copyright (C) 2010-2011 Chia-I Wu <[email protected]> -# Copyright (C) 2010-2011 LunarG Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -# Android.mk for libGLES_mesa - -LOCAL_PATH := $(call my-dir) - -include $(LOCAL_PATH)/Makefile.sources - -SOURCES := \ - ${LIBEGL_C_FILES} - -# --------------------------------------- -# Build libGLES_mesa -# --------------------------------------- - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := $(SOURCES) - -LOCAL_CFLAGS := \ - -D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_ANDROID \ - -D_EGL_DRIVER_SEARCH_DIR=\"/system/lib/egl\" \ - -D_EGL_OS_UNIX=1 - -LOCAL_SHARED_LIBRARIES := \ - libdl \ - libhardware \ - liblog \ - libcutils \ - libgralloc_drm \ - -ifeq ($(shell echo "$(MESA_ANDROID_VERSION) >= 4.2" | bc),1) -LOCAL_SHARED_LIBRARIES += libsync -endif - -# add libdrm if there are hardware drivers -ifneq ($(MESA_GPU_DRIVERS),swrast) -LOCAL_SHARED_LIBRARIES += libdrm -endif - -LOCAL_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2 - -ifeq ($(strip $(MESA_BUILD_CLASSIC)),true) -# require i915_dri and/or i965_dri -LOCAL_REQUIRED_MODULES += \ - $(addsuffix _dri, $(filter i915 i965, $(MESA_GPU_DRIVERS))) -endif # MESA_BUILD_CLASSIC - -ifeq ($(strip $(MESA_BUILD_GALLIUM)),true) -LOCAL_REQUIRED_MODULES += gallium_dri -endif # MESA_BUILD_GALLIUM - -LOCAL_STATIC_LIBRARIES := \ - libmesa_egl_dri2 \ - libmesa_loader - -LOCAL_MODULE := libGLES_mesa -ifeq ($(MESA_LOLLIPOP_BUILD),true) -LOCAL_MODULE_RELATIVE_PATH := egl -else -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl -endif - -include $(MESA_COMMON_MK) -include $(BUILD_SHARED_LIBRARY) diff --git a/src/egl/main/Makefile.am b/src/egl/main/Makefile.am deleted file mode 100644 index 9030d272b53..00000000000 --- a/src/egl/main/Makefile.am +++ /dev/null @@ -1,102 +0,0 @@ -# Copyright © 2012 Intel Corporation -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and associated documentation files (the "Software"), -# to deal in the Software without restriction, including without limitation -# the rights to use, copy, modify, merge, publish, distribute, sublicense, -# and/or sell copies of the Software, and to permit persons to whom the -# Software is furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice (including the next -# paragraph) shall be included in all copies or substantial portions of the -# Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. - -include Makefile.sources - -AM_CFLAGS = \ - -I$(top_srcdir)/include \ - -I$(top_srcdir)/src/gbm/main \ - $(DEFINES) \ - $(VISIBILITY_CFLAGS) \ - $(EGL_CFLAGS) \ - -D_EGL_NATIVE_PLATFORM=$(EGL_NATIVE_PLATFORM) \ - -D_EGL_DRIVER_SEARCH_DIR=\"$(libdir)/egl\" \ - -D_EGL_OS_UNIX=1 - -lib_LTLIBRARIES = libEGL.la - -libEGL_la_SOURCES = \ - ${LIBEGL_C_FILES} - -libEGL_la_LIBADD = \ - $(EGL_LIB_DEPS) -libEGL_la_LDFLAGS = \ - -no-undefined \ - -version-number 1:0 \ - $(BSYMBOLIC) \ - $(GC_SECTIONS) \ - $(LD_NO_UNDEFINED) - -if HAVE_EGL_PLATFORM_X11 -AM_CFLAGS += -DHAVE_X11_PLATFORM -AM_CFLAGS += $(XCB_DRI2_CFLAGS) -libEGL_la_LIBADD += $(XCB_DRI2_LIBS) -endif - -if HAVE_EGL_PLATFORM_WAYLAND -AM_CFLAGS += -DHAVE_WAYLAND_PLATFORM -AM_CFLAGS += $(WAYLAND_CFLAGS) -libEGL_la_LIBADD += $(WAYLAND_LIBS) -libEGL_la_LIBADD += $(LIBDRM_LIBS) -libEGL_la_LIBADD += ../wayland/wayland-drm/libwayland-drm.la -endif - -if HAVE_EGL_PLATFORM_DRM -AM_CFLAGS += -DHAVE_DRM_PLATFORM -libEGL_la_LIBADD += ../../gbm/libgbm.la -endif - -if HAVE_EGL_PLATFORM_NULL -AM_CFLAGS += -DHAVE_NULL_PLATFORM -endif - -if HAVE_EGL_PLATFORM_SURFACELESS -AM_CFLAGS += -DHAVE_SURFACELESS_PLATFORM -endif - -if HAVE_EGL_DRIVER_DRI2 -AM_CFLAGS += -D_EGL_BUILT_IN_DRIVER_DRI2 -AM_CFLAGS += -DHAVE_XCB_DRI2 -libEGL_la_LIBADD += ../drivers/dri2/libegl_dri2.la -libEGL_la_LIBADD += $(DLOPEN_LIBS) $(LIBDRM_LIBS) -endif - -include $(top_srcdir)/install-lib-links.mk - -pkgconfigdir = $(libdir)/pkgconfig - -pkgconfig_DATA = egl.pc - -khrdir = $(includedir)/KHR -khr_HEADERS = $(top_srcdir)/include/KHR/khrplatform.h - -egldir = $(includedir)/EGL -egl_HEADERS = \ - $(top_srcdir)/include/EGL/eglext.h \ - $(top_srcdir)/include/EGL/egl.h \ - $(top_srcdir)/include/EGL/eglextchromium.h \ - $(top_srcdir)/include/EGL/eglmesaext.h \ - $(top_srcdir)/include/EGL/eglplatform.h - -EXTRA_DIST = \ - egl.def \ - README.txt \ - SConscript diff --git a/src/egl/main/Makefile.sources b/src/egl/main/Makefile.sources deleted file mode 100644 index e39a80f14a6..00000000000 --- a/src/egl/main/Makefile.sources +++ /dev/null @@ -1,31 +0,0 @@ -LIBEGL_C_FILES := \ - eglapi.c \ - eglapi.h \ - eglarray.c \ - eglarray.h \ - eglcompiler.h \ - eglconfig.c \ - eglconfig.h \ - eglcontext.c \ - eglcontext.h \ - eglcurrent.c \ - eglcurrent.h \ - egldefines.h \ - egldisplay.c \ - egldisplay.h \ - egldriver.c \ - egldriver.h \ - eglfallbacks.c \ - eglglobals.c \ - eglglobals.h \ - eglimage.c \ - eglimage.h \ - egllog.c \ - egllog.h \ - eglstring.c \ - eglstring.h \ - eglsurface.c \ - eglsurface.h \ - eglsync.c \ - eglsync.h \ - egltypedefs.h diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript deleted file mode 100644 index c0012831bb9..00000000000 --- a/src/egl/main/SConscript +++ /dev/null @@ -1,52 +0,0 @@ -####################################################################### -# SConscript for EGL - - -Import('*') - -env = env.Clone() - -env.Append(CPPDEFINES = [ - '_EGL_DRIVER_SEARCH_DIR=\\"\\"', -]) - -if env['platform'] == 'haiku': - env.Append(CPPDEFINES = [ - '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_HAIKU', - '_EGL_OS_UNIX', - '_EGL_BUILT_IN_DRIVER_HAIKU', - ]) - env.Prepend(LIBS = [ - egl_haiku, - libloader, - ]) -else: - env.Append(CPPDEFINES = [ - '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11', - '_EGL_OS_UNIX', - ]) - if env['dri']: - env.Prepend(LIBS = [ - egl_dri2, - libloader, - ]) - # Disallow undefined symbols - if env['platform'] != 'darwin': - env.Append(SHLINKFLAGS = ['-Wl,-z,defs']) - -env.Append(CPPPATH = [ - '#/include', -]) - - -# parse Makefile.sources -egl_sources = env.ParseSourceList('Makefile.sources', 'LIBEGL_C_FILES') - -egl = env.SharedLibrary( - target = 'EGL', - source = egl_sources, -) - -egl = env.InstallSharedLibrary(egl, version=(1, 0, 0)) - -env.Alias('egl', egl) diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 105e919683a..323634e4511 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -100,7 +100,6 @@ #include "eglconfig.h" #include "eglimage.h" #include "eglsync.h" -#include "eglstring.h" /** @@ -381,48 +380,47 @@ _eglCreateExtensionsString(_EGLDisplay *dpy) char *exts = dpy->ExtensionsString; - _EGL_CHECK_EXTENSION(MESA_drm_display); - _EGL_CHECK_EXTENSION(MESA_drm_image); - _EGL_CHECK_EXTENSION(MESA_configless_context); + /* Please keep these sorted alphabetically. */ + _EGL_CHECK_EXTENSION(ANDROID_image_native_buffer); - _EGL_CHECK_EXTENSION(WL_bind_wayland_display); - _EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image); + _EGL_CHECK_EXTENSION(CHROMIUM_sync_control); - _EGL_CHECK_EXTENSION(KHR_image_base); - _EGL_CHECK_EXTENSION(KHR_image_pixmap); - if (dpy->Extensions.KHR_image_base && dpy->Extensions.KHR_image_pixmap) - _eglAppendExtension(&exts, "EGL_KHR_image"); + _EGL_CHECK_EXTENSION(EXT_buffer_age); + _EGL_CHECK_EXTENSION(EXT_create_context_robustness); + _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import); + _EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage); - _EGL_CHECK_EXTENSION(KHR_vg_parent_image); + _EGL_CHECK_EXTENSION(KHR_cl_event2); + _EGL_CHECK_EXTENSION(KHR_create_context); + _EGL_CHECK_EXTENSION(KHR_fence_sync); _EGL_CHECK_EXTENSION(KHR_get_all_proc_addresses); + _EGL_CHECK_EXTENSION(KHR_gl_colorspace); + _EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image); _EGL_CHECK_EXTENSION(KHR_gl_texture_2D_image); - _EGL_CHECK_EXTENSION(KHR_gl_texture_cubemap_image); _EGL_CHECK_EXTENSION(KHR_gl_texture_3D_image); - _EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image); - + _EGL_CHECK_EXTENSION(KHR_gl_texture_cubemap_image); + if (dpy->Extensions.KHR_image_base && dpy->Extensions.KHR_image_pixmap) + _eglAppendExtension(&exts, "EGL_KHR_image"); + _EGL_CHECK_EXTENSION(KHR_image_base); + _EGL_CHECK_EXTENSION(KHR_image_pixmap); _EGL_CHECK_EXTENSION(KHR_reusable_sync); - _EGL_CHECK_EXTENSION(KHR_fence_sync); + _EGL_CHECK_EXTENSION(KHR_surfaceless_context); + _EGL_CHECK_EXTENSION(KHR_vg_parent_image); _EGL_CHECK_EXTENSION(KHR_wait_sync); - _EGL_CHECK_EXTENSION(KHR_cl_event2); - _EGL_CHECK_EXTENSION(KHR_surfaceless_context); - _EGL_CHECK_EXTENSION(KHR_create_context); + _EGL_CHECK_EXTENSION(MESA_configless_context); + _EGL_CHECK_EXTENSION(MESA_drm_display); + _EGL_CHECK_EXTENSION(MESA_drm_image); + _EGL_CHECK_EXTENSION(MESA_image_dma_buf_export); _EGL_CHECK_EXTENSION(NOK_swap_region); _EGL_CHECK_EXTENSION(NOK_texture_from_pixmap); - _EGL_CHECK_EXTENSION(ANDROID_image_native_buffer); - - _EGL_CHECK_EXTENSION(CHROMIUM_sync_control); - - _EGL_CHECK_EXTENSION(EXT_create_context_robustness); - _EGL_CHECK_EXTENSION(EXT_buffer_age); - _EGL_CHECK_EXTENSION(EXT_swap_buffers_with_damage); - _EGL_CHECK_EXTENSION(EXT_image_dma_buf_import); - _EGL_CHECK_EXTENSION(NV_post_sub_buffer); - _EGL_CHECK_EXTENSION(MESA_image_dma_buf_export); + _EGL_CHECK_EXTENSION(WL_bind_wayland_display); + _EGL_CHECK_EXTENSION(WL_create_wayland_buffer_from_image); + #undef _EGL_CHECK_EXTENSION } @@ -507,7 +505,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) _eglComputeVersion(disp); _eglCreateExtensionsString(disp); _eglCreateAPIsString(disp); - _eglsnprintf(disp->VersionString, sizeof(disp->VersionString), + snprintf(disp->VersionString, sizeof(disp->VersionString), "%d.%d (%s)", disp->Version / 10, disp->Version % 10, disp->Driver->Name); } @@ -1015,8 +1013,6 @@ eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) } -#ifdef EGL_EXT_swap_buffers_with_damage - static EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects) @@ -1042,8 +1038,6 @@ eglSwapBuffersWithDamageEXT(EGLDisplay dpy, EGLSurface surface, RETURN_EGL_EVAL(disp, ret); } -#endif /* EGL_EXT_swap_buffers_with_damage */ - EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) { @@ -1204,8 +1198,6 @@ eglGetError(void) } -#ifdef EGL_MESA_drm_display - static EGLDisplay EGLAPIENTRY eglGetDRMDisplayMESA(int fd) { @@ -1213,8 +1205,6 @@ eglGetDRMDisplayMESA(int fd) return _eglGetDisplayHandle(dpy); } -#endif /* EGL_MESA_drm_display */ - /** ** EGL 1.2 **/ @@ -1580,8 +1570,6 @@ eglGetSyncAttribKHR(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLint *valu } -#ifdef EGL_NOK_swap_region - static EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects) @@ -1607,10 +1595,6 @@ eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, RETURN_EGL_EVAL(disp, ret); } -#endif /* EGL_NOK_swap_region */ - - -#ifdef EGL_MESA_drm_image static EGLImage EGLAPIENTRY eglCreateDRMImageMESA(EGLDisplay dpy, const EGLint *attr_list) @@ -1650,9 +1634,7 @@ eglExportDRMImageMESA(EGLDisplay dpy, EGLImage image, RETURN_EGL_EVAL(disp, ret); } -#endif -#ifdef EGL_WL_bind_wayland_display struct wl_display; static EGLBoolean EGLAPIENTRY @@ -1709,9 +1691,8 @@ eglQueryWaylandBufferWL(EGLDisplay dpy, struct wl_resource *buffer, RETURN_EGL_EVAL(disp, ret); } -#endif -#ifdef EGL_WL_create_wayland_buffer_from_image + static struct wl_buffer * EGLAPIENTRY eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image) { @@ -1732,7 +1713,6 @@ eglCreateWaylandBufferFromImageWL(EGLDisplay dpy, EGLImage image) RETURN_EGL_EVAL(disp, ret); } -#endif static EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, @@ -1775,7 +1755,6 @@ eglGetSyncValuesCHROMIUM(EGLDisplay display, EGLSurface surface, RETURN_EGL_EVAL(disp, ret); } -#ifdef EGL_MESA_image_dma_buf_export static EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA(EGLDisplay dpy, EGLImage image, EGLint *fourcc, EGLint *nplanes, @@ -1817,7 +1796,6 @@ eglExportDMABUFImageMESA(EGLDisplay dpy, EGLImage image, RETURN_EGL_EVAL(disp, ret); } -#endif __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) @@ -1874,9 +1852,7 @@ eglGetProcAddress(const char *procname) { "eglGetPlatformDisplay", (_EGLProc) eglGetPlatformDisplay }, { "eglCreatePlatformWindowSurface", (_EGLProc) eglCreatePlatformWindowSurface }, { "eglCreatePlatformPixmapSurface", (_EGLProc) eglCreatePlatformPixmapSurface }, -#ifdef EGL_MESA_drm_display { "eglGetDRMDisplayMESA", (_EGLProc) eglGetDRMDisplayMESA }, -#endif { "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR }, { "eglDestroyImageKHR", (_EGLProc) eglDestroyImage }, { "eglCreateSyncKHR", (_EGLProc) eglCreateSyncKHR }, @@ -1886,33 +1862,21 @@ eglGetProcAddress(const char *procname) { "eglWaitSyncKHR", (_EGLProc) eglWaitSyncKHR }, { "eglSignalSyncKHR", (_EGLProc) eglSignalSyncKHR }, { "eglGetSyncAttribKHR", (_EGLProc) eglGetSyncAttribKHR }, -#ifdef EGL_NOK_swap_region { "eglSwapBuffersRegionNOK", (_EGLProc) eglSwapBuffersRegionNOK }, -#endif -#ifdef EGL_MESA_drm_image { "eglCreateDRMImageMESA", (_EGLProc) eglCreateDRMImageMESA }, { "eglExportDRMImageMESA", (_EGLProc) eglExportDRMImageMESA }, -#endif -#ifdef EGL_WL_bind_wayland_display { "eglBindWaylandDisplayWL", (_EGLProc) eglBindWaylandDisplayWL }, { "eglUnbindWaylandDisplayWL", (_EGLProc) eglUnbindWaylandDisplayWL }, { "eglQueryWaylandBufferWL", (_EGLProc) eglQueryWaylandBufferWL }, -#endif -#ifdef EGL_WL_create_wayland_buffer_from_image { "eglCreateWaylandBufferFromImageWL", (_EGLProc) eglCreateWaylandBufferFromImageWL }, -#endif { "eglPostSubBufferNV", (_EGLProc) eglPostSubBufferNV }, -#ifdef EGL_EXT_swap_buffers_with_damage { "eglSwapBuffersWithDamageEXT", (_EGLProc) eglSwapBuffersWithDamageEXT }, -#endif { "eglGetPlatformDisplayEXT", (_EGLProc) eglGetPlatformDisplayEXT }, { "eglCreatePlatformWindowSurfaceEXT", (_EGLProc) eglCreatePlatformWindowSurfaceEXT }, { "eglCreatePlatformPixmapSurfaceEXT", (_EGLProc) eglCreatePlatformPixmapSurfaceEXT }, { "eglGetSyncValuesCHROMIUM", (_EGLProc) eglGetSyncValuesCHROMIUM }, -#ifdef EGL_MESA_image_dma_buf_export { "eglExportDMABUFImageQueryMESA", (_EGLProc) eglExportDMABUFImageQueryMESA }, { "eglExportDMABUFImageMESA", (_EGLProc) eglExportDMABUFImageMESA }, -#endif { NULL, NULL } }; EGLint i; diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h index 4e0378d0d5f..6c54c7c410d 100644 --- a/src/egl/main/eglapi.h +++ b/src/egl/main/eglapi.h @@ -99,41 +99,29 @@ typedef EGLBoolean (*SignalSyncKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSyn typedef EGLBoolean (*GetSyncAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync, EGLint attribute, EGLAttrib *value); -#ifdef EGL_NOK_swap_region typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects); -#endif -#ifdef EGL_MESA_drm_image typedef _EGLImage *(*CreateDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attr_list); typedef EGLBoolean (*ExportDRMImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *name, EGLint *handle, EGLint *stride); -#endif -#ifdef EGL_WL_bind_wayland_display struct wl_display; typedef EGLBoolean (*BindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display); typedef EGLBoolean (*UnbindWaylandDisplayWL_t)(_EGLDriver *drv, _EGLDisplay *disp, struct wl_display *display); typedef EGLBoolean (*QueryWaylandBufferWL_t)(_EGLDriver *drv, _EGLDisplay *displ, struct wl_resource *buffer, EGLint attribute, EGLint *value); -#endif -#ifdef EGL_WL_create_wayland_buffer_from_image typedef struct wl_buffer * (*CreateWaylandBufferFromImageWL_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img); -#endif typedef EGLBoolean (*PostSubBufferNV_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surface, EGLint x, EGLint y, EGLint width, EGLint height); typedef EGLint (*QueryBufferAge_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface); -#ifdef EGL_EXT_swap_buffers_with_damage typedef EGLBoolean (*SwapBuffersWithDamageEXT_t) (_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, const EGLint *rects, EGLint n_rects); -#endif typedef EGLBoolean (*GetSyncValuesCHROMIUM_t) (_EGLDisplay *dpy, _EGLSurface *surface, EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc); -#ifdef EGL_MESA_image_dma_buf_export typedef EGLBoolean (*ExportDMABUFImageQueryMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *fourcc, EGLint *nplanes, EGLuint64KHR *modifiers); typedef EGLBoolean (*ExportDMABUFImageMESA_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLImage *img, EGLint *fds, EGLint *strides, EGLint *offsets); -#endif /** * The API dispatcher jumps through these functions @@ -180,38 +168,26 @@ struct _egl_api SignalSyncKHR_t SignalSyncKHR; GetSyncAttrib_t GetSyncAttrib; -#ifdef EGL_NOK_swap_region SwapBuffersRegionNOK_t SwapBuffersRegionNOK; -#endif -#ifdef EGL_MESA_drm_image CreateDRMImageMESA_t CreateDRMImageMESA; ExportDRMImageMESA_t ExportDRMImageMESA; -#endif -#ifdef EGL_WL_bind_wayland_display BindWaylandDisplayWL_t BindWaylandDisplayWL; UnbindWaylandDisplayWL_t UnbindWaylandDisplayWL; QueryWaylandBufferWL_t QueryWaylandBufferWL; -#endif -#ifdef EGL_WL_create_wayland_buffer_from_image CreateWaylandBufferFromImageWL_t CreateWaylandBufferFromImageWL; -#endif -#ifdef EGL_EXT_swap_buffers_with_damage SwapBuffersWithDamageEXT_t SwapBuffersWithDamageEXT; -#endif /* EGL_EXT_swap_buffers_with_damage */ PostSubBufferNV_t PostSubBufferNV; QueryBufferAge_t QueryBufferAge; GetSyncValuesCHROMIUM_t GetSyncValuesCHROMIUM; -#ifdef EGL_MESA_image_dma_buf_export ExportDMABUFImageQueryMESA_t ExportDMABUFImageQueryMESA; ExportDMABUFImageMESA_t ExportDMABUFImageMESA; -#endif }; diff --git a/src/egl/main/eglarray.c b/src/egl/main/eglarray.c index 3ccc8a649f0..d2f39af49a6 100644 --- a/src/egl/main/eglarray.c +++ b/src/egl/main/eglarray.c @@ -197,6 +197,9 @@ _eglFlattenArray(_EGLArray *array, void *buffer, EGLint elem_size, EGLint size, count = array->Size; if (buffer) { + /* clamp size to 0 */ + if (size < 0) + size = 0; /* do not exceed buffer size */ if (count > size) count = size; diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index cf65c69b7b4..c445d9b0c92 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -83,7 +83,8 @@ _eglLinkConfig(_EGLConfig *conf) _EGLDisplay *dpy = conf->Display; /* sanity check */ - assert(dpy && conf->ConfigID > 0); + assert(dpy); + assert(conf->ConfigID > 0); if (!dpy->Configs) { dpy->Configs = _eglCreateArray("Config", 16); diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index e767f4b1abe..588f48921f2 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -101,11 +101,42 @@ _eglParseContextAttribList(_EGLContext *ctx, _EGLDisplay *dpy, switch (attr) { case EGL_CONTEXT_CLIENT_VERSION: + /* The EGL 1.4 spec says: + * + * "attribute EGL_CONTEXT_CLIENT_VERSION is only valid when the + * current rendering API is EGL_OPENGL_ES_API" + * + * The EGL_KHR_create_context spec says: + * + * "EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 + * (this token is an alias for EGL_CONTEXT_CLIENT_VERSION)" + * + * "The values for attributes EGL_CONTEXT_MAJOR_VERSION_KHR and + * EGL_CONTEXT_MINOR_VERSION_KHR specify the requested client API + * version. They are only meaningful for OpenGL and OpenGL ES + * contexts, and specifying them for other types of contexts will + * generate an error." + */ + if ((api != EGL_OPENGL_ES_API && + (!dpy->Extensions.KHR_create_context || api != EGL_OPENGL_API))) { + err = EGL_BAD_ATTRIBUTE; + break; + } + ctx->ClientMajorVersion = val; break; case EGL_CONTEXT_MINOR_VERSION_KHR: - if (!dpy->Extensions.KHR_create_context) { + /* The EGL_KHR_create_context spec says: + * + * "The values for attributes EGL_CONTEXT_MAJOR_VERSION_KHR and + * EGL_CONTEXT_MINOR_VERSION_KHR specify the requested client API + * version. They are only meaningful for OpenGL and OpenGL ES + * contexts, and specifying them for other types of contexts will + * generate an error." + */ + if (!dpy->Extensions.KHR_create_context || + (api != EGL_OPENGL_ES_API && api != EGL_OPENGL_API)) { err = EGL_BAD_ATTRIBUTE; break; } diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c index 24a0c7e61a7..f6db03ab50c 100644 --- a/src/egl/main/egldisplay.c +++ b/src/egl/main/egldisplay.c @@ -65,11 +65,9 @@ static const struct { _EGLPlatformType platform; const char *name; } egl_platforms[_EGL_NUM_PLATFORMS] = { - { _EGL_PLATFORM_WINDOWS, "gdi" }, { _EGL_PLATFORM_X11, "x11" }, { _EGL_PLATFORM_WAYLAND, "wayland" }, { _EGL_PLATFORM_DRM, "drm" }, - { _EGL_PLATFORM_NULL, "null" }, { _EGL_PLATFORM_ANDROID, "android" }, { _EGL_PLATFORM_HAIKU, "haiku" }, { _EGL_PLATFORM_SURFACELESS, "surfaceless" }, diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 0b50a36a098..6c64980cf20 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -44,11 +44,9 @@ extern "C" { #endif enum _egl_platform_type { - _EGL_PLATFORM_WINDOWS, _EGL_PLATFORM_X11, _EGL_PLATFORM_WAYLAND, _EGL_PLATFORM_DRM, - _EGL_PLATFORM_NULL, _EGL_PLATFORM_ANDROID, _EGL_PLATFORM_HAIKU, _EGL_PLATFORM_SURFACELESS, @@ -91,46 +89,44 @@ struct _egl_resource */ struct _egl_extensions { - EGLBoolean MESA_drm_display; - EGLBoolean MESA_drm_image; - EGLBoolean MESA_configless_context; + /* Please keep these sorted alphabetically. */ + EGLBoolean ANDROID_image_native_buffer; - EGLBoolean WL_bind_wayland_display; - EGLBoolean WL_create_wayland_buffer_from_image; + EGLBoolean CHROMIUM_sync_control; - EGLBoolean KHR_image_base; - EGLBoolean KHR_image_pixmap; - EGLBoolean KHR_vg_parent_image; + EGLBoolean EXT_buffer_age; + EGLBoolean EXT_create_context_robustness; + EGLBoolean EXT_image_dma_buf_import; + EGLBoolean EXT_swap_buffers_with_damage; + + EGLBoolean KHR_cl_event2; + EGLBoolean KHR_create_context; + EGLBoolean KHR_fence_sync; EGLBoolean KHR_get_all_proc_addresses; EGLBoolean KHR_gl_colorspace; + EGLBoolean KHR_gl_renderbuffer_image; EGLBoolean KHR_gl_texture_2D_image; - EGLBoolean KHR_gl_texture_cubemap_image; EGLBoolean KHR_gl_texture_3D_image; - EGLBoolean KHR_gl_renderbuffer_image; - + EGLBoolean KHR_gl_texture_cubemap_image; + EGLBoolean KHR_image_base; + EGLBoolean KHR_image_pixmap; EGLBoolean KHR_reusable_sync; - EGLBoolean KHR_fence_sync; + EGLBoolean KHR_surfaceless_context; + EGLBoolean KHR_vg_parent_image; EGLBoolean KHR_wait_sync; - EGLBoolean KHR_cl_event2; - EGLBoolean KHR_surfaceless_context; - EGLBoolean KHR_create_context; + EGLBoolean MESA_configless_context; + EGLBoolean MESA_drm_display; + EGLBoolean MESA_drm_image; + EGLBoolean MESA_image_dma_buf_export; EGLBoolean NOK_swap_region; EGLBoolean NOK_texture_from_pixmap; - EGLBoolean ANDROID_image_native_buffer; - - EGLBoolean CHROMIUM_sync_control; - EGLBoolean NV_post_sub_buffer; - EGLBoolean EXT_create_context_robustness; - EGLBoolean EXT_buffer_age; - EGLBoolean EXT_swap_buffers_with_damage; - EGLBoolean EXT_image_dma_buf_import; - - EGLBoolean MESA_image_dma_buf_export; + EGLBoolean WL_bind_wayland_display; + EGLBoolean WL_create_wayland_buffer_from_image; }; diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 6ef79d96502..b9b21dec5ea 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -39,7 +39,6 @@ #include <stdlib.h> #include "c11/threads.h" -#include "eglstring.h" #include "egldefines.h" #include "egldisplay.h" #include "egldriver.h" @@ -97,15 +96,10 @@ _eglLoadModule(_EGLModule *mod) static void _eglUnloadModule(_EGLModule *mod) { -#if defined(_EGL_OS_UNIX) /* destroy the driver */ if (mod->Driver && mod->Driver->Unload) mod->Driver->Unload(mod->Driver); -#elif defined(_EGL_OS_WINDOWS) - /* XXX Windows unloads DLLs before atexit */ -#endif - mod->Driver = NULL; } @@ -135,7 +129,7 @@ _eglAddModule(const char *name) /* allocate a new one */ mod = calloc(1, sizeof(*mod)); if (mod) { - mod->Name = _eglstrdup(name); + mod->Name = strdup(name); if (!mod->Name) { free(mod); mod = NULL; diff --git a/src/egl/main/eglfallbacks.c b/src/egl/main/eglfallbacks.c index 3c3701f4ae9..65daf8fd0f5 100644 --- a/src/egl/main/eglfallbacks.c +++ b/src/egl/main/eglfallbacks.c @@ -93,17 +93,11 @@ _eglInitDriverFallbacks(_EGLDriver *drv) drv->API.SignalSyncKHR = NULL; drv->API.GetSyncAttrib = _eglGetSyncAttrib; -#ifdef EGL_MESA_drm_image drv->API.CreateDRMImageMESA = NULL; drv->API.ExportDRMImageMESA = NULL; -#endif -#ifdef EGL_NOK_swap_region drv->API.SwapBuffersRegionNOK = NULL; -#endif -#ifdef EGL_MESA_image_dma_buf_export drv->API.ExportDMABUFImageQueryMESA = NULL; drv->API.ExportDMABUFImageMESA = NULL; -#endif } diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index 884cff0c36b..938d9537891 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -53,10 +53,10 @@ struct _egl_global _eglGlobal = /* ClientExtensionsString */ "EGL_EXT_client_extensions" " EGL_EXT_platform_base" - " EGL_EXT_platform_x11" " EGL_EXT_platform_wayland" - " EGL_MESA_platform_gbm" + " EGL_EXT_platform_x11" " EGL_KHR_client_get_all_proc_addresses" + " EGL_MESA_platform_gbm" }; diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index 1877d8bfd10..956946532cd 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -38,10 +38,11 @@ #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <strings.h> #include "c11/threads.h" #include "egllog.h" -#include "eglstring.h" #define MAXSTRING 1000 #define FALLBACK_LOG_LEVEL _EGL_WARNING @@ -146,7 +147,7 @@ _eglInitLogger(void) log_env = getenv("EGL_LOG_LEVEL"); if (log_env) { for (i = 0; level_strings[i]; i++) { - if (_eglstrcasecmp(log_env, level_strings[i]) == 0) { + if (strcasecmp(log_env, level_strings[i]) == 0) { level = i; break; } diff --git a/src/egl/main/eglstring.c b/src/egl/main/eglstring.c deleted file mode 100644 index 8b4c491ac64..00000000000 --- a/src/egl/main/eglstring.c +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 VMware, Inc. - * Copyright 2009-2010 Chia-I Wu <[email protected]> - * Copyright 2010-2011 LunarG, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -/** - * String utils. - */ - -#include <stdlib.h> -#include <string.h> -#include "eglstring.h" - - -char * -_eglstrdup(const char *s) -{ - if (s) { - size_t l = strlen(s); - char *s2 = malloc(l + 1); - if (s2) - strcpy(s2, s); - return s2; - } - return NULL; -} - - - diff --git a/src/egl/main/eglstring.h b/src/egl/main/eglstring.h deleted file mode 100644 index 16baa477714..00000000000 --- a/src/egl/main/eglstring.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 VMware, Inc. - * Copyright 2009-2010 Chia-I Wu <[email protected]> - * Copyright 2010-2011 LunarG, Inc. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef EGLSTRING_INCLUDED -#define EGLSTRING_INCLUDED - -#include <string.h> -#include <stdio.h> - -#ifdef _EGL_OS_WINDOWS -#define _eglstrcasecmp _stricmp -#define _eglsnprintf _snprintf -#else -#include <strings.h> // for strcasecmp -#define _eglstrcasecmp strcasecmp -#define _eglsnprintf snprintf -#endif - -extern char * -_eglstrdup(const char *s); - - -#endif /* EGLSTRING_INCLUDED */ diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c index 76c60e940dc..4fa43f3e2b1 100644 --- a/src/egl/main/eglsurface.c +++ b/src/egl/main/eglsurface.c @@ -84,6 +84,22 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list) switch (attr) { /* common attributes */ + case EGL_GL_COLORSPACE_KHR: + if (!dpy->Extensions.KHR_gl_colorspace) { + err = EGL_BAD_ATTRIBUTE; + break; + } + switch (val) { + case EGL_GL_COLORSPACE_SRGB_KHR: + case EGL_GL_COLORSPACE_LINEAR_KHR: + break; + default: + err = EGL_BAD_ATTRIBUTE; + } + if (err != EGL_SUCCESS) + break; + surf->GLColorspace = val; + break; case EGL_VG_COLORSPACE: switch (val) { case EGL_VG_COLORSPACE_sRGB: @@ -272,6 +288,7 @@ _eglInitSurface(_EGLSurface *surf, _EGLDisplay *dpy, EGLint type, surf->RenderBuffer = renderBuffer; surf->VGAlphaFormat = EGL_VG_ALPHA_FORMAT_NONPRE; surf->VGColorspace = EGL_VG_COLORSPACE_sRGB; + surf->GLColorspace = EGL_GL_COLORSPACE_LINEAR_KHR; surf->MipmapLevel = 0; surf->MultisampleResolve = EGL_MULTISAMPLE_RESOLVE_DEFAULT; @@ -309,7 +326,8 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, *value = surface->Config->ConfigID; break; case EGL_LARGEST_PBUFFER: - *value = surface->LargestPbuffer; + if (surface->Type == EGL_PBUFFER_BIT) + *value = surface->LargestPbuffer; break; case EGL_TEXTURE_FORMAT: /* texture attributes: only for pbuffers, no error otherwise */ @@ -352,6 +370,13 @@ _eglQuerySurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, case EGL_VG_COLORSPACE: *value = surface->VGColorspace; break; + case EGL_GL_COLORSPACE_KHR: + if (!dpy->Extensions.KHR_gl_colorspace) { + _eglError(EGL_BAD_ATTRIBUTE, "eglQuerySurface"); + return EGL_FALSE; + } + *value = surface->GLColorspace; + break; case EGL_POST_SUB_BUFFER_SUPPORTED_NV: *value = surface->PostSubBufferSupportedNV; break; diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h index 74c429a9628..fc799ee43dc 100644 --- a/src/egl/main/eglsurface.h +++ b/src/egl/main/eglsurface.h @@ -65,6 +65,7 @@ struct _egl_surface EGLenum RenderBuffer; EGLenum VGAlphaFormat; EGLenum VGColorspace; + EGLenum GLColorspace; /* attributes set by eglSurfaceAttrib */ EGLint MipmapLevel; |