Module Name:    xsrc
Committed By:   veego
Date:           Sun Sep 23 20:06:03 UTC 2012

Modified Files:
        xsrc/external/mit/xf86-video-ati/dist/src: legacy_crtc.c r600_exa.c
            radeon_accelfuncs.c radeon_cursor.c radeon_dri.c radeon_driver.c
            radeon_exa_funcs.c radeon_textured_video.c

Log Message:
merge xf86-video-ati 6.14.6


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
    xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c \
    xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c
cvs rdiff -u -r1.2 -r1.3 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c
cvs rdiff -u -r1.6 -r1.7 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c
cvs rdiff -u -r1.8 -r1.9 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c
cvs rdiff -u -r1.11 -r1.12 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c
cvs rdiff -u -r1.3 -r1.4 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c:1.4 xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c:1.5
--- xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c:1.4	Sat Jul 17 06:34:13 2010
+++ xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c	Sun Sep 23 20:06:02 2012
@@ -854,7 +854,7 @@ RADEONInitCrtcBase(xf86CrtcPtr crtc, RAD
         /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
 	 *** pageflipping!
 	 ***/
-	pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]);
+	pSAREAPriv = DRIGetSAREAPrivate(xf86ScrnToScreen(pScrn));
 	/* can't get at sarea in a semi-sane way? */
 	pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
 
@@ -1075,7 +1075,7 @@ RADEONInitCrtc2Base(xf86CrtcPtr crtc, RA
         /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
 	 *** pageflipping!
 	 ***/
-	pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]);
+	pSAREAPriv = DRIGetSAREAPrivate(xf86ScrnToScreen(pScrn));
 	/* can't get at sarea in a semi-sane way? */
 	pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
 
@@ -1886,10 +1886,10 @@ legacy_crtc_mode_set(xf86CrtcPtr crtc, D
 	/* need to redraw front buffer, I guess this can be considered a hack ? */
 	/* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
 	if (pScrn->pScreen)
-	    xf86EnableDisableFBAccess(pScrn->scrnIndex, FALSE);
+	    xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), FALSE);
 	RADEONChangeSurfaces(pScrn);
 	if (pScrn->pScreen)
-	    xf86EnableDisableFBAccess(pScrn->scrnIndex, TRUE);
+	    xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), TRUE);
 	/* xf86SetRootClip would do, but can't access that here */
     }
 
