From 23bf87beeea059ac68d2f2be03d6508857d1dbc1 Mon Sep 17 00:00:00 2001 From: hasso Date: Thu, 11 Jun 2009 06:55:28 +0000 Subject: Pull in some patches from upstream repo. Should fix a cursor corruption issues and hardware freeze with images of certain size. Bump PKGREVISION. --- x11/xf86-video-ati/Makefile | 3 +- x11/xf86-video-ati/distinfo | 4 +- x11/xf86-video-ati/patches/patch-aa | 165 ++++++++++++++++++++++++++++++++++++ x11/xf86-video-ati/patches/patch-ab | 21 +++++ 4 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 x11/xf86-video-ati/patches/patch-aa create mode 100644 x11/xf86-video-ati/patches/patch-ab (limited to 'x11') diff --git a/x11/xf86-video-ati/Makefile b/x11/xf86-video-ati/Makefile index 497f7ee4881..72b0d92edd0 100644 --- a/x11/xf86-video-ati/Makefile +++ b/x11/xf86-video-ati/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.11 2009/06/09 05:35:10 hasso Exp $ +# $NetBSD: Makefile,v 1.12 2009/06/11 06:55:28 hasso Exp $ DISTNAME= xf86-video-ati-6.12.2 +PKGREVISION= 1 CATEGORIES= x11 MASTER_SITES= ${MASTER_SITE_XORG:=driver/} EXTRACT_SUFX= .tar.bz2 diff --git a/x11/xf86-video-ati/distinfo b/x11/xf86-video-ati/distinfo index 1d9f92cea48..f74d23e5fe0 100644 --- a/x11/xf86-video-ati/distinfo +++ b/x11/xf86-video-ati/distinfo @@ -1,6 +1,8 @@ -$NetBSD: distinfo,v 1.8 2009/06/09 05:35:10 hasso Exp $ +$NetBSD: distinfo,v 1.9 2009/06/11 06:55:28 hasso Exp $ SHA1 (xf86-video-ati-6.12.2.tar.bz2) = a09a579ece160e714774d3a54da3e1f2bc48ec36 RMD160 (xf86-video-ati-6.12.2.tar.bz2) = 79f6be946e121a9a27240f1a6b05b7dce0714a2f Size (xf86-video-ati-6.12.2.tar.bz2) = 902480 bytes +SHA1 (patch-aa) = 36602ec8e62ac1b854a51d666811376890871fd5 +SHA1 (patch-ab) = bb01db0635ab92d7379d31ca3890e574e8450886 SHA1 (patch-ac) = 605892e355f028d83b5db112f5c68a72bcc5e4b0 diff --git a/x11/xf86-video-ati/patches/patch-aa b/x11/xf86-video-ati/patches/patch-aa new file mode 100644 index 00000000000..7e61a03b702 --- /dev/null +++ b/x11/xf86-video-ati/patches/patch-aa @@ -0,0 +1,165 @@ +$NetBSD: patch-aa,v 1.5 2009/06/11 06:55:28 hasso Exp $ + +Accumulated cursor fixes from 6.12 branch. Should fix cursor corruption +issues: + +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=0ea75453 +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=f2aaa708 +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=998fd244 +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=666b0ff9 +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=fbb04716 +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=cb8081a8 +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=b6cd47ec +http://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?h=6.12-branch&id=f2c0fa5e + +--- src/radeon_cursor.c.orig 2009-06-10 21:33:32 +0300 ++++ src/radeon_cursor.c 2009-06-10 21:34:01 +0300 +@@ -73,14 +73,17 @@ + #define CURSOR_SWAPPING_DECL_MMIO unsigned char *RADEONMMIO = info->MMIO; + #define CURSOR_SWAPPING_START() \ + do { \ ++ if (info->ChipFamily < CHIP_FAMILY_R600) \ + OUTREG(RADEON_SURFACE_CNTL, \ + (info->ModeReg->surface_cntl | \ + RADEON_NONSURF_AP0_SWP_32BPP | RADEON_NONSURF_AP1_SWP_32BPP) & \ + ~(RADEON_NONSURF_AP0_SWP_16BPP | RADEON_NONSURF_AP1_SWP_16BPP)); \ + } while (0) +-#define CURSOR_SWAPPING_END() (OUTREG(RADEON_SURFACE_CNTL, \ +- info->ModeReg->surface_cntl)) +- ++#define CURSOR_SWAPPING_END() \ ++ do { \ ++ if (info->ChipFamily < CHIP_FAMILY_R600) \ ++ OUTREG(RADEON_SURFACE_CNTL, info->ModeReg->surface_cntl); \ ++ } while (0) + #else + + #define CURSOR_SWAPPING_DECL_MMIO +@@ -97,13 +100,14 @@ avivo_setup_cursor(xf86CrtcPtr crtc, Boo + RADEONInfoPtr info = RADEONPTR(crtc->scrn); + unsigned char *RADEONMMIO = info->MMIO; + +- OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, 0); ++ /* always use the same cursor mode even if the cursor is disabled, ++ * otherwise you may end up with cursor curruption bands ++ */ ++ OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); + + if (enable) { + OUTREG(AVIVO_D1CUR_SURFACE_ADDRESS + radeon_crtc->crtc_offset, + info->fbLocation + radeon_crtc->cursor_offset + pScrn->fbOffset); +- OUTREG(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset, +- ((CURSOR_WIDTH - 1) << 16) | (CURSOR_HEIGHT - 1)); + OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, + AVIVO_D1CURSOR_EN | (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); + } +@@ -138,9 +142,6 @@ radeon_crtc_show_cursor (xf86CrtcPtr crt + + if (IS_AVIVO_VARIANT) { + avivo_lock_cursor(crtc, TRUE); +- OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, +- INREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset) +- | AVIVO_D1CURSOR_EN); + avivo_setup_cursor(crtc, TRUE); + avivo_lock_cursor(crtc, FALSE); + } else { +@@ -171,9 +172,6 @@ radeon_crtc_hide_cursor (xf86CrtcPtr crt + + if (IS_AVIVO_VARIANT) { + avivo_lock_cursor(crtc, TRUE); +- OUTREG(AVIVO_D1CUR_CONTROL+ radeon_crtc->crtc_offset, +- INREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset) +- & ~(AVIVO_D1CURSOR_EN)); + avivo_setup_cursor(crtc, FALSE); + avivo_lock_cursor(crtc, FALSE); + } else { +@@ -196,6 +194,7 @@ void + radeon_crtc_set_cursor_position (xf86CrtcPtr crtc, int x, int y) + { + ScrnInfoPtr pScrn = crtc->scrn; ++ RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); + RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; + int crtc_id = radeon_crtc->crtc_id; + RADEONInfoPtr info = RADEONPTR(pScrn); +@@ -210,15 +209,38 @@ radeon_crtc_set_cursor_position (xf86Crt + if (yorigin >= CURSOR_HEIGHT) yorigin = CURSOR_HEIGHT - 1; + + if (IS_AVIVO_VARIANT) { ++ int w = CURSOR_WIDTH; ++ + /* avivo cursor spans the full fb width */ + if (crtc->rotatedData == NULL) { + x += crtc->x; + y += crtc->y; + } ++ ++ if (pRADEONEnt->Controller[0]->enabled && ++ pRADEONEnt->Controller[1]->enabled) { ++ int cursor_end, frame_end; ++ ++ cursor_end = x - xorigin + w; ++ frame_end = crtc->x + mode->CrtcHDisplay; ++ ++ if (cursor_end >= frame_end) { ++ w = w - (cursor_end - frame_end); ++ if (!(frame_end & 0x7f)) ++ w--; ++ } else { ++ if (!(cursor_end & 0x7f)) ++ w--; ++ } ++ if (w <= 0) ++ w = 1; ++ } ++ + avivo_lock_cursor(crtc, TRUE); + OUTREG(AVIVO_D1CUR_POSITION + radeon_crtc->crtc_offset, ((xorigin ? 0 : x) << 16) + | (yorigin ? 0 : y)); + OUTREG(AVIVO_D1CUR_HOT_SPOT + radeon_crtc->crtc_offset, (xorigin << 16) | yorigin); ++ OUTREG(AVIVO_D1CUR_SIZE + radeon_crtc->crtc_offset, ((w - 1) << 16) | (CURSOR_HEIGHT - 1)); + avivo_lock_cursor(crtc, FALSE); + } else { + if (mode->Flags & V_DBLSCAN) +@@ -320,23 +342,17 @@ Bool RADEONCursorInit(ScreenPtr pScreen) + { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); ++ unsigned char *RADEONMMIO = info->MMIO; + xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); +- int width; +- int width_bytes; +- int height; +- int size_bytes; + int c; + +- size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT; +- width = pScrn->displayWidth; +- width_bytes = width * (pScrn->bitsPerPixel / 8); +- height = ((size_bytes * xf86_config->num_crtc) + width_bytes - 1) / width_bytes; +- int align = IS_AVIVO_VARIANT ? 4096 : 256; +- +- if (!info->useEXA) { +- for (c = 0; c < xf86_config->num_crtc; c++) { +- xf86CrtcPtr crtc = xf86_config->crtc[c]; +- RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; ++ for (c = 0; c < xf86_config->num_crtc; c++) { ++ xf86CrtcPtr crtc = xf86_config->crtc[c]; ++ RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; ++ ++ if (!info->useEXA) { ++ int size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT; ++ int align = IS_AVIVO_VARIANT ? 4096 : 256; + + radeon_crtc->cursor_offset = + radeon_legacy_allocate_memory(pScrn, &radeon_crtc->cursor_mem, size_bytes, align); +@@ -350,6 +366,10 @@ Bool RADEONCursorInit(ScreenPtr pScreen) + c, + (unsigned int)radeon_crtc->cursor_offset); + } ++ /* set the cursor mode the same on both crtcs to avoid corruption */ ++ if (IS_AVIVO_VARIANT) ++ OUTREG(AVIVO_D1CUR_CONTROL + radeon_crtc->crtc_offset, ++ (AVIVO_D1CURSOR_MODE_24BPP << AVIVO_D1CURSOR_MODE_SHIFT)); + } + + return xf86_cursors_init (pScreen, CURSOR_WIDTH, CURSOR_HEIGHT, diff --git a/x11/xf86-video-ati/patches/patch-ab b/x11/xf86-video-ati/patches/patch-ab new file mode 100644 index 00000000000..461eda601b4 --- /dev/null +++ b/x11/xf86-video-ati/patches/patch-ab @@ -0,0 +1,21 @@ +$NetBSD: patch-ab,v 1.3 2009/06/11 06:55:28 hasso Exp $ + +Fix coordinate limits off-by-one error causing hardware freezes: +http://bugs.freedesktop.org/show_bug.cgi?id=21598 + +--- src/radeon_exa_funcs.c.orig 2009-06-10 21:36:23 +0300 ++++ src/radeon_exa_funcs.c 2009-06-10 21:36:43 +0300 +@@ -532,11 +532,11 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting EXA maxPitchBytes\n"); + + info->accel_state->exa->maxPitchBytes = 16320; +- info->accel_state->exa->maxX = 8192; ++ info->accel_state->exa->maxX = 8191; + #else + info->accel_state->exa->maxX = 16320 / 4; + #endif +- info->accel_state->exa->maxY = 8192; ++ info->accel_state->exa->maxY = 8191; + + if (xf86ReturnOptValBool(info->Options, OPTION_EXA_VSYNC, FALSE)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "EXA VSync enabled\n"); -- cgit v1.2.3