-
Notifications
You must be signed in to change notification settings - Fork 1
/
0013-egl-wayland-add-support-for-RGB565-back-buffers.patch
43 lines (37 loc) · 1.44 KB
/
0013-egl-wayland-add-support-for-RGB565-back-buffers.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From 604445ffba928897b55eb23b02b96885b0ddf6e4 Mon Sep 17 00:00:00 2001
From: James Glanville <[email protected]>
Date: Tue, 28 Feb 2017 16:08:47 +0000
Subject: [PATCH] egl/wayland: add support for RGB565 back buffers
---
src/egl/drivers/dri2/platform_wayland.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c
index 5b886f8..6eca68e 100644
--- a/src/egl/drivers/dri2/platform_wayland.c
+++ b/src/egl/drivers/dri2/platform_wayland.c
@@ -1096,18 +1096,27 @@ back_bo_to_dri_buffer(struct dri2_egl_surface *dri2_surf, __DRIbuffer *buffer)
struct dri2_egl_display *dri2_dpy =
dri2_egl_display(dri2_surf->base.Resource.Display);
__DRIimage *image;
- int name, pitch;
+ int name, pitch, format;
image = dri2_surf->back->dri_image;
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_NAME, &name);
dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_STRIDE, &pitch);
+ dri2_dpy->image->queryImage(image, __DRI_IMAGE_ATTRIB_FORMAT, &format);
buffer->attachment = __DRI_BUFFER_BACK_LEFT;
buffer->name = name;
buffer->pitch = pitch;
- buffer->cpp = 4;
buffer->flags = 0;
+
+ switch (format) {
+ case __DRI_IMAGE_FORMAT_RGB565:
+ buffer->cpp = 2;
+ break;
+ default:
+ buffer->cpp = 4;
+ break;
+ }
}
/* Value chosen empirically as a compromise between avoiding frequent