Commit Graph

109 Commits

Author SHA1 Message Date
Kristian Høgsberg e23bfdb329 wayland: Use existing EGL_TEXTURE_FORMAT for querying wl_buffer texture format
We also reuse EGL_TEXTURE_RGBA and EGL_TEXTURE_RGB, adding only the new
planar YUV texture formats: EGL_TEXTURE_Y_U_V_WL, EGL_TEXTURE_Y_UV_WL and
EGL_TEXTURE_Y_XUXV_WL.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2012-07-19 14:03:17 -04:00
Kristian Høgsberg e6a33570b7 egl: Add EGL_WAYLAND_PLANE_WL attribute
This lets us specify the plane to create the image for for multiplanar
wl_buffers.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2012-07-11 15:28:36 -04:00
Kristian Høgsberg 1aaec8c609 wayland-drm: Add protocol to create planar buffers 2012-07-11 15:28:35 -04:00
Kristian Høgsberg 379eb47ea6 wayland-drm: Pass struct wl_drm_buffer to the driver
We're going to extend this to support multi-plane buffers, so pass this
to the driver so it can access the details.
2012-07-11 15:28:35 -04:00
Kristian Høgsberg 5f5746a692 egl_dri2: Reorganize the EGLImage constructors to share more code
We factor out all the EGL book-keeping into dri2_create_image() and
simplify the wayland case by using dupImage.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2012-07-05 14:22:07 -04:00
Eric Anholt 9f0f00c319 egl: Drop _EGL_MAIN entrypoint obfuscation.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-02-29 11:52:40 -08:00
Matt Turner 027ce0c493 Revert "Always build shared glapi"
This reverts commit adefee50d9.

Shared glapi was never tested with --enable-xlib-glx and turns out
to cause a lot of problems.

Conflicts:

	configure.ac
2012-01-24 11:34:42 -05:00
Matt Turner adefee50d9 Always build shared glapi
libglapi.so, libGL.so, libGLESv2.so, libGLESv1_CM.so must all
come from the same version of Mesa or bad things may happen.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Matt Turner <mattst88@gmail.com>
2012-01-20 14:56:42 -05:00
Kristian Høgsberg 58dc1b28d1 wayland-drm: Drop the non-premul formats, use format codes from drm_fourcc.h 2012-01-11 14:24:00 -05:00
Kristian Høgsberg 513d1feee4 egl_dri2: Put the _eglError call in the case switch case
Log an error in case we get an unknown format, not in case for XRGB32.
I botched the edit of Roberts patch.
2012-01-11 12:44:58 -05:00
Robert Bragg 670f182a1f egl_dri2/wayland: handle creating xrgb8888 images
When creating an EGLImage from a struct wl_buffer * this ensures
that we create an XRGB8888 image if the wayland buffer doesn't have an
alpha channel. To determine if a wl_buffer has a valid alpha channel
this patch adds an internal wayland_drm_buffer_has_alpha() function.

It's important to get the internal format for an EGLImage right so that
if a GL texture is later created from the image then the GL driver will
know if it should sample the alpha from the texture or flatten it to
a constant of 1.0.

This avoids needing fragment program workarounds in wayland compositors
to manually ignore the alpha component of textures created from wayland
buffers.

krh: Edited to use wl_buffer_get_format() instead of wl_buffer_has_alpha().

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
2012-01-11 12:16:47 -05:00
Fredrik Höglund 655f2c1d65 egl_dri2/x11: Add support for eglSwapInterval 2011-12-20 22:11:17 -05:00
Benjamin Franzke 2a58453e25 egl_dri2: Fix some valgrind reported leaks
Free the device_name, reported by Pekka Paalanen.

