summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/platform_android.c
Commit message (Collapse)AuthorAgeFilesLines
...
* egl/main: Stop using EGLNative types internallyChad Versace2014-03-171-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglCreateImageKHR by display, not driverChad Versace2014-03-171-8/+1
| | | | | | | | | | | | 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 <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglCreateWaylandBufferFromImageWL by display, not driverChad Versace2014-03-171-0/+1
| | | | | | | | | | 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 <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglPostSubBufferNV by display, not driverChad Versace2014-03-171-0/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglSwapBuffersRegionNOK by display, not driverChad Versace2014-03-171-0/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglCopyBuffers by display, not driverChad Versace2014-03-171-0/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch API.QueryBufferAge by display, not driverChad Versace2014-03-171-0/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglDestroySurface by display, not driverChad Versace2014-03-171-2/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglCreatePbufferSurface by display, not driverChad Versace2014-03-171-1/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglCreatePixmapSurface by display, not driverChad Versace2014-03-171-9/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglCreateWindowSurface by display, not driverChad Versace2014-03-171-1/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglSwapBuffersWithDamage by display, not driverChad Versace2014-03-171-0/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglSwapBuffers by display, not driverChad Versace2014-03-171-1/+1
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Dispatch eglSwapInterval by display, not driverChad Versace2014-03-171-0/+2
| | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/dri2: Move dri2_egl_display virtual funcs to vtblChad Versace2014-03-171-0/+9
| | | | | | | | | | | 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 <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* 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 <emil.l.velikov@gmail.com>
* egl_dri2: use loader util libEmil Velikov2014-01-181-103/+4
| | | | | | | Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* egl_dri2: Remove depth argument from dri2_add_config()Kristian Høgsberg2013-10-151-8/+6
| | | | | | | | | | | | | | All callers now use the more correct rgba mask mechanism for filtering out mathcing DRI configs. Even if depth and buffer size match, the color component layout can be different, or in case or ARGB8888 and ARGB2101010 the color components can even be different sizes. Since anything that the depth check would reject is also rejected by the rgba mask comparison, the depth parameter is redundant and not specific enough. We should probably have removed it when the rgba masks argument was introduced, but better late than never. Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <brianp@vmware.com>
* egl/android: Fix error condition for EGL_ANDROID_image_native_bufferChad Versace2013-05-081-2/+14
| | | | | | | | | | | | | Emit EGL_BAD_CONTEXT if the user passes a context to eglCreateImageKHR(type=EGL_ANDROID_image_native_buffer). From the EGL_ANDROID_image_native_buffer spec: * If <target> is EGL_NATIVE_BUFFER_ANDROID and <ctx> is not EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated. Note: This is a candidate for the stable branches. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* android: use gralloc_drm_get_gem_handle apiTapani Pälli2013-01-281-6/+2
| | | | | | | | Currently a gralloc internal structure is exposed to Mesa, Use a query function instead to maintain ABI compatibility. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
* egl/android: Fix build for Jelly Bean (v2)Chad Versace2013-01-021-0/+59
| | | | | | | | | | | | | In Jelly Bean, the interface to ANativeWindow changed. The change included adding a new parameter the queueBuffer and dequeueBuffer methods, removing the lockBuffer method, and requiring libsync. v2: - s/fence_fd == -1/fence_fd != -1/ - Fix leak. Close the fence_fd. Reviewed-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* android: do not expose single buffered eglconfigsTapani Pälli2012-08-311-11/+8
| | | | | | | | | | | | On Android we want to add only double buffered configs for visuals. Earlier implementation set the SurfaceType as 0 for single buffered configs but driver still exposed these configs that were not compatible with any egl surface type. This caused Khronos conformance test runs to fail on Android. This patch fixes the issue by skipping single buffered configs earlier and not exposing them. Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* android: fix liblog API changesTapani Pälli2012-08-311-3/+14
| | | | | | | | android logging macros changed their name in JellyBean. Signed-off-by: Bruce E. Robertson <bruce.e.robertson@intel.com> Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* egl/android: Add support for RGBX_8888 used in Android native buffersSean V Kelley2012-04-301-0/+2
| | | | | | | | Add new format __DRI_IMAGE_FORMAT_XBGR8888 to __DRI_IMAGE. HAL_PIXEL_FORMAT_RGBX_8888 now maps to __DRI_IMAGE_FORMAT_XBGR8888. Signed-off-by: Sean V Kelley <sean.v.kelley@linux.intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
* android: add support for ICSChia-I Wu2011-11-251-3/+3
| | | | | | | | With ICS (Android 4.0), several headers and structs are renamed. Define ANDROID_VERSION so that we can choose a different path depending on the platform version. I've tested only softpipe and llvmpipe. r600g is also reported to work.
* egl_dri2: add support for RGBA_8888 android native bufferChia-I Wu2011-09-091-0/+2
| | | | HAL_PIXEL_FORMAT_RGBA_8888 maps to __DRI_IMAGE_FORMAT_ABGR8888.
* egl_dri2: add pbuffer support to platform_androidChia-I Wu2011-08-311-5/+16
| | | | | | This is a simple change thanks to allocateBuffer. Reviewed-by: Chad Versace <chad@chad-versace.us>
* egl_dri2: check the surface type in platform_androidChia-I Wu2011-08-311-45/+56
| | | | | | | Check the surface type is EGL_WINDOW_BIT before doing anything, in preparation for pbuffer support. Reviewed-by: Chad Versace <chad@chad-versace.us>
* egl_dri2: refactor droid_get_buffers_with_formatChia-I Wu2011-08-311-27/+39
| | | | | | Move the loop to parse attachments to its own function. Reviewed-by: Chad Versace <chad@chad-versace.us>
* egl_dri2: add support for AndroidChia-I Wu2011-08-281-0/+720
Add platform_android.c that supports _EGL_PLAFORM_ANDROID. It works with drm_gralloc, where back buffers of windows are backed by GEM objects. In Android a native window has a queue of back buffers allocated by the server, through drm_gralloc. For each frame, EGL needs to dequeue the next back buffer render to the buffer enqueue the buffer After enqueuing, the buffer is no longer valid to EGL. A window has no depth buffer or other aux buffers. They need to be allocated locally by EGL. Reviewed-by: Benjamin Franzke <benjaminfranzke@googlemail.com> Reviewed-by: Chad Versace <chad@chad-versace.us> [olv: with assorted minor changes, mostly suggested during the review]