Index: xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c:1.4 xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c:1.5
--- xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c:1.4	Sun Jun  3 16:42:22 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c	Sun Sep 23 20:06:02 2012
@@ -168,7 +168,7 @@ R600SetAccelState(ScrnInfoPtr pScrn,
 static Bool
 R600PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     cb_config_t     cb_conf;
@@ -323,7 +323,7 @@ R600PrepareSolid(PixmapPtr pPix, int alu
 static void
 R600DoneSolid(PixmapPtr pPix)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
 
@@ -339,7 +339,7 @@ R600DoneSolid(PixmapPtr pPix)
 static void
 R600Solid(PixmapPtr pPix, int x1, int y1, int x2, int y2)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     float *vb;
@@ -517,7 +517,7 @@ R600DoCopy(ScrnInfoPtr pScrn)
 static void
 R600DoCopyVline(PixmapPtr pPix)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
 
@@ -566,7 +566,7 @@ R600PrepareCopy(PixmapPtr pSrc,   Pixmap
 		int rop,
 		Pixel planemask)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     struct r600_accel_object src_obj, dst_obj;
@@ -681,7 +681,7 @@ R600PrepareCopy(PixmapPtr pSrc,   Pixmap
 static void
 R600DoneCopy(PixmapPtr pDst)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
 
@@ -702,7 +702,7 @@ R600Copy(PixmapPtr pDst,
 	 int dstX, int dstY,
 	 int w, int h)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
 
@@ -901,17 +901,8 @@ static Bool R600CheckCompositeTexture(Pi
 				      int op,
 				      int unit)
 {
-    int w = pPict->pDrawable->width;
-    int h = pPict->pDrawable->height;
     unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
     unsigned int i;
-    int max_tex_w, max_tex_h;
-
-    max_tex_w = 8192;
-    max_tex_h = 8192;
-
-    if ((w > max_tex_w) || (h > max_tex_h))
-	RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h));
 
     for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) {
 	if (R600TexFormats[i].fmt == pPict->format)
@@ -948,12 +939,10 @@ static Bool R600CheckCompositeTexture(Pi
 static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
 					int unit)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
-    int w = pPict->pDrawable->width;
-    int h = pPict->pDrawable->height;
-    unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
+    unsigned int repeatType;
     unsigned int i;
     tex_resource_t  tex_res;
     tex_sampler_t   tex_samp;
@@ -969,9 +958,16 @@ static Bool R600TextureSetup(PicturePtr 
     }
 
     /* Texture */
+    if (pPict->pDrawable) {
+	tex_res.w               = pPict->pDrawable->width;
+	tex_res.h               = pPict->pDrawable->height;
+	repeatType              = pPict->repeat ? pPict->repeatType : RepeatNone;
+    } else {
+	tex_res.w               = 1;
+	tex_res.h               = 1;
+	repeatType              = RepeatNormal;
+    }
     tex_res.id                  = unit;
-    tex_res.w                   = w;
-    tex_res.h                   = h;
     tex_res.pitch               = accel_state->src_obj[unit].pitch;
     tex_res.depth               = 0;
     tex_res.dim                 = SQ_TEX_DIM_2D;
@@ -1170,24 +1166,24 @@ static Bool R600TextureSetup(PicturePtr 
 	vs_alu_consts[0] = xFixedToFloat(pPict->transform->matrix[0][0]);
 	vs_alu_consts[1] = xFixedToFloat(pPict->transform->matrix[0][1]);
 	vs_alu_consts[2] = xFixedToFloat(pPict->transform->matrix[0][2]);
-	vs_alu_consts[3] = 1.0 / w;
+	vs_alu_consts[3] = 1.0 / tex_res.w;
 
 	vs_alu_consts[4] = xFixedToFloat(pPict->transform->matrix[1][0]);
 	vs_alu_consts[5] = xFixedToFloat(pPict->transform->matrix[1][1]);
 	vs_alu_consts[6] = xFixedToFloat(pPict->transform->matrix[1][2]);
-	vs_alu_consts[7] = 1.0 / h;
+	vs_alu_consts[7] = 1.0 / tex_res.h;
     } else {
 	accel_state->is_transform[unit] = FALSE;
 
 	vs_alu_consts[0] = 1.0;
 	vs_alu_consts[1] = 0.0;
 	vs_alu_consts[2] = 0.0;
-	vs_alu_consts[3] = 1.0 / w;
+	vs_alu_consts[3] = 1.0 / tex_res.w;
 
 	vs_alu_consts[4] = 0.0;
 	vs_alu_consts[5] = 1.0;
 	vs_alu_consts[6] = 0.0;
-	vs_alu_consts[7] = 1.0 / h;
+	vs_alu_consts[7] = 1.0 / tex_res.h;
     }
 
     /* VS alu constants */
@@ -1202,33 +1198,30 @@ static Bool R600CheckComposite(int op, P
 {
     uint32_t tmp1;
     PixmapPtr pSrcPixmap, pDstPixmap;
-    int max_tex_w, max_tex_h, max_dst_w, max_dst_h;
 
     /* Check for unsupported compositing operations. */
     if (op >= (int) (sizeof(R600BlendOp) / sizeof(R600BlendOp[0])))
 	RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
 
-    if (!pSrcPicture->pDrawable)
-	RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+    if (pSrcPicture->pDrawable) {
+	pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
 
-    pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
+	if (pSrcPixmap->drawable.width >= 8192 ||
+	    pSrcPixmap->drawable.height >= 8192) {
+	    RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
+			     pSrcPixmap->drawable.width,
+			     pSrcPixmap->drawable.height));
+	}
 
-    max_tex_w = 8192;
-    max_tex_h = 8192;
-    max_dst_w = 8192;
-    max_dst_h = 8192;
-
-    if (pSrcPixmap->drawable.width >= max_tex_w ||
-	pSrcPixmap->drawable.height >= max_tex_h) {
-	RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
-			 pSrcPixmap->drawable.width,
-			 pSrcPixmap->drawable.height));
-    }
+	if (!R600CheckCompositeTexture(pSrcPicture, pDstPicture, op, 0))
+	    return FALSE;
+    } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
+	RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
 
     pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
 
