summaryrefslogtreecommitdiff
path: root/src/gallium/state_trackers/egl/wayland/native_wayland.c
diff options
context:
space:
mode:
authorChia-I Wu <olv@lunarg.com>2011-09-08 03:00:31 +0800
committerChia-I Wu <olv@lunarg.com>2011-09-08 11:16:12 +0800
commit23aa978a9d76a48f4b93e9a8911ec50c0e5d94ab (patch)
treef711f866855f88cab9365d13731cf56670f82466 /src/gallium/state_trackers/egl/wayland/native_wayland.c
parent95b445699d7f049116ee0927387a958a9933766b (diff)
st/egl: add premultiplied alpha support to wayland
Return true for NATIVE_PARAM_PREMULTIPLIED_ALPHA when all formats with alpha support premultiplied alpha. Currently, it means when argb32 and argb32_pre are both supported.
Diffstat (limited to 'src/gallium/state_trackers/egl/wayland/native_wayland.c')
-rw-r--r--src/gallium/state_trackers/egl/wayland/native_wayland.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c
index 14cc908cf7a..b2dab8fae53 100644
--- a/src/gallium/state_trackers/egl/wayland/native_wayland.c
+++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c
@@ -60,9 +60,13 @@ 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->param_premultiplied_alpha;
+ break;
case NATIVE_PARAM_USE_NATIVE_BUFFER:
case NATIVE_PARAM_PRESERVE_BUFFER:
case NATIVE_PARAM_MAX_SWAP_INTERVAL:
@@ -283,6 +287,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;