Destroy wayland display and drm resources,
if created by dri2_initialize_wayland.
2011-12-13 15:32:43 +01:00
Kristian Høgsberg 7b1d94e5d1 wayland: Track changes to drop wl_visual 2011-08-31 18:33:47 -04:00
Kristian Høgsberg 447bb454d8 egl_dri2: Only clear EGL_PIXMAP_BIT if DRI config is double buffered
We don't want to set the pixmap bit in the EGL config if the DRI
config we're adding is a double buffered config.  However, don't clear
any other bits the platform might pass in in the surface_type
argument.
2011-08-31 18:33:36 -04:00
Chia-I Wu 357d3f30f3 egl_dri2: set ctx->WindowRenderBuffer
Set ctx->WindowRenderBuffer to EGL_BACK_BUFFER.  As EGL_WINDOW_BIT of a
config is set only when there is dri_double_buffer, that makes sure
window surfaces are always double-buffered and contexts will render to
the back buffer.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-31 11:51:42 +08:00
Chia-I Wu 9779f6f5c1 egl_dri2: add support for Android
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]
2011-08-28 21:56:23 +08:00
Chia-I Wu 58911b86a1 egl_dri2: allow RGBA masks to be specified for matching
Add rgba_masks to dri2_add_config.  When it is non-NULL, the DRI config
is accepted only when the offsets and sizes of the its channels match
rgba_mask.

Reviewed-by: Chad Versace <chad@chad-versace.us>
2011-08-28 21:56:22 +08:00
Cooper Yuan f5e757ea60 Destroy context in dri2/glx driver when apps call eglDestroyContext 2011-08-14 15:14:17 +08:00
Benjamin Franzke 32f4cf3808 egl/gbm: Fix EGL_DEFAULT_DISPLAY 2011-08-04 14:09:34 +02:00
Marek Olšák 5fe54df58f Rename swrastg_dri to swrast_dri
I prefer it this way and it has been suggested earlier by others too.
Opinions?
2011-07-14 03:03:26 +02:00
Völgyes Dávid f747d03b1d Fixes for leaks reported by cppcheck. 2011-07-06 10:11:04 -04:00
Benjamin Franzke 992680c8b4 egl: Fix Terminate with shared gbm screens
NOTE: This is a candidate for the 7.11 branch.
2011-06-27 10:25:12 +02:00
Benjamin Franzke 629c15aaac egl_dri2: Build drm platform only if enabled 2011-06-24 22:00:45 +02:00
Benjamin Franzke e5fc4c81ce egl_dri2: Hookup gbm as drm platform 2011-06-23 21:07:17 +02:00
Chia-I Wu 77e031a1c4 egl_dri2: try swrastg_dri if swrast_dri fails
Per libGL.
2011-06-13 12:19:39 +08:00
Chia-I Wu cf69eeacc6 egl_dri2: add dri2_load_driver_swrast
Refactor dri2_load_driver and add dri2_load_driver_swrast for loading
swrast DRI driver.
2011-06-13 11:11:43 +08:00
Benjamin Franzke 16e30276e8 egl_dri2: Compare configs before matching them
This compares attribs like buffer size, and will prevent merging
unequal configs because of match criterion is e.g. ATLEAST.
2011-06-12 08:56:35 -04:00
Benjamin Franzke b8325fd255 egl_dri2/wayland: Add support for EGL_DEFAULT_DISPLAY 2011-06-12 08:56:35 -04:00
Benjamin Franzke 83c68758be egl_dri2: Discard similar configs 2011-05-13 09:31:09 -04:00
Kristian Høgsberg 93aea63a33 egl_dri2: Make it possible to not compile in the X11 platform 2011-05-13 09:31:09 -04:00
José Fonseca 5de2c67ba7 egl/dri2: Avoid unused static functions. 2011-05-12 15:24:26 +01:00
José Fonseca 4a47d6d46b egl/dri2: Prevent uninitialized variable dereference. 2011-05-12 15:23:48 +01:00
José Fonseca 6a661895e9 egl: Fix int <-> ptr casts.
Based on zhigang gong <zhigang.gong@gmail.com>'s patch.
2011-05-12 15:12:16 +01:00
Kristian Høgsberg e5169e9615 egl: Add a cursor use bit to MESA_drm_image 2011-05-06 10:33:50 -04:00
Benjamin Franzke 834b84149d egl/wayland-drm: Generalize interface
Do not depend on _EGLDisplay and _EGLImage.
2011-05-06 10:33:50 -04:00
Kristian Høgsberg a1bd012473 egl_dri2: We don't actually support KHR_gl_texture_2D_image 2011-03-26 10:57:31 -04:00
Kristian Høgsberg 981e338611 egl_dri2: Enable image extensions in one place
We know what we can support in egl_dri2.c so just enable the extensions
there.
2011-03-26 10:57:31 -04:00
Benjamin Franzke 4f6fbfa0ed egl_dri2: Add attribute map for __DRI_ATTRIB_FRAMEBUFFER_SRGB_CAPABLE
Broken since 6538b5824e.
Thanks to iskren on #wayland for helping on finding this.
2011-03-07 00:32:05 +01:00
Benjamin Franzke 6b369c4c7c egl: Add EGL_WL_bind_wayland_display 2011-03-01 17:23:50 -05:00
Haitao Feng f55d027ac2 egl_dri2: add swrast
This enables the egl_dri2 driver to load swrast driver
for software rendering. It could be used when hardware
dri2 drivers are not available, such as in VM.

