Imported Debian patch 2:1.15.1-0ubuntu2.6
[deb_xorg-server.git] / debian / patches / fb-24-depth.patch
CommitLineData
7217e0ca
ML
1commit fe5018e0564118a7a8198fa286186fdb9ed818c7
2Author: Takashi Iwai <tiwai@suse.de>
3Date: Tue Aug 19 15:57:22 2014 -0500
4
5 fb: Fix invalid bpp for 24bit depth window
6
7 We have a hack in fb layer for a 24bpp screen to use 32bpp images, and
8 fbCreateWindow() replaces its drawable.bitsPerPixel field
9 appropriately. But, the problem is that it always replaces when 32bpp
10 is passed. If the depth is 32, this results in bpp < depth, which is
11 actually invalid.
12
13 Meanwhile, fbCreatePixmap() has a more check and it creates with 24bpp
14 only when the passed depth <= 24 for avoiding such a problem.
15
16 This oneliner patch just adds the similar check in fbCreateWindow().
17 This (hopefully) fixes the long-standing broken graphics mess of
18 cirrus KMS with 24bpp.
19
20 Signed-off-by: Takashi Iwai <tiwai@suse.de>
21 Reviewed-by: Keith Packard <keithp@keithp.com>
22
23diff --git a/fb/fbwindow.c b/fb/fbwindow.c
24index 368c4b8..c90175f 100644
25--- a/fb/fbwindow.c
26+++ b/fb/fbwindow.c
27@@ -33,7 +33,7 @@ fbCreateWindow(WindowPtr pWin)
28 {
29 dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin),
30 fbGetScreenPixmap(pWin->drawable.pScreen));
31- if (pWin->drawable.bitsPerPixel == 32)
32+ if (pWin->drawable.bitsPerPixel == 32 && pWin->drawable.depth <= 24)
33 pWin->drawable.bitsPerPixel =
34 fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp;
35 return TRUE;