-    if (pDstPixmap->drawable.width >= max_dst_w ||
-	pDstPixmap->drawable.height >= max_dst_h) {
+    if (pDstPixmap->drawable.width >= 8192 ||
+	pDstPixmap->drawable.height >= 8192) {
 	RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n",
 			 pDstPixmap->drawable.width,
 			 pDstPixmap->drawable.height));
@@ -1237,38 +1230,35 @@ static Bool R600CheckComposite(int op, P
     if (pMaskPicture) {
 	PixmapPtr pMaskPixmap;
 
-	if (!pMaskPicture->pDrawable)
-	    RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n"));
+	if (pMaskPicture->pDrawable) {
+	    pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
 
-	pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
-
-	if (pMaskPixmap->drawable.width >= max_tex_w ||
-	    pMaskPixmap->drawable.height >= max_tex_h) {
-	    RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
-			     pMaskPixmap->drawable.width,
-			     pMaskPixmap->drawable.height));
-	}
+	    if (pMaskPixmap->drawable.width >= 8192 ||
+		pMaskPixmap->drawable.height >= 8192) {
+	      RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
+			       pMaskPixmap->drawable.width,
+			       pMaskPixmap->drawable.height));
+	    }
 
-	if (pMaskPicture->componentAlpha) {
-	    /* Check if it's component alpha that relies on a source alpha and
-	     * on the source value.  We can only get one of those into the
-	     * single source value that we get to blend with.
-	     */
-	    if (R600BlendOp[op].src_alpha &&
-		(R600BlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
-		(BLEND_ZERO << COLOR_SRCBLEND_shift)) {
-		RADEON_FALLBACK(("Component alpha not supported with source "
-				 "alpha and source value blending.\n"));
+	    if (pMaskPicture->componentAlpha) {
+		/* Check if it's component alpha that relies on a source alpha and
+		 * on the source value.  We can only get one of those into the
+		 * single source value that we get to blend with.
+		 */
+		if (R600BlendOp[op].src_alpha &&
+		    (R600BlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
+		    (BLEND_ZERO << COLOR_SRCBLEND_shift)) {
+		    RADEON_FALLBACK(("Component alpha not supported with source "
+				     "alpha and source value blending.\n"));
+		}
 	    }
-	}
 
-	if (!R600CheckCompositeTexture(pMaskPicture, pDstPicture, op, 1))
-	    return FALSE;
+	    if (!R600CheckCompositeTexture(pMaskPicture, pDstPicture, op, 1))
+		return FALSE;
+	} else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
+	    RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
     }
 
-    if (!R600CheckCompositeTexture(pSrcPicture, pDstPicture, op, 0))
-	return FALSE;
-
     if (!R600GetDestFormat(pDstPicture, &tmp1))
 	return FALSE;
 
@@ -1280,7 +1270,8 @@ static Bool R600PrepareComposite(int op,
 				 PicturePtr pMaskPicture, PicturePtr pDstPicture,
 				 PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
+    ScreenPtr pScreen = pDst->drawable.pScreen;
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     uint32_t dst_format;
@@ -1288,15 +1279,21 @@ static Bool R600PrepareComposite(int op,
     shader_config_t vs_conf, ps_conf;
     struct r600_accel_object src_obj, mask_obj, dst_obj;
 
-    if (pDst->drawable.bitsPerPixel < 8 || pSrc->drawable.bitsPerPixel < 8)
+    if (pDst->drawable.bitsPerPixel < 8 || (pSrc && pSrc->drawable.bitsPerPixel < 8))
 	return FALSE;
 
+    if (!pSrc) {
+	pSrc = RADEONSolidPixmap(pScreen, pSrcPicture->pSourcePict->solidFill.color);
+	if (!pSrc)
+	    RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
+    }
+
 #if defined(XF86DRM_MODE)
     if (info->cs) {
 	src_obj.offset = 0;
 	dst_obj.offset = 0;
-	src_obj.bo = radeon_get_pixmap_bo(pSrc);
 	dst_obj.bo = radeon_get_pixmap_bo(pDst);
+	src_obj.bo = radeon_get_pixmap_bo(pSrc);
 	dst_obj.tiling_flags = radeon_get_pixmap_tiling(pDst);
 	src_obj.tiling_flags = radeon_get_pixmap_tiling(pSrc);
 	dst_obj.surface = radeon_get_pixmap_surface(pDst);
@@ -1322,7 +1319,16 @@ static Bool R600PrepareComposite(int op,
     dst_obj.bpp = pDst->drawable.bitsPerPixel;
     dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
 
-    if (pMask) {
+    if (pMaskPicture) {
+	if (!pMask) {
+	    pMask = RADEONSolidPixmap(pScreen, pMaskPicture->pSourcePict->solidFill.color);
+	    if (!pMask) {
+		if (!pSrcPicture->pDrawable)
+		    pScreen->DestroyPixmap(pSrc);
+		RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
+	    }
+	}
+
 #if defined(XF86DRM_MODE)
 	if (info->cs) {
 	    mask_obj.offset = 0;
@@ -1509,11 +1515,9 @@ static Bool R600PrepareComposite(int op,
     return TRUE;
 }
 
-static void R600DoneComposite(PixmapPtr pDst)
+static void R600FinishComposite(ScrnInfoPtr pScrn, PixmapPtr pDst,
+				struct radeon_accel_state *accel_state)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
-    RADEONInfoPtr info = RADEONPTR(pScrn);
-    struct radeon_accel_state *accel_state = info->accel_state;
     int vtx_size;
 
     if (accel_state->vsync)
@@ -1527,13 +1531,29 @@ static void R600DoneComposite(PixmapPtr 
     r600_finish_op(pScrn, vtx_size);
 }
 
+static void R600DoneComposite(PixmapPtr pDst)
+{
+    ScreenPtr pScreen = pDst->drawable.pScreen;
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+    RADEONInfoPtr info = RADEONPTR(pScrn);
+    struct radeon_accel_state *accel_state = info->accel_state;
+
+    R600FinishComposite(pScrn, pDst, accel_state);
+
+    if (!accel_state->src_pic->pDrawable)
+	pScreen->DestroyPixmap(accel_state->src_pix);
+
+    if (accel_state->msk_pic && !accel_state->msk_pic->pDrawable)
+	pScreen->DestroyPixmap(accel_state->msk_pix);
+}
+
 static void R600Composite(PixmapPtr pDst,
 			  int srcX, int srcY,
 			  int maskX, int maskY,
 			  int dstX, int dstY,
 			  int w, int h)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     float *vb;
@@ -1543,7 +1563,7 @@ static void R600Composite(PixmapPtr pDst
 
 #ifdef XF86DRM_MODE
     if (info->cs && CS_FULL(info->cs)) {
-	R600DoneComposite(info->accel_state->dst_pix);
+	R600FinishComposite(pScrn, pDst, info->accel_state);
 	radeon_cs_flush_indirect(pScrn);
 	R600PrepareComposite(info->accel_state->composite_op,
 			     info->accel_state->src_pic,
@@ -1708,7 +1728,7 @@ static Bool
 R600UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
 		   char *src, int src_pitch)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     uint32_t dst_pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8);
     uint32_t dst_mc_addr = exaGetPixmapOffset(pDst) + info->fbLocation + pScrn->fbOffset;
@@ -1724,7 +1744,7 @@ static Bool
 R600DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
 		       char *dst, int dst_pitch)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     uint32_t src_pitch = exaGetPixmapPitch(pSrc) / (pSrc->drawable.bitsPerPixel / 8);
@@ -1824,7 +1844,7 @@ static Bool
 R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
 		     char *src, int src_pitch)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     struct radeon_exa_pixmap_priv *driver_priv;
@@ -1947,7 +1967,7 @@ static Bool
 R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
 			 int h, char *dst, int dst_pitch)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
     struct radeon_exa_pixmap_priv *driver_priv;
@@ -2085,7 +2105,7 @@ out:
 static int
 R600MarkSync(ScreenPtr pScreen)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
 
@@ -2096,7 +2116,7 @@ R600MarkSync(ScreenPtr pScreen)
 static void
 R600Sync(ScreenPtr pScreen, int marker)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     struct radeon_accel_state *accel_state = info->accel_state;
 
@@ -2216,7 +2236,7 @@ R600LoadShaders(ScrnInfoPtr pScrn)
 static Bool
 R600PrepareAccess(PixmapPtr pPix, int index)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
 
@@ -2229,7 +2249,7 @@ R600PrepareAccess(PixmapPtr pPix, int in
 static void
 R600FinishAccess(PixmapPtr pPix, int index)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     unsigned char *RADEONMMIO = info->MMIO;
 
@@ -2241,7 +2261,7 @@ R600FinishAccess(PixmapPtr pPix, int ind
 Bool
 R600DrawInit(ScreenPtr pScreen)
 {
-    ScrnInfoPtr pScrn =  xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn =  xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info   = RADEONPTR(pScrn);
 
     if (info->accel_state->exa == NULL) {

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c:1.2 xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c:1.3
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c:1.2	Wed Jul  6 03:59:54 2011
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c	Sun Sep 23 20:06:02 2012
@@ -1152,7 +1152,7 @@ FUNC_NAME(RADEONDisableClipping)(ScrnInf
 void
 FUNC_NAME(RADEONAccelInit)(ScreenPtr pScreen, XAAInfoRecPtr a)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
 
     a->Flags                            = (PIXMAP_CACHE

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c:1.6 xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c:1.7
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c:1.6	Mon Feb 21 00:58:48 2011
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c	Sun Sep 23 20:06:02 2012
@@ -407,7 +407,7 @@ radeon_crtc_load_cursor_argb (xf86CrtcPt
 /* Initialize hardware cursor support. */
 Bool RADEONCursorInit(ScreenPtr pScreen)
 {
-    ScrnInfoPtr        pScrn   = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr        pScrn   = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr      info    = RADEONPTR(pScrn);
     unsigned char     *RADEONMMIO = info->MMIO;
     xf86CrtcConfigPtr  xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c:1.8 xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c:1.9
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c:1.8	Sun Jun  3 16:42:23 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c	Sun Sep 23 20:06:02 2012
@@ -93,7 +93,7 @@ static void RADEONDRIClipNotify(ScreenPt
  */
 static Bool RADEONInitVisualConfigs(ScreenPtr pScreen)
 {
-    ScrnInfoPtr          pScrn             = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr          pScrn             = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr        info              = RADEONPTR(pScrn);
     int                  numConfigs        = 0;
     __GLXvisualConfig   *pConfigs          = 0;
@@ -319,7 +319,7 @@ static void RADEONDestroyContext(ScreenP
  */
 static void RADEONEnterServer(ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     drm_radeon_sarea_t *pSAREAPriv;
 
@@ -361,7 +361,7 @@ static void RADEONEnterServer(ScreenPtr 
  */
 static void RADEONLeaveServer(ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     RING_LOCALS;
 
@@ -492,7 +492,7 @@ static void RADEONDRIMoveBuffers(WindowP
 {
 #ifdef USE_XAA
     ScreenPtr      pScreen  = pParent->drawable.pScreen;
-    ScrnInfoPtr    pScrn    = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn    = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info     = RADEONPTR(pScrn);
 
     BoxPtr         pboxTmp, pboxNext, pboxBase;
@@ -902,7 +902,7 @@ static Bool RADEONSetAgpMode(RADEONInfoP
 /* Initialize Radeon's AGP registers */
 static void RADEONSetAgpBase(RADEONInfoPtr info, ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     unsigned char *RADEONMMIO = info->MMIO;
 
     if (info->ChipFamily >= CHIP_FAMILY_R600)
@@ -1173,7 +1173,7 @@ static Bool RADEONDRIMapInit(RADEONInfoP
 /* Initialize the kernel data structures */
 static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     int            cpp   = info->CurrentLayout.pixel_bytes;
     drm_radeon_init_t  drmInfo;
 
@@ -1280,7 +1280,7 @@ static Bool RADEONDRIBufInit(RADEONInfoP
 
 static void RADEONDRIIrqInit(RADEONInfoPtr info, ScreenPtr pScreen)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 
     if (!info->dri->irq) {
 	info->dri->irq = drmGetInterruptFromBusID(
@@ -1524,7 +1524,7 @@ Bool RADEONDRISetVBlankInterrupt(ScrnInf
  */
 Bool RADEONDRIScreenInit(ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn   = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn   = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info    = RADEONPTR(pScrn);
     DRIInfoPtr     pDRIInfo;
     RADEONDRIPtr   pRADEONDRI;
@@ -1715,15 +1715,15 @@ Bool RADEONDRIScreenInit(ScreenPtr pScre
     return TRUE;
 }
 
-static Bool RADEONDRIDoCloseScreen(int scrnIndex, ScreenPtr pScreen)
+static Bool RADEONDRIDoCloseScreen(CLOSE_SCREEN_ARGS_DECL)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
 
     RADEONDRICloseScreen(pScreen);
 
     pScreen->CloseScreen = info->dri->DRICloseScreen;
-    return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+    return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
 }
 
 /* Finish initializing the device-dependent DRI state, and call
@@ -1732,7 +1732,7 @@ static Bool RADEONDRIDoCloseScreen(int s
  */
 Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen)
 {
-    ScrnInfoPtr         pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr         pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr       info  = RADEONPTR(pScrn);
     drm_radeon_sarea_t  *pSAREAPriv;
     RADEONDRIPtr        pRADEONDRI;
@@ -1830,7 +1830,7 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr
 void RADEONDRIResume(ScreenPtr pScreen)
 {
     int _ret;
-    ScrnInfoPtr   pScrn   = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr   pScrn   = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info    = RADEONPTR(pScrn);
 
     if (info->dri->pKernelDRMVersion->version_minor >= 9) {
@@ -1865,7 +1865,7 @@ void RADEONDRIResume(ScreenPtr pScreen)
 
 void RADEONDRIStop(ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     RING_LOCALS;
 
@@ -1888,7 +1888,7 @@ void RADEONDRIStop(ScreenPtr pScreen)
  */
 void RADEONDRICloseScreen(ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     drm_radeon_init_t  drmInfo;
 
@@ -2092,7 +2092,7 @@ out:
 static void RADEONEnablePageFlip(ScreenPtr pScreen)
 {
 #ifdef DAMAGE
-    ScrnInfoPtr         pScrn      = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr         pScrn      = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr       info       = RADEONPTR(pScrn);
 
     if (info->dri->allowPageFlip) {
@@ -2132,7 +2132,7 @@ static void RADEONDRITransitionMultiToSi
 
 static void RADEONDRITransitionTo3d(ScreenPtr pScreen)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
 #ifdef USE_XAA
     FBAreaPtr      fbarea;
@@ -2220,7 +2220,7 @@ static void RADEONDRITransitionTo3d(Scre
 
 static void RADEONDRITransitionTo2d(ScreenPtr pScreen)
 {
-    ScrnInfoPtr         pScrn      = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr         pScrn      = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr       info       = RADEONPTR(pScrn);
     drm_radeon_sarea_t  *pSAREAPriv = DRIGetSAREAPrivate(pScreen);
 
@@ -2265,7 +2265,7 @@ static void RADEONDRITransitionTo2d(Scre
 static void
 RADEONDRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
 
     REGION_UNINIT(pScreen, &info->dri->driRegion);
@@ -2288,7 +2288,7 @@ RADEONDRIClipNotify(ScreenPtr pScreen, W
 
 void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen)
 {
-    ScrnInfoPtr        pScrn   = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr        pScrn   = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr      info    = RADEONPTR(pScrn);
 
     if (info->cardType != CARD_PCIE ||
Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c:1.8 xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c:1.9
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c:1.8	Sun Jun  3 16:42:23 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c	Sun Sep 23 20:06:02 2012
@@ -71,7 +71,7 @@ FUNC_NAME(RADEONMarkSync)(ScreenPtr pScr
 static void
 FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr info = RADEONPTR(pScrn);
 
     if (info->cs)

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c:1.11 xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c:1.12
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c:1.11	Sun Jun  3 16:42:23 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c	Sun Sep 23 20:06:02 2012
@@ -121,7 +121,7 @@
 #include "radeon_chipinfo_gen.h"
 
 				/* Forward definitions for driver functions */
-static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen);
+static Bool RADEONCloseScreen(CLOSE_SCREEN_ARGS_DECL);
 static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode);
 static void RADEONSave(ScrnInfoPtr pScrn);
 
@@ -231,7 +231,7 @@ static void *
 radeonShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
 		   CARD32 *size, void *closure)
 {
-    ScrnInfoPtr pScrn = xf86Screens[screen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
     RADEONInfoPtr  info   = RADEONPTR(pScrn);
     int stride;
 
@@ -243,7 +243,7 @@ radeonShadowWindow(ScreenPtr screen, CAR
 static Bool
 RADEONCreateScreenResources (ScreenPtr pScreen)
 {
-   ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+   ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    RADEONInfoPtr  info   = RADEONPTR(pScrn);
    PixmapPtr pixmap;
 
@@ -3373,15 +3373,14 @@ static void RADEONLoadPalette(ScrnInfoPt
 #endif
 }
 
-static void RADEONBlockHandler(int i, pointer blockData,
-			       pointer pTimeout, pointer pReadmask)
+static void RADEONBlockHandler(BLOCKHANDLER_ARGS_DECL)
 {
-    ScreenPtr      pScreen = screenInfo.screens[i];
-    ScrnInfoPtr    pScrn   = xf86Screens[i];
+    SCREEN_PTR(arg);
+    ScrnInfoPtr    pScrn   = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info    = RADEONPTR(pScrn);
 
     pScreen->BlockHandler = info->BlockHandler;
-    (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
+    (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
     pScreen->BlockHandler = RADEONBlockHandler;
 
     if (info->VideoTimerCallback)
@@ -3448,10 +3447,9 @@ RADEONInitBIOSRegisters(ScrnInfoPtr pScr
 
 
 /* Called at the start of each server generation. */
-Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen,
-                                int argc, char **argv)
+Bool RADEONScreenInit(SCREEN_INIT_ARGS_DECL)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr    pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     int            hasDRI = 0;
 #ifdef RENDER
@@ -3636,14 +3634,14 @@ Bool RADEONScreenInit(int scrnIndex, Scr
 		info->dri->textureSize = -1;
 	    }
 	}
-	if (!RADEONSetupMemXAA_DRI(scrnIndex, pScreen))
+	if (!RADEONSetupMemXAA_DRI(pScreen))
 	    return FALSE;
     	pScrn->fbOffset    = info->dri->frontOffset;
     }
 #endif
 
 #ifdef USE_XAA
-    if (!info->useEXA && !hasDRI && !RADEONSetupMemXAA(scrnIndex, pScreen))
+    if (!info->useEXA && !hasDRI && !RADEONSetupMemXAA(pScreen))
 	return FALSE;
 #endif
 
@@ -3665,9 +3663,9 @@ Bool RADEONScreenInit(int scrnIndex, Scr
 	int  maxy        = info->FbMapSize / width_bytes;
 
 	if (maxy <= pScrn->virtualY * 3) {
-	    xf86DrvMsg(scrnIndex, X_ERROR,
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "Static buffer allocation failed.  Disabling DRI.\n");
-	    xf86DrvMsg(scrnIndex, X_ERROR,
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "At least %d kB of video memory needed at this "
 		       "resolution and depth.\n",
 		       (pScrn->displayWidth * pScrn->virtualY *
@@ -3817,16 +3815,16 @@ Bool RADEONScreenInit(int scrnIndex, Scr
 	xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
 		       "Initializing Acceleration\n");
 	if (RADEONAccelInit(pScreen)) {
-	    xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n");
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n");
 	    info->accelOn = TRUE;
 	} else {
-	    xf86DrvMsg(scrnIndex, X_ERROR,
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "Acceleration initialization failed\n");
-	    xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
 	    info->accelOn = FALSE;
 	}
     } else {
-	xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n");
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
 	info->accelOn = FALSE;
     }
 
@@ -3853,19 +3851,19 @@ Bool RADEONScreenInit(int scrnIndex, Scr
 
 		if (xf86QueryLargestOffscreenArea(pScreen, &width, &height,
 					      0, 0, 0)) {
-		    xf86DrvMsg(scrnIndex, X_INFO,
+		    xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 			       "Largest offscreen area available: %d x %d\n",
 			       width, height);
 		}
 	    }
 #endif /* USE_XAA */
 	} else {
-	    xf86DrvMsg(scrnIndex, X_ERROR,
+	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
 		       "Hardware cursor initialization failed\n");
-	    xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n");
+	    xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
 	}
     } else {
-	xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n");
+	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
     }
 
     /* DGA setup */
@@ -5937,7 +5935,7 @@ static void RADEONRestore(ScrnInfoPtr pS
 
 static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode)
 {
-    ScrnInfoPtr  pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr  pScrn = xf86ScreenToScrn(pScreen);
     Bool         unblank;
 
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -5955,9 +5953,9 @@ static Bool RADEONSaveScreen(ScreenPtr p
     return TRUE;
 }
 
-Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags)
+Bool RADEONSwitchMode(SWITCH_MODE_ARGS_DECL)
 {
-    ScrnInfoPtr    pScrn       = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     RADEONInfoPtr  info        = RADEONPTR(pScrn);
     Bool           tilingOld   = info->tilingEnabled;
     Bool           ret;
@@ -5994,9 +5992,9 @@ Bool RADEONSwitchMode(int scrnIndex, Dis
 
     if (info->tilingEnabled != tilingOld) {
 	/* need to redraw front buffer, I guess this can be considered a hack ? */
-	xf86EnableDisableFBAccess(scrnIndex, FALSE);
+	xf86EnableDisableFBAccess(arg, FALSE);
 	RADEONChangeSurfaces(pScrn);
-	xf86EnableDisableFBAccess(scrnIndex, TRUE);
+	xf86EnableDisableFBAccess(arg, TRUE);
 	/* xf86SetRootClip would do, but can't access that here */
     }
 
@@ -6051,10 +6049,10 @@ xf86ModeBandwidth(DisplayModePtr mode, i
 #endif
 
 /* Used to disallow modes that are not supported by the hardware */
-ModeStatus RADEONValidMode(int scrnIndex, DisplayModePtr mode,
+ModeStatus RADEONValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
                                      Bool verbose, int flag)
 {
-    ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     RADEONInfoPtr info = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
 
@@ -6158,7 +6156,7 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
         /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
 	 *** pageflipping!
 	 ***/
-	pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]);
+	pSAREAPriv = DRIGetSAREAPrivate(xf86ScrnToScreen(pScrn));
 	/* can't get at sarea in a semi-sane way? */
 	pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
 
@@ -6189,9 +6187,9 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
     OUTREG(reg, Base);
 }
 
-void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags)
+void RADEONAdjustFrame(ADJUST_FRAME_ARGS_DECL)
 {
-    ScrnInfoPtr    pScrn      = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     RADEONInfoPtr  info       = RADEONPTR(pScrn);
     RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
     xf86CrtcConfigPtr	config = XF86_CRTC_CONFIG_PTR(pScrn);
@@ -6227,9 +6225,9 @@ void RADEONAdjustFrame(int scrnIndex, in
 /* Called when VT switching back to the X server.  Reinitialize the
  * video mode.
  */
-Bool RADEONEnterVT(int scrnIndex, int flags)
+Bool RADEONEnterVT(VT_FUNC_ARGS_DECL)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
     int i;
@@ -6327,9 +6325,9 @@ Bool RADEONEnterVT(int scrnIndex, int fl
 /* Called when VT switching away from the X server.  Restore the
  * original text mode.
  */
-void RADEONLeaveVT(int scrnIndex, int flags)
+void RADEONLeaveVT(VT_FUNC_ARGS_DECL)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
     int i;
@@ -6414,9 +6412,9 @@ void RADEONLeaveVT(int scrnIndex, int fl
  * text mode, unmap video memory, and unwrap and call the saved
  * CloseScreen function.
  */
-static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen)
+static Bool RADEONCloseScreen(CLOSE_SCREEN_ARGS_DECL)
 {
-    ScrnInfoPtr    pScrn = xf86Screens[scrnIndex];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
     int i;
@@ -6499,12 +6497,12 @@ static Bool RADEONCloseScreen(int scrnIn
 
     pScreen->BlockHandler = info->BlockHandler;
     pScreen->CloseScreen = info->CloseScreen;
-    return (*pScreen->CloseScreen)(scrnIndex, pScreen);
+    return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
 }
 
-void RADEONFreeScreen(int scrnIndex, int flags)
+void RADEONFreeScreen(FREE_SCREEN_ARGS_DECL)
 {
-    ScrnInfoPtr  pScrn = xf86Screens[scrnIndex];
+    SCRN_INFO_PTR(arg);
     RADEONInfoPtr  info  = RADEONPTR(pScrn);
     
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c:1.3 xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c:1.4
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c:1.3	Sun Jun  3 16:42:23 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c	Sun Sep 23 20:06:03 2012
@@ -811,7 +811,7 @@ static void radeon_unload_bicubic_textur
 XF86VideoAdaptorPtr
 RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
 {
-    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     RADEONInfoPtr    info = RADEONPTR(pScrn);
     RADEONPortPrivPtr pPortPriv;
     XF86VideoAdaptorPtr adapt;

Reply via email to