summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c10
-rw-r--r--src/egl/drivers/dri2/platform_wayland.c31
-rw-r--r--src/egl/wayland/wayland-drm/protocol/wayland-drm.xml64
-rw-r--r--src/egl/wayland/wayland-drm/wayland-drm.c11
-rw-r--r--src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c5
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_drm.c16
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_shm.c9
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.c13
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.h5
9 files changed, 97 insertions, 67 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 5fff7e1cce..80b2e38d9d 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -1094,11 +1094,10 @@ dri2_create_image_wayland_wl_buffer(_EGLDisplay *disp, _EGLContext *ctx,
attrs.Height = buffer->height;
switch (wayland_drm_buffer_get_format(buffer)) {
- case WL_DRM_FORMAT_ARGB32:
- case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
+ case WL_DRM_FORMAT_ARGB8888:
format = __DRI_IMAGE_FORMAT_ARGB8888;
break;
- case WL_DRM_FORMAT_XRGB32:
+ case WL_DRM_FORMAT_XRGB8888:
format = __DRI_IMAGE_FORMAT_XRGB8888;
break;
default:
@@ -1273,11 +1272,10 @@ dri2_wl_reference_buffer(void *user_data, uint32_t name,
int dri_format;
switch (format) {
- case WL_DRM_FORMAT_ARGB32:
- case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
+ case WL_DRM_FORMAT_ARGB8888:
dri_format =__DRI_IMAGE_FORMAT_ARGB8888;
break;
- case WL_DRM_FORMAT_XRGB32:
+ case WL_DRM_FORMAT_XRGB8888:
dri_format = __DRI_IMAGE_FORMAT_XRGB8888;
break;
default:
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 16c613f30d..b2981a02cd 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -41,9 +41,8 @@
#include "wayland-drm-client-protocol.h"
enum wl_drm_format_flags {
- HAS_ARGB32 = 1,
- HAS_PREMUL_ARGB32 = 2,
- HAS_XRGB32 = 4
+ HAS_ARGB8888 = 1,
+ HAS_XRGB8888 = 2
};
static void
@@ -108,11 +107,9 @@ dri2_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
dri2_surf->block_swap_buffers = EGL_FALSE;
if (conf->AlphaSize == 0)
- dri2_surf->format = WL_DRM_FORMAT_XRGB32;
- else if (dri2_surf->base.VGAlphaFormat == EGL_VG_ALPHA_FORMAT_PRE)
- dri2_surf->format = WL_DRM_FORMAT_PREMULTIPLIED_ARGB32;
+ dri2_surf->format = WL_DRM_FORMAT_XRGB8888;
else
- dri2_surf->format = WL_DRM_FORMAT_ARGB32;
+ dri2_surf->format = WL_DRM_FORMAT_ARGB8888;
switch (type) {
case EGL_WINDOW_BIT:
@@ -671,7 +668,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
wl_egl_pixmap->width,
wl_egl_pixmap->height,
dri2_buf->dri_buffer->pitch,
- WL_DRM_FORMAT_PREMULTIPLIED_ARGB32);
+ WL_DRM_FORMAT_ARGB8888);
wl_attr_list[1] = wl_egl_pixmap->width;
wl_attr_list[3] = wl_egl_pixmap->height;
@@ -768,14 +765,11 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
struct dri2_egl_display *dri2_dpy = data;
switch (format) {
- case WL_DRM_FORMAT_ARGB32:
- dri2_dpy->formats |= HAS_ARGB32;
+ case WL_DRM_FORMAT_ARGB8888:
+ dri2_dpy->formats |= HAS_ARGB8888;
break;
- case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
- dri2_dpy->formats |= HAS_PREMUL_ARGB32;
- break;
- case WL_DRM_FORMAT_XRGB32:
- dri2_dpy->formats |= HAS_XRGB32;
+ case WL_DRM_FORMAT_XRGB8888:
+ dri2_dpy->formats |= HAS_XRGB8888;
break;
}
}
@@ -871,14 +865,11 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay *disp)
goto cleanup_driver;
types = EGL_WINDOW_BIT | EGL_PIXMAP_BIT;
- if (dri2_dpy->formats & HAS_PREMUL_ARGB32)
- types |= EGL_VG_ALPHA_FORMAT_PRE_BIT;
-
for (i = 0; dri2_dpy->driver_configs[i]; i++) {
config = dri2_dpy->driver_configs[i];
- if (dri2_dpy->formats & HAS_XRGB32)
+ if (dri2_dpy->formats & HAS_XRGB8888)
dri2_add_config(disp, config, i + 1, 0, types, NULL, rgb_masks);
- if (dri2_dpy->formats & (HAS_ARGB32 | HAS_PREMUL_ARGB32))
+ if (dri2_dpy->formats & HAS_ARGB8888)
dri2_add_config(disp, config, i + 1, 0, types, NULL, argb_masks);
}
diff --git a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
index f63bebdcaf..89fd8f0887 100644
--- a/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
+++ b/src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
@@ -37,9 +37,67 @@
</enum>
<enum name="format">
- <entry name="argb32" value="0"/>
- <entry name="premultiplied_argb32" value="1"/>
- <entry name="xrgb32" value="2"/>
+ <!-- The drm format codes match the #defines in drm_fourcc.h.
+ The formats actually supported by the compositor will be
+ reported by the format event. -->
+ <entry name="c8" value="0x20203843"/>
+ <entry name="rgb332" value="0x38424752"/>
+ <entry name="bgr233" value="0x38524742"/>
+ <entry name="xrgb4444" value="0x32315258"/>
+ <entry name="xbgr4444" value="0x32314258"/>
+ <entry name="rgbx4444" value="0x32315852"/>
+ <entry name="bgrx4444" value="0x32315842"/>
+ <entry name="argb4444" value="0x32315241"/>
+ <entry name="abgr4444" value="0x32314241"/>
+ <entry name="rgba4444" value="0x32314152"/>
+ <entry name="bgra4444" value="0x32314142"/>
+ <entry name="xrgb1555" value="0x35315258"/>
+ <entry name="xbgr1555" value="0x35314258"/>
+ <entry name="rgbx5551" value="0x35315852"/>
+ <entry name="bgrx5551" value="0x35315842"/>
+ <entry name="argb1555" value="0x35315241"/>
+ <entry name="abgr1555" value="0x35314241"/>
+ <entry name="rgba5551" value="0x35314152"/>
+ <entry name="bgra5551" value="0x35314142"/>
+ <entry name="rgb565" value="0x36314752"/>
+ <entry name="bgr565" value="0x36314742"/>
+ <entry name="rgb888" value="0x34324752"/>
+ <entry name="bgr888" value="0x34324742"/>
+ <entry name="xrgb8888" value="0x34325258"/>
+ <entry name="xbgr8888" value="0x34324258"/>
+ <entry name="rgbx8888" value="0x34325852"/>
+ <entry name="bgrx8888" value="0x34325842"/>
+ <entry name="argb8888" value="0x34325241"/>
+ <entry name="abgr8888" value="0x34324241"/>
+ <entry name="rgba8888" value="0x34324152"/>
+ <entry name="bgra8888" value="0x34324142"/>
+ <entry name="xrgb2101010" value="0x30335258"/>
+ <entry name="xbgr2101010" value="0x30334258"/>
+ <entry name="rgbx1010102" value="0x30335852"/>
+ <entry name="bgrx1010102" value="0x30335842"/>
+ <entry name="argb2101010" value="0x30335241"/>
+ <entry name="abgr2101010" value="0x30334241"/>
+ <entry name="rgba1010102" value="0x30334152"/>
+ <entry name="bgra1010102" value="0x30334142"/>
+ <entry name="yuyv" value="0x56595559"/>
+ <entry name="yvyu" value="0x55595659"/>
+ <entry name="uyvy" value="0x59565955"/>
+ <entry name="vyuy" value="0x59555956"/>
+ <entry name="ayuv" value="0x56555941"/>
+ <entry name="nv12" value="0x3231564e"/>
+ <entry name="nv21" value="0x3132564e"/>
+ <entry name="nv16" value="0x3631564e"/>
+ <entry name="nv61" value="0x3136564e"/>
+ <entry name="yuv410" value="0x39565559"/>
+ <entry name="yvu410" value="0x39555659"/>
+ <entry name="yuv411" value="0x31315559"/>
+ <entry name="yvu411" value="0x31315659"/>
+ <entry name="yuv420" value="0x32315559"/>
+ <entry name="yvu420" value="0x32315659"/>
+ <entry name="yuv422" value="0x36315559"/>
+ <entry name="yvu422" value="0x36315659"/>
+ <entry name="yuv444" value="0x34325559"/>
+ <entry name="yvu444" value="0x34325659"/>
</enum>
<!-- Call this request with the magic received from drmGetMagic().
diff --git a/src/egl/wayland/wayland-drm/wayland-drm.c b/src/egl/wayland/wayland-drm/wayland-drm.c
index 43f9169104..42e6788d87 100644
--- a/src/egl/wayland/wayland-drm/wayland-drm.c
+++ b/src/egl/wayland/wayland-drm/wayland-drm.c
@@ -90,9 +90,8 @@ drm_create_buffer(struct wl_client *client, struct wl_resource *resource,
struct wl_drm_buffer *buffer;
switch (format) {
- case WL_DRM_FORMAT_ARGB32:
- case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
- case WL_DRM_FORMAT_XRGB32:
+ case WL_DRM_FORMAT_ARGB8888:
+ case WL_DRM_FORMAT_XRGB8888:
break;
default:
wl_resource_post_error(resource,
@@ -164,10 +163,10 @@ bind_drm(struct wl_client *client, void *data, uint32_t version, uint32_t id)
resource = wl_client_add_object(client, &wl_drm_interface,
&drm_interface, id, data);
wl_resource_post_event(resource, WL_DRM_DEVICE, drm->device_name);
- wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_ARGB32);
wl_resource_post_event(resource, WL_DRM_FORMAT,
- WL_DRM_FORMAT_PREMULTIPLIED_ARGB32);
- wl_resource_post_event(resource, WL_DRM_FORMAT, WL_DRM_FORMAT_XRGB32);
+ WL_DRM_FORMAT_ARGB8888);
+ wl_resource_post_event(resource, WL_DRM_FORMAT,
+ WL_DRM_FORMAT_XRGB8888);
}
struct wl_drm *
diff --git a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
index 50b6efd610..80b3f227d0 100644
--- a/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_wayland_drm_bufmgr_helper.c
@@ -23,11 +23,10 @@ egl_g3d_wl_drm_helper_reference_buffer(void *user_data, uint32_t name,
enum pipe_format pf;
switch (format) {
- case WL_DRM_FORMAT_ARGB32:
- case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
+ case WL_DRM_FORMAT_ARGB8888:
pf = PIPE_FORMAT_B8G8R8A8_UNORM;
break;
- case WL_DRM_FORMAT_XRGB32:
+ case WL_DRM_FORMAT_XRGB8888:
pf = PIPE_FORMAT_B8G8R8X8_UNORM;
break;
default:
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index 5618f3ec29..ad238bee12 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -109,11 +109,10 @@ wayland_create_drm_buffer(struct wayland_display *display,
switch (surface->color_format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
- format = (surface->premultiplied_alpha) ?
- WL_DRM_FORMAT_PREMULTIPLIED_ARGB32 : WL_DRM_FORMAT_ARGB32;
+ format = WL_DRM_FORMAT_ARGB8888;
break;
case PIPE_FORMAT_B8G8R8X8_UNORM:
- format = WL_DRM_FORMAT_XRGB32;
+ format = WL_DRM_FORMAT_XRGB8888;
break;
default:
return NULL;
@@ -151,14 +150,11 @@ drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
struct wayland_drm_display *drmdpy = data;
switch (format) {
- case WL_DRM_FORMAT_ARGB32:
- drmdpy->base.formats |= HAS_ARGB32;
+ case WL_DRM_FORMAT_ARGB8888:
+ drmdpy->base.formats |= HAS_ARGB8888;
break;
- case WL_DRM_FORMAT_PREMULTIPLIED_ARGB32:
- drmdpy->base.formats |= HAS_PREMUL_ARGB32;
- break;
- case WL_DRM_FORMAT_XRGB32:
- drmdpy->base.formats |= HAS_XRGB32;
+ case WL_DRM_FORMAT_XRGB8888:
+ drmdpy->base.formats |= HAS_XRGB8888;
break;
}
}
diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
index f9a7d81c04..b76e5db33d 100644
--- a/src/gallium/state_trackers/egl/wayland/native_shm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
@@ -117,13 +117,10 @@ shm_handle_format(void *data, struct wl_shm *shm, uint32_t format)
switch (format) {
case WL_SHM_FORMAT_ARGB32:
- shmdpy->base.formats |= HAS_ARGB32;
+ shmdpy->base.formats |= HAS_ARGB8888;
break;
- case WL_SHM_FORMAT_PREMULTIPLIED_ARGB32:
- shmdpy->base.formats |= HAS_PREMUL_ARGB32;
- break;
- case WL_SHM_FORMAT_XRGB32:
- shmdpy->base.formats |= HAS_XRGB32;
+ case WL_SHM_FORMAT_XRGB8888:
+ shmdpy->base.formats |= HAS_XRGB8888;
break;
}
}
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
index c6942931ec..dfaa50f1a8 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -41,14 +41,8 @@ const static struct {
enum pipe_format format;
enum wayland_format_flag flag;
} wayland_formats[] = {
- /*
- * HAS_PREMUL_ARGB32 is ignored here. For the case that HAS_PREMUL_ARGB32
- * is set but HAS_ARGB32 isn't, we should not claim
- * PIPE_FORMAT_B8G8R8A8_UNORM support because we will not be able to present
- * a surface with non-premultiplied alpha.
- */
- { PIPE_FORMAT_B8G8R8A8_UNORM, HAS_ARGB32 },
- { PIPE_FORMAT_B8G8R8X8_UNORM, HAS_XRGB32 },
+ { PIPE_FORMAT_B8G8R8A8_UNORM, HAS_ARGB8888 },
+ { PIPE_FORMAT_B8G8R8X8_UNORM, HAS_XRGB8888 },
};
static const struct native_config **
@@ -104,8 +98,7 @@ wayland_display_get_param(struct native_display *ndpy,
switch (param) {
case NATIVE_PARAM_PREMULTIPLIED_ALPHA:
- val = ((display->formats & HAS_ARGB32) &&
- (display->formats & HAS_PREMUL_ARGB32));
+ val = 1;
break;
case NATIVE_PARAM_USE_NATIVE_BUFFER:
case NATIVE_PARAM_PRESERVE_BUFFER:
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h b/src/gallium/state_trackers/egl/wayland/native_wayland.h
index 143428c5f9..e6a914fc02 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -37,9 +37,8 @@
struct wayland_surface;
enum wayland_format_flag {
- HAS_ARGB32 = (1 << 0),
- HAS_PREMUL_ARGB32 = (1 << 1),
- HAS_XRGB32 = (1 << 2)
+ HAS_ARGB8888 = (1 << 0),
+ HAS_XRGB8888 = (1 << 1)
};
struct wayland_display {