1
0
Stephan Kulow 2014-08-28 08:01:55 +00:00 committed by Git OBS Bridge
commit af1e9d9740
5 changed files with 51 additions and 90 deletions

View File

@ -0,0 +1,40 @@
From fe5018e0564118a7a8198fa286186fdb9ed818c7 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 19 Aug 2014 15:57:22 -0500
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@suse.de>
Reviewed-by: Keith Packard <keithp@keithp.com>
---
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

View File

@ -1,44 +0,0 @@
From patchwork Fri Jun 6 11:52:13 2014
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: fb: Correctly implement CopyArea when using a window with depth 32
and 24bpp.
From: Robert Ancell <robert.ancell@canonical.com>
X-Patchwork-Id: 27263
Message-Id: <1402055533-9866-1-git-send-email-robert.ancell@canonical.com>
To: xorg-devel@lists.x.org
Cc: Robert Ancell <robert.ancell@canonical.com>
Date: Fri, 6 Jun 2014 23:52:13 +1200
When using the fb backend at 24bpp it allows a visual with 32 bit depth.
When using CopyArea from a 32bpp pixmap to a window with a 32 bit depth it would
read the ARGB as RGB.
Fix is to correctly ignore the alpha channel in the pixmap when copying.
---
fb/fbcopy.c | 10 +++++++++-
fb/fbcopy.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
--- a/fb/fbcopy.c
+++ b/fb/fbcopy.c
@@ -242,8 +242,16 @@ fbCopyArea(DrawablePtr pSrcDrawable,
int xIn, int yIn, int widthSrc, int heightSrc, int xOut, int yOut)
{
miCopyProc copy;
+ int src_bpp, dst_bpp;
- if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
+ src_bpp = pSrcDrawable->bitsPerPixel;
+ if (src_bpp < pSrcDrawable->depth)
+ src_bpp = BitsPerPixel (pSrcDrawable->depth);
+ dst_bpp = pDstDrawable->bitsPerPixel;
+ if (dst_bpp < pDstDrawable->depth)
+ dst_bpp = BitsPerPixel (pDstDrawable->depth);
+
+ if (src_bpp != dst_bpp)
copy = fb24_32CopyMtoN;
else
copy = fbCopyNtoN;

View File

@ -1,43 +0,0 @@
From patchwork Fri Jun 6 04:36:59 2014
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: render: Don't generate invalid pixman format when using a 24bpp
framebuffer with a 32bit depth visual.
From: Robert Ancell <robert.ancell@canonical.com>
X-Patchwork-Id: 27240
Message-Id: <1402029419-6400-1-git-send-email-robert.ancell@canonical.com>
To: xorg-devel@lists.x.org
Cc: Robert Ancell <robert.ancell@canonical.com>
Date: Fri, 6 Jun 2014 16:36:59 +1200
When using the fb backend at 24bpp it allows a visual with 32 bit depth.
This would cause RENDER to try and create an invalid pixman buffer and hit the
following assertion when trying to render to it:
---
render/picture.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
--- a/render/picture.c
+++ b/render/picture.c
@@ -762,6 +762,7 @@ CreatePicture(Picture pid,
{
PicturePtr pPicture;
PictureScreenPtr ps = GetPictureScreen(pDrawable->pScreen);
+ int bpp;
pPicture = dixAllocateScreenObjectWithPrivates(pDrawable->pScreen,
PictureRec, PRIVATE_PICTURE);
@@ -773,7 +774,10 @@ CreatePicture(Picture pid,
pPicture->id = pid;
pPicture->pDrawable = pDrawable;
pPicture->pFormat = pFormat;
- pPicture->format = pFormat->format | (pDrawable->bitsPerPixel << 24);
+ bpp = pDrawable->bitsPerPixel;
+ if (bpp < pFormat->depth)
+ bpp = BitsPerPixel (pFormat->depth);
+ pPicture->format = pFormat->format | (bpp << 24);
/* security creation/labeling check */
*error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture,

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Mon Aug 18 17:33:34 CEST 2014 - tiwai@suse.de
- A better fix for 24bpp graphics problem with cirrus KMS
(bnc#890599); Adding a new patch:
U_fb-Fix-invalid-bpp-for-24bit-depth-window.patch
while obsoleting two patches:
u_render-Don-t-generate-invalid-pixman-format-when-using-a-24bpp-framebuffer-with-a-32bit-depth-visual.patch
u_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Aug 15 12:09:12 UTC 2014 - sndirsch@suse.com Fri Aug 15 12:09:12 UTC 2014 - sndirsch@suse.com

View File

@ -156,8 +156,7 @@ Patch110: u_connection-avoid-crash-when-CloseWellKnownConnections-gets-cal
Patch111: u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch Patch111: u_CloseConsole-Don-t-report-FatalError-when-shutting-down.patch
Patch112: u_render-Cast-color-masks-to-unsigned-long-before-shifting-them.patch Patch112: u_render-Cast-color-masks-to-unsigned-long-before-shifting-them.patch
Patch130: U_BellProc-Send-bell-event-on-core-protocol-bell-when-requested.patch Patch130: U_BellProc-Send-bell-event-on-core-protocol-bell-when-requested.patch
Patch131: u_render-Don-t-generate-invalid-pixman-format-when-using-a-24bpp-framebuffer-with-a-32bit-depth-visual.patch Patch131: U_fb-Fix-invalid-bpp-for-24bit-depth-window.patch
Patch132: u_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch
Patch1000: n_xserver-optimus-autoconfig-hack.patch Patch1000: n_xserver-optimus-autoconfig-hack.patch
@ -240,7 +239,6 @@ cp %{SOURCE90} .
%patch112 -p1 %patch112 -p1
%patch130 -p1 %patch130 -p1
%patch131 -p1 %patch131 -p1
%patch132 -p1
%patch1000 -p1 %patch1000 -p1
### disabled for now ### disabled for now