summaryrefslogtreecommitdiffstats
path: root/src/egl
Commit message (Collapse)AuthorAgeFilesLines
* egl/main: Enable Linux platform extensionsChad Versace2014-03-175-23/+215
| | | | | | | | | | | | | | | | Enable EGL_EXT_platform_base and the Linux platform extensions layered atop it: EGL_EXT_platform_x11, EGL_EXT_platform_wayland, and EGL_MESA_platform_gbm. Tested with Piglit's EGL_EXT_platform_base tests under an X11 session. To enable running the Wayland and GBM tests, windowed Weston was running and the kernel had render nodes enabled. I regression tested my EGL_EXT_platform_base patch set with Piglit on Ivybridge under X11/EGL, standalone Weston, and GBM with rendernodes. No regressions found. Signed-off-by: Chad Versace <[email protected]>
* egl/wayland: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurfaceChad Versace2014-03-171-1/+17
| | | | | | | | | | From the EGL_EXT_wayland_spec, version 3: It is not valid to call eglCreatePlatformPixmapSurfaceEXT with a <dpy> that belongs to Wayland. Any such call fails and generates EGL_BAD_PARAMETER. Signed-off-by: Chad Versace <[email protected]>
* egl/gbm: Emit EGL_BAD_PARAMETER for eglCreatePlatformPixmapSurfaceChad Versace2014-03-171-1/+16
| | | | | | | | | | From the EGL_MESA_platform_gbm spec, version 5: It is not valid to call eglCreatePlatformPixmapSurfaceEXT with a <dpy> that belongs to the GBM platform. Any such call fails and generates EGL_BAD_PARAMETER. Signed-off-by: Chad Versace <[email protected]>
* egl/main: Stop using EGLNative types internallyChad Versace2014-03-1711-43/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Internally, much of the EGL code uses EGLNativeDisplayType, EGLNativeWindowType, and EGLPixmapType. However, the EGLNative type often does not match the variable's actual type. The concept of EGLNative types are a bad match for Linux, as explained below. And the EGL platform extensions don't use EGLNative types at all. Those extensions attempt to solve cross-platform issues by moving the EGL API away from the EGLNative types. The core of the problem is that eglplatform.h can define each EGLNative type once only, but Linux supports multiple EGL platforms. To work around the problem, Mesa's eglplatform.h contains multiple definitions of each EGLNative type, selected by feature macros. Mesa expects EGL clients to set the feature macro approrpiately. But the feature macros don't work when a single codebase must be built with support for multiple EGL platforms, *such as Mesa itself*. When building libEGL, autotools chooses the EGLNative typedefs based on the first element of '--with-egl-platforms'. For example, '--with-egl-platforms=x11,drm,wayland' defines the following: typedef Display* EGLNativeDisplayType; typedef Window EGLNativeWindowType; typedef Pixmap EGLNativePixmapType; Clearly, this doesn't work well for Wayland and GBM. Mesa works around the problem by casting the EGLNative types to different things in different files. For sanity's sake, and to prepare for the EGL platform extensions, this patch removes from egl/main and egl/dri2 all internal use of the EGLNative types. It replaces them with 'void*' and checks each explicit cast with a static assertion. Also, the patch touches egl_gallium the minimal amount to keep it compatible with eglapi.h. Signed-off-by: Chad Versace <[email protected]>
* egl: Add STATIC_ASSERT() macroChad Versace2014-03-171-0/+5
| | | | Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglCreateImageKHR by display, not driverChad Versace2014-03-176-18/+35
| | | | | | | | | | | | Add dri2_egl_display_vtbl::create_image, set it for each platform, and let egl_dri2 dispatch eglCreateImageKHR to that. To remove ambiguity, rename egl_dri2.c:dri2_create_image() to dri2_create_image_from_dri(). This prepares for the EGL platform extensions. Signed-off-by: Chad Versace <[email protected]>
* egl/dri2/x11: Don't clobber _EGLDriver::APIChad Versace2014-03-171-5/+0
| | | | | | | | | | | dri2_initialize_x11_swrast() does a strange thing. For some extensions it doesn't support, it sets the corresponding functions in _EGLDriver::API to NULL. The intention here is clear, but misplaced. NULL or not, the function pointers never get called because their extensions aren't supported. Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglCreateWaylandBufferFromImageWL by display, not driverChad Versace2014-03-177-6/+32
| | | | | | | | | | Add dri2_egl_display_vtbl::create_wayland_buffer_from_image, set it for each platform, and let egl_dri2 dispatch eglCreateWaylandBufferFromImageWL to that. This prepares for the EGL platform extensions. Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Consolidate eglTerminateChad Versace2014-03-172-40/+24
| | | | | | | | | | | | | | | | | | | | egl_dri2.c:dri2_terminate() handled terminating X11 and DRM displays. The Wayland platform implemented its own dri2_wl_terminate(), which was nearly a copy of the common one. To implement the EGL platform extensions, we either need to dispatch eglTerminate per display or define a common implementation for all platforms. This patch chooses consolidation. It removes dri2_wl_terminate() by folding it into the common dri2_terminate(). It was necessary to invert the `if (disp->PlatformDisplay == NULL)` and the switch statement because, unlike DRM and X11, Wayland's terminator performed action even when EGL didn't own the native display. In the inversion, I replaced `disp->PlatformDisplay == NULL` with `dri2_dpy->own_device` because the two expressions are synonymous, but the latter's meaning is clearer. Signed-off-by: Chad Versace <[email protected]>
* egl/dri2/x11: Set dri2_dpy->own_deviceChad Versace2014-03-171-0/+3
| | | | | | | | When the user calls eglGetDisplay(EGL_DEFAULT_DISPLAY), the Wayland and DRM platforms set dri2_dpy->own_device=true. This patch makes the X11 platform do the same for consistency. Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglPostSubBufferNV by display, not driverChad Versace2014-03-177-1/+27
| | | | | | | | | | Add dri2_egl_display_vtbl::post_sub_buffer, set it for each platform, and let egl_dri2 dispatch eglPostSubBufferNV to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driverChad Versace2014-03-177-2/+26
| | | | | | | | | | Add dri2_egl_display_vtbl::swap_buffers_region, set it for each platform, and let egl_dri2 dispatch eglSwapBuffersRegionNOK to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglCopyBuffers by display, not driverChad Versace2014-03-177-3/+25
| | | | | | | | | | Add dri2_egl_display_vtbl::copy_buffers, set it for each platform, and let egl_dri2 dispatch eglCopyBuffers to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch API.QueryBufferAge by display, not driverChad Versace2014-03-177-5/+26
| | | | | | | | | | Add dri2_egl_display_vtbl::query_buffer_age, set it for each platform, and let egl_dri2 dispatch API.QueryBufferAge to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglDestroySurface by display, not driverChad Versace2014-03-176-6/+16
| | | | | | | | | | Add dri2_egl_display_vtbl::destroy_surface, set it for each platform, and let egl_dri2 dispatch eglDestroySurface to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglCreatePbufferSurface by display, not driverChad Versace2014-03-177-3/+26
| | | | | | | | | | Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each platform, and let egl_dri2 dispatch eglCreatePbufferSurface to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglCreatePixmapSurface by display, not driverChad Versace2014-03-177-11/+30
| | | | | | | | | | Add dri2_egl_display_vtbl::create_pbuffer_surface, set it for each platform, and let egl_dri2 dispatch eglCreatePixmapSurface to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglCreateWindowSurface by display, not driverChad Versace2014-03-176-5/+21
| | | | | | | | | | Add dri2_egl_display_vtbl::create_window_surface, set it for each platform, and let egl_dri2 dispatch eglCreateWindowSurface to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driverChad Versace2014-03-177-1/+27
| | | | | | | | | | Add dri2_egl_display_vtbl::swap_buffers_with_damage, set it for each platform, and let egl_dri2 dispatch eglSwapBuffersWithDamageEXT to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglSwapBuffers by display, not driverChad Versace2014-03-176-5/+16
| | | | | | | | | | Add dri2_egl_display_vtbl::swap_buffers, set it for each platform, and let egl_dri2 dispatch eglSwapBuffers to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Dispatch eglSwapInterval by display, not driverChad Versace2014-03-177-2/+55
| | | | | | | | | | Add dri2_egl_display_vtbl::swap_interval, set it for each platform, and let egl_dri2 dispatch eglSwapInterval to that. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/wl,x11: Call dri2_swap_interval() staticallyChad Versace2014-03-172-2/+10
| | | | | | | | | | Don't call it through the driver dispatch table. Just call it statically. This prepares for the EGL platform extensions. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Put platform func names into proper namespacesChad Versace2014-03-173-170/+177
| | | | | | | | | | | | | | | | | | | | Each of the egl_dri2 platforms (except Android) prefix their function names with "dri2", not "dri2_${platform}". This means many function names have three separate definitions in the egl_dri2 directory: one in each of platform_drm.c, platform_wayland.c, and platform_x11.c. For example, each of the three files defines dri2_create_window_surface(). The name collisions make it difficult to review patches for correctness ("Is this patch hunk calling a platform_x11 function or a global egl_dri2 function?"), complicate debugging, and confuse code navigation tools. For each function in platform_x11.c prefixed with 'dri2', this patch changes its prefix to 'dri2_x11'. Likewise for platform_drm.c and 'dri2_drm'; and platform_wayland.c and 'dri2_wl'. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* egl/dri2: Move dri2_egl_display virtual funcs to vtblChad Versace2014-03-176-7/+52
| | | | | | | | | | | dri2_egl_display has only one virtual function, 'authenticate'. Define dri2_egl_display::vtbl and move 'authenticate' there. This prepares for the EGL platform extensions, which will add many more virtual functions to dri2_egl_display. Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Chad Versace <[email protected]>
* Add the EGL_MESA_configless_context extensionNeil Roberts2014-03-125-5/+20
| | | | | | | | | | | | | | | | | | | | This extension provides a way for an application to render to multiple surfaces with different buffer formats without having to use multiple contexts. An EGLContext can be created without an EGLConfig by passing EGL_NO_CONFIG_MESA. In that case there are no restrictions on the surfaces that can be used with the context apart from that they must be using the same EGLDisplay. _mesa_initialze_context can now take a NULL gl_config which will mark the context as ‘configless’. It will memset the visual to zero in that case. Previously the i965 and i915 drivers were explicitly creating a zeroed visual whenever 0 is passed for the EGLConfig. Mesa needs to be aware that the context is configless because it affects the initial value to use for glDrawBuffer. The first time the context is bound it will set the initial value for configless contexts depending on whether the framebuffer used is double-buffered. Reviewed-by: Kristian Høgsberg <[email protected]>
* eglCreateContext: Remove the check for whether config == 0Neil Roberts2014-03-121-5/+2
| | | | | | | | | | | | | | | | In eglCreateContext there is a check for whether the config parameter is zero and in this case it will avoid reporting an error if the EGL_KHR_surfacless_context extension is supported. However there is nothing in that extension which says you can create a context without a config and Mesa breaks if you try this so it is probably better to leave it reporting an error. The original check was added in b90a3e7d8b1bc based on the API-specific extensions EGL_KHR_surfaceless_opengl/gles1/gles2. This was later changed to refer to EGL_KHR_surfacless_context in b50703aea5. Perhaps the original extensions specified a configless context but the new one does not. Reviewed-by: Kristian Høgsberg <[email protected]>
* automake: use install-lib-links.mk across all classic mesaEmil Velikov2014-03-111-0/+2
| | | | | | | Use the handy script and minimise the boilerplate in the makefiles. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Jon TURNEY <[email protected]>
* egl/wayland: explicitly set __DRIimageLoaderExtension membersEmil Velikov2014-02-231-3/+4
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]>y
* egl: clarify what _eglInitResource doesChia-I Wu2014-02-191-1/+5
| | | | It is a helper called from the initializers of its subclasses.
* Revert "egl: Unhide functionality in _eglInitContext()"Chia-I Wu2014-02-191-2/+1
| | | | | | | This reverts commit 1456ed85f0ed8b9c9f0abd6bd389a089fa3824b2. _eglInitResource can and is supposed to be called on subclass objects. Acked-by: Juha-Pekka Heikkila <[email protected]>
* Revert "egl: Unhide functionality in _eglInitSurface()"Chia-I Wu2014-02-191-3/+1
| | | | | | | This reverts commit 498d10e230663f8604d00608cae6324f779c9cdd. _eglInitResource can and is supposed to be called on subclass objects. Acked-by: Juha-Pekka Heikkila <[email protected]>
* Prevent zero sized wl_egl_windowSinclair Yeh2014-02-181-0/+6
| | | | | It is illegal to create or resize a window to zero (or negative) width and/or height. This patch prevents such a request from happening.
* automake: remove leftover XORG and LIBKMS variablesEmil Velikov2014-02-181-1/+0
| | | | | | | No longer set or used since the removal of st/xorg. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* wayland-egl: automake: add symbol testEmil Velikov2014-02-112-0/+18
| | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* egl/dri2/android: free driver_name in dri2_initialize_android error pathEmil Velikov2014-02-111-1/+3
| | | | | | | v2: Cleanup driver name if dri2_load_driver() fails. Spotted by Chad Signed-off-by: Emil Velikov <[email protected]>
* egl_dri2: remove LIBUDEV_CFLAGS from Makefile.amEmil Velikov2014-02-111-1/+0
| | | | | | None of the code within builds or (explicitly) requires udev. Signed-off-by: Emil Velikov <[email protected]>
* egl: Unhide functionality in _eglInitSurface()Juha-Pekka Heikkila2014-02-071-1/+3
| | | | | | | | | | _eglInitResource() was used to memset entire _EGLSurface by writing more than size of pointed target. This does work as long as Resource is the first element in _EGLSurface, this patch fixes such dependency. Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* egl: Unhide functionality in _eglInitContext()Juha-Pekka Heikkila2014-02-071-1/+2
| | | | | | | | | | _eglInitResource() was used to memset entire _EGLContext by writing more than size of pointed target. This does work as long as Resource is the first element in _EGLContext, this patch fixes such dependency. Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* egl/glx: Remove egl_glx driverChad Versace2014-02-055-1229/+0
| | | | | | | | | | | | | | | Mesa now has a real, feature-rich EGL implementation on X11 via xcb. Therefore I believe there is no longer a practical need for the egl_glx driver. Furthermore, egl_glx appears to be unmaintained. The most recent nontrivial commit to egl_glx was 6baa5f1 on 2011-11-25. Tested by running weston-smoke in windowed Weston on X with i965. Signed-off-by: Chad Versace <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Acked-by: Kristian Høgsberg <[email protected]>
* build: Share the all-local rule for linking libraries into the build dirKristian Høgsberg2014-01-291-6/+1
| | | | | | | | | | This consolidates how we link the libraries into the build directory. It works for lib_LTLIBRARIES but not custom shared libraries like DRI drivers or gallium state trackers which needs special casing (cf dri mega drivers, for example) Signed-off-by: Kristian Høgsberg <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* loader: Use dlsym to get our udev symbols instead of explicit linking.Eric Anholt2014-01-271-1/+1
| | | | | | | | | | | | | | | | Steam links against libudev.so.0, while we're linking against libudev.so.1. The result is that the symbol names (which are the same in the two libraries) end up conflicting, and some of the usage of .so.1 calls the .so.0 bits, which have different internal structures, and segfaults happen. By using a dlopen() with RTLD_LOCAL, we can explicitly look for the symbols we want, while they get the symbols they want. Reviewed-by: Keith Packard <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Tested-by: Alexandre Demers <[email protected]> Tested-by: Mike Lothian <[email protected]>
* egl: Use C11 thread abstractions.José Fonseca2014-01-231-19/+7
| | | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl_dri2: use loader util libEmil Velikov2014-01-187-259/+15
| | | | | | | Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* egl-static: use loader util libEmil Velikov2014-01-181-0/+1
| | | | | | | | | | v2 * Drop the no longer used _EGL_NO_DRM from Android.mk. Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* loader: introduce the loader util libEmil Velikov2014-01-182-0/+2
| | | | | | | | | | | | | | | | | | | | | | All the various window system integration layers duplicate roughly the same code for figuring out device and driver name, pci-id's, etc. Which is sad. So extract it out into a loader util lib. v2 (Emil) * Separate the introduction of libloader from the code de-duplication. * Strip out non-pci devices support. * Add scons + Android build system support. * Add VISIBILITY_CFLAGS to avoid exporting the loader funcs. v3 (Emil) * PIPE_OS_ANDROID is undefined at this scope, use ANDROID * Make sure we define _EGL_NO_DRM when building only swrast Signed-off-by: Rob Clark <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Rob Clark <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* s/Tungsten Graphics/VMware/José Fonseca2014-01-1727-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the old copyright name is creating unnecessary confusion, hence this change. This was the sed script I used: $ cat tg2vmw.sed # Run as: # # git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed # # Rename copyrights s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./ s/TUNGSTEN GRAPHICS/VMWARE/g # Rename emails s/[email protected]/[email protected]/ s/[email protected]/[email protected]/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\[email protected]/[email protected]/g s/keithw\[email protected]/[email protected]/g s/[email protected]/[email protected]/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/[email protected]/[email protected]/ # Remove dead links s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g # C string src/gallium/state_trackers/vega/api_misc.c s/"Tungsten Graphics, Inc"/"VMware, Inc"/ Reviewed-by: Brian Paul <[email protected]>
* egl_dri2: call dri2_add_configs_for_visuals after extensions setTapani Pälli2014-01-131-5/+6
| | | | | | | | dri2_add_config makes decisions based on NOK_texture_from_pixmap so it needs to be enabled before calling dri2_add_configs_for_visuals. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Chad Versace <[email protected]>
* egl: break instead of looping after driver is foundQuanxian Wang2013-12-191-0/+3
| | | | | | | | Stop searching for a driver after success. Signed-off-by: Quanxian Wang <[email protected]> Reviewed-By: Gong, Zhigang <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* egl/wayland: Return -1 from get_back_bo to indicate errorKristian Høgsberg2013-12-091-1/+1
| | | | | A return value of -1 indicate failure to allocate the back buffer and means we don't segfault on the way out.
* egl_dri2: Remove the unused swap_interval member of dri2_egl_surfaceNeil Roberts2013-12-091-1/+0
| | | | | | The _EGLSurface struct which is embedded into dri2_egl_surface also contains a swap interval member so the other member is redundant. Nothing was using it as far as I can tell.