summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/egl
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/state_trackers/egl')
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_drm.c4
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_shm.c4
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.c19
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.h1
4 files changed, 24 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/egl/wayland/native_drm.c b/src/gallium/state_trackers/egl/wayland/native_drm.c
index 9f6757b3c61..5618f3ec296 100644
--- a/src/gallium/state_trackers/egl/wayland/native_drm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_drm.c
@@ -109,8 +109,8 @@ wayland_create_drm_buffer(struct wayland_display *display,
switch (surface->color_format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
- /* assume premultiplied */
- format = WL_DRM_FORMAT_PREMULTIPLIED_ARGB32;
+ format = (surface->premultiplied_alpha) ?
+ WL_DRM_FORMAT_PREMULTIPLIED_ARGB32 : WL_DRM_FORMAT_ARGB32;
break;
case PIPE_FORMAT_B8G8R8X8_UNORM:
format = WL_DRM_FORMAT_XRGB32;
diff --git a/src/gallium/state_trackers/egl/wayland/native_shm.c b/src/gallium/state_trackers/egl/wayland/native_shm.c
index 8a50915a9c6..f9a7d81c043 100644
--- a/src/gallium/state_trackers/egl/wayland/native_shm.c
+++ b/src/gallium/state_trackers/egl/wayland/native_shm.c
@@ -94,8 +94,8 @@ wayland_create_shm_buffer(struct wayland_display *display,
switch (surface->color_format) {
case PIPE_FORMAT_B8G8R8A8_UNORM:
- /* assume premultiplied */
- format = WL_SHM_FORMAT_PREMULTIPLIED_ARGB32;
+ format = (surface->premultiplied_alpha) ?
+ WL_SHM_FORMAT_PREMULTIPLIED_ARGB32 : WL_SHM_FORMAT_ARGB32;
break;
case PIPE_FORMAT_B8G8R8X8_UNORM:
format = WL_SHM_FORMAT_XRGB32;
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
index 7273d0ef9a7..c6942931ec2 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -99,9 +99,14 @@ static int
wayland_display_get_param(struct native_display *ndpy,
enum native_param_type param)
{
+ struct wayland_display *display = wayland_display(ndpy);
int val;
switch (param) {
+ case NATIVE_PARAM_PREMULTIPLIED_ALPHA:
+ val = ((display->formats & HAS_ARGB32) &&
+ (display->formats & HAS_PREMUL_ARGB32));
+ break;
case NATIVE_PARAM_USE_NATIVE_BUFFER:
case NATIVE_PARAM_PRESERVE_BUFFER:
case NATIVE_PARAM_MAX_SWAP_INTERVAL:
@@ -322,6 +327,20 @@ wayland_surface_present(struct native_surface *nsurf,
if (ctrl->preserve || ctrl->swap_interval)
return FALSE;
+ /* force buffers to be re-created if they will be presented differently */
+ if (surface->premultiplied_alpha != ctrl->premultiplied_alpha) {
+ enum wayland_buffer_type buffer;
+
+ for (buffer = 0; buffer < WL_BUFFER_COUNT; ++buffer) {
+ if (surface->buffer[buffer]) {
+ wl_buffer_destroy(surface->buffer[buffer]);
+ surface->buffer[buffer] = NULL;
+ }
+ }
+
+ surface->premultiplied_alpha = ctrl->premultiplied_alpha;
+ }
+
switch (ctrl->natt) {
case NATIVE_ATTACHMENT_FRONT_LEFT:
ret = TRUE;
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.h b/src/gallium/state_trackers/egl/wayland/native_wayland.h
index 0350a958154..143428c5f9c 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.h
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.h
@@ -87,6 +87,7 @@ struct wayland_surface {
unsigned int attachment_mask;
boolean block_swap_buffers;
+ boolean premultiplied_alpha;
};
struct wayland_config {