Commit | Line | Data |
---|---|---|
7217e0ca ML |
1 | commit fe5018e0564118a7a8198fa286186fdb9ed818c7 |
2 | Author: Takashi Iwai <tiwai@suse.de> | |
3 | Date: 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 | ||
7217e0ca ML |
23 | --- a/fb/fbwindow.c |
24 | +++ b/fb/fbwindow.c | |
25 | @@ -33,7 +33,7 @@ fbCreateWindow(WindowPtr pWin) | |
26 | { | |
27 | dixSetPrivate(&pWin->devPrivates, fbGetWinPrivateKey(pWin), | |
28 | fbGetScreenPixmap(pWin->drawable.pScreen)); | |
29 | - if (pWin->drawable.bitsPerPixel == 32) | |
30 | + if (pWin->drawable.bitsPerPixel == 32 && pWin->drawable.depth <= 24) | |
31 | pWin->drawable.bitsPerPixel = | |
32 | fbGetScreenPrivate(pWin->drawable.pScreen)->win32bpp; | |
33 | return TRUE; |