Hello community, here is the log from the commit of package xf86-video-mga for openSUSE:Factory checked in at 2014-05-13 20:49:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xf86-video-mga (Old) and /work/SRC/openSUSE:Factory/.xf86-video-mga.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xf86-video-mga" Changes: -------- --- /work/SRC/openSUSE:Factory/xf86-video-mga/xf86-video-mga.changes 2013-12-11 17:43:00.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.xf86-video-mga.new/xf86-video-mga.changes 2014-05-13 20:49:33.000000000 +0200 @@ -1,0 +2,14 @@ +Sun May 11 17:35:59 UTC 2014 - [email protected] + +- u_Change-shadow-fb-implementation-from-DDX-based-to-miext-damage-based.patch + Fix the shadowfb implementation: old implementation produced + artefacts: Fixed by changing to the mi base shadow method (bnc#876098). +- u_EXA-Fix-UploadToScreen.patch + Fix EXA UploadToScreen: Images were garbled as writing to aperture didn't wait + for FIFO to drain. (bnc#876941). +- u_Fix-compiler-warnings.patch +- u_Fix-crash-when-EXA-accel-mode-is-enabled.patch + Fix segfault in EXA: fb base address was not added to source in + DownloadFromScreen (bnc#876940). + +------------------------------------------------------------------- New: ---- u_Change-shadow-fb-implementation-from-DDX-based-to-miext-damage-based.patch u_EXA-Fix-UploadToScreen.patch u_Fix-compiler-warnings.patch u_Fix-crash-when-EXA-accel-mode-is-enabled.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xf86-video-mga.spec ++++++ --- /var/tmp/diff_new_pack.USa1QW/_old 2014-05-13 20:49:34.000000000 +0200 +++ /var/tmp/diff_new_pack.USa1QW/_new 2014-05-13 20:49:34.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package xf86-video-mga # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,6 +24,10 @@ Group: System/X11/Servers/XF86_4 Url: http://xorg.freedesktop.org/ Source0: http://xorg.freedesktop.org/releases/individual/driver/%{name}-%{version}.tar.bz2 +Patch0: u_Change-shadow-fb-implementation-from-DDX-based-to-miext-damage-based.patch +Patch1: u_Fix-compiler-warnings.patch +Patch2: u_Fix-crash-when-EXA-accel-mode-is-enabled.patch +Patch3: u_EXA-Fix-UploadToScreen.patch BuildRequires: Mesa-devel BuildRequires: pkg-config BuildRequires: pkgconfig(fontsproto) @@ -62,6 +66,10 @@ %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build %configure ++++++ u_Change-shadow-fb-implementation-from-DDX-based-to-miext-damage-based.patch ++++++ From: Egbert Eich <[email protected]> Date: Tue May 6 16:31:19 2014 +0200 Subject: [PATCH]Change shadow fb implementation from DDX based to miext/damage based Patch-mainline: to be upstreamed Git-commit: 2ef052a4baaed2d9fcc5e607a4673116b19c16b5 Git-repo: ssh://git.freedesktop.org/git/xorg/driver/xf86-video-mga References: bnc#876098 Signed-off-by: Egbert Eich <[email protected]> This fixes rendering artefacts with antialiased font drawing and gets rid of some code. Signed-off-by: Egbert Eich <[email protected]> --- src/mga.h | 12 +-- src/mga_driver.c | 70 ++++++++------- src/mga_shadow.c | 266 +++++++++++-------------------------------------------- 3 files changed, 94 insertions(+), 254 deletions(-) diff --git a/src/mga.h b/src/mga.h index 5f75d37..3334331 100644 --- a/src/mga.h +++ b/src/mga.h @@ -545,7 +545,6 @@ typedef struct { Bool ShowCache; Bool ShadowFB; unsigned char * ShadowPtr; - int ShadowPitch; int MemClk; int MinClock; int MaxClock; @@ -582,6 +581,8 @@ typedef struct { void (*PointerMoved)(SCRN_ARG_TYPE arg, int x, int y); CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; +/* shadowfb */ + CreateScreenResourcesProcPtr CreateScreenResources; unsigned int (*ddc1Read)(ScrnInfoPtr); void (*DDC1SetSpeed)(ScrnInfoPtr, xf86ddcSpeed); Bool (*i2cInit)(ScrnInfoPtr); @@ -751,19 +752,14 @@ void MGAPolyArcThinSolid(DrawablePtr, GCPtr, int, xArc*); Bool MGADGAInit(ScreenPtr pScreen); -void MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void MGARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void MGARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); -void MGARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); - void mgaDoSetupForScreenToScreenCopy( ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, int trans, unsigned int bpp ); void mgaDoSetupForSolidFill( ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask, unsigned int bpp ); -void MGAPointerMoved(SCRN_ARG_TYPE arg, int x, int y); +Bool MGAShadowInit(ScreenPtr pScreen); +void MGAShadowPointerMoved(SCRN_ARG_TYPE arg, int x, int y); void MGAInitVideo(ScreenPtr pScreen); void MGAResetVideo(ScrnInfoPtr pScrn); diff --git a/src/mga_driver.c b/src/mga_driver.c index 46478a6..08c836d 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -92,7 +92,7 @@ #endif #include "xf86cmap.h" -#include "shadowfb.h" +#include "shadow.h" #include "fbdevhw.h" #ifdef MGADRI @@ -2109,7 +2109,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->ShadowFB = TRUE; pMga->NoAccel = TRUE; pMga->HWCursor = FALSE; - pMga->Rotate = 1; + pMga->Rotate = 270; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen clockwise - acceleration disabled\n"); } else @@ -2117,10 +2117,17 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) pMga->ShadowFB = TRUE; pMga->NoAccel = TRUE; pMga->HWCursor = FALSE; - pMga->Rotate = -1; + pMga->Rotate = 90; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen counter clockwise - acceleration disabled\n"); - } else { + } else if(!xf86NameCmp(s, "UD")) { + pMga->ShadowFB = TRUE; + pMga->NoAccel = TRUE; + pMga->HWCursor = FALSE; + pMga->Rotate = 180; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen upside down - acceleration disabled\n"); + } else { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid value for Option \"Rotate\"\n", s); xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -2141,6 +2148,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) "Falling back to shadowfb\n"); pMga->ShadowFB = TRUE; pMga->NoAccel = TRUE; + pMga->HWCursor = FALSE; } } else { #endif @@ -2150,6 +2158,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) "Falling back to shadowfb\n"); pMga->ShadowFB = TRUE; pMga->NoAccel = TRUE; + pMga->HWCursor = FALSE; } #endif #ifdef USE_EXA @@ -2662,7 +2671,7 @@ MGAPreInit(ScrnInfoPtr pScrn, int flags) /* Load shadowfb if needed */ if (pMga->ShadowFB) { - if (!xf86LoadSubModule(pScrn, "shadowfb")) { + if (!xf86LoadSubModule(pScrn, "shadow")) { MGAFreeRec(pScrn); return FALSE; } @@ -3207,7 +3216,6 @@ MGACrtc2FillStrip(ScrnInfoPtr pScrn) } } - /* Mandatory */ /* This gets called at the start of each server generation */ @@ -3391,9 +3399,8 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL) } if(pMga->ShadowFB) { - pMga->ShadowPitch = BitmapBytePad(pScrn->bitsPerPixel * width); - pMga->ShadowPtr = malloc(pMga->ShadowPitch * height); - displayWidth = pMga->ShadowPitch / (pScrn->bitsPerPixel >> 3); + pMga->ShadowPtr = (unsigned char *)xnfcalloc(1, width * height * + (pScrn->bitsPerPixel >> 3)); FBStart = pMga->ShadowPtr; } else { pMga->ShadowPtr = NULL; @@ -3436,7 +3443,7 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL) "Static buffer allocation failed, not initializing the DRI\n"); xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Need at least %d kB video memory at this resolution, bit depth\n", - (3 * displayWidth * height * (pScrn->bitsPerPixel >> 3)) / 1024 ); + (3 * pScrn->displayWidth * height * (pScrn->bitsPerPixel >> 3)) / 1024 ); pMga->directRenderingEnabled = FALSE; driFrom = X_PROBED; } @@ -3447,7 +3454,7 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL) if (!fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, - pScrn->yDpi, displayWidth, pScrn->bitsPerPixel)) { + pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) { return FALSE; } @@ -3470,6 +3477,20 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL) /* must be after RGB ordering fixed */ fbPictureInit (pScreen, 0, 0); + if (pMga->ShadowFB) { + if(pMga->Rotate) { + if (!pMga->PointerMoved) { + pMga->PointerMoved = pScrn->PointerMoved; + pScrn->PointerMoved = MGAShadowPointerMoved; + } + } + if (!MGAShadowInit(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "shadow framebuffer initialization failed\n"); + return FALSE; + } + } + xf86SetBlackWhitePixels(pScreen); pMga->BlockHandler = pScreen->BlockHandler; @@ -3526,26 +3547,6 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL) NULL, f)) return FALSE; - if(pMga->ShadowFB) { - RefreshAreaFuncPtr refreshArea = MGARefreshArea; - - if(pMga->Rotate) { - if (!pMga->PointerMoved) { - pMga->PointerMoved = pScrn->PointerMoved; - pScrn->PointerMoved = MGAPointerMoved; - } - - switch(pScrn->bitsPerPixel) { - case 8: refreshArea = MGARefreshArea8; break; - case 16: refreshArea = MGARefreshArea16; break; - case 24: refreshArea = MGARefreshArea24; break; - case 32: refreshArea = MGARefreshArea32; break; - } - } - - ShadowFBInit(pScreen, refreshArea); - } - xf86DPMSInit(pScreen, mga_dpms_set_proc, 0); pScrn->memPhysBase = pMga->FbAddress; @@ -3869,7 +3870,11 @@ MGACloseScreen(CLOSE_SCREEN_ARGS_DECL) #endif if (pMga->CursorInfoRec) xf86DestroyCursorInfoRec(pMga->CursorInfoRec); - free(pMga->ShadowPtr); + if (pMga->ShadowFB) { + shadowRemove(pScreen, pScreen->GetScreenPixmap(pScreen)); + free(pMga->ShadowPtr); + pMga->ShadowPtr = NULL; + } free(pMga->DGAModes); free(pMga->adaptor); free(pMga->portPrivate); @@ -4272,3 +4277,4 @@ MGAG100BlackMagic(ScrnInfoPtr pScrn) OUTREG(MGAREG_MACCESS, 1<<15); usleep(10); } + diff --git a/src/mga_shadow.c b/src/mga_shadow.c index a8d5cfb..93badb6 100644 --- a/src/mga_shadow.c +++ b/src/mga_shadow.c @@ -9,244 +9,82 @@ #include "xf86.h" #include "xf86_OSproc.h" -#include "xf86Pci.h" -#include "mga_reg.h" #include "mga.h" -#include "shadowfb.h" +#include "shadow.h" #include "servermd.h" - - -void -MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +static void * +MGAShadowWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 *size, void *closure) { + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); MGAPtr pMga = MGAPTR(pScrn); - int width, height, Bpp, FBPitch; - unsigned char *src, *dst; - - Bpp = pScrn->bitsPerPixel >> 3; - FBPitch = BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel); - - while(num--) { - width = (pbox->x2 - pbox->x1) * Bpp; - height = pbox->y2 - pbox->y1; - src = pMga->ShadowPtr + (pbox->y1 * pMga->ShadowPitch) + - (pbox->x1 * Bpp); - dst = pMga->FbStart + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); - - while(height--) { - memcpy(dst, src, width); - dst += FBPitch; - src += pMga->ShadowPitch; - } - - pbox++; - } -} + void *pointer; -void -MGAPointerMoved(SCRN_ARG_TYPE arg, int x, int y) -{ - SCRN_INFO_PTR(arg); - MGAPtr pMga = MGAPTR(pScrn); - int newX, newY; - - if(pMga->Rotate == 1) { - newX = pScrn->pScreen->height - y - 1; - newY = x; - } else { - newX = y; - newY = pScrn->pScreen->width - x - 1; - } + if (!pScrn->vtSema) + return NULL; - (*pMga->PointerMoved)(arg, newX, newY); + *size = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); + return ((CARD8 *)pMga->FbStart + (row * *size) + offset); } -void -MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +static Bool +MGAShadowCreateScreenResources(ScreenPtr pScreen) { + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); MGAPtr pMga = MGAPTR(pScrn); - int count, width, height, y1, y2, dstPitch, srcPitch; - CARD8 *dstPtr, *srcPtr, *src; - CARD32 *dst; - - dstPitch = pScrn->displayWidth; - srcPitch = -pMga->Rotate * pMga->ShadowPitch; - - while(num--) { - width = pbox->x2 - pbox->x1; - y1 = pbox->y1 & ~3; - y2 = (pbox->y2 + 3) & ~3; - height = (y2 - y1) >> 2; /* in dwords */ - - if(pMga->Rotate == 1) { - dstPtr = pMga->FbStart + - (pbox->x1 * dstPitch) + pScrn->virtualX - y2; - srcPtr = pMga->ShadowPtr + ((1 - y2) * srcPitch) + pbox->x1; - } else { - dstPtr = pMga->FbStart + - ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; - srcPtr = pMga->ShadowPtr + (y1 * srcPitch) + pbox->x2 - 1; - } - - while(width--) { - src = srcPtr; - dst = (CARD32*)dstPtr; - count = height; - while(count--) { - *(dst++) = src[0] | (src[srcPitch] << 8) | - (src[srcPitch * 2] << 16) | - (src[srcPitch * 3] << 24); - src += srcPitch * 4; - } - srcPtr += pMga->Rotate; - dstPtr += dstPitch; - } - - pbox++; - } -} + PixmapPtr pPixmap; + Bool ret; + pScreen->CreateScreenResources = pMga->CreateScreenResources; + ret = pScreen->CreateScreenResources(pScreen); + pScreen->CreateScreenResources = MGAShadowCreateScreenResources; -void -MGARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox) -{ - MGAPtr pMga = MGAPTR(pScrn); - int count, width, height, y1, y2, dstPitch, srcPitch; - CARD16 *dstPtr, *srcPtr, *src; - CARD32 *dst; - - dstPitch = pScrn->displayWidth; - srcPitch = -pMga->Rotate * pMga->ShadowPitch >> 1; - - while(num--) { - width = pbox->x2 - pbox->x1; - y1 = pbox->y1 & ~1; - y2 = (pbox->y2 + 1) & ~1; - height = (y2 - y1) >> 1; /* in dwords */ - - if(pMga->Rotate == 1) { - dstPtr = (CARD16*)pMga->FbStart + - (pbox->x1 * dstPitch) + pScrn->virtualX - y2; - srcPtr = (CARD16*)pMga->ShadowPtr + - ((1 - y2) * srcPitch) + pbox->x1; - } else { - dstPtr = (CARD16*)pMga->FbStart + - ((pScrn->virtualY - pbox->x2) * dstPitch) + y1; - srcPtr = (CARD16*)pMga->ShadowPtr + - (y1 * srcPitch) + pbox->x2 - 1; - } - - while(width--) { - src = srcPtr; - dst = (CARD32*)dstPtr; - count = height; - while(count--) { - *(dst++) = src[0] | (src[srcPitch] << 16); - src += srcPitch * 2; - } - srcPtr += pMga->Rotate; - dstPtr += dstPitch; - } - - pbox++; + if (!ret) + return FALSE; + + pPixmap = pScreen->GetScreenPixmap(pScreen); + + if (!shadowAdd(pScreen, pPixmap, pMga->Rotate ? + shadowUpdateRotatePackedWeak() : shadowUpdatePackedWeak(), + MGAShadowWindowLinear, pMga->Rotate, NULL)) { + return FALSE; } -} + return TRUE; +} -/* this one could be faster */ -void -MGARefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +Bool +MGAShadowInit(ScreenPtr pScreen) { + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); MGAPtr pMga = MGAPTR(pScrn); - int count, width, height, y1, y2, dstPitch, srcPitch; - CARD8 *dstPtr, *srcPtr, *src; - CARD32 *dst; - - dstPitch = BitmapBytePad(pScrn->displayWidth * 24); - srcPitch = -pMga->Rotate * pMga->ShadowPitch; - - while(num--) { - width = pbox->x2 - pbox->x1; - y1 = pbox->y1 & ~3; - y2 = (pbox->y2 + 3) & ~3; - height = (y2 - y1) >> 2; /* blocks of 3 dwords */ - - if(pMga->Rotate == 1) { - dstPtr = pMga->FbStart + - (pbox->x1 * dstPitch) + ((pScrn->virtualX - y2) * 3); - srcPtr = pMga->ShadowPtr + ((1 - y2) * srcPitch) + (pbox->x1 * 3); - } else { - dstPtr = pMga->FbStart + - ((pScrn->virtualY - pbox->x2) * dstPitch) + (y1 * 3); - srcPtr = pMga->ShadowPtr + (y1 * srcPitch) + (pbox->x2 * 3) - 3; - } - - while(width--) { - src = srcPtr; - dst = (CARD32*)dstPtr; - count = height; - while(count--) { - dst[0] = src[0] | (src[1] << 8) | (src[2] << 16) | - (src[srcPitch] << 24); - dst[1] = src[srcPitch + 1] | (src[srcPitch + 2] << 8) | - (src[srcPitch * 2] << 16) | - (src[(srcPitch * 2) + 1] << 24); - dst[2] = src[(srcPitch * 2) + 2] | (src[srcPitch * 3] << 8) | - (src[(srcPitch * 3) + 1] << 16) | - (src[(srcPitch * 3) + 2] << 24); - dst += 3; - src += srcPitch * 4; - } - srcPtr += pMga->Rotate * 3; - dstPtr += dstPitch; - } - - pbox++; + + if (!shadowSetup(pScreen)) { + return FALSE; } + + pMga->CreateScreenResources = pScreen->CreateScreenResources; + pScreen->CreateScreenResources = MGAShadowCreateScreenResources; + + return TRUE; } void -MGARefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox) +MGAShadowPointerMoved(SCRN_ARG_TYPE arg, int x, int y) { + SCRN_INFO_PTR(arg); MGAPtr pMga = MGAPTR(pScrn); - int count, width, height, dstPitch, srcPitch; - CARD32 *dstPtr, *srcPtr, *src, *dst; - - dstPitch = pScrn->displayWidth; - srcPitch = -pMga->Rotate * pMga->ShadowPitch >> 2; - - while(num--) { - width = pbox->x2 - pbox->x1; - height = pbox->y2 - pbox->y1; - - if(pMga->Rotate == 1) { - dstPtr = (CARD32*)pMga->FbStart + - (pbox->x1 * dstPitch) + pScrn->virtualX - pbox->y2; - srcPtr = (CARD32*)pMga->ShadowPtr + - ((1 - pbox->y2) * srcPitch) + pbox->x1; - } else { - dstPtr = (CARD32*)pMga->FbStart + - ((pScrn->virtualY - pbox->x2) * dstPitch) + pbox->y1; - srcPtr = (CARD32*)pMga->ShadowPtr + - (pbox->y1 * srcPitch) + pbox->x2 - 1; - } - - while(width--) { - src = srcPtr; - dst = dstPtr; - count = height; - while(count--) { - *(dst++) = *src; - src += srcPitch; - } - srcPtr += pMga->Rotate; - dstPtr += dstPitch; - } - - pbox++; - } -} + int newX, newY; + if(pMga->Rotate == 1) { + newX = pScrn->pScreen->height - y - 1; + newY = x; + } else { + newX = y; + newY = pScrn->pScreen->width - x - 1; + } + (*pMga->PointerMoved)(arg, newX, newY); +} ++++++ u_EXA-Fix-UploadToScreen.patch ++++++ From: Egbert Eich <[email protected]> Date: Wed May 7 23:15:13 2014 +0200 Subject: [PATCH]EXA: Fix UploadToScreen Patch-mainline: to be upstreamed Git-commit: 889839b017fb83d687afb0fa5e7ee335e629022e Git-repo: ssh://git.freedesktop.org/git/xorg/driver/xf86-video-mga References: bnc#876941 Signed-off-by: Egbert Eich <[email protected]> UploadToScreen needs to wait for the FIFO to have enough space to take the image data otherwise FIFO content will be overwritten leading to garbled images. Also memcopy() must not be used to copy this data. Replace this with a copy method once used in XAA. Signed-off-by: Egbert Eich <[email protected]> --- src/mga_exa.c | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/src/mga_exa.c b/src/mga_exa.c index 8543be4..4585197 100644 --- a/src/mga_exa.c +++ b/src/mga_exa.c @@ -689,6 +689,26 @@ mgaComposite(PixmapPtr pDst, int srcx, int srcy, int maskx, int masky, OUTREG(MGAREG_YDSTLEN | MGAREG_EXEC, (dsty << 16) | (h & 0xffff)); } +static void +copyDwords(CARD32 *dst, CARD32 *src, int count) +{ + while (count & ~0x03) { + *dst = *src; + *(dst + 1) = *(src + 1); + *(dst + 2) = *(src + 2); + *(dst + 3) = *(src + 3); + src += 4; + dst += 4; + count -= 4; + } + if (!count) return; + *dst = *src; + if (count == 1) return; + *(dst + 1) = *(src + 1); + if (count == 2) return; + *(dst + 2) = *(src + 2); +} + static Bool mgaUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src, int src_pitch) @@ -706,16 +726,28 @@ mgaUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, OUTREG(MGAREG_PLNWT, 0xffffffff); OUTREG(MGAREG_DWGCTL, MGADWG_ILOAD | MGADWG_BFCOL | MGADWG_SGNZERO | MGADWG_SHIFTZERO | - MGADWG_RSTR | 0x000c0000); + MGADWG_RPL | 0x000c0000); OUTREG(MGAREG_AR0, w - 1); OUTREG(MGAREG_AR3, 0); OUTREG(MGAREG_AR5, 0); OUTREG(MGAREG_FXBNDRY, ((x + w - 1) << 16) | (x & 0xffff)); - OUTREG(MGAREG_YDSTLEN | MGAREG_EXEC, (y << 16) | (h & 0xffff)); + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | (h & 0xffff)); while (h--) { - memcpy (pMga->ILOADBase, src, bytes_padded); - src += src_pitch; + char *src_save = src; + int count = bytes_padded >> 2; + + while (count > pMga->FifoSize) { + WAITFIFO(pMga->FifoSize); + /* don't use memcpy */ + copyDwords((CARD32 *)pMga->ILOADBase, (CARD32 *)src, pMga->FifoSize); + src += pMga->FifoSize << 2; + count -= pMga->FifoSize; + } + + WAITFIFO(count); + copyDwords((CARD32 *)pMga->ILOADBase, (CARD32 *)src, count); + src = src_save + src_pitch; } exaMarkSync(pDst->drawable.pScreen); ++++++ u_Fix-compiler-warnings.patch ++++++ From: Egbert Eich <[email protected]> Date: Wed May 7 21:23:40 2014 +0200 Subject: [PATCH]Fix compiler warnings Patch-mainline: to be upstreamed Git-commit: 9726dda8d50f6c79d0004ef254c500a8eed4c367 Git-repo: ssh://git.freedesktop.org/git/xorg/driver/xf86-video-mga References: Signed-off-by: Egbert Eich <[email protected]> Signed-off-by: Egbert Eich <[email protected]> --- src/mga_driver.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mga_driver.c b/src/mga_driver.c index 08c836d..d3b25f0 100644 --- a/src/mga_driver.c +++ b/src/mga_driver.c @@ -1003,7 +1003,8 @@ MGASoftReset(ScrnInfoPtr pScrn) MGAPtr pMga = MGAPTR(pScrn); pMga->FbMapSize = 8192 * 1024; - MGAMapMem(pScrn); + if (!MGAMapMem(pScrn)) + return; /* set soft reset bit */ OUTREG(MGAREG_Reset, 1); @@ -1124,7 +1125,8 @@ MGACountRam(ScrnInfoPtr pScrn) ProbeSize = 16384; ProbeSizeOffset = 0x10000; pMga->FbMapSize = ProbeSize * 1024; - MGAMapMem(pScrn); + if (!MGAMapMem(pScrn)) + return 0; base = pMga->FbBase; } @@ -1164,7 +1166,8 @@ MGACountRam(ScrnInfoPtr pScrn) else { MGAUnmapMem(pScrn); pMga->FbMapSize = ProbeSize * 1024; - MGAMapMem(pScrn); + if (!MGAMapMem(pScrn)) + return 0; base = pMga->FbBase; } } @@ -2746,7 +2749,7 @@ MGAMapMem(ScrnInfoPtr pScrn) err = pci_device_map_range(dev, region->base_addr, region->size, PCI_DEV_MAP_FLAG_WRITABLE, - &pMga->IOBase); + (void **)&pMga->IOBase); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, ++++++ u_Fix-crash-when-EXA-accel-mode-is-enabled.patch ++++++ From: Egbert Eich <[email protected]> Date: Wed May 7 21:23:25 2014 +0200 Subject: [PATCH]Fix crash when EXA accel mode is enabled Patch-mainline: to be upstreamed Git-commit: 6888cea8b8b5e542929f3e785f8407bfcf32633a Git-repo: ssh://git.freedesktop.org/git/xorg/driver/xf86-video-mga References: bnc#876940 Signed-off-by: Egbert Eich <[email protected]> Signed-off-by: Egbert Eich <[email protected]> --- src/mga_exa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mga_exa.c b/src/mga_exa.c index 69ffa16..8543be4 100644 --- a/src/mga_exa.c +++ b/src/mga_exa.c @@ -729,7 +729,7 @@ mgaDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, { PMGA(pSrc); - char *src = (char *) exaGetPixmapFirstPixel(pSrc); + char *src = (char *) pMga->FbBase + exaGetPixmapOffset(pSrc); int src_pitch = exaGetPixmapPitch(pSrc); int cpp = (pSrc->drawable.bitsPerPixel + 7) / 8; -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