Signed-off-by: Haitao Feng <haitao.feng@intel.com>
2011-02-16 23:06:36 -05:00
Benjamin Franzke 4e8f95f64d egl_dri2: Always unbind old contexts
This fixes __DRIdrawable refcounting.
Binding a context increases their refcount,
so we need to decrease it.
2011-02-10 23:07:01 -05:00
Benjamin Franzke 87dde5b1cd egl_dri2: Use double buffering for window surfaces 2011-02-10 23:07:01 -05:00
Benjamin Franzke 93aea84f47 egl_dri2: Add wayland platform 2011-02-07 14:01:31 +01:00
Benjamin Franzke a8128d7d4b egl_dri2: Enable pixmap bind_to_texture according to the extension 2011-02-07 14:01:30 +01:00
Kristian Høgsberg 9dc5de5bb1 egl_dri2: Split out drm platform implementation to a separate file 2011-02-03 11:59:38 -05:00
Kristian Høgsberg 2889d9640f egl_dri2: Split out x11 platform code 2011-02-03 11:59:38 -05:00
Chia-I Wu 218381d927 egl_dri2: Export glapi symbols for DRI drivers.
When an app loads libEGL.so dynamically with RTLD_LOCAL, loading DRI
drivers would fail because of missing glapi symbols.  This commit makes
egl_dri2 load libglapi.so with RTLD_GLOBAL to export glapi symbols for
future symbol resolutions.

The same trick can be found in GLX.  However, egl_dri2 can only do so
when --enable-shared-glapi is given.  Because, otherwise, both libGL.so
and libglapi.so define glapi symbols and egl_dri2 cannot tell which
library to load.
2011-01-30 05:28:24 +08:00
Chia-I Wu a22a332fc7 egl: Improve driver selection.
The idea is to be able to match a driver using the following order

  try egl_gallium with hw renderer
  try egl_dri2
  try egl_gallium with sw renderer
  try egl_glx

given the module list

  egl_gallium
  egl_dri2
  egl_glx

For that, UseFallback initialization option is added.  The module list
is matched twice: with the option unset and with the option set.  In the
first pass, egl_gallium skips its sw renderer and egl_glx rejects to
initialize since UseFallback is not set.  In the second pass,
egl_gallium skips its hw renderer and egl_dri2 rejects to initialize
since UseFallback is set.  The process stops at the first driver that
initializes the display.
2011-01-13 18:15:45 +08:00
Chia-I Wu 655e459892 egl: Simplify driver matching.
Add initialization options that drv->API.Initialize should support.
Replace drv->Probe by TestOnly initialization option and simplify
_eglMatchDriver.
2011-01-13 18:10:38 +08:00