From 64dea9ecdeb50d78ed45b6790bdc907e0b6cd414320a71e829639956cdd6af44 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Thu, 7 Aug 2014 14:57:57 +0000 Subject: [PATCH] Accepting request 243884 from home:tiwai:branches:X11:XOrg - Fix corrupted graphics with 24bpp on cirrus KMS (bnc#890599) two patches added: 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 OBS-URL: https://build.opensuse.org/request/show/243884 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=530 --- ...ing-a-window-with-depth-32-and-24bpp.patch | 44 +++++++++++++++++++ ...ramebuffer-with-a-32bit-depth-visual.patch | 43 ++++++++++++++++++ xorg-x11-server.changes | 8 ++++ xorg-x11-server.spec | 4 ++ 4 files changed, 99 insertions(+) create mode 100644 U_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch create mode 100644 U_render-Don-t-generate-invalid-pixman-format-when-using-a-24bpp-framebuffer-with-a-32bit-depth-visual.patch diff --git a/U_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch b/U_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch new file mode 100644 index 0000000..16d2989 --- /dev/null +++ b/U_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch @@ -0,0 +1,44 @@ +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 +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 +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; diff --git a/U_render-Don-t-generate-invalid-pixman-format-when-using-a-24bpp-framebuffer-with-a-32bit-depth-visual.patch b/U_render-Don-t-generate-invalid-pixman-format-when-using-a-24bpp-framebuffer-with-a-32bit-depth-visual.patch new file mode 100644 index 0000000..4d936f8 --- /dev/null +++ b/U_render-Don-t-generate-invalid-pixman-format-when-using-a-24bpp-framebuffer-with-a-32bit-depth-visual.patch @@ -0,0 +1,43 @@ +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 +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 +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, diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index b9a0780..e8fb5df 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Aug 7 14:50:55 CEST 2014 - tiwai@suse.de + +- Fix corrupted graphics with 24bpp on cirrus KMS (bnc#890599) + two patches added: + 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 + ------------------------------------------------------------------- Tue Aug 5 06:19:04 UTC 2014 - eich@suse.com diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index beb667c..fa8c529 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -152,6 +152,8 @@ Patch110: u_connection-avoid-crash-when-CloseWellKnownConnections-gets-cal Patch111: u_CloseConsole-Don-t-report-FatalError-when-shutting-down.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 +Patch131: U_render-Don-t-generate-invalid-pixman-format-when-using-a-24bpp-framebuffer-with-a-32bit-depth-visual.patch +Patch132: U_fb-Correctly-implement-CopyArea-when-using-a-window-with-depth-32-and-24bpp.patch Patch1000: n_xserver-optimus-autoconfig-hack.patch @@ -231,6 +233,8 @@ cp %{SOURCE90} . %patch111 -p1 %patch112 -p1 %patch130 -p1 +%patch131 -p1 +%patch132 -p1 %patch1000 -p1 ### disabled for now