[PATCH] compositor-fbdev: Add support for ABGR in calculate_pixman_format

Pablo Castellano pablo at anche.no
Tue Jul 18 22:06:38 UTC 2017


In PostmarketOS we have added support for the Asus grouper device
(Google Nexus 7 2012 tablet), which uses ABGR.

This mode seems to be less common and previously it was not correctly
handled by calculate_pixman_format()

For more information, see:
https://github.com/postmarketOS/pmbootstrap/wiki/asus-grouper-%28Google-Nexus-7-2012%29

Signed-off-by: Pablo Castellano <pablo at anche.no>
---
 libweston/compositor-fbdev.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libweston/compositor-fbdev.c b/libweston/compositor-fbdev.c
index e80a504..37c8005 100644
--- a/libweston/compositor-fbdev.c
+++ b/libweston/compositor-fbdev.c
@@ -211,8 +211,8 @@ calculate_pixman_format(struct fb_var_screeninfo *vinfo,
 	    vinfo->blue.msb_right != 0)
 		return 0;
 
-	/* Work out the format type from the offsets. We only support RGBA and
-	 * ARGB at the moment. */
+	/* Work out the format type from the offsets. We only support RGBA,
+	 * ARGB and ABGR at the moment. */
 	type = PIXMAN_TYPE_OTHER;
 
 	if ((vinfo->transp.offset >= vinfo->red.offset ||
@@ -224,6 +224,10 @@ calculate_pixman_format(struct fb_var_screeninfo *vinfo,
 	         vinfo->green.offset >= vinfo->blue.offset &&
 	         vinfo->blue.offset >= vinfo->transp.offset)
 		type = PIXMAN_TYPE_RGBA;
+	else if (vinfo->transp.offset >= vinfo->blue.offset &&
+	         vinfo->blue.offset >= vinfo->green.offset &&
+	         vinfo->green.offset >= vinfo->red.offset)
+		type = PIXMAN_TYPE_ABGR;
 
 	if (type == PIXMAN_TYPE_OTHER)
 		return 0;
-- 
1.9.1



More information about the wayland-devel mailing list