From 58dc1b28d1ef4d1931c52b079d304f2e1546329d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Wed, 11 Jan 2012 14:23:24 -0500 Subject: [PATCH] wayland-drm: Drop the non-premul formats, use format codes from drm_fourcc.h --- src/egl/drivers/dri2/egl_dri2.c | 10 ++- src/egl/drivers/dri2/platform_wayland.c | 31 ++++----- .../wayland-drm/protocol/wayland-drm.xml | 64 ++++++++++++++++++- src/egl/wayland/wayland-drm/wayland-drm.c | 11 ++-- .../common/native_wayland_drm_bufmgr_helper.c | 5 +- .../state_trackers/egl/wayland/native_drm.c | 16 ++--- .../state_trackers/egl/wayland/native_shm.c | 9 +-- .../egl/wayland/native_wayland.c | 13 +--- .../egl/wayland/native_wayland.h | 5 +- 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 5fff7e1ccef..80b2e38d9d3 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 16c613f30d7..b2981a02cd0 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 f63bebdcaf5..89fd8f08872 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 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +