[PATCH] render: Don't generate invalid pixman format when using a 24bpp framebuffer with a 32bit depth visual.

Takashi Iwai tiwai at suse.de
Mon Aug 18 07:06:40 PDT 2014


At Sun, 17 Aug 2014 14:41:32 -0700,
Keith Packard wrote:
> 
> Takashi Iwai <tiwai at suse.de> writes:
> 
> > That is, bitsPerPixel is replaced from 32 to 24 in CreateWindow().
> > Hence this results in the combination of depth=32/bpp=24.  Ouch.
> 
> Sounds like we need to hack Composite to fix how depth 32 windows are
> supported for this platform; those windows need to actually be listed as
> 32bpp instead of 24bpp.

Reading the relevant codes again, the problem appears to be the
inconsistent bpp between window and pixmap.  Then I tested the
oneliner below to make CreateWindow() behaving same as fb/pixmap.c,
and the problem is actually gone.

Is this approach more reasonable?


Takashi

-- 8< --
From: Takashi Iwai <tiwai at suse.de>
Subject: [PATCH] fb: Fix invalid bpp for 24bit depth window

We have a hack in fb layer for a 24bpp screen to use 32bpp images, and
fbCreateWindow() replaces its drawable.bitsPerPixel field
appropriately.  But, the problem is that it always replaces when 32bpp
is passed.  If the depth is 32, this results in bpp < depth, which is
actually invalid.

Meanwhile, fbCreatePixmap() has a more check and it creates with 24bpp
only when the passed depth <= 24 for avoiding such a problem.

This oneliner patch just adds the similar check in fbCreateWindow().
This (hopefully) fixes the long-standing broken graphics mess of
cirrus KMS with 24bpp.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 fb/fbwindow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fb/fbwindow.c b/fb/fbwindow.c
index 368c4b883b31..c90175faa078 100644
--- a/fb/fbwindow.c
+++ b/fb/fbwindow.c
@@ -33,7 +33,7 @@ fbCreateWindow(WindowPtr pWin)
 {
     dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin),
                   fbGetScreenPixmap(pWin->drawable.pScreen));
-    if (pWin->drawable.bitsPerPixel == 32)
+    if (pWin->drawable.bitsPerPixel == 32 && pWin->drawable.depth <= 24)
         pWin->drawable.bitsPerPixel =
             fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
     return TRUE;
-- 
2.0.4



More information about the xorg-devel mailing list