Sun Sep 23 20:06:03 2012 UTC ()
merge xf86-video-ati 6.14.6


(veego)
diff -r1.4 -r1.5 xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c
diff -r1.4 -r1.5 xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c
diff -r1.2 -r1.3 xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c
diff -r1.6 -r1.7 xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c
diff -r1.8 -r1.9 xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c
diff -r1.8 -r1.9 xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c
diff -r1.11 -r1.12 xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c
diff -r1.3 -r1.4 xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c

cvs diff -r1.4 -r1.5 xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c 2010/07/17 06:34:13 1.4
+++ xsrc/external/mit/xf86-video-ati/dist/src/legacy_crtc.c 2012/09/23 20:06:02 1.5
@@ -844,27 +844,27 @@ RADEONInitCrtcBase(xf86CrtcPtr crtc, RAD @@ -844,27 +844,27 @@ RADEONInitCrtcBase(xf86CrtcPtr crtc, RAD
844 Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB; 844 Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB;
845 } 845 }
846 846
847 Base &= ~7; /* 3 lower bits are always 0 */ 847 Base &= ~7; /* 3 lower bits are always 0 */
848 848
849 849
850#ifdef XF86DRI 850#ifdef XF86DRI
851 if (info->directRenderingInited) { 851 if (info->directRenderingInited) {
852 /* note cannot use pScrn->pScreen since this is unitialized when called from 852 /* note cannot use pScrn->pScreen since this is unitialized when called from
853 RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */ 853 RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */
854 /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for 854 /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
855 *** pageflipping! 855 *** pageflipping!
856 ***/ 856 ***/
857 pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]); 857 pSAREAPriv = DRIGetSAREAPrivate(xf86ScrnToScreen(pScrn));
858 /* can't get at sarea in a semi-sane way? */ 858 /* can't get at sarea in a semi-sane way? */
859 pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec)); 859 pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
860 860
861 pSAREA->frame.x = (Base / info->CurrentLayout.pixel_bytes) 861 pSAREA->frame.x = (Base / info->CurrentLayout.pixel_bytes)
862 % info->CurrentLayout.displayWidth; 862 % info->CurrentLayout.displayWidth;
863 pSAREA->frame.y = (Base / info->CurrentLayout.pixel_bytes) 863 pSAREA->frame.y = (Base / info->CurrentLayout.pixel_bytes)
864 / info->CurrentLayout.displayWidth; 864 / info->CurrentLayout.displayWidth;
865 pSAREA->frame.width = pScrn->frameX1 - x + 1; 865 pSAREA->frame.width = pScrn->frameX1 - x + 1;
866 pSAREA->frame.height = pScrn->frameY1 - y + 1; 866 pSAREA->frame.height = pScrn->frameY1 - y + 1;
867 867
868 if (pSAREAPriv->pfCurrentPage == 1) { 868 if (pSAREAPriv->pfCurrentPage == 1) {
869 Base += info->dri->backOffset - info->dri->frontOffset; 869 Base += info->dri->backOffset - info->dri->frontOffset;
870 } 870 }
@@ -1065,27 +1065,27 @@ RADEONInitCrtc2Base(xf86CrtcPtr crtc, RA @@ -1065,27 +1065,27 @@ RADEONInitCrtc2Base(xf86CrtcPtr crtc, RA
1065 if (crtc->rotatedData != NULL) { 1065 if (crtc->rotatedData != NULL) {
1066 Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB; 1066 Base = pScrn->fbOffset + (char *)crtc->rotatedData - (char *)info->FB;
1067 } 1067 }
1068 1068
1069 Base &= ~7; /* 3 lower bits are always 0 */ 1069 Base &= ~7; /* 3 lower bits are always 0 */
1070 1070
1071#ifdef XF86DRI 1071#ifdef XF86DRI
1072 if (info->directRenderingInited) { 1072 if (info->directRenderingInited) {
1073 /* note cannot use pScrn->pScreen since this is unitialized when called from 1073 /* note cannot use pScrn->pScreen since this is unitialized when called from
1074 RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */ 1074 RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */
1075 /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for 1075 /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
1076 *** pageflipping! 1076 *** pageflipping!
1077 ***/ 1077 ***/
1078 pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]); 1078 pSAREAPriv = DRIGetSAREAPrivate(xf86ScrnToScreen(pScrn));
1079 /* can't get at sarea in a semi-sane way? */ 1079 /* can't get at sarea in a semi-sane way? */
1080 pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec)); 1080 pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
1081 1081
1082 pSAREAPriv->crtc2_base = Base; 1082 pSAREAPriv->crtc2_base = Base;
1083 1083
1084 if (pSAREAPriv->pfCurrentPage == 1) { 1084 if (pSAREAPriv->pfCurrentPage == 1) {
1085 Base += info->dri->backOffset - info->dri->frontOffset; 1085 Base += info->dri->backOffset - info->dri->frontOffset;
1086 } 1086 }
1087 } 1087 }
1088#endif 1088#endif
1089 save->crtc2_offset = Base; 1089 save->crtc2_offset = Base;
1090 1090
1091} 1091}
@@ -1876,25 +1876,25 @@ legacy_crtc_mode_set(xf86CrtcPtr crtc, D @@ -1876,25 +1876,25 @@ legacy_crtc_mode_set(xf86CrtcPtr crtc, D
1876 /* pixclks_cntl handles tv-out clock routing */ 1876 /* pixclks_cntl handles tv-out clock routing */
1877 if (update_tv_routing) 1877 if (update_tv_routing)
1878 radeon_update_tv_routing(pScrn, info->ModeReg); 1878 radeon_update_tv_routing(pScrn, info->ModeReg);
1879 1879
1880 if (info->DispPriority) 1880 if (info->DispPriority)
1881 RADEONInitDispBandwidth(pScrn); 1881 RADEONInitDispBandwidth(pScrn);
1882 1882
1883 radeon_crtc->initialized = TRUE; 1883 radeon_crtc->initialized = TRUE;
1884 1884
1885 if (tilingChanged) { 1885 if (tilingChanged) {
1886 /* need to redraw front buffer, I guess this can be considered a hack ? */ 1886 /* need to redraw front buffer, I guess this can be considered a hack ? */
1887 /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */ 1887 /* if this is called during ScreenInit() we don't have pScrn->pScreen yet */
1888 if (pScrn->pScreen) 1888 if (pScrn->pScreen)
1889 xf86EnableDisableFBAccess(pScrn->scrnIndex, FALSE); 1889 xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), FALSE);
1890 RADEONChangeSurfaces(pScrn); 1890 RADEONChangeSurfaces(pScrn);
1891 if (pScrn->pScreen) 1891 if (pScrn->pScreen)
1892 xf86EnableDisableFBAccess(pScrn->scrnIndex, TRUE); 1892 xf86EnableDisableFBAccess(XF86_ENABLEDISABLEFB_ARG(pScrn), TRUE);
1893 /* xf86SetRootClip would do, but can't access that here */ 1893 /* xf86SetRootClip would do, but can't access that here */
1894 } 1894 }
1895 1895
1896 /* reset ecp_div for Xv */ 1896 /* reset ecp_div for Xv */
1897 info->ecp_div = -1; 1897 info->ecp_div = -1;
1898 1898
1899} 1899}
1900 1900

cvs diff -r1.4 -r1.5 xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c 2012/06/03 16:42:22 1.4
+++ xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c 2012/09/23 20:06:02 1.5
@@ -158,27 +158,27 @@ R600SetAccelState(ScrnInfoPtr pScrn, @@ -158,27 +158,27 @@ R600SetAccelState(ScrnInfoPtr pScrn,
158 { 158 {
159 accel_state->vs_mc_addr = info->fbLocation + pScrn->fbOffset + accel_state->shaders->offset + 159 accel_state->vs_mc_addr = info->fbLocation + pScrn->fbOffset + accel_state->shaders->offset +
160 vs_offset; 160 vs_offset;
161 accel_state->ps_mc_addr = info->fbLocation + pScrn->fbOffset + accel_state->shaders->offset + 161 accel_state->ps_mc_addr = info->fbLocation + pScrn->fbOffset + accel_state->shaders->offset +
162 ps_offset; 162 ps_offset;
163 } 163 }
164 164
165 return TRUE; 165 return TRUE;
166} 166}
167 167
168static Bool 168static Bool
169R600PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg) 169R600PrepareSolid(PixmapPtr pPix, int alu, Pixel pm, Pixel fg)
170{ 170{
171 ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 171 ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
172 RADEONInfoPtr info = RADEONPTR(pScrn); 172 RADEONInfoPtr info = RADEONPTR(pScrn);
173 struct radeon_accel_state *accel_state = info->accel_state; 173 struct radeon_accel_state *accel_state = info->accel_state;
174 cb_config_t cb_conf; 174 cb_config_t cb_conf;
175 shader_config_t vs_conf, ps_conf; 175 shader_config_t vs_conf, ps_conf;
176 uint32_t a, r, g, b; 176 uint32_t a, r, g, b;
177 float ps_alu_consts[4]; 177 float ps_alu_consts[4];
178 struct r600_accel_object dst; 178 struct r600_accel_object dst;
179 179
180 if (!RADEONCheckBPP(pPix->drawable.bitsPerPixel)) 180 if (!RADEONCheckBPP(pPix->drawable.bitsPerPixel))
181 RADEON_FALLBACK(("R600CheckDatatype failed\n")); 181 RADEON_FALLBACK(("R600CheckDatatype failed\n"));
182 if (!RADEONValidPM(pm, pPix->drawable.bitsPerPixel)) 182 if (!RADEONValidPM(pm, pPix->drawable.bitsPerPixel))
183 RADEON_FALLBACK(("invalid planemask\n")); 183 RADEON_FALLBACK(("invalid planemask\n"));
184 184
@@ -313,43 +313,43 @@ R600PrepareSolid(PixmapPtr pPix, int alu @@ -313,43 +313,43 @@ R600PrepareSolid(PixmapPtr pPix, int alu
313 313
314 if (accel_state->vsync) 314 if (accel_state->vsync)
315 RADEONVlineHelperClear(pScrn); 315 RADEONVlineHelperClear(pScrn);
316 316
317 accel_state->dst_pix = pPix; 317 accel_state->dst_pix = pPix;
318 accel_state->fg = fg; 318 accel_state->fg = fg;
319 319
320 return TRUE; 320 return TRUE;
321} 321}
322 322
323static void 323static void
324R600DoneSolid(PixmapPtr pPix) 324R600DoneSolid(PixmapPtr pPix)
325{ 325{
326 ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 326 ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
327 RADEONInfoPtr info = RADEONPTR(pScrn); 327 RADEONInfoPtr info = RADEONPTR(pScrn);
328 struct radeon_accel_state *accel_state = info->accel_state; 328 struct radeon_accel_state *accel_state = info->accel_state;
329 329
330 if (accel_state->vsync) 330 if (accel_state->vsync)
331 r600_cp_wait_vline_sync(pScrn, accel_state->ib, pPix, 331 r600_cp_wait_vline_sync(pScrn, accel_state->ib, pPix,
332 accel_state->vline_crtc, 332 accel_state->vline_crtc,
333 accel_state->vline_y1, 333 accel_state->vline_y1,
334 accel_state->vline_y2); 334 accel_state->vline_y2);
335 335
336 r600_finish_op(pScrn, 8); 336 r600_finish_op(pScrn, 8);
337} 337}
338 338
339static void 339static void
340R600Solid(PixmapPtr pPix, int x1, int y1, int x2, int y2) 340R600Solid(PixmapPtr pPix, int x1, int y1, int x2, int y2)
341{ 341{
342 ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 342 ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
343 RADEONInfoPtr info = RADEONPTR(pScrn); 343 RADEONInfoPtr info = RADEONPTR(pScrn);
344 struct radeon_accel_state *accel_state = info->accel_state; 344 struct radeon_accel_state *accel_state = info->accel_state;
345 float *vb; 345 float *vb;
346 346
347#ifdef XF86DRM_MODE 347#ifdef XF86DRM_MODE
348 if (info->cs && CS_FULL(info->cs)) { 348 if (info->cs && CS_FULL(info->cs)) {
349 R600DoneSolid(info->accel_state->dst_pix); 349 R600DoneSolid(info->accel_state->dst_pix);
350 radeon_cs_flush_indirect(pScrn); 350 radeon_cs_flush_indirect(pScrn);
351 R600PrepareSolid(accel_state->dst_pix, 351 R600PrepareSolid(accel_state->dst_pix,
352 accel_state->rop, 352 accel_state->rop,
353 accel_state->planemask, 353 accel_state->planemask,
354 accel_state->fg); 354 accel_state->fg);
355 } 355 }
@@ -507,27 +507,27 @@ R600DoPrepareCopy(ScrnInfoPtr pScrn) @@ -507,27 +507,27 @@ R600DoPrepareCopy(ScrnInfoPtr pScrn)
507 r600_set_spi(pScrn, accel_state->ib, (1 - 1), 1); 507 r600_set_spi(pScrn, accel_state->ib, (1 - 1), 1);
508 508
509} 509}
510 510
511static void 511static void
512R600DoCopy(ScrnInfoPtr pScrn) 512R600DoCopy(ScrnInfoPtr pScrn)
513{ 513{
514 r600_finish_op(pScrn, 16); 514 r600_finish_op(pScrn, 16);
515} 515}
516 516
517static void 517static void
518R600DoCopyVline(PixmapPtr pPix) 518R600DoCopyVline(PixmapPtr pPix)
519{ 519{
520 ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 520 ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
521 RADEONInfoPtr info = RADEONPTR(pScrn); 521 RADEONInfoPtr info = RADEONPTR(pScrn);
522 struct radeon_accel_state *accel_state = info->accel_state; 522 struct radeon_accel_state *accel_state = info->accel_state;
523 523
524 if (accel_state->vsync) 524 if (accel_state->vsync)
525 r600_cp_wait_vline_sync(pScrn, accel_state->ib, pPix, 525 r600_cp_wait_vline_sync(pScrn, accel_state->ib, pPix,
526 accel_state->vline_crtc, 526 accel_state->vline_crtc,
527 accel_state->vline_y1, 527 accel_state->vline_y1,
528 accel_state->vline_y2); 528 accel_state->vline_y2);
529 529
530 r600_finish_op(pScrn, 16); 530 r600_finish_op(pScrn, 16);
531} 531}
532 532
533static void 533static void
@@ -556,27 +556,27 @@ R600AppendCopyVertex(ScrnInfoPtr pScrn, @@ -556,27 +556,27 @@ R600AppendCopyVertex(ScrnInfoPtr pScrn,
556 vb[9] = (float)(dstY + h); 556 vb[9] = (float)(dstY + h);
557 vb[10] = (float)(srcX + w); 557 vb[10] = (float)(srcX + w);
558 vb[11] = (float)(srcY + h); 558 vb[11] = (float)(srcY + h);
559 559
560 radeon_vbo_commit(pScrn, &accel_state->vbo); 560 radeon_vbo_commit(pScrn, &accel_state->vbo);
561} 561}
562 562
563static Bool 563static Bool
564R600PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst, 564R600PrepareCopy(PixmapPtr pSrc, PixmapPtr pDst,
565 int xdir, int ydir, 565 int xdir, int ydir,
566 int rop, 566 int rop,
567 Pixel planemask) 567 Pixel planemask)
568{ 568{
569 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 569 ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
570 RADEONInfoPtr info = RADEONPTR(pScrn); 570 RADEONInfoPtr info = RADEONPTR(pScrn);
571 struct radeon_accel_state *accel_state = info->accel_state; 571 struct radeon_accel_state *accel_state = info->accel_state;
572 struct r600_accel_object src_obj, dst_obj; 572 struct r600_accel_object src_obj, dst_obj;
573 573
574 if (!RADEONCheckBPP(pSrc->drawable.bitsPerPixel)) 574 if (!RADEONCheckBPP(pSrc->drawable.bitsPerPixel))
575 RADEON_FALLBACK(("R600CheckDatatype src failed\n")); 575 RADEON_FALLBACK(("R600CheckDatatype src failed\n"));
576 if (!RADEONCheckBPP(pDst->drawable.bitsPerPixel)) 576 if (!RADEONCheckBPP(pDst->drawable.bitsPerPixel))
577 RADEON_FALLBACK(("R600CheckDatatype dst failed\n")); 577 RADEON_FALLBACK(("R600CheckDatatype dst failed\n"));
578 if (!RADEONValidPM(planemask, pDst->drawable.bitsPerPixel)) 578 if (!RADEONValidPM(planemask, pDst->drawable.bitsPerPixel))
579 RADEON_FALLBACK(("Invalid planemask\n")); 579 RADEON_FALLBACK(("Invalid planemask\n"));
580 580
581 dst_obj.pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8); 581 dst_obj.pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8);
582 src_obj.pitch = exaGetPixmapPitch(pSrc) / (pSrc->drawable.bitsPerPixel / 8); 582 src_obj.pitch = exaGetPixmapPitch(pSrc) / (pSrc->drawable.bitsPerPixel / 8);
@@ -671,48 +671,48 @@ R600PrepareCopy(PixmapPtr pSrc, Pixmap @@ -671,48 +671,48 @@ R600PrepareCopy(PixmapPtr pSrc, Pixmap
671 RADEONVlineHelperClear(pScrn); 671 RADEONVlineHelperClear(pScrn);
672 672
673 accel_state->dst_pix = pDst; 673 accel_state->dst_pix = pDst;
674 accel_state->src_pix = pSrc; 674 accel_state->src_pix = pSrc;
675 accel_state->xdir = xdir; 675 accel_state->xdir = xdir;
676 accel_state->ydir = ydir; 676 accel_state->ydir = ydir;
677 677
678 return TRUE; 678 return TRUE;
679} 679}
680 680
681static void 681static void
682R600DoneCopy(PixmapPtr pDst) 682R600DoneCopy(PixmapPtr pDst)
683{ 683{
684 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 684 ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
685 RADEONInfoPtr info = RADEONPTR(pScrn); 685 RADEONInfoPtr info = RADEONPTR(pScrn);
686 struct radeon_accel_state *accel_state = info->accel_state; 686 struct radeon_accel_state *accel_state = info->accel_state;
687 687
688 if (!accel_state->same_surface) 688 if (!accel_state->same_surface)
689 R600DoCopyVline(pDst); 689 R600DoCopyVline(pDst);
690 690
691 if (accel_state->copy_area) { 691 if (accel_state->copy_area) {
692 if (!info->cs) 692 if (!info->cs)
693 exaOffscreenFree(pDst->drawable.pScreen, accel_state->copy_area); 693 exaOffscreenFree(pDst->drawable.pScreen, accel_state->copy_area);
694 accel_state->copy_area = NULL; 694 accel_state->copy_area = NULL;
695 } 695 }
696 696
697} 697}
698 698
699static void 699static void
700R600Copy(PixmapPtr pDst, 700R600Copy(PixmapPtr pDst,
701 int srcX, int srcY, 701 int srcX, int srcY,
702 int dstX, int dstY, 702 int dstX, int dstY,
703 int w, int h) 703 int w, int h)
704{ 704{
705 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 705 ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
706 RADEONInfoPtr info = RADEONPTR(pScrn); 706 RADEONInfoPtr info = RADEONPTR(pScrn);
707 struct radeon_accel_state *accel_state = info->accel_state; 707 struct radeon_accel_state *accel_state = info->accel_state;
708 708
709 if (accel_state->same_surface && (srcX == dstX) && (srcY == dstY)) 709 if (accel_state->same_surface && (srcX == dstX) && (srcY == dstY))
710 return; 710 return;
711 711
712#ifdef XF86DRM_MODE 712#ifdef XF86DRM_MODE
713 if (info->cs && CS_FULL(info->cs)) { 713 if (info->cs && CS_FULL(info->cs)) {
714 R600DoneCopy(info->accel_state->dst_pix); 714 R600DoneCopy(info->accel_state->dst_pix);
715 radeon_cs_flush_indirect(pScrn); 715 radeon_cs_flush_indirect(pScrn);
716 R600PrepareCopy(accel_state->src_pix, 716 R600PrepareCopy(accel_state->src_pix,
717 accel_state->dst_pix, 717 accel_state->dst_pix,
718 accel_state->xdir, 718 accel_state->xdir,
@@ -891,37 +891,28 @@ static Bool R600GetDestFormat(PicturePtr @@ -891,37 +891,28 @@ static Bool R600GetDestFormat(PicturePtr
891 break; 891 break;
892 default: 892 default:
893 RADEON_FALLBACK(("Unsupported dest format 0x%x\n", 893 RADEON_FALLBACK(("Unsupported dest format 0x%x\n",
894 (int)pDstPicture->format)); 894 (int)pDstPicture->format));
895 } 895 }
896 return TRUE; 896 return TRUE;
897} 897}
898 898
899static Bool R600CheckCompositeTexture(PicturePtr pPict, 899static Bool R600CheckCompositeTexture(PicturePtr pPict,
900 PicturePtr pDstPict, 900 PicturePtr pDstPict,
901 int op, 901 int op,
902 int unit) 902 int unit)
903{ 903{
904 int w = pPict->pDrawable->width; 
905 int h = pPict->pDrawable->height; 
906 unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; 904 unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
907 unsigned int i; 905 unsigned int i;
908 int max_tex_w, max_tex_h; 
909 
910 max_tex_w = 8192; 
911 max_tex_h = 8192; 
912 
913 if ((w > max_tex_w) || (h > max_tex_h)) 
914 RADEON_FALLBACK(("Picture w/h too large (%dx%d)\n", w, h)); 
915 906
916 for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) { 907 for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) {
917 if (R600TexFormats[i].fmt == pPict->format) 908 if (R600TexFormats[i].fmt == pPict->format)
918 break; 909 break;
919 } 910 }
920 if (i == sizeof(R600TexFormats) / sizeof(R600TexFormats[0])) 911 if (i == sizeof(R600TexFormats) / sizeof(R600TexFormats[0]))
921 RADEON_FALLBACK(("Unsupported picture format 0x%x\n", 912 RADEON_FALLBACK(("Unsupported picture format 0x%x\n",
922 (int)pPict->format)); 913 (int)pPict->format));
923 914
924 if (pPict->filter != PictFilterNearest && 915 if (pPict->filter != PictFilterNearest &&
925 pPict->filter != PictFilterBilinear) 916 pPict->filter != PictFilterBilinear)
926 RADEON_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter)); 917 RADEON_FALLBACK(("Unsupported filter 0x%x\n", pPict->filter));
927 918
@@ -938,50 +929,55 @@ static Bool R600CheckCompositeTexture(Pi @@ -938,50 +929,55 @@ static Bool R600CheckCompositeTexture(Pi
938 if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0))) 929 if (!(((op == PictOpSrc) || (op == PictOpClear)) && (PICT_FORMAT_A(pDstPict->format) == 0)))
939 RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n")); 930 RADEON_FALLBACK(("REPEAT_NONE unsupported for transformed xRGB source\n"));
940 } 931 }
941 932
942 if (!radeon_transform_is_affine_or_scaled(pPict->transform)) 933 if (!radeon_transform_is_affine_or_scaled(pPict->transform))
943 RADEON_FALLBACK(("non-affine transforms not supported\n")); 934 RADEON_FALLBACK(("non-affine transforms not supported\n"));
944 935
945 return TRUE; 936 return TRUE;
946} 937}
947 938
948static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix, 939static Bool R600TextureSetup(PicturePtr pPict, PixmapPtr pPix,
949 int unit) 940 int unit)
950{ 941{
951 ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 942 ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
952 RADEONInfoPtr info = RADEONPTR(pScrn); 943 RADEONInfoPtr info = RADEONPTR(pScrn);
953 struct radeon_accel_state *accel_state = info->accel_state; 944 struct radeon_accel_state *accel_state = info->accel_state;
954 int w = pPict->pDrawable->width; 945 unsigned int repeatType;
955 int h = pPict->pDrawable->height; 
956 unsigned int repeatType = pPict->repeat ? pPict->repeatType : RepeatNone; 
957 unsigned int i; 946 unsigned int i;
958 tex_resource_t tex_res; 947 tex_resource_t tex_res;
959 tex_sampler_t tex_samp; 948 tex_sampler_t tex_samp;
960 int pix_r, pix_g, pix_b, pix_a; 949 int pix_r, pix_g, pix_b, pix_a;
961 float vs_alu_consts[8]; 950 float vs_alu_consts[8];
962 951
963 CLEAR (tex_res); 952 CLEAR (tex_res);
964 CLEAR (tex_samp); 953 CLEAR (tex_samp);
965 954
966 for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) { 955 for (i = 0; i < sizeof(R600TexFormats) / sizeof(R600TexFormats[0]); i++) {
967 if (R600TexFormats[i].fmt == pPict->format) 956 if (R600TexFormats[i].fmt == pPict->format)
968 break; 957 break;
969 } 958 }
970 959
971 /* Texture */ 960 /* Texture */
 961 if (pPict->pDrawable) {
 962 tex_res.w = pPict->pDrawable->width;
 963 tex_res.h = pPict->pDrawable->height;
 964 repeatType = pPict->repeat ? pPict->repeatType : RepeatNone;
 965 } else {
 966 tex_res.w = 1;
 967 tex_res.h = 1;
 968 repeatType = RepeatNormal;
 969 }
972 tex_res.id = unit; 970 tex_res.id = unit;
973 tex_res.w = w; 
974 tex_res.h = h; 
975 tex_res.pitch = accel_state->src_obj[unit].pitch; 971 tex_res.pitch = accel_state->src_obj[unit].pitch;
976 tex_res.depth = 0; 972 tex_res.depth = 0;
977 tex_res.dim = SQ_TEX_DIM_2D; 973 tex_res.dim = SQ_TEX_DIM_2D;
978 tex_res.base = accel_state->src_obj[unit].offset; 974 tex_res.base = accel_state->src_obj[unit].offset;
979 tex_res.mip_base = accel_state->src_obj[unit].offset; 975 tex_res.mip_base = accel_state->src_obj[unit].offset;
980 tex_res.size = accel_state->src_size[unit]; 976 tex_res.size = accel_state->src_size[unit];
981 tex_res.format = R600TexFormats[i].card_fmt; 977 tex_res.format = R600TexFormats[i].card_fmt;
982 tex_res.bo = accel_state->src_obj[unit].bo; 978 tex_res.bo = accel_state->src_obj[unit].bo;
983 tex_res.mip_bo = accel_state->src_obj[unit].bo; 979 tex_res.mip_bo = accel_state->src_obj[unit].bo;
984#ifdef XF86DRM_MODE 980#ifdef XF86DRM_MODE
985 tex_res.surface = accel_state->src_obj[unit].surface; 981 tex_res.surface = accel_state->src_obj[unit].surface;
986#endif 982#endif
987 tex_res.request_size = 1; 983 tex_res.request_size = 1;
@@ -1160,179 +1156,189 @@ static Bool R600TextureSetup(PicturePtr  @@ -1160,179 +1156,189 @@ static Bool R600TextureSetup(PicturePtr
1160 1156
1161 tex_samp.clamp_z = SQ_TEX_WRAP; 1157 tex_samp.clamp_z = SQ_TEX_WRAP;
1162 tex_samp.z_filter = SQ_TEX_Z_FILTER_NONE; 1158 tex_samp.z_filter = SQ_TEX_Z_FILTER_NONE;
1163 tex_samp.mip_filter = 0; /* no mipmap */ 1159 tex_samp.mip_filter = 0; /* no mipmap */
1164 r600_set_tex_sampler(pScrn, accel_state->ib, &tex_samp); 1160 r600_set_tex_sampler(pScrn, accel_state->ib, &tex_samp);
1165 1161
1166 if (pPict->transform != 0) { 1162 if (pPict->transform != 0) {
1167 accel_state->is_transform[unit] = TRUE; 1163 accel_state->is_transform[unit] = TRUE;
1168 accel_state->transform[unit] = pPict->transform; 1164 accel_state->transform[unit] = pPict->transform;
1169 1165
1170 vs_alu_consts[0] = xFixedToFloat(pPict->transform->matrix[0][0]); 1166 vs_alu_consts[0] = xFixedToFloat(pPict->transform->matrix[0][0]);
1171 vs_alu_consts[1] = xFixedToFloat(pPict->transform->matrix[0][1]); 1167 vs_alu_consts[1] = xFixedToFloat(pPict->transform->matrix[0][1]);
1172 vs_alu_consts[2] = xFixedToFloat(pPict->transform->matrix[0][2]); 1168 vs_alu_consts[2] = xFixedToFloat(pPict->transform->matrix[0][2]);
1173 vs_alu_consts[3] = 1.0 / w; 1169 vs_alu_consts[3] = 1.0 / tex_res.w;
1174 1170
1175 vs_alu_consts[4] = xFixedToFloat(pPict->transform->matrix[1][0]); 1171 vs_alu_consts[4] = xFixedToFloat(pPict->transform->matrix[1][0]);
1176 vs_alu_consts[5] = xFixedToFloat(pPict->transform->matrix[1][1]); 1172 vs_alu_consts[5] = xFixedToFloat(pPict->transform->matrix[1][1]);
1177 vs_alu_consts[6] = xFixedToFloat(pPict->transform->matrix[1][2]); 1173 vs_alu_consts[6] = xFixedToFloat(pPict->transform->matrix[1][2]);
1178 vs_alu_consts[7] = 1.0 / h; 1174 vs_alu_consts[7] = 1.0 / tex_res.h;
1179 } else { 1175 } else {
1180 accel_state->is_transform[unit] = FALSE; 1176 accel_state->is_transform[unit] = FALSE;
1181 1177
1182 vs_alu_consts[0] = 1.0; 1178 vs_alu_consts[0] = 1.0;
1183 vs_alu_consts[1] = 0.0; 1179 vs_alu_consts[1] = 0.0;
1184 vs_alu_consts[2] = 0.0; 1180 vs_alu_consts[2] = 0.0;
1185 vs_alu_consts[3] = 1.0 / w; 1181 vs_alu_consts[3] = 1.0 / tex_res.w;
1186 1182
1187 vs_alu_consts[4] = 0.0; 1183 vs_alu_consts[4] = 0.0;
1188 vs_alu_consts[5] = 1.0; 1184 vs_alu_consts[5] = 1.0;
1189 vs_alu_consts[6] = 0.0; 1185 vs_alu_consts[6] = 0.0;
1190 vs_alu_consts[7] = 1.0 / h; 1186 vs_alu_consts[7] = 1.0 / tex_res.h;
1191 } 1187 }
1192 1188
1193 /* VS alu constants */ 1189 /* VS alu constants */
1194 r600_set_alu_consts(pScrn, accel_state->ib, SQ_ALU_CONSTANT_vs + (unit * 2), 1190 r600_set_alu_consts(pScrn, accel_state->ib, SQ_ALU_CONSTANT_vs + (unit * 2),
1195 sizeof(vs_alu_consts) / SQ_ALU_CONSTANT_offset, vs_alu_consts); 1191 sizeof(vs_alu_consts) / SQ_ALU_CONSTANT_offset, vs_alu_consts);
1196 1192
1197 return TRUE; 1193 return TRUE;
1198} 1194}
1199 1195
1200static Bool R600CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, 1196static Bool R600CheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture,
1201 PicturePtr pDstPicture) 1197 PicturePtr pDstPicture)
1202{ 1198{
1203 uint32_t tmp1; 1199 uint32_t tmp1;
1204 PixmapPtr pSrcPixmap, pDstPixmap; 1200 PixmapPtr pSrcPixmap, pDstPixmap;
1205 int max_tex_w, max_tex_h, max_dst_w, max_dst_h; 
1206 1201
1207 /* Check for unsupported compositing operations. */ 1202 /* Check for unsupported compositing operations. */
1208 if (op >= (int) (sizeof(R600BlendOp) / sizeof(R600BlendOp[0]))) 1203 if (op >= (int) (sizeof(R600BlendOp) / sizeof(R600BlendOp[0])))
1209 RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op)); 1204 RADEON_FALLBACK(("Unsupported Composite op 0x%x\n", op));
1210 1205
1211 if (!pSrcPicture->pDrawable) 1206 if (pSrcPicture->pDrawable) {
1212 RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n")); 1207 pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable);
1213 1208
1214 pSrcPixmap = RADEONGetDrawablePixmap(pSrcPicture->pDrawable); 1209 if (pSrcPixmap->drawable.width >= 8192 ||
 1210 pSrcPixmap->drawable.height >= 8192) {
 1211 RADEON_FALLBACK(("Source w/h too large (%d,%d).\n",
 1212 pSrcPixmap->drawable.width,
 1213 pSrcPixmap->drawable.height));
 1214 }
1215 1215
1216 max_tex_w = 8192; 1216 if (!R600CheckCompositeTexture(pSrcPicture, pDstPicture, op, 0))
1217 max_tex_h = 8192; 1217 return FALSE;
1218 max_dst_w = 8192; 1218 } else if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill)
1219 max_dst_h = 8192; 1219 RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
1220 
1221 if (pSrcPixmap->drawable.width >= max_tex_w || 
1222 pSrcPixmap->drawable.height >= max_tex_h) { 
1223 RADEON_FALLBACK(("Source w/h too large (%d,%d).\n", 
1224 pSrcPixmap->drawable.width, 
1225 pSrcPixmap->drawable.height)); 
1226 } 
1227 1220
1228 pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable); 1221 pDstPixmap = RADEONGetDrawablePixmap(pDstPicture->pDrawable);
1229 1222
1230 if (pDstPixmap->drawable.width >= max_dst_w || 1223 if (pDstPixmap->drawable.width >= 8192 ||
1231 pDstPixmap->drawable.height >= max_dst_h) { 1224 pDstPixmap->drawable.height >= 8192) {
1232 RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n", 1225 RADEON_FALLBACK(("Dest w/h too large (%d,%d).\n",
1233 pDstPixmap->drawable.width, 1226 pDstPixmap->drawable.width,
1234 pDstPixmap->drawable.height)); 1227 pDstPixmap->drawable.height));
1235 } 1228 }
1236 1229
1237 if (pMaskPicture) { 1230 if (pMaskPicture) {
1238 PixmapPtr pMaskPixmap; 1231 PixmapPtr pMaskPixmap;
1239 1232
1240 if (!pMaskPicture->pDrawable) 1233 if (pMaskPicture->pDrawable) {
1241 RADEON_FALLBACK(("Solid or gradient pictures not supported yet\n")); 1234 pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable);
1242 1235
1243 pMaskPixmap = RADEONGetDrawablePixmap(pMaskPicture->pDrawable); 1236 if (pMaskPixmap->drawable.width >= 8192 ||
1244 1237 pMaskPixmap->drawable.height >= 8192) {
1245 if (pMaskPixmap->drawable.width >= max_tex_w || 1238 RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n",
1246 pMaskPixmap->drawable.height >= max_tex_h) { 1239 pMaskPixmap->drawable.width,
1247 RADEON_FALLBACK(("Mask w/h too large (%d,%d).\n", 1240 pMaskPixmap->drawable.height));
1248 pMaskPixmap->drawable.width, 1241 }
1249 pMaskPixmap->drawable.height)); 
1250 } 
1251 1242
1252 if (pMaskPicture->componentAlpha) { 1243 if (pMaskPicture->componentAlpha) {
1253 /* Check if it's component alpha that relies on a source alpha and 1244 /* Check if it's component alpha that relies on a source alpha and
1254 * on the source value. We can only get one of those into the 1245 * on the source value. We can only get one of those into the
1255 * single source value that we get to blend with. 1246 * single source value that we get to blend with.
1256 */ 1247 */
1257 if (R600BlendOp[op].src_alpha && 1248 if (R600BlendOp[op].src_alpha &&
1258 (R600BlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) != 1249 (R600BlendOp[op].blend_cntl & COLOR_SRCBLEND_mask) !=
1259 (BLEND_ZERO << COLOR_SRCBLEND_shift)) { 1250 (BLEND_ZERO << COLOR_SRCBLEND_shift)) {
1260 RADEON_FALLBACK(("Component alpha not supported with source " 1251 RADEON_FALLBACK(("Component alpha not supported with source "
1261 "alpha and source value blending.\n")); 1252 "alpha and source value blending.\n"));
 1253 }
1262 } 1254 }
1263 } 
1264 1255
1265 if (!R600CheckCompositeTexture(pMaskPicture, pDstPicture, op, 1)) 1256 if (!R600CheckCompositeTexture(pMaskPicture, pDstPicture, op, 1))
1266 return FALSE; 1257 return FALSE;
 1258 } else if (pMaskPicture->pSourcePict->type != SourcePictTypeSolidFill)
 1259 RADEON_FALLBACK(("Gradient pictures not supported yet\n"));
1267 } 1260 }
1268 1261
1269 if (!R600CheckCompositeTexture(pSrcPicture, pDstPicture, op, 0)) 
1270 return FALSE; 
1271 
1272 if (!R600GetDestFormat(pDstPicture, &tmp1)) 1262 if (!R600GetDestFormat(pDstPicture, &tmp1))
1273 return FALSE; 1263 return FALSE;
1274 1264
1275 return TRUE; 1265 return TRUE;
1276 1266
1277} 1267}
1278 1268
1279static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture, 1269static Bool R600PrepareComposite(int op, PicturePtr pSrcPicture,
1280 PicturePtr pMaskPicture, PicturePtr pDstPicture, 1270 PicturePtr pMaskPicture, PicturePtr pDstPicture,
1281 PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst) 1271 PixmapPtr pSrc, PixmapPtr pMask, PixmapPtr pDst)
1282{ 1272{
1283 ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; 1273 ScreenPtr pScreen = pDst->drawable.pScreen;
 1274 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1284 RADEONInfoPtr info = RADEONPTR(pScrn); 1275 RADEONInfoPtr info = RADEONPTR(pScrn);
1285 struct radeon_accel_state *accel_state = info->accel_state; 1276 struct radeon_accel_state *accel_state = info->accel_state;
1286 uint32_t dst_format; 1277 uint32_t dst_format;
1287 cb_config_t cb_conf; 1278 cb_config_t cb_conf;
1288 shader_config_t vs_conf, ps_conf; 1279 shader_config_t vs_conf, ps_conf;
1289 struct r600_accel_object src_obj, mask_obj, dst_obj; 1280 struct r600_accel_object src_obj, mask_obj, dst_obj;
1290 1281
1291 if (pDst->drawable.bitsPerPixel < 8 || pSrc->drawable.bitsPerPixel < 8) 1282 if (pDst->drawable.bitsPerPixel < 8 || (pSrc && pSrc->drawable.bitsPerPixel < 8))
1292 return FALSE; 1283 return FALSE;
1293 1284
 1285 if (!pSrc) {
 1286 pSrc = RADEONSolidPixmap(pScreen, pSrcPicture->pSourcePict->solidFill.color);
 1287 if (!pSrc)
 1288 RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
 1289 }
 1290
1294#if defined(XF86DRM_MODE) 1291#if defined(XF86DRM_MODE)
1295 if (info->cs) { 1292 if (info->cs) {
1296 src_obj.offset = 0; 1293 src_obj.offset = 0;
1297 dst_obj.offset = 0; 1294 dst_obj.offset = 0;
1298 src_obj.bo = radeon_get_pixmap_bo(pSrc); 
1299 dst_obj.bo = radeon_get_pixmap_bo(pDst); 1295 dst_obj.bo = radeon_get_pixmap_bo(pDst);
 1296 src_obj.bo = radeon_get_pixmap_bo(pSrc);
1300 dst_obj.tiling_flags = radeon_get_pixmap_tiling(pDst); 1297 dst_obj.tiling_flags = radeon_get_pixmap_tiling(pDst);
1301 src_obj.tiling_flags = radeon_get_pixmap_tiling(pSrc); 1298 src_obj.tiling_flags = radeon_get_pixmap_tiling(pSrc);
1302 dst_obj.surface = radeon_get_pixmap_surface(pDst); 1299 dst_obj.surface = radeon_get_pixmap_surface(pDst);
1303 src_obj.surface = radeon_get_pixmap_surface(pSrc); 1300 src_obj.surface = radeon_get_pixmap_surface(pSrc);
1304 } else 1301 } else
1305#endif 1302#endif
1306 { 1303 {
1307 src_obj.offset = exaGetPixmapOffset(pSrc) + info->fbLocation + pScrn->fbOffset; 1304 src_obj.offset = exaGetPixmapOffset(pSrc) + info->fbLocation + pScrn->fbOffset;
1308 dst_obj.offset = exaGetPixmapOffset(pDst) + info->fbLocation + pScrn->fbOffset; 1305 dst_obj.offset = exaGetPixmapOffset(pDst) + info->fbLocation + pScrn->fbOffset;
1309 src_obj.bo = NULL; 1306 src_obj.bo = NULL;
1310 dst_obj.bo = NULL; 1307 dst_obj.bo = NULL;
1311 } 1308 }
1312 src_obj.pitch = exaGetPixmapPitch(pSrc) / (pSrc->drawable.bitsPerPixel / 8); 1309 src_obj.pitch = exaGetPixmapPitch(pSrc) / (pSrc->drawable.bitsPerPixel / 8);
1313 dst_obj.pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8); 1310 dst_obj.pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8);
1314 1311
1315 src_obj.width = pSrc->drawable.width; 1312 src_obj.width = pSrc->drawable.width;
1316 src_obj.height = pSrc->drawable.height; 1313 src_obj.height = pSrc->drawable.height;
1317 src_obj.bpp = pSrc->drawable.bitsPerPixel; 1314 src_obj.bpp = pSrc->drawable.bitsPerPixel;
1318 src_obj.domain = RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT; 1315 src_obj.domain = RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT;
1319 1316
1320 dst_obj.width = pDst->drawable.width; 1317 dst_obj.width = pDst->drawable.width;
1321 dst_obj.height = pDst->drawable.height; 1318 dst_obj.height = pDst->drawable.height;
1322 dst_obj.bpp = pDst->drawable.bitsPerPixel; 1319 dst_obj.bpp = pDst->drawable.bitsPerPixel;
1323 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM; 1320 dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
1324 1321
1325 if (pMask) { 1322 if (pMaskPicture) {
 1323 if (!pMask) {
 1324 pMask = RADEONSolidPixmap(pScreen, pMaskPicture->pSourcePict->solidFill.color);
 1325 if (!pMask) {
 1326 if (!pSrcPicture->pDrawable)
 1327 pScreen->DestroyPixmap(pSrc);
 1328 RADEON_FALLBACK("Failed to create solid scratch pixmap\n");
 1329 }
 1330 }
 1331
1326#if defined(XF86DRM_MODE) 1332#if defined(XF86DRM_MODE)
1327 if (info->cs) { 1333 if (info->cs) {
1328 mask_obj.offset = 0; 1334 mask_obj.offset = 0;
1329 mask_obj.bo = radeon_get_pixmap_bo(pMask); 1335 mask_obj.bo = radeon_get_pixmap_bo(pMask);
1330 mask_obj.tiling_flags = radeon_get_pixmap_tiling(pMask); 1336 mask_obj.tiling_flags = radeon_get_pixmap_tiling(pMask);
1331 mask_obj.surface = radeon_get_pixmap_surface(pMask); 1337 mask_obj.surface = radeon_get_pixmap_surface(pMask);
1332 } else 1338 } else
1333#endif 1339#endif
1334 { 1340 {
1335 mask_obj.offset = exaGetPixmapOffset(pMask) + info->fbLocation + pScrn->fbOffset; 1341 mask_obj.offset = exaGetPixmapOffset(pMask) + info->fbLocation + pScrn->fbOffset;
1336 mask_obj.bo = NULL; 1342 mask_obj.bo = NULL;
1337 } 1343 }
1338 mask_obj.pitch = exaGetPixmapPitch(pMask) / (pMask->drawable.bitsPerPixel / 8); 1344 mask_obj.pitch = exaGetPixmapPitch(pMask) / (pMask->drawable.bitsPerPixel / 8);
@@ -1499,61 +1505,75 @@ static Bool R600PrepareComposite(int op, @@ -1499,61 +1505,75 @@ static Bool R600PrepareComposite(int op,
1499 if (accel_state->vsync) 1505 if (accel_state->vsync)
1500 RADEONVlineHelperClear(pScrn); 1506 RADEONVlineHelperClear(pScrn);
1501 1507
1502 accel_state->composite_op = op; 1508 accel_state->composite_op = op;
1503 accel_state->dst_pic = pDstPicture; 1509 accel_state->dst_pic = pDstPicture;
1504 accel_state->src_pic = pSrcPicture; 1510 accel_state->src_pic = pSrcPicture;
1505 accel_state->dst_pix = pDst; 1511 accel_state->dst_pix = pDst;
1506 accel_state->msk_pix = pMask; 1512 accel_state->msk_pix = pMask;
1507 accel_state->src_pix = pSrc; 1513 accel_state->src_pix = pSrc;
1508 1514
1509 return TRUE; 1515 return TRUE;
1510} 1516}
1511 1517
1512static void R600DoneComposite(PixmapPtr pDst) 1518static void R600FinishComposite(ScrnInfoPtr pScrn, PixmapPtr pDst,
 1519 struct radeon_accel_state *accel_state)
1513{ 1520{
1514 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 
1515 RADEONInfoPtr info = RADEONPTR(pScrn); 
1516 struct radeon_accel_state *accel_state = info->accel_state; 
1517 int vtx_size; 1521 int vtx_size;
1518 1522
1519 if (accel_state->vsync) 1523 if (accel_state->vsync)
1520 r600_cp_wait_vline_sync(pScrn, accel_state->ib, pDst, 1524 r600_cp_wait_vline_sync(pScrn, accel_state->ib, pDst,
1521 accel_state->vline_crtc, 1525 accel_state->vline_crtc,
1522 accel_state->vline_y1, 1526 accel_state->vline_y1,
1523 accel_state->vline_y2); 1527 accel_state->vline_y2);
1524 1528
1525 vtx_size = accel_state->msk_pic ? 24 : 16; 1529 vtx_size = accel_state->msk_pic ? 24 : 16;
1526 1530
1527 r600_finish_op(pScrn, vtx_size); 1531 r600_finish_op(pScrn, vtx_size);
1528} 1532}
1529 1533
 1534static void R600DoneComposite(PixmapPtr pDst)
 1535{
 1536 ScreenPtr pScreen = pDst->drawable.pScreen;
 1537 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
 1538 RADEONInfoPtr info = RADEONPTR(pScrn);
 1539 struct radeon_accel_state *accel_state = info->accel_state;
 1540
 1541 R600FinishComposite(pScrn, pDst, accel_state);
 1542
 1543 if (!accel_state->src_pic->pDrawable)
 1544 pScreen->DestroyPixmap(accel_state->src_pix);
 1545
 1546 if (accel_state->msk_pic && !accel_state->msk_pic->pDrawable)
 1547 pScreen->DestroyPixmap(accel_state->msk_pix);
 1548}
 1549
1530static void R600Composite(PixmapPtr pDst, 1550static void R600Composite(PixmapPtr pDst,
1531 int srcX, int srcY, 1551 int srcX, int srcY,
1532 int maskX, int maskY, 1552 int maskX, int maskY,
1533 int dstX, int dstY, 1553 int dstX, int dstY,
1534 int w, int h) 1554 int w, int h)
1535{ 1555{
1536 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 1556 ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
1537 RADEONInfoPtr info = RADEONPTR(pScrn); 1557 RADEONInfoPtr info = RADEONPTR(pScrn);
1538 struct radeon_accel_state *accel_state = info->accel_state; 1558 struct radeon_accel_state *accel_state = info->accel_state;
1539 float *vb; 1559 float *vb;
1540 1560
1541 /* ErrorF("R600Composite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n", 1561 /* ErrorF("R600Composite (%d,%d) (%d,%d) (%d,%d) (%d,%d)\n",
1542 srcX, srcY, maskX, maskY,dstX, dstY, w, h); */ 1562 srcX, srcY, maskX, maskY,dstX, dstY, w, h); */
1543 1563
1544#ifdef XF86DRM_MODE 1564#ifdef XF86DRM_MODE
1545 if (info->cs && CS_FULL(info->cs)) { 1565 if (info->cs && CS_FULL(info->cs)) {
1546 R600DoneComposite(info->accel_state->dst_pix); 1566 R600FinishComposite(pScrn, pDst, info->accel_state);
1547 radeon_cs_flush_indirect(pScrn); 1567 radeon_cs_flush_indirect(pScrn);
1548 R600PrepareComposite(info->accel_state->composite_op, 1568 R600PrepareComposite(info->accel_state->composite_op,
1549 info->accel_state->src_pic, 1569 info->accel_state->src_pic,
1550 info->accel_state->msk_pic, 1570 info->accel_state->msk_pic,
1551 info->accel_state->dst_pic, 1571 info->accel_state->dst_pic,
1552 info->accel_state->src_pix, 1572 info->accel_state->src_pix,
1553 info->accel_state->msk_pix, 1573 info->accel_state->msk_pix,
1554 info->accel_state->dst_pix); 1574 info->accel_state->dst_pix);
1555 } 1575 }
1556#endif 1576#endif
1557 1577
1558 if (accel_state->vsync) 1578 if (accel_state->vsync)
1559 RADEONVlineHelperSet(pScrn, dstX, dstY, dstX + w, dstY + h); 1579 RADEONVlineHelperSet(pScrn, dstX, dstY, dstX + w, dstY + h);
@@ -1698,43 +1718,43 @@ R600CopyToVRAM(ScrnInfoPtr pScrn, @@ -1698,43 +1718,43 @@ R600CopyToVRAM(ScrnInfoPtr pScrn,
1698 R600DoCopy(pScrn); 1718 R600DoCopy(pScrn);
1699 y += oldhpass; 1719 y += oldhpass;
1700 } 1720 }
1701 1721
1702 R600IBDiscard(pScrn, scratch); 1722 R600IBDiscard(pScrn, scratch);
1703 1723
1704 return TRUE; 1724 return TRUE;
1705} 1725}
1706 1726
1707static Bool 1727static Bool
1708R600UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, 1728R600UploadToScreen(PixmapPtr pDst, int x, int y, int w, int h,
1709 char *src, int src_pitch) 1729 char *src, int src_pitch)
1710{ 1730{
1711 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 1731 ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
1712 RADEONInfoPtr info = RADEONPTR(pScrn); 1732 RADEONInfoPtr info = RADEONPTR(pScrn);
1713 uint32_t dst_pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8); 1733 uint32_t dst_pitch = exaGetPixmapPitch(pDst) / (pDst->drawable.bitsPerPixel / 8);
1714 uint32_t dst_mc_addr = exaGetPixmapOffset(pDst) + info->fbLocation + pScrn->fbOffset; 1734 uint32_t dst_mc_addr = exaGetPixmapOffset(pDst) + info->fbLocation + pScrn->fbOffset;
1715 int bpp = pDst->drawable.bitsPerPixel; 1735 int bpp = pDst->drawable.bitsPerPixel;
1716 1736
1717 return R600CopyToVRAM(pScrn, 1737 return R600CopyToVRAM(pScrn,
1718 src, src_pitch, 1738 src, src_pitch,
1719 dst_pitch, dst_mc_addr, pDst->drawable.width, pDst->drawable.height, bpp, 1739 dst_pitch, dst_mc_addr, pDst->drawable.width, pDst->drawable.height, bpp,
1720 x, y, w, h); 1740 x, y, w, h);
1721} 1741}
1722 1742
1723static Bool 1743static Bool
1724R600DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h, 1744R600DownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
1725 char *dst, int dst_pitch) 1745 char *dst, int dst_pitch)
1726{ 1746{
1727 ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; 1747 ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
1728 RADEONInfoPtr info = RADEONPTR(pScrn); 1748 RADEONInfoPtr info = RADEONPTR(pScrn);
1729 struct radeon_accel_state *accel_state = info->accel_state; 1749 struct radeon_accel_state *accel_state = info->accel_state;
1730 uint32_t src_pitch = exaGetPixmapPitch(pSrc) / (pSrc->drawable.bitsPerPixel / 8); 1750 uint32_t src_pitch = exaGetPixmapPitch(pSrc) / (pSrc->drawable.bitsPerPixel / 8);
1731 uint32_t src_mc_addr = exaGetPixmapOffset(pSrc) + info->fbLocation + pScrn->fbOffset; 1751 uint32_t src_mc_addr = exaGetPixmapOffset(pSrc) + info->fbLocation + pScrn->fbOffset;
1732 uint32_t src_width = pSrc->drawable.width; 1752 uint32_t src_width = pSrc->drawable.width;
1733 uint32_t src_height = pSrc->drawable.height; 1753 uint32_t src_height = pSrc->drawable.height;
1734 int bpp = pSrc->drawable.bitsPerPixel; 1754 int bpp = pSrc->drawable.bitsPerPixel;
1735 uint32_t scratch_mc_addr; 1755 uint32_t scratch_mc_addr;
1736 int scratch_pitch_bytes = RADEON_ALIGN(dst_pitch, 256); 1756 int scratch_pitch_bytes = RADEON_ALIGN(dst_pitch, 256);
1737 int scratch_offset = 0, hpass; 1757 int scratch_offset = 0, hpass;
1738 uint32_t scratch_pitch = scratch_pitch_bytes / (bpp / 8); 1758 uint32_t scratch_pitch = scratch_pitch_bytes / (bpp / 8);
1739 int wpass = w * (bpp/8); 1759 int wpass = w * (bpp/8);
1740 drmBufPtr scratch; 1760 drmBufPtr scratch;
@@ -1814,27 +1834,27 @@ R600DownloadFromScreen(PixmapPtr pSrc, i @@ -1814,27 +1834,27 @@ R600DownloadFromScreen(PixmapPtr pSrc, i
1814 1834
1815 R600IBDiscard(pScrn, scratch); 1835 R600IBDiscard(pScrn, scratch);
1816 1836
1817 return TRUE; 1837 return TRUE;
1818 1838
1819} 1839}
1820 1840
1821#if defined(XF86DRM_MODE) 1841#if defined(XF86DRM_MODE)
1822 1842
1823static Bool 1843static Bool
1824R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h, 1844R600UploadToScreenCS(PixmapPtr pDst, int x, int y, int w, int h,
1825 char *src, int src_pitch) 1845 char *src, int src_pitch)
1826{ 1846{
1827 ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; 1847 ScrnInfoPtr pScrn = xf86ScreenToScrn(pDst->drawable.pScreen);
1828 RADEONInfoPtr info = RADEONPTR(pScrn); 1848 RADEONInfoPtr info = RADEONPTR(pScrn);
1829 struct radeon_accel_state *accel_state = info->accel_state; 1849 struct radeon_accel_state *accel_state = info->accel_state;
1830 struct radeon_exa_pixmap_priv *driver_priv; 1850 struct radeon_exa_pixmap_priv *driver_priv;
1831 struct radeon_bo *scratch = NULL; 1851 struct radeon_bo *scratch = NULL;
1832 struct radeon_bo *copy_dst; 1852 struct radeon_bo *copy_dst;
1833 unsigned char *dst; 1853 unsigned char *dst;
1834 unsigned size; 1854 unsigned size;
1835 uint32_t dst_domain; 1855 uint32_t dst_domain;
1836 int bpp = pDst->drawable.bitsPerPixel; 1856 int bpp = pDst->drawable.bitsPerPixel;
1837 uint32_t scratch_pitch; 1857 uint32_t scratch_pitch;
1838 uint32_t copy_pitch; 1858 uint32_t copy_pitch;
1839 uint32_t dst_pitch_hw = exaGetPixmapPitch(pDst) / (bpp / 8); 1859 uint32_t dst_pitch_hw = exaGetPixmapPitch(pDst) / (bpp / 8);
1840 int ret; 1860 int ret;
@@ -1937,27 +1957,27 @@ copy: @@ -1937,27 +1957,27 @@ copy:
1937 R600DoCopyVline(pDst); 1957 R600DoCopyVline(pDst);
1938 } 1958 }
1939 1959
1940out: 1960out:
1941 if (scratch) 1961 if (scratch)
1942 radeon_bo_unref(scratch); 1962 radeon_bo_unref(scratch);
1943 return r; 1963 return r;
1944} 1964}
1945 1965
1946static Bool 1966static Bool
1947R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w, 1967R600DownloadFromScreenCS(PixmapPtr pSrc, int x, int y, int w,
1948 int h, char *dst, int dst_pitch) 1968 int h, char *dst, int dst_pitch)
1949{ 1969{
1950 ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum]; 1970 ScrnInfoPtr pScrn = xf86ScreenToScrn(pSrc->drawable.pScreen);
1951 RADEONInfoPtr info = RADEONPTR(pScrn); 1971 RADEONInfoPtr info = RADEONPTR(pScrn);
1952 struct radeon_accel_state *accel_state = info->accel_state; 1972 struct radeon_accel_state *accel_state = info->accel_state;
1953 struct radeon_exa_pixmap_priv *driver_priv; 1973 struct radeon_exa_pixmap_priv *driver_priv;
1954 struct radeon_bo *scratch = NULL; 1974 struct radeon_bo *scratch = NULL;
1955 struct radeon_bo *copy_src; 1975 struct radeon_bo *copy_src;
1956 unsigned size; 1976 unsigned size;
1957 uint32_t src_domain = 0; 1977 uint32_t src_domain = 0;
1958 int bpp = pSrc->drawable.bitsPerPixel; 1978 int bpp = pSrc->drawable.bitsPerPixel;
1959 uint32_t scratch_pitch; 1979 uint32_t scratch_pitch;
1960 uint32_t copy_pitch; 1980 uint32_t copy_pitch;
1961 uint32_t src_pitch_hw = exaGetPixmapPitch(pSrc) / (bpp / 8); 1981 uint32_t src_pitch_hw = exaGetPixmapPitch(pSrc) / (bpp / 8);
1962 int ret; 1982 int ret;
1963 Bool flush = FALSE; 1983 Bool flush = FALSE;
@@ -2075,38 +2095,38 @@ copy: @@ -2075,38 +2095,38 @@ copy:
2075 dst += dst_pitch; 2095 dst += dst_pitch;
2076 } 2096 }
2077 radeon_bo_unmap(copy_src); 2097 radeon_bo_unmap(copy_src);
2078out: 2098out:
2079 if (scratch) 2099 if (scratch)
2080 radeon_bo_unref(scratch); 2100 radeon_bo_unref(scratch);
2081 return r; 2101 return r;
2082} 2102}
2083#endif 2103#endif
2084 2104
2085static int 2105static int
2086R600MarkSync(ScreenPtr pScreen) 2106R600MarkSync(ScreenPtr pScreen)
2087{ 2107{
2088 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2108 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2089 RADEONInfoPtr info = RADEONPTR(pScrn); 2109 RADEONInfoPtr info = RADEONPTR(pScrn);
2090 struct radeon_accel_state *accel_state = info->accel_state; 2110 struct radeon_accel_state *accel_state = info->accel_state;
2091 2111
2092 return ++accel_state->exaSyncMarker; 2112 return ++accel_state->exaSyncMarker;
2093 2113
2094} 2114}
2095 2115
2096static void 2116static void
2097R600Sync(ScreenPtr pScreen, int marker) 2117R600Sync(ScreenPtr pScreen, int marker)
2098{ 2118{
2099 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2119 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2100 RADEONInfoPtr info = RADEONPTR(pScrn); 2120 RADEONInfoPtr info = RADEONPTR(pScrn);
2101 struct radeon_accel_state *accel_state = info->accel_state; 2121 struct radeon_accel_state *accel_state = info->accel_state;
2102 2122
2103 if (accel_state->exaMarkerSynced != marker) { 2123 if (accel_state->exaMarkerSynced != marker) {
2104#ifdef XF86DRM_MODE 2124#ifdef XF86DRM_MODE
2105#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 4) 2125#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 4)
2106 if (!info->cs) 2126 if (!info->cs)
2107#endif 2127#endif
2108#endif 2128#endif
2109 RADEONWaitForIdleCP(pScrn); 2129 RADEONWaitForIdleCP(pScrn);
2110 accel_state->exaMarkerSynced = marker; 2130 accel_state->exaMarkerSynced = marker;
2111 } 2131 }
2112 2132
@@ -2206,52 +2226,52 @@ R600LoadShaders(ScrnInfoPtr pScrn) @@ -2206,52 +2226,52 @@ R600LoadShaders(ScrnInfoPtr pScrn)
2206#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 4) 2226#if (EXA_VERSION_MAJOR == 2 && EXA_VERSION_MINOR >= 4)
2207 if (info->cs) { 2227 if (info->cs) {
2208 radeon_bo_unmap(accel_state->shaders_bo); 2228 radeon_bo_unmap(accel_state->shaders_bo);
2209 } 2229 }
2210#endif 2230#endif
2211#endif 2231#endif
2212 2232
2213 return TRUE; 2233 return TRUE;
2214} 2234}
2215 2235
2216static Bool 2236static Bool
2217R600PrepareAccess(PixmapPtr pPix, int index) 2237R600PrepareAccess(PixmapPtr pPix, int index)
2218{ 2238{
2219 ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 2239 ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
2220 RADEONInfoPtr info = RADEONPTR(pScrn); 2240 RADEONInfoPtr info = RADEONPTR(pScrn);
2221 unsigned char *RADEONMMIO = info->MMIO; 2241 unsigned char *RADEONMMIO = info->MMIO;
2222 2242
2223 /* flush HDP read/write caches */ 2243 /* flush HDP read/write caches */
2224 OUTREG(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1); 2244 OUTREG(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
2225 2245
2226 return TRUE; 2246 return TRUE;
2227} 2247}
2228 2248
2229static void 2249static void
2230R600FinishAccess(PixmapPtr pPix, int index) 2250R600FinishAccess(PixmapPtr pPix, int index)
2231{ 2251{
2232 ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum]; 2252 ScrnInfoPtr pScrn = xf86ScreenToScrn(pPix->drawable.pScreen);
2233 RADEONInfoPtr info = RADEONPTR(pScrn); 2253 RADEONInfoPtr info = RADEONPTR(pScrn);
2234 unsigned char *RADEONMMIO = info->MMIO; 2254 unsigned char *RADEONMMIO = info->MMIO;
2235 2255
2236 /* flush HDP read/write caches */ 2256 /* flush HDP read/write caches */
2237 OUTREG(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1); 2257 OUTREG(HDP_MEM_COHERENCY_FLUSH_CNTL, 0x1);
2238 2258
2239} 2259}
2240 2260
2241Bool 2261Bool
2242R600DrawInit(ScreenPtr pScreen) 2262R600DrawInit(ScreenPtr pScreen)
2243{ 2263{
2244 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2264 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2245 RADEONInfoPtr info = RADEONPTR(pScrn); 2265 RADEONInfoPtr info = RADEONPTR(pScrn);
2246 2266
2247 if (info->accel_state->exa == NULL) { 2267 if (info->accel_state->exa == NULL) {
2248 xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n"); 2268 xf86DrvMsg(pScreen->myNum, X_ERROR, "Memory map not set up\n");
2249 return FALSE; 2269 return FALSE;
2250 } 2270 }
2251 2271
2252 info->accel_state->exa->exa_major = EXA_VERSION_MAJOR; 2272 info->accel_state->exa->exa_major = EXA_VERSION_MAJOR;
2253 info->accel_state->exa->exa_minor = EXA_VERSION_MINOR; 2273 info->accel_state->exa->exa_minor = EXA_VERSION_MINOR;
2254 2274
2255 info->accel_state->exa->PrepareSolid = R600PrepareSolid; 2275 info->accel_state->exa->PrepareSolid = R600PrepareSolid;
2256 info->accel_state->exa->Solid = R600Solid; 2276 info->accel_state->exa->Solid = R600Solid;
2257 info->accel_state->exa->DoneSolid = R600DoneSolid; 2277 info->accel_state->exa->DoneSolid = R600DoneSolid;

cvs diff -r1.2 -r1.3 xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c 2011/07/06 03:59:54 1.2
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_accelfuncs.c 2012/09/23 20:06:02 1.3
@@ -1142,27 +1142,27 @@ FUNC_NAME(RADEONDisableClipping)(ScrnInf @@ -1142,27 +1142,27 @@ FUNC_NAME(RADEONDisableClipping)(ScrnInf
1142 FINISH_ACCEL(); 1142 FINISH_ACCEL();
1143 BEGIN_ACCEL(2); 1143 BEGIN_ACCEL(2);
1144 OUT_ACCEL_REG(RADEON_DSTCACHE_CTLSTAT, RADEON_RB2D_DC_FLUSH_ALL); 1144 OUT_ACCEL_REG(RADEON_DSTCACHE_CTLSTAT, RADEON_RB2D_DC_FLUSH_ALL);
1145 OUT_ACCEL_REG(RADEON_WAIT_UNTIL, 1145 OUT_ACCEL_REG(RADEON_WAIT_UNTIL,
1146 RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE); 1146 RADEON_WAIT_2D_IDLECLEAN | RADEON_WAIT_DMA_GUI_IDLE);
1147 FINISH_ACCEL(); 1147 FINISH_ACCEL();
1148 1148
1149 FUNC_NAME(RADEONSetTransparency)(pScrn, info->accel_state->trans_color); 1149 FUNC_NAME(RADEONSetTransparency)(pScrn, info->accel_state->trans_color);
1150} 1150}
1151 1151
1152void 1152void
1153FUNC_NAME(RADEONAccelInit)(ScreenPtr pScreen, XAAInfoRecPtr a) 1153FUNC_NAME(RADEONAccelInit)(ScreenPtr pScreen, XAAInfoRecPtr a)
1154{ 1154{
1155 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1155 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1156 RADEONInfoPtr info = RADEONPTR(pScrn); 1156 RADEONInfoPtr info = RADEONPTR(pScrn);
1157 1157
1158 a->Flags = (PIXMAP_CACHE 1158 a->Flags = (PIXMAP_CACHE
1159 | OFFSCREEN_PIXMAPS 1159 | OFFSCREEN_PIXMAPS
1160 | LINEAR_FRAMEBUFFER); 1160 | LINEAR_FRAMEBUFFER);
1161 1161
1162 /* Sync */ 1162 /* Sync */
1163 a->Sync = FUNC_NAME(RADEONWaitForIdle); 1163 a->Sync = FUNC_NAME(RADEONWaitForIdle);
1164 1164
1165 /* Solid Filled Rectangle */ 1165 /* Solid Filled Rectangle */
1166 a->PolyFillRectSolidFlags = 0; 1166 a->PolyFillRectSolidFlags = 0;
1167 a->SetupForSolidFill 1167 a->SetupForSolidFill
1168 = FUNC_NAME(RADEONSetupForSolidFill); 1168 = FUNC_NAME(RADEONSetupForSolidFill);

cvs diff -r1.6 -r1.7 xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c 2011/02/21 00:58:48 1.6
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_cursor.c 2012/09/23 20:06:02 1.7
@@ -397,27 +397,27 @@ radeon_crtc_load_cursor_argb (xf86CrtcPt @@ -397,27 +397,27 @@ radeon_crtc_load_cursor_argb (xf86CrtcPt
397 CURSOR_SWAPPING_START(); 397 CURSOR_SWAPPING_START();
398 398
399 memcpy (d, image, CURSOR_HEIGHT * CURSOR_WIDTH * 4); 399 memcpy (d, image, CURSOR_HEIGHT * CURSOR_WIDTH * 4);
400 400
401 CURSOR_SWAPPING_END (); 401 CURSOR_SWAPPING_END ();
402} 402}
403 403
404#endif 404#endif
405 405
406 406
407/* Initialize hardware cursor support. */ 407/* Initialize hardware cursor support. */
408Bool RADEONCursorInit(ScreenPtr pScreen) 408Bool RADEONCursorInit(ScreenPtr pScreen)
409{ 409{
410 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 410 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
411 RADEONInfoPtr info = RADEONPTR(pScrn); 411 RADEONInfoPtr info = RADEONPTR(pScrn);
412 unsigned char *RADEONMMIO = info->MMIO; 412 unsigned char *RADEONMMIO = info->MMIO;
413 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); 413 xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
414 int c; 414 int c;
415 415
416 for (c = 0; c < xf86_config->num_crtc; c++) { 416 for (c = 0; c < xf86_config->num_crtc; c++) {
417 xf86CrtcPtr crtc = xf86_config->crtc[c]; 417 xf86CrtcPtr crtc = xf86_config->crtc[c];
418 RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private; 418 RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
419 419
420 if (!info->useEXA) { 420 if (!info->useEXA) {
421 int size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT; 421 int size_bytes = CURSOR_WIDTH * 4 * CURSOR_HEIGHT;
422 int align = IS_AVIVO_VARIANT ? 4096 : 256; 422 int align = IS_AVIVO_VARIANT ? 4096 : 256;
423 423

cvs diff -r1.8 -r1.9 xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c 2012/06/03 16:42:23 1.8
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_dri.c 2012/09/23 20:06:02 1.9
@@ -83,27 +83,27 @@ static void RADEONDRIRefreshArea(ScrnInf @@ -83,27 +83,27 @@ static void RADEONDRIRefreshArea(ScrnInf
83#if (DRIINFO_MAJOR_VERSION > 5 || \ 83#if (DRIINFO_MAJOR_VERSION > 5 || \
84 (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1)) 84 (DRIINFO_MAJOR_VERSION == 5 && DRIINFO_MINOR_VERSION >= 1))
85static void RADEONDRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num); 85static void RADEONDRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num);
86#endif 86#endif
87#endif 87#endif
88 88
89/* Initialize the visual configs that are supported by the hardware. 89/* Initialize the visual configs that are supported by the hardware.
90 * These are combined with the visual configs that the indirect 90 * These are combined with the visual configs that the indirect
91 * rendering core supports, and the intersection is exported to the 91 * rendering core supports, and the intersection is exported to the
92 * client. 92 * client.
93 */ 93 */
94static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) 94static Bool RADEONInitVisualConfigs(ScreenPtr pScreen)
95{ 95{
96 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 96 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
97 RADEONInfoPtr info = RADEONPTR(pScrn); 97 RADEONInfoPtr info = RADEONPTR(pScrn);
98 int numConfigs = 0; 98 int numConfigs = 0;
99 __GLXvisualConfig *pConfigs = 0; 99 __GLXvisualConfig *pConfigs = 0;
100 RADEONConfigPrivPtr pRADEONConfigs = 0; 100 RADEONConfigPrivPtr pRADEONConfigs = 0;
101 RADEONConfigPrivPtr *pRADEONConfigPtrs = 0; 101 RADEONConfigPrivPtr *pRADEONConfigPtrs = 0;
102 int i, accum, stencil, db, use_db; 102 int i, accum, stencil, db, use_db;
103 103
104 use_db = !info->dri->noBackBuffer ? 1 : 0; 104 use_db = !info->dri->noBackBuffer ? 1 : 0;
105 105
106 switch (info->CurrentLayout.pixel_code) { 106 switch (info->CurrentLayout.pixel_code) {
107 case 8: /* 8bpp mode is not support */ 107 case 8: /* 8bpp mode is not support */
108 case 15: /* FIXME */ 108 case 15: /* FIXME */
109 case 24: /* FIXME */ 109 case 24: /* FIXME */
@@ -309,27 +309,27 @@ static void RADEONDestroyContext(ScreenP @@ -309,27 +309,27 @@ static void RADEONDestroyContext(ScreenP
309 DRIContextType contextStore) 309 DRIContextType contextStore)
310{ 310{
311} 311}
312 312
313/* Called when the X server is woken up to allow the last client's 313/* Called when the X server is woken up to allow the last client's
314 * context to be saved and the X server's context to be loaded. This is 314 * context to be saved and the X server's context to be loaded. This is
315 * not necessary for the Radeon since the client detects when it's 315 * not necessary for the Radeon since the client detects when it's
316 * context is not currently loaded and then load's it itself. Since the 316 * context is not currently loaded and then load's it itself. Since the
317 * registers to start and stop the CP are privileged, only the X server 317 * registers to start and stop the CP are privileged, only the X server
318 * can start/stop the engine. 318 * can start/stop the engine.
319 */ 319 */
320static void RADEONEnterServer(ScreenPtr pScreen) 320static void RADEONEnterServer(ScreenPtr pScreen)
321{ 321{
322 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 322 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
323 RADEONInfoPtr info = RADEONPTR(pScrn); 323 RADEONInfoPtr info = RADEONPTR(pScrn);
324 drm_radeon_sarea_t *pSAREAPriv; 324 drm_radeon_sarea_t *pSAREAPriv;
325 325
326 326
327 RADEON_MARK_SYNC(info, pScrn); 327 RADEON_MARK_SYNC(info, pScrn);
328 328
329 pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen); 329 pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
330 if (pSAREAPriv->ctx_owner != DRIGetContext(pScrn->pScreen)) { 330 if (pSAREAPriv->ctx_owner != DRIGetContext(pScrn->pScreen)) {
331 info->accel_state->XInited3D = FALSE; 331 info->accel_state->XInited3D = FALSE;
332 info->cp->needCacheFlush = (info->ChipFamily >= CHIP_FAMILY_R300); 332 info->cp->needCacheFlush = (info->ChipFamily >= CHIP_FAMILY_R300);
333 } 333 }
334 334
335#ifdef DAMAGE 335#ifdef DAMAGE
@@ -351,27 +351,27 @@ static void RADEONEnterServer(ScreenPtr  @@ -351,27 +351,27 @@ static void RADEONEnterServer(ScreenPtr
351 } 351 }
352#endif 352#endif
353} 353}
354 354
355/* Called when the X server goes to sleep to allow the X server's 355/* Called when the X server goes to sleep to allow the X server's
356 * context to be saved and the last client's context to be loaded. This 356 * context to be saved and the last client's context to be loaded. This
357 * is not necessary for the Radeon since the client detects when it's 357 * is not necessary for the Radeon since the client detects when it's
358 * context is not currently loaded and then load's it itself. Since the 358 * context is not currently loaded and then load's it itself. Since the
359 * registers to start and stop the CP are privileged, only the X server 359 * registers to start and stop the CP are privileged, only the X server
360 * can start/stop the engine. 360 * can start/stop the engine.
361 */ 361 */
362static void RADEONLeaveServer(ScreenPtr pScreen) 362static void RADEONLeaveServer(ScreenPtr pScreen)
363{ 363{
364 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 364 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
365 RADEONInfoPtr info = RADEONPTR(pScrn); 365 RADEONInfoPtr info = RADEONPTR(pScrn);
366 RING_LOCALS; 366 RING_LOCALS;
367 367
368#ifdef DAMAGE 368#ifdef DAMAGE
369 if (info->dri->pDamage) { 369 if (info->dri->pDamage) {
370 RegionPtr pDamageReg = DamageRegion(info->dri->pDamage); 370 RegionPtr pDamageReg = DamageRegion(info->dri->pDamage);
371 int nrects = pDamageReg ? REGION_NUM_RECTS(pDamageReg) : 0; 371 int nrects = pDamageReg ? REGION_NUM_RECTS(pDamageReg) : 0;
372 372
373 if (nrects) { 373 if (nrects) {
374 RADEONDRIRefreshArea(pScrn, pDamageReg); 374 RADEONDRIRefreshArea(pScrn, pDamageReg);
375 } 375 }
376 } 376 }
377#endif 377#endif
@@ -482,27 +482,27 @@ static void RADEONDRIInitBuffers(WindowP @@ -482,27 +482,27 @@ static void RADEONDRIInitBuffers(WindowP
482 482
483/* Copy the back and depth buffers when the X server moves a window. 483/* Copy the back and depth buffers when the X server moves a window.
484 * 484 *
485 * This routine is a modified form of XAADoBitBlt with the calls to 485 * This routine is a modified form of XAADoBitBlt with the calls to
486 * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source 486 * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source
487 * instead of destination. My origin is upside down so the ydir cases 487 * instead of destination. My origin is upside down so the ydir cases
488 * are reversed. 488 * are reversed.
489 */ 489 */
490static void RADEONDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, 490static void RADEONDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg,
491 RegionPtr prgnSrc, CARD32 indx) 491 RegionPtr prgnSrc, CARD32 indx)
492{ 492{
493#ifdef USE_XAA 493#ifdef USE_XAA
494 ScreenPtr pScreen = pParent->drawable.pScreen; 494 ScreenPtr pScreen = pParent->drawable.pScreen;
495 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 495 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
496 RADEONInfoPtr info = RADEONPTR(pScrn); 496 RADEONInfoPtr info = RADEONPTR(pScrn);
497 497
498 BoxPtr pboxTmp, pboxNext, pboxBase; 498 BoxPtr pboxTmp, pboxNext, pboxBase;
499 DDXPointPtr pptTmp; 499 DDXPointPtr pptTmp;
500 int xdir, ydir; 500 int xdir, ydir;
501 501
502 int screenwidth = pScrn->virtualX; 502 int screenwidth = pScrn->virtualX;
503 int screenheight = pScrn->virtualY; 503 int screenheight = pScrn->virtualY;
504 504
505 BoxPtr pbox = REGION_RECTS(prgnSrc); 505 BoxPtr pbox = REGION_RECTS(prgnSrc);
506 int nbox = REGION_NUM_RECTS(prgnSrc); 506 int nbox = REGION_NUM_RECTS(prgnSrc);
507 507
508 BoxPtr pboxNew1 = NULL; 508 BoxPtr pboxNew1 = NULL;
@@ -892,27 +892,27 @@ static Bool RADEONSetAgpMode(RADEONInfoP @@ -892,27 +892,27 @@ static Bool RADEONSetAgpMode(RADEONInfoP
892 892
893 /* Modify the mode if the default mode 893 /* Modify the mode if the default mode
894 * is not appropriate for this 894 * is not appropriate for this
895 * particular combination of graphics 895 * particular combination of graphics
896 * card and AGP chipset. 896 * card and AGP chipset.
897 */ 897 */
898 898
899 return TRUE; 899 return TRUE;
900} 900}
901 901
902/* Initialize Radeon's AGP registers */ 902/* Initialize Radeon's AGP registers */
903static void RADEONSetAgpBase(RADEONInfoPtr info, ScreenPtr pScreen) 903static void RADEONSetAgpBase(RADEONInfoPtr info, ScreenPtr pScreen)
904{ 904{
905 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 905 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
906 unsigned char *RADEONMMIO = info->MMIO; 906 unsigned char *RADEONMMIO = info->MMIO;
907 907
908 if (info->ChipFamily >= CHIP_FAMILY_R600) 908 if (info->ChipFamily >= CHIP_FAMILY_R600)
909 return; 909 return;
910 910
911 /* drm already does this, so we can probably remove this. 911 /* drm already does this, so we can probably remove this.
912 * agp_base_2 ? 912 * agp_base_2 ?
913 */ 913 */
914 if (info->ChipFamily == CHIP_FAMILY_RV515) 914 if (info->ChipFamily == CHIP_FAMILY_RV515)
915 OUTMC(pScrn, RV515_MC_AGP_BASE, drmAgpBase(info->dri->drmFD)); 915 OUTMC(pScrn, RV515_MC_AGP_BASE, drmAgpBase(info->dri->drmFD));
916 else if ((info->ChipFamily >= CHIP_FAMILY_R520) && 916 else if ((info->ChipFamily >= CHIP_FAMILY_R520) &&
917 (info->ChipFamily <= CHIP_FAMILY_RV570)) 917 (info->ChipFamily <= CHIP_FAMILY_RV570))
918 OUTMC(pScrn, R520_MC_AGP_BASE, drmAgpBase(info->dri->drmFD)); 918 OUTMC(pScrn, R520_MC_AGP_BASE, drmAgpBase(info->dri->drmFD));
@@ -1163,27 +1163,27 @@ static Bool RADEONDRIMapInit(RADEONInfoP @@ -1163,27 +1163,27 @@ static Bool RADEONDRIMapInit(RADEONInfoP
1163 if (drmAddMap(info->dri->drmFD, info->MMIOAddr, info->dri->registerSize, 1163 if (drmAddMap(info->dri->drmFD, info->MMIOAddr, info->dri->registerSize,
1164 DRM_REGISTERS, DRM_READ_ONLY, &info->dri->registerHandle) < 0) { 1164 DRM_REGISTERS, DRM_READ_ONLY, &info->dri->registerHandle) < 0) {
1165 return FALSE; 1165 return FALSE;
1166 } 1166 }
1167 xf86DrvMsg(pScreen->myNum, X_INFO, 1167 xf86DrvMsg(pScreen->myNum, X_INFO,
1168 "[drm] register handle = 0x%08lx\n", info->dri->registerHandle); 1168 "[drm] register handle = 0x%08lx\n", info->dri->registerHandle);
1169 1169
1170 return TRUE; 1170 return TRUE;
1171} 1171}
1172 1172
1173/* Initialize the kernel data structures */ 1173/* Initialize the kernel data structures */
1174static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen) 1174static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen)
1175{ 1175{
1176 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1176 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1177 int cpp = info->CurrentLayout.pixel_bytes; 1177 int cpp = info->CurrentLayout.pixel_bytes;
1178 drm_radeon_init_t drmInfo; 1178 drm_radeon_init_t drmInfo;
1179 1179
1180 memset(&drmInfo, 0, sizeof(drm_radeon_init_t)); 1180 memset(&drmInfo, 0, sizeof(drm_radeon_init_t));
1181 if ( info->ChipFamily >= CHIP_FAMILY_R600 ) 1181 if ( info->ChipFamily >= CHIP_FAMILY_R600 )
1182 drmInfo.func = RADEON_INIT_R600_CP; 1182 drmInfo.func = RADEON_INIT_R600_CP;
1183 else if ( info->ChipFamily >= CHIP_FAMILY_R300 ) 1183 else if ( info->ChipFamily >= CHIP_FAMILY_R300 )
1184 drmInfo.func = RADEON_INIT_R300_CP; 1184 drmInfo.func = RADEON_INIT_R300_CP;
1185 else if ( info->ChipFamily >= CHIP_FAMILY_R200 ) 1185 else if ( info->ChipFamily >= CHIP_FAMILY_R200 )
1186 drmInfo.func = RADEON_INIT_R200_CP; 1186 drmInfo.func = RADEON_INIT_R200_CP;
1187 else 1187 else
1188 drmInfo.func = RADEON_INIT_CP; 1188 drmInfo.func = RADEON_INIT_CP;
1189 1189
@@ -1270,27 +1270,27 @@ static Bool RADEONDRIBufInit(RADEONInfoP @@ -1270,27 +1270,27 @@ static Bool RADEONDRIBufInit(RADEONInfoP
1270 xf86DrvMsg(pScreen->myNum, X_ERROR, 1270 xf86DrvMsg(pScreen->myNum, X_ERROR,
1271 "[drm] Failed to map vertex/indirect buffers list\n"); 1271 "[drm] Failed to map vertex/indirect buffers list\n");
1272 return FALSE; 1272 return FALSE;
1273 } 1273 }
1274 xf86DrvMsg(pScreen->myNum, X_INFO, 1274 xf86DrvMsg(pScreen->myNum, X_INFO,
1275 "[drm] Mapped %d vertex/indirect buffers\n", 1275 "[drm] Mapped %d vertex/indirect buffers\n",
1276 info->dri->buffers->count); 1276 info->dri->buffers->count);
1277 1277
1278 return TRUE; 1278 return TRUE;
1279} 1279}
1280 1280
1281static void RADEONDRIIrqInit(RADEONInfoPtr info, ScreenPtr pScreen) 1281static void RADEONDRIIrqInit(RADEONInfoPtr info, ScreenPtr pScreen)
1282{ 1282{
1283 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1283 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1284 1284
1285 if (!info->dri->irq) { 1285 if (!info->dri->irq) {
1286 info->dri->irq = drmGetInterruptFromBusID( 1286 info->dri->irq = drmGetInterruptFromBusID(
1287 info->dri->drmFD, 1287 info->dri->drmFD,
1288 PCI_CFG_BUS(info->PciInfo), 1288 PCI_CFG_BUS(info->PciInfo),
1289 PCI_CFG_DEV(info->PciInfo), 1289 PCI_CFG_DEV(info->PciInfo),
1290 PCI_CFG_FUNC(info->PciInfo)); 1290 PCI_CFG_FUNC(info->PciInfo));
1291 1291
1292 if ((drmCtlInstHandler(info->dri->drmFD, info->dri->irq)) != 0) { 1292 if ((drmCtlInstHandler(info->dri->drmFD, info->dri->irq)) != 0) {
1293 xf86DrvMsg(pScrn->scrnIndex, X_INFO, 1293 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
1294 "[drm] failure adding irq handler, " 1294 "[drm] failure adding irq handler, "
1295 "there is a device already using that irq\n" 1295 "there is a device already using that irq\n"
1296 "[drm] falling back to irq-free operation\n"); 1296 "[drm] falling back to irq-free operation\n");
@@ -1514,27 +1514,27 @@ Bool RADEONDRISetVBlankInterrupt(ScrnInf @@ -1514,27 +1514,27 @@ Bool RADEONDRISetVBlankInterrupt(ScrnInf
1514 } 1514 }
1515 } 1515 }
1516 return TRUE; 1516 return TRUE;
1517} 1517}
1518 1518
1519 1519
1520/* Initialize the screen-specific data structures for the DRI and the 1520/* Initialize the screen-specific data structures for the DRI and the
1521 * Radeon. This is the main entry point to the device-specific 1521 * Radeon. This is the main entry point to the device-specific
1522 * initialization code. It calls device-independent DRI functions to 1522 * initialization code. It calls device-independent DRI functions to
1523 * create the DRI data structures and initialize the DRI state. 1523 * create the DRI data structures and initialize the DRI state.
1524 */ 1524 */
1525Bool RADEONDRIScreenInit(ScreenPtr pScreen) 1525Bool RADEONDRIScreenInit(ScreenPtr pScreen)
1526{ 1526{
1527 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1527 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1528 RADEONInfoPtr info = RADEONPTR(pScrn); 1528 RADEONInfoPtr info = RADEONPTR(pScrn);
1529 DRIInfoPtr pDRIInfo; 1529 DRIInfoPtr pDRIInfo;
1530 RADEONDRIPtr pRADEONDRI; 1530 RADEONDRIPtr pRADEONDRI;
1531 1531
1532 info->dri->DRICloseScreen = NULL; 1532 info->dri->DRICloseScreen = NULL;
1533 1533
1534 switch (info->CurrentLayout.pixel_code) { 1534 switch (info->CurrentLayout.pixel_code) {
1535 case 8: 1535 case 8:
1536 case 15: 1536 case 15:
1537 case 24: 1537 case 24:
1538 /* These modes are not supported (yet). */ 1538 /* These modes are not supported (yet). */
1539 xf86DrvMsg(pScreen->myNum, X_ERROR, 1539 xf86DrvMsg(pScreen->myNum, X_ERROR,
1540 "[dri] RADEONInitVisualConfigs failed " 1540 "[dri] RADEONInitVisualConfigs failed "
@@ -1705,44 +1705,44 @@ Bool RADEONDRIScreenInit(ScreenPtr pScre @@ -1705,44 +1705,44 @@ Bool RADEONDRIScreenInit(ScreenPtr pScre
1705 } 1705 }
1706 1706
1707 /* FIXME: When are these mappings unmapped? */ 1707 /* FIXME: When are these mappings unmapped? */
1708 1708
1709 if (!RADEONInitVisualConfigs(pScreen)) { 1709 if (!RADEONInitVisualConfigs(pScreen)) {
1710 RADEONDRICloseScreen(pScreen); 1710 RADEONDRICloseScreen(pScreen);
1711 return FALSE; 1711 return FALSE;
1712 } 1712 }
1713 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n"); 1713 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n");
1714 1714
1715 return TRUE; 1715 return TRUE;
1716} 1716}
1717 1717
1718static Bool RADEONDRIDoCloseScreen(int scrnIndex, ScreenPtr pScreen) 1718static Bool RADEONDRIDoCloseScreen(CLOSE_SCREEN_ARGS_DECL)
1719{ 1719{
1720 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1720 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1721 RADEONInfoPtr info = RADEONPTR(pScrn); 1721 RADEONInfoPtr info = RADEONPTR(pScrn);
1722 1722
1723 RADEONDRICloseScreen(pScreen); 1723 RADEONDRICloseScreen(pScreen);
1724 1724
1725 pScreen->CloseScreen = info->dri->DRICloseScreen; 1725 pScreen->CloseScreen = info->dri->DRICloseScreen;
1726 return (*pScreen->CloseScreen)(scrnIndex, pScreen); 1726 return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
1727} 1727}
1728 1728
1729/* Finish initializing the device-dependent DRI state, and call 1729/* Finish initializing the device-dependent DRI state, and call
1730 * DRIFinishScreenInit() to complete the device-independent DRI 1730 * DRIFinishScreenInit() to complete the device-independent DRI
1731 * initialization. 1731 * initialization.
1732 */ 1732 */
1733Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) 1733Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen)
1734{ 1734{
1735 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1735 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1736 RADEONInfoPtr info = RADEONPTR(pScrn); 1736 RADEONInfoPtr info = RADEONPTR(pScrn);
1737 drm_radeon_sarea_t *pSAREAPriv; 1737 drm_radeon_sarea_t *pSAREAPriv;
1738 RADEONDRIPtr pRADEONDRI; 1738 RADEONDRIPtr pRADEONDRI;
1739 1739
1740 info->dri->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; 1740 info->dri->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT;
1741 /* info->dri->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */ 1741 /* info->dri->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */
1742 1742
1743 /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit 1743 /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit
1744 * because *DRIKernelInit requires that the hardware lock is held by 1744 * because *DRIKernelInit requires that the hardware lock is held by
1745 * the X server, and the first time the hardware lock is grabbed is 1745 * the X server, and the first time the hardware lock is grabbed is
1746 * in DRIFinishScreenInit. 1746 * in DRIFinishScreenInit.
1747 */ 1747 */
1748 if (!DRIFinishScreenInit(pScreen)) { 1748 if (!DRIFinishScreenInit(pScreen)) {
@@ -1820,27 +1820,27 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr @@ -1820,27 +1820,27 @@ Bool RADEONDRIFinishScreenInit(ScreenPtr
1820 1820
1821 return TRUE; 1821 return TRUE;
1822} 1822}
1823 1823
1824/** 1824/**
1825 * This function will attempt to get the Radeon hardware back into shape 1825 * This function will attempt to get the Radeon hardware back into shape
1826 * after a resume from disc. 1826 * after a resume from disc.
1827 * 1827 *
1828 * Charl P. Botha <http://cpbotha.net> 1828 * Charl P. Botha <http://cpbotha.net>
1829 */ 1829 */
1830void RADEONDRIResume(ScreenPtr pScreen) 1830void RADEONDRIResume(ScreenPtr pScreen)
1831{ 1831{
1832 int _ret; 1832 int _ret;
1833 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1833 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1834 RADEONInfoPtr info = RADEONPTR(pScrn); 1834 RADEONInfoPtr info = RADEONPTR(pScrn);
1835 1835
1836 if (info->dri->pKernelDRMVersion->version_minor >= 9) { 1836 if (info->dri->pKernelDRMVersion->version_minor >= 9) {
1837 xf86DrvMsg(pScreen->myNum, X_INFO, 1837 xf86DrvMsg(pScreen->myNum, X_INFO,
1838 "[RESUME] Attempting to re-init Radeon hardware.\n"); 1838 "[RESUME] Attempting to re-init Radeon hardware.\n");
1839 } else { 1839 } else {
1840 xf86DrvMsg(pScreen->myNum, X_WARNING, 1840 xf86DrvMsg(pScreen->myNum, X_WARNING,
1841 "[RESUME] Cannot re-init Radeon hardware, DRM too old\n" 1841 "[RESUME] Cannot re-init Radeon hardware, DRM too old\n"
1842 "(need 1.9.0 or newer)\n"); 1842 "(need 1.9.0 or newer)\n");
1843 return; 1843 return;
1844 } 1844 }
1845 1845
1846 if (info->cardType==CARD_AGP) { 1846 if (info->cardType==CARD_AGP) {
@@ -1855,50 +1855,50 @@ void RADEONDRIResume(ScreenPtr pScreen) @@ -1855,50 +1855,50 @@ void RADEONDRIResume(ScreenPtr pScreen)
1855 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 1855 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
1856 "%s: CP resume %d\n", __FUNCTION__, _ret); 1856 "%s: CP resume %d\n", __FUNCTION__, _ret);
1857 /* FIXME: return? */ 1857 /* FIXME: return? */
1858 } 1858 }
1859 1859
1860 if (info->ChipFamily < CHIP_FAMILY_R600) 1860 if (info->ChipFamily < CHIP_FAMILY_R600)
1861 RADEONEngineRestore(pScrn); 1861 RADEONEngineRestore(pScrn);
1862 1862
1863 RADEONDRICPInit(pScrn); 1863 RADEONDRICPInit(pScrn);
1864} 1864}
1865 1865
1866void RADEONDRIStop(ScreenPtr pScreen) 1866void RADEONDRIStop(ScreenPtr pScreen)
1867{ 1867{
1868 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1868 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1869 RADEONInfoPtr info = RADEONPTR(pScrn); 1869 RADEONInfoPtr info = RADEONPTR(pScrn);
1870 RING_LOCALS; 1870 RING_LOCALS;
1871 1871
1872 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 1872 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
1873 "RADEONDRIStop\n"); 1873 "RADEONDRIStop\n");
1874 1874
1875 /* Stop the CP */ 1875 /* Stop the CP */
1876 if (info->directRenderingInited) { 1876 if (info->directRenderingInited) {
1877 /* If we've generated any CP commands, we must flush them to the 1877 /* If we've generated any CP commands, we must flush them to the
1878 * kernel module now. 1878 * kernel module now.
1879 */ 1879 */
1880 RADEONCP_RELEASE(pScrn, info); 1880 RADEONCP_RELEASE(pScrn, info);
1881 RADEONCP_STOP(pScrn, info); 1881 RADEONCP_STOP(pScrn, info);
1882 } 1882 }
1883 info->directRenderingInited = FALSE; 1883 info->directRenderingInited = FALSE;
1884} 1884}
1885 1885
1886/* The screen is being closed, so clean up any state and free any 1886/* The screen is being closed, so clean up any state and free any
1887 * resources used by the DRI. 1887 * resources used by the DRI.
1888 */ 1888 */
1889void RADEONDRICloseScreen(ScreenPtr pScreen) 1889void RADEONDRICloseScreen(ScreenPtr pScreen)
1890{ 1890{
1891 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 1891 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
1892 RADEONInfoPtr info = RADEONPTR(pScrn); 1892 RADEONInfoPtr info = RADEONPTR(pScrn);
1893 drm_radeon_init_t drmInfo; 1893 drm_radeon_init_t drmInfo;
1894 1894
1895 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 1895 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
1896 "RADEONDRICloseScreen\n"); 1896 "RADEONDRICloseScreen\n");
1897 1897
1898#ifdef DAMAGE 1898#ifdef DAMAGE
1899 REGION_UNINIT(pScreen, &info->dri->driRegion); 1899 REGION_UNINIT(pScreen, &info->dri->driRegion);
1900#endif 1900#endif
1901 1901
1902 if (info->dri->irq) { 1902 if (info->dri->irq) {
1903 RADEONDRISetVBlankInterrupt (pScrn, FALSE); 1903 RADEONDRISetVBlankInterrupt (pScrn, FALSE);
1904 drmCtlUninstHandler(info->dri->drmFD); 1904 drmCtlUninstHandler(info->dri->drmFD);
@@ -2082,27 +2082,27 @@ static void RADEONDRIRefreshArea(ScrnInf @@ -2082,27 +2082,27 @@ static void RADEONDRIRefreshArea(ScrnInf
2082 info->accel_state->dst_pitch_offset &= ~RADEON_DST_TILE_MACRO; 2082 info->accel_state->dst_pitch_offset &= ~RADEON_DST_TILE_MACRO;
2083#endif 2083#endif
2084 2084
2085out: 2085out:
2086 REGION_NULL(pScreen, &region); 2086 REGION_NULL(pScreen, &region);
2087 DamageEmpty(info->dri->pDamage); 2087 DamageEmpty(info->dri->pDamage);
2088} 2088}
2089 2089
2090#endif /* DAMAGE */ 2090#endif /* DAMAGE */
2091 2091
2092static void RADEONEnablePageFlip(ScreenPtr pScreen) 2092static void RADEONEnablePageFlip(ScreenPtr pScreen)
2093{ 2093{
2094#ifdef DAMAGE 2094#ifdef DAMAGE
2095 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2095 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2096 RADEONInfoPtr info = RADEONPTR(pScrn); 2096 RADEONInfoPtr info = RADEONPTR(pScrn);
2097 2097
2098 if (info->dri->allowPageFlip) { 2098 if (info->dri->allowPageFlip) {
2099 drm_radeon_sarea_t *pSAREAPriv = DRIGetSAREAPrivate(pScreen); 2099 drm_radeon_sarea_t *pSAREAPriv = DRIGetSAREAPrivate(pScreen);
2100 BoxRec box = { .x1 = 0, .y1 = 0, .x2 = pScrn->virtualX - 1, 2100 BoxRec box = { .x1 = 0, .y1 = 0, .x2 = pScrn->virtualX - 1,
2101 .y2 = pScrn->virtualY - 1 }; 2101 .y2 = pScrn->virtualY - 1 };
2102 RegionPtr pReg = REGION_CREATE(pScreen, &box, 1); 2102 RegionPtr pReg = REGION_CREATE(pScreen, &box, 1);
2103 2103
2104 pSAREAPriv->pfState = 1; 2104 pSAREAPriv->pfState = 1;
2105 RADEONDRIRefreshArea(pScrn, pReg); 2105 RADEONDRIRefreshArea(pScrn, pReg);
2106 REGION_DESTROY(pScreen, pReg); 2106 REGION_DESTROY(pScreen, pReg);
2107 } 2107 }
2108#endif 2108#endif
@@ -2122,27 +2122,27 @@ static void RADEONDisablePageFlip(Screen @@ -2122,27 +2122,27 @@ static void RADEONDisablePageFlip(Screen
2122static void RADEONDRITransitionSingleToMulti3d(ScreenPtr pScreen) 2122static void RADEONDRITransitionSingleToMulti3d(ScreenPtr pScreen)
2123{ 2123{
2124 RADEONDisablePageFlip(pScreen); 2124 RADEONDisablePageFlip(pScreen);
2125} 2125}
2126 2126
2127static void RADEONDRITransitionMultiToSingle3d(ScreenPtr pScreen) 2127static void RADEONDRITransitionMultiToSingle3d(ScreenPtr pScreen)
2128{ 2128{
2129 /* Let the remaining 3d app start page flipping again */ 2129 /* Let the remaining 3d app start page flipping again */
2130 RADEONEnablePageFlip(pScreen); 2130 RADEONEnablePageFlip(pScreen);
2131} 2131}
2132 2132
2133static void RADEONDRITransitionTo3d(ScreenPtr pScreen) 2133static void RADEONDRITransitionTo3d(ScreenPtr pScreen)
2134{ 2134{
2135 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2135 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2136 RADEONInfoPtr info = RADEONPTR(pScrn); 2136 RADEONInfoPtr info = RADEONPTR(pScrn);
2137#ifdef USE_XAA 2137#ifdef USE_XAA
2138 FBAreaPtr fbarea; 2138 FBAreaPtr fbarea;
2139 int width, height; 2139 int width, height;
2140 2140
2141 /* EXA allocates these areas up front, so it doesn't do the following 2141 /* EXA allocates these areas up front, so it doesn't do the following
2142 * stuff. 2142 * stuff.
2143 */ 2143 */
2144 if (!info->useEXA) { 2144 if (!info->useEXA) {
2145 /* reserve offscreen area for back and depth buffers and textures */ 2145 /* reserve offscreen area for back and depth buffers and textures */
2146 2146
2147 /* If we still have an area for the back buffer reserved, free it 2147 /* If we still have an area for the back buffer reserved, free it
2148 * first so we always start with all free offscreen memory, except 2148 * first so we always start with all free offscreen memory, except
@@ -2210,27 +2210,27 @@ static void RADEONDRITransitionTo3d(Scre @@ -2210,27 +2210,27 @@ static void RADEONDRITransitionTo3d(Scre
2210 2210
2211 RADEONChangeSurfaces(pScrn); 2211 RADEONChangeSurfaces(pScrn);
2212 RADEONEnablePageFlip(pScreen); 2212 RADEONEnablePageFlip(pScreen);
2213  2213
2214 info->want_vblank_interrupts = TRUE; 2214 info->want_vblank_interrupts = TRUE;
2215 RADEONDRISetVBlankInterrupt(pScrn, TRUE); 2215 RADEONDRISetVBlankInterrupt(pScrn, TRUE);
2216 2216
2217 if (info->cursor) 2217 if (info->cursor)
2218 xf86ForceHWCursor (pScreen, TRUE); 2218 xf86ForceHWCursor (pScreen, TRUE);
2219} 2219}
2220 2220
2221static void RADEONDRITransitionTo2d(ScreenPtr pScreen) 2221static void RADEONDRITransitionTo2d(ScreenPtr pScreen)
2222{ 2222{
2223 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2223 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2224 RADEONInfoPtr info = RADEONPTR(pScrn); 2224 RADEONInfoPtr info = RADEONPTR(pScrn);
2225 drm_radeon_sarea_t *pSAREAPriv = DRIGetSAREAPrivate(pScreen); 2225 drm_radeon_sarea_t *pSAREAPriv = DRIGetSAREAPrivate(pScreen);
2226 2226
2227 /* Try flipping back to the front page if necessary */ 2227 /* Try flipping back to the front page if necessary */
2228 if (pSAREAPriv->pfCurrentPage == 1) 2228 if (pSAREAPriv->pfCurrentPage == 1)
2229 drmCommandNone(info->dri->drmFD, DRM_RADEON_FLIP); 2229 drmCommandNone(info->dri->drmFD, DRM_RADEON_FLIP);
2230 2230
2231 /* Shut down shadowing if we've made it back to the front page */ 2231 /* Shut down shadowing if we've made it back to the front page */
2232 if (pSAREAPriv->pfCurrentPage == 0) { 2232 if (pSAREAPriv->pfCurrentPage == 0) {
2233 RADEONDisablePageFlip(pScreen); 2233 RADEONDisablePageFlip(pScreen);
2234#ifdef USE_XAA 2234#ifdef USE_XAA
2235 if (!info->useEXA) { 2235 if (!info->useEXA) {
2236 xf86FreeOffscreenArea(info->dri->backArea); 2236 xf86FreeOffscreenArea(info->dri->backArea);
@@ -2255,50 +2255,50 @@ static void RADEONDRITransitionTo2d(Scre @@ -2255,50 +2255,50 @@ static void RADEONDRITransitionTo2d(Scre
2255 info->want_vblank_interrupts = FALSE; 2255 info->want_vblank_interrupts = FALSE;
2256 RADEONDRISetVBlankInterrupt(pScrn, FALSE); 2256 RADEONDRISetVBlankInterrupt(pScrn, FALSE);
2257 2257
2258 if (info->cursor) 2258 if (info->cursor)
2259 xf86ForceHWCursor (pScreen, FALSE); 2259 xf86ForceHWCursor (pScreen, FALSE);
2260} 2260}
2261 2261
2262#if defined(DAMAGE) && (DRIINFO_MAJOR_VERSION > 5 || \ 2262#if defined(DAMAGE) && (DRIINFO_MAJOR_VERSION > 5 || \
2263 (DRIINFO_MAJOR_VERSION == 5 && \ 2263 (DRIINFO_MAJOR_VERSION == 5 && \
2264 DRIINFO_MINOR_VERSION >= 1)) 2264 DRIINFO_MINOR_VERSION >= 1))
2265static void 2265static void
2266RADEONDRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num) 2266RADEONDRIClipNotify(ScreenPtr pScreen, WindowPtr *ppWin, int num)
2267{ 2267{
2268 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2268 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2269 RADEONInfoPtr info = RADEONPTR(pScrn); 2269 RADEONInfoPtr info = RADEONPTR(pScrn);
2270 2270
2271 REGION_UNINIT(pScreen, &info->dri->driRegion); 2271 REGION_UNINIT(pScreen, &info->dri->driRegion);
2272 REGION_NULL(pScreen, &info->dri->driRegion); 2272 REGION_NULL(pScreen, &info->dri->driRegion);
2273 2273
2274 if (num > 0) { 2274 if (num > 0) {
2275 int i; 2275 int i;
2276 2276
2277 for (i = 0; i < num; i++) { 2277 for (i = 0; i < num; i++) {
2278 WindowPtr pWin = ppWin[i]; 2278 WindowPtr pWin = ppWin[i];
2279 2279
2280 if (pWin) { 2280 if (pWin) {
2281 REGION_UNION(pScreen, &info->dri->driRegion, &pWin->clipList, 2281 REGION_UNION(pScreen, &info->dri->driRegion, &pWin->clipList,
2282 &info->dri->driRegion); 2282 &info->dri->driRegion);
2283 } 2283 }
2284 } 2284 }
2285 } 2285 }
2286} 2286}
2287#endif 2287#endif
2288 2288
2289void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen) 2289void RADEONDRIAllocatePCIGARTTable(ScreenPtr pScreen)
2290{ 2290{
2291 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 2291 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
2292 RADEONInfoPtr info = RADEONPTR(pScrn); 2292 RADEONInfoPtr info = RADEONPTR(pScrn);
2293 2293
2294 if (info->cardType != CARD_PCIE || 2294 if (info->cardType != CARD_PCIE ||
2295 info->dri->pKernelDRMVersion->version_minor < 19) 2295 info->dri->pKernelDRMVersion->version_minor < 19)
2296 return; 2296 return;
2297 2297
2298 if (info->FbSecureSize==0) 2298 if (info->FbSecureSize==0)
2299 return; 2299 return;
2300 2300
2301 /* set the old default size of pci gart table */ 2301 /* set the old default size of pci gart table */
2302 if (info->dri->pKernelDRMVersion->version_minor < 26) 2302 if (info->dri->pKernelDRMVersion->version_minor < 26)
2303 info->dri->pciGartSize = 32768; 2303 info->dri->pciGartSize = 32768;
2304 2304

cvs diff -r1.8 -r1.9 xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c 2012/06/03 16:42:23 1.8
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c 2012/09/23 20:06:02 1.9
@@ -61,27 +61,27 @@ @@ -61,27 +61,27 @@
61static int 61static int
62FUNC_NAME(RADEONMarkSync)(ScreenPtr pScreen) 62FUNC_NAME(RADEONMarkSync)(ScreenPtr pScreen)
63{ 63{
64 RINFO_FROM_SCREEN(pScreen); 64 RINFO_FROM_SCREEN(pScreen);
65 65
66 TRACE; 66 TRACE;
67 67
68 return ++info->accel_state->exaSyncMarker; 68 return ++info->accel_state->exaSyncMarker;
69} 69}
70 70
71static void 71static void
72FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker) 72FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker)
73{ 73{
74 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 74 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
75 RADEONInfoPtr info = RADEONPTR(pScrn); 75 RADEONInfoPtr info = RADEONPTR(pScrn);
76 76
77 if (info->cs) 77 if (info->cs)
78 return; 78 return;
79 79
80 TRACE; 80 TRACE;
81 81
82 if (info->accel_state->exaMarkerSynced != marker) { 82 if (info->accel_state->exaMarkerSynced != marker) {
83 FUNC_NAME(RADEONWaitForIdle)(pScrn); 83 FUNC_NAME(RADEONWaitForIdle)(pScrn);
84 info->accel_state->exaMarkerSynced = marker; 84 info->accel_state->exaMarkerSynced = marker;
85 } 85 }
86 86
87 RADEONPTR(pScrn)->accel_state->engineMode = EXA_ENGINEMODE_UNKNOWN; 87 RADEONPTR(pScrn)->accel_state->engineMode = EXA_ENGINEMODE_UNKNOWN;

cvs diff -r1.11 -r1.12 xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c 2012/06/03 16:42:23 1.11
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c 2012/09/23 20:06:02 1.12
@@ -111,27 +111,27 @@ @@ -111,27 +111,27 @@
111#else 111#else
112#define DPMS_SERVER 112#define DPMS_SERVER
113#include <X11/extensions/dpms.h> 113#include <X11/extensions/dpms.h>
114#endif 114#endif
115 115
116 116
117#include "atipciids.h" 117#include "atipciids.h"
118#include "radeon_chipset_gen.h" 118#include "radeon_chipset_gen.h"
119 119
120 120
121#include "radeon_chipinfo_gen.h" 121#include "radeon_chipinfo_gen.h"
122 122
123 /* Forward definitions for driver functions */ 123 /* Forward definitions for driver functions */
124static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen); 124static Bool RADEONCloseScreen(CLOSE_SCREEN_ARGS_DECL);
125static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode); 125static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode);
126static void RADEONSave(ScrnInfoPtr pScrn); 126static void RADEONSave(ScrnInfoPtr pScrn);
127 127
128static void RADEONSaveMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save); 128static void RADEONSaveMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save);
129 129
130static void 130static void
131RADEONSaveBIOSRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save); 131RADEONSaveBIOSRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save);
132 132
133#ifdef XF86DRI 133#ifdef XF86DRI
134static void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save); 134static void RADEONAdjustMemMapRegisters(ScrnInfoPtr pScrn, RADEONSavePtr save);
135#endif 135#endif
136 136
137static const OptionInfoRec RADEONOptions[] = { 137static const OptionInfoRec RADEONOptions[] = {
@@ -221,39 +221,39 @@ static int getRADEONEntityIndex(void) @@ -221,39 +221,39 @@ static int getRADEONEntityIndex(void)
221struct RADEONInt10Save { 221struct RADEONInt10Save {
222 uint32_t MEM_CNTL; 222 uint32_t MEM_CNTL;
223 uint32_t MEMSIZE; 223 uint32_t MEMSIZE;
224 uint32_t MPP_TB_CONFIG; 224 uint32_t MPP_TB_CONFIG;
225}; 225};
226 226
227static Bool RADEONMapMMIO(ScrnInfoPtr pScrn); 227static Bool RADEONMapMMIO(ScrnInfoPtr pScrn);
228static Bool RADEONUnmapMMIO(ScrnInfoPtr pScrn); 228static Bool RADEONUnmapMMIO(ScrnInfoPtr pScrn);
229 229
230static void * 230static void *
231radeonShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode, 231radeonShadowWindow(ScreenPtr screen, CARD32 row, CARD32 offset, int mode,
232 CARD32 *size, void *closure) 232 CARD32 *size, void *closure)
233{ 233{
234 ScrnInfoPtr pScrn = xf86Screens[screen->myNum]; 234 ScrnInfoPtr pScrn = xf86ScreenToScrn(screen);
235 RADEONInfoPtr info = RADEONPTR(pScrn); 235 RADEONInfoPtr info = RADEONPTR(pScrn);
236 int stride; 236 int stride;
237 237
238 stride = (pScrn->displayWidth * pScrn->bitsPerPixel) / 8; 238 stride = (pScrn->displayWidth * pScrn->bitsPerPixel) / 8;
239 *size = stride; 239 *size = stride;
240 240
241 return ((uint8_t *)info->FB + pScrn->fbOffset + row * stride + offset); 241 return ((uint8_t *)info->FB + pScrn->fbOffset + row * stride + offset);
242} 242}
243static Bool 243static Bool
244RADEONCreateScreenResources (ScreenPtr pScreen) 244RADEONCreateScreenResources (ScreenPtr pScreen)
245{ 245{
246 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 246 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
247 RADEONInfoPtr info = RADEONPTR(pScrn); 247 RADEONInfoPtr info = RADEONPTR(pScrn);
248 PixmapPtr pixmap; 248 PixmapPtr pixmap;
249 249
250 pScreen->CreateScreenResources = info->CreateScreenResources; 250 pScreen->CreateScreenResources = info->CreateScreenResources;
251 if (!(*pScreen->CreateScreenResources)(pScreen)) 251 if (!(*pScreen->CreateScreenResources)(pScreen))
252 return FALSE; 252 return FALSE;
253 pScreen->CreateScreenResources = RADEONCreateScreenResources; 253 pScreen->CreateScreenResources = RADEONCreateScreenResources;
254 254
255 if (info->r600_shadow_fb) { 255 if (info->r600_shadow_fb) {
256 pixmap = pScreen->GetScreenPixmap(pScreen); 256 pixmap = pScreen->GetScreenPixmap(pScreen);
257 257
258 if (!shadowAdd(pScreen, pixmap, shadowUpdatePackedWeak(), 258 if (!shadowAdd(pScreen, pixmap, shadowUpdatePackedWeak(),
259 radeonShadowWindow, 0, NULL)) 259 radeonShadowWindow, 0, NULL))
@@ -3363,35 +3363,34 @@ static void RADEONLoadPalette(ScrnInfoPt @@ -3363,35 +3363,34 @@ static void RADEONLoadPalette(ScrnInfoPt
3363 if (crtc->randr_crtc) 3363 if (crtc->randr_crtc)
3364 RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b); 3364 RRCrtcGammaSet(crtc->randr_crtc, lut_r, lut_g, lut_b);
3365 else 3365 else
3366#endif 3366#endif
3367 crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256); 3367 crtc->funcs->gamma_set(crtc, lut_r, lut_g, lut_b, 256);
3368 } 3368 }
3369 } 3369 }
3370 3370
3371#ifdef XF86DRI 3371#ifdef XF86DRI
3372 if (info->cp->CPStarted && pScrn->pScreen) DRIUnlock(pScrn->pScreen); 3372 if (info->cp->CPStarted && pScrn->pScreen) DRIUnlock(pScrn->pScreen);
3373#endif 3373#endif
3374} 3374}
3375 3375
3376static void RADEONBlockHandler(int i, pointer blockData, 3376static void RADEONBlockHandler(BLOCKHANDLER_ARGS_DECL)
3377 pointer pTimeout, pointer pReadmask) 
3378{ 3377{
3379 ScreenPtr pScreen = screenInfo.screens[i]; 3378 SCREEN_PTR(arg);
3380 ScrnInfoPtr pScrn = xf86Screens[i]; 3379 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
3381 RADEONInfoPtr info = RADEONPTR(pScrn); 3380 RADEONInfoPtr info = RADEONPTR(pScrn);
3382 3381
3383 pScreen->BlockHandler = info->BlockHandler; 3382 pScreen->BlockHandler = info->BlockHandler;
3384 (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); 3383 (*pScreen->BlockHandler) (BLOCKHANDLER_ARGS);
3385 pScreen->BlockHandler = RADEONBlockHandler; 3384 pScreen->BlockHandler = RADEONBlockHandler;
3386 3385
3387 if (info->VideoTimerCallback) 3386 if (info->VideoTimerCallback)
3388 (*info->VideoTimerCallback)(pScrn, currentTime.milliseconds); 3387 (*info->VideoTimerCallback)(pScrn, currentTime.milliseconds);
3389 3388
3390#if defined(RENDER) && defined(USE_XAA) 3389#if defined(RENDER) && defined(USE_XAA)
3391 if(info->accel_state->RenderCallback) 3390 if(info->accel_state->RenderCallback)
3392 (*info->accel_state->RenderCallback)(pScrn); 3391 (*info->accel_state->RenderCallback)(pScrn);
3393#endif 3392#endif
3394 3393
3395#ifdef USE_EXA 3394#ifdef USE_EXA
3396 info->accel_state->engineMode = EXA_ENGINEMODE_UNKNOWN; 3395 info->accel_state->engineMode = EXA_ENGINEMODE_UNKNOWN;
3397#endif 3396#endif
@@ -3438,30 +3437,29 @@ RADEONInitBIOSRegisters(ScrnInfoPtr pScr @@ -3438,30 +3437,29 @@ RADEONInitBIOSRegisters(ScrnInfoPtr pScr
3438 RADEON_ACC_MODE_CHANGE); 3437 RADEON_ACC_MODE_CHANGE);
3439 /* tell the bios a driver is loaded */ 3438 /* tell the bios a driver is loaded */
3440 save->bios_7_scratch |= RADEON_DRV_LOADED; 3439 save->bios_7_scratch |= RADEON_DRV_LOADED;
3441 3440
3442 OUTREG(RADEON_BIOS_0_SCRATCH, save->bios_0_scratch); 3441 OUTREG(RADEON_BIOS_0_SCRATCH, save->bios_0_scratch);
3443 OUTREG(RADEON_BIOS_6_SCRATCH, save->bios_6_scratch); 3442 OUTREG(RADEON_BIOS_6_SCRATCH, save->bios_6_scratch);
3444 //OUTREG(RADEON_BIOS_7_SCRATCH, save->bios_7_scratch); 3443 //OUTREG(RADEON_BIOS_7_SCRATCH, save->bios_7_scratch);
3445 } 3444 }
3446 3445
3447} 3446}
3448 3447
3449 3448
3450/* Called at the start of each server generation. */ 3449/* Called at the start of each server generation. */
3451Bool RADEONScreenInit(int scrnIndex, ScreenPtr pScreen, 3450Bool RADEONScreenInit(SCREEN_INIT_ARGS_DECL)
3452 int argc, char **argv) 
3453{ 3451{
3454 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 3452 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
3455 RADEONInfoPtr info = RADEONPTR(pScrn); 3453 RADEONInfoPtr info = RADEONPTR(pScrn);
3456 int hasDRI = 0; 3454 int hasDRI = 0;
3457#ifdef RENDER 3455#ifdef RENDER
3458 int subPixelOrder = SubPixelUnknown; 3456 int subPixelOrder = SubPixelUnknown;
3459 char* s; 3457 char* s;
3460#endif 3458#endif
3461 3459
3462 3460
3463 info->accelOn = FALSE; 3461 info->accelOn = FALSE;
3464#ifdef USE_XAA 3462#ifdef USE_XAA
3465 info->accel_state->accel = NULL; 3463 info->accel_state->accel = NULL;
3466#endif 3464#endif
3467#ifdef XF86DRI 3465#ifdef XF86DRI
@@ -3626,58 +3624,58 @@ Bool RADEONScreenInit(int scrnIndex, Scr @@ -3626,58 +3624,58 @@ Bool RADEONScreenInit(int scrnIndex, Scr
3626 3624
3627#if defined(XF86DRI) && defined(USE_XAA) 3625#if defined(XF86DRI) && defined(USE_XAA)
3628 if (!info->useEXA && hasDRI) { 3626 if (!info->useEXA && hasDRI) {
3629 info->dri->textureSize = -1; 3627 info->dri->textureSize = -1;
3630 if (xf86GetOptValInteger(info->Options, OPTION_FBTEX_PERCENT, 3628 if (xf86GetOptValInteger(info->Options, OPTION_FBTEX_PERCENT,
3631 &(info->dri->textureSize))) { 3629 &(info->dri->textureSize))) {
3632 if (info->dri->textureSize < 0 || info->dri->textureSize > 100) { 3630 if (info->dri->textureSize < 0 || info->dri->textureSize > 100) {
3633 xf86DrvMsg(pScrn->scrnIndex, X_ERROR, 3631 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
3634 "Illegal texture memory percentage: %dx, using default behaviour\n", 3632 "Illegal texture memory percentage: %dx, using default behaviour\n",
3635 info->dri->textureSize); 3633 info->dri->textureSize);
3636 info->dri->textureSize = -1; 3634 info->dri->textureSize = -1;
3637 } 3635 }
3638 } 3636 }
3639 if (!RADEONSetupMemXAA_DRI(scrnIndex, pScreen)) 3637 if (!RADEONSetupMemXAA_DRI(pScreen))
3640 return FALSE; 3638 return FALSE;
3641 pScrn->fbOffset = info->dri->frontOffset; 3639 pScrn->fbOffset = info->dri->frontOffset;
3642 } 3640 }
3643#endif 3641#endif
3644 3642
3645#ifdef USE_XAA 3643#ifdef USE_XAA
3646 if (!info->useEXA && !hasDRI && !RADEONSetupMemXAA(scrnIndex, pScreen)) 3644 if (!info->useEXA && !hasDRI && !RADEONSetupMemXAA(pScreen))
3647 return FALSE; 3645 return FALSE;
3648#endif 3646#endif
3649 3647
3650 info->accel_state->dst_pitch_offset = 3648 info->accel_state->dst_pitch_offset =
3651 (((pScrn->displayWidth * info->CurrentLayout.pixel_bytes / 64) 3649 (((pScrn->displayWidth * info->CurrentLayout.pixel_bytes / 64)
3652 << 22) | ((info->fbLocation + pScrn->fbOffset) >> 10)); 3650 << 22) | ((info->fbLocation + pScrn->fbOffset) >> 10));
3653 3651
3654 /* Setup DRI after visuals have been established, but before fbScreenInit is 3652 /* Setup DRI after visuals have been established, but before fbScreenInit is
3655 * called. fbScreenInit will eventually call the driver's InitGLXVisuals 3653 * called. fbScreenInit will eventually call the driver's InitGLXVisuals
3656 * call back. */ 3654 * call back. */
3657#ifdef XF86DRI 3655#ifdef XF86DRI
3658 if (info->directRenderingEnabled) { 3656 if (info->directRenderingEnabled) {
3659 /* FIXME: When we move to dynamic allocation of back and depth 3657 /* FIXME: When we move to dynamic allocation of back and depth
3660 * buffers, we will want to revisit the following check for 3 3658 * buffers, we will want to revisit the following check for 3
3661 * times the virtual size of the screen below. 3659 * times the virtual size of the screen below.
3662 */ 3660 */
3663 int width_bytes = (pScrn->displayWidth * 3661 int width_bytes = (pScrn->displayWidth *
3664 info->CurrentLayout.pixel_bytes); 3662 info->CurrentLayout.pixel_bytes);
3665 int maxy = info->FbMapSize / width_bytes; 3663 int maxy = info->FbMapSize / width_bytes;
3666 3664
3667 if (maxy <= pScrn->virtualY * 3) { 3665 if (maxy <= pScrn->virtualY * 3) {
3668 xf86DrvMsg(scrnIndex, X_ERROR, 3666 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
3669 "Static buffer allocation failed. Disabling DRI.\n"); 3667 "Static buffer allocation failed. Disabling DRI.\n");
3670 xf86DrvMsg(scrnIndex, X_ERROR, 3668 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
3671 "At least %d kB of video memory needed at this " 3669 "At least %d kB of video memory needed at this "
3672 "resolution and depth.\n", 3670 "resolution and depth.\n",
3673 (pScrn->displayWidth * pScrn->virtualY * 3671 (pScrn->displayWidth * pScrn->virtualY *
3674 info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024); 3672 info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024);
3675 info->directRenderingEnabled = FALSE; 3673 info->directRenderingEnabled = FALSE;
3676 } else { 3674 } else {
3677 info->directRenderingEnabled = RADEONDRIScreenInit(pScreen); 3675 info->directRenderingEnabled = RADEONDRIScreenInit(pScreen);
3678 } 3676 }
3679 } 3677 }
3680 3678
3681 /* Tell DRI about new memory map */ 3679 /* Tell DRI about new memory map */
3682 if (info->directRenderingEnabled && info->dri->newMemoryMap) { 3680 if (info->directRenderingEnabled && info->dri->newMemoryMap) {
3683 if (RADEONDRISetParam(pScrn, RADEON_SETPARAM_NEW_MEMMAP, 1) < 0) { 3681 if (RADEONDRISetParam(pScrn, RADEON_SETPARAM_NEW_MEMMAP, 1) < 0) {
@@ -3807,75 +3805,75 @@ Bool RADEONScreenInit(int scrnIndex, Scr @@ -3807,75 +3805,75 @@ Bool RADEONScreenInit(int scrnIndex, Scr
3807 if (info->ChipFamily < CHIP_FAMILY_R600) { 3805 if (info->ChipFamily < CHIP_FAMILY_R600) {
3808 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 3806 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
3809 "Setting up final surfaces\n"); 3807 "Setting up final surfaces\n");
3810 3808
3811 RADEONChangeSurfaces(pScrn); 3809 RADEONChangeSurfaces(pScrn);
3812 } 3810 }
3813 3811
3814 3812
3815 /* Enable aceleration */ 3813 /* Enable aceleration */
3816 if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { 3814 if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) {
3817 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 3815 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
3818 "Initializing Acceleration\n"); 3816 "Initializing Acceleration\n");
3819 if (RADEONAccelInit(pScreen)) { 3817 if (RADEONAccelInit(pScreen)) {
3820 xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n"); 3818 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration enabled\n");
3821 info->accelOn = TRUE; 3819 info->accelOn = TRUE;
3822 } else { 3820 } else {
3823 xf86DrvMsg(scrnIndex, X_ERROR, 3821 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
3824 "Acceleration initialization failed\n"); 3822 "Acceleration initialization failed\n");
3825 xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); 3823 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
3826 info->accelOn = FALSE; 3824 info->accelOn = FALSE;
3827 } 3825 }
3828 } else { 3826 } else {
3829 xf86DrvMsg(scrnIndex, X_INFO, "Acceleration disabled\n"); 3827 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Acceleration disabled\n");
3830 info->accelOn = FALSE; 3828 info->accelOn = FALSE;
3831 } 3829 }
3832 3830
3833 /* Init DPMS */ 3831 /* Init DPMS */
3834 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 3832 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
3835 "Initializing DPMS\n"); 3833 "Initializing DPMS\n");
3836 xf86DPMSInit(pScreen, xf86DPMSSet, 0); 3834 xf86DPMSInit(pScreen, xf86DPMSSet, 0);
3837 3835
3838 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 3836 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
3839 "Initializing Cursor\n"); 3837 "Initializing Cursor\n");
3840 3838
3841 /* Set Silken Mouse */ 3839 /* Set Silken Mouse */
3842 xf86SetSilkenMouse(pScreen); 3840 xf86SetSilkenMouse(pScreen);
3843 3841
3844 /* Cursor setup */ 3842 /* Cursor setup */
3845 miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); 3843 miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
3846 3844
3847 /* Hardware cursor setup */ 3845 /* Hardware cursor setup */
3848 if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { 3846 if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
3849 if (RADEONCursorInit(pScreen)) { 3847 if (RADEONCursorInit(pScreen)) {
3850#ifdef USE_XAA 3848#ifdef USE_XAA
3851 if (!info->useEXA) { 3849 if (!info->useEXA) {
3852 int width, height; 3850 int width, height;
3853 3851
3854 if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 3852 if (xf86QueryLargestOffscreenArea(pScreen, &width, &height,
3855 0, 0, 0)) { 3853 0, 0, 0)) {
3856 xf86DrvMsg(scrnIndex, X_INFO, 3854 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
3857 "Largest offscreen area available: %d x %d\n", 3855 "Largest offscreen area available: %d x %d\n",
3858 width, height); 3856 width, height);
3859 } 3857 }
3860 } 3858 }
3861#endif /* USE_XAA */ 3859#endif /* USE_XAA */
3862 } else { 3860 } else {
3863 xf86DrvMsg(scrnIndex, X_ERROR, 3861 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
3864 "Hardware cursor initialization failed\n"); 3862 "Hardware cursor initialization failed\n");
3865 xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); 3863 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
3866 } 3864 }
3867 } else { 3865 } else {
3868 xf86DrvMsg(scrnIndex, X_INFO, "Using software cursor\n"); 3866 xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using software cursor\n");
3869 } 3867 }
3870 3868
3871 /* DGA setup */ 3869 /* DGA setup */
3872#ifdef XFreeXDGA 3870#ifdef XFreeXDGA
3873 xf86DiDGAInit(pScreen, info->LinearAddr + pScrn->fbOffset); 3871 xf86DiDGAInit(pScreen, info->LinearAddr + pScrn->fbOffset);
3874#endif 3872#endif
3875 3873
3876 /* Init Xv */ 3874 /* Init Xv */
3877 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 3875 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
3878 "Initializing Xv\n"); 3876 "Initializing Xv\n");
3879 RADEONInitVideo(pScreen); 3877 RADEONInitVideo(pScreen);
3880 3878
3881 if (info->r600_shadow_fb == TRUE) { 3879 if (info->r600_shadow_fb == TRUE) {
@@ -5927,47 +5925,47 @@ static void RADEONRestore(ScrnInfoPtr pS @@ -5927,47 +5925,47 @@ static void RADEONRestore(ScrnInfoPtr pS
5927 dce4_restore_vga_regs(pScrn, restore); 5925 dce4_restore_vga_regs(pScrn, restore);
5928 else if (IS_AVIVO_VARIANT) 5926 else if (IS_AVIVO_VARIANT)
5929 avivo_restore_vga_regs(pScrn, restore); 5927 avivo_restore_vga_regs(pScrn, restore);
5930 else { 5928 else {
5931 RADEONRestoreDACRegisters(pScrn, restore); 5929 RADEONRestoreDACRegisters(pScrn, restore);
5932 } 5930 }
5933#if 0 5931#if 0
5934 RADEONWaitForVerticalSync(pScrn); 5932 RADEONWaitForVerticalSync(pScrn);
5935#endif 5933#endif
5936} 5934}
5937 5935
5938static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode) 5936static Bool RADEONSaveScreen(ScreenPtr pScreen, int mode)
5939{ 5937{
5940 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 5938 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
5941 Bool unblank; 5939 Bool unblank;
5942 5940
5943 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 5941 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
5944 "RADEONSaveScreen(%d)\n", mode); 5942 "RADEONSaveScreen(%d)\n", mode);
5945 5943
5946 unblank = xf86IsUnblank(mode); 5944 unblank = xf86IsUnblank(mode);
5947 if (unblank) SetTimeSinceLastInputEvent(); 5945 if (unblank) SetTimeSinceLastInputEvent();
5948 5946
5949 if ((pScrn != NULL) && pScrn->vtSema) { 5947 if ((pScrn != NULL) && pScrn->vtSema) {
5950 if (unblank) 5948 if (unblank)
5951 RADEONUnblank(pScrn); 5949 RADEONUnblank(pScrn);
5952 else 5950 else
5953 RADEONBlank(pScrn); 5951 RADEONBlank(pScrn);
5954 } 5952 }
5955 return TRUE; 5953 return TRUE;
5956} 5954}
5957 5955
5958Bool RADEONSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) 5956Bool RADEONSwitchMode(SWITCH_MODE_ARGS_DECL)
5959{ 5957{
5960 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 5958 SCRN_INFO_PTR(arg);
5961 RADEONInfoPtr info = RADEONPTR(pScrn); 5959 RADEONInfoPtr info = RADEONPTR(pScrn);
5962 Bool tilingOld = info->tilingEnabled; 5960 Bool tilingOld = info->tilingEnabled;
5963 Bool ret; 5961 Bool ret;
5964#ifdef XF86DRI 5962#ifdef XF86DRI
5965 Bool CPStarted = info->cp->CPStarted; 5963 Bool CPStarted = info->cp->CPStarted;
5966 5964
5967 if (CPStarted) { 5965 if (CPStarted) {
5968 DRILock(pScrn->pScreen, 0); 5966 DRILock(pScrn->pScreen, 0);
5969 RADEONCP_STOP(pScrn, info); 5967 RADEONCP_STOP(pScrn, info);
5970 } 5968 }
5971#endif 5969#endif
5972 5970
5973 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 5971 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -5984,29 +5982,29 @@ Bool RADEONSwitchMode(int scrnIndex, Dis @@ -5984,29 +5982,29 @@ Bool RADEONSwitchMode(int scrnIndex, Dis
5984 pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen); 5982 pSAREAPriv = DRIGetSAREAPrivate(pScrn->pScreen);
5985 info->tilingEnabled = pSAREAPriv->tiling_enabled ? TRUE : FALSE; 5983 info->tilingEnabled = pSAREAPriv->tiling_enabled ? TRUE : FALSE;
5986 } 5984 }
5987#endif 5985#endif
5988 } 5986 }
5989 5987
5990 if (info->accelOn) 5988 if (info->accelOn)
5991 RADEON_SYNC(info, pScrn); 5989 RADEON_SYNC(info, pScrn);
5992 5990
5993 ret = xf86SetSingleMode (pScrn, mode, RR_Rotate_0); 5991 ret = xf86SetSingleMode (pScrn, mode, RR_Rotate_0);
5994 5992
5995 if (info->tilingEnabled != tilingOld) { 5993 if (info->tilingEnabled != tilingOld) {
5996 /* need to redraw front buffer, I guess this can be considered a hack ? */ 5994 /* need to redraw front buffer, I guess this can be considered a hack ? */
5997 xf86EnableDisableFBAccess(scrnIndex, FALSE); 5995 xf86EnableDisableFBAccess(arg, FALSE);
5998 RADEONChangeSurfaces(pScrn); 5996 RADEONChangeSurfaces(pScrn);
5999 xf86EnableDisableFBAccess(scrnIndex, TRUE); 5997 xf86EnableDisableFBAccess(arg, TRUE);
6000 /* xf86SetRootClip would do, but can't access that here */ 5998 /* xf86SetRootClip would do, but can't access that here */
6001 } 5999 }
6002 6000
6003 if (info->accelOn) { 6001 if (info->accelOn) {
6004 RADEON_SYNC(info, pScrn); 6002 RADEON_SYNC(info, pScrn);
6005 if (info->ChipFamily < CHIP_FAMILY_R600) 6003 if (info->ChipFamily < CHIP_FAMILY_R600)
6006 RADEONEngineRestore(pScrn); 6004 RADEONEngineRestore(pScrn);
6007 } 6005 }
6008 6006
6009#ifdef XF86DRI 6007#ifdef XF86DRI
6010 if (CPStarted) { 6008 if (CPStarted) {
6011 RADEONCP_START(pScrn, info); 6009 RADEONCP_START(pScrn, info);
6012 DRIUnlock(pScrn->pScreen); 6010 DRIUnlock(pScrn->pScreen);
@@ -6041,30 +6039,30 @@ xf86ModeBandwidth(DisplayModePtr mode, i @@ -6041,30 +6039,30 @@ xf86ModeBandwidth(DisplayModePtr mode, i
6041 if (!mode->HTotal || !mode->VTotal || !mode->Clock) 6039 if (!mode->HTotal || !mode->VTotal || !mode->Clock)
6042 return 0; 6040 return 0;
6043 6041
6044 a_active = mode->HDisplay * mode->VDisplay; 6042 a_active = mode->HDisplay * mode->VDisplay;
6045 a_total = mode->HTotal * mode->VTotal; 6043 a_total = mode->HTotal * mode->VTotal;
6046 active_percent = a_active / a_total; 6044 active_percent = a_active / a_total;
6047 pixels_per_second = active_percent * mode->Clock * 1000.0; 6045 pixels_per_second = active_percent * mode->Clock * 1000.0;
6048 6046
6049 return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024)); 6047 return (unsigned int)(pixels_per_second * bytes_per_pixel / (1024 * 1024));
6050} 6048}
6051#endif 6049#endif
6052 6050
6053/* Used to disallow modes that are not supported by the hardware */ 6051/* Used to disallow modes that are not supported by the hardware */
6054ModeStatus RADEONValidMode(int scrnIndex, DisplayModePtr mode, 6052ModeStatus RADEONValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode,
6055 Bool verbose, int flag) 6053 Bool verbose, int flag)
6056{ 6054{
6057 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 6055 SCRN_INFO_PTR(arg);
6058 RADEONInfoPtr info = RADEONPTR(pScrn); 6056 RADEONInfoPtr info = RADEONPTR(pScrn);
6059 RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); 6057 RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
6060 6058
6061 /* 6059 /*
6062 * RN50 has effective maximum mode bandwidth of about 300MiB/s. 6060 * RN50 has effective maximum mode bandwidth of about 300MiB/s.
6063 * XXX should really do this for all chips by properly computing 6061 * XXX should really do this for all chips by properly computing
6064 * memory bandwidth and an overhead factor. 6062 * memory bandwidth and an overhead factor.
6065 */ 6063 */
6066 if (info->ChipFamily == CHIP_FAMILY_RV100 && !pRADEONEnt->HasCRTC2) { 6064 if (info->ChipFamily == CHIP_FAMILY_RV100 && !pRADEONEnt->HasCRTC2) {
6067 if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 300) 6065 if (xf86ModeBandwidth(mode, pScrn->bitsPerPixel) > 300)
6068 return MODE_BANDWIDTH; 6066 return MODE_BANDWIDTH;
6069 } 6067 }
6070 6068
@@ -6148,27 +6146,27 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc @@ -6148,27 +6146,27 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
6148 } 6146 }
6149 Base += offset; 6147 Base += offset;
6150 } 6148 }
6151 6149
6152 Base &= ~7; /* 3 lower bits are always 0 */ 6150 Base &= ~7; /* 3 lower bits are always 0 */
6153 6151
6154#ifdef XF86DRI 6152#ifdef XF86DRI
6155 if (info->directRenderingInited) { 6153 if (info->directRenderingInited) {
6156 /* note cannot use pScrn->pScreen since this is unitialized when called from 6154 /* note cannot use pScrn->pScreen since this is unitialized when called from
6157 RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */ 6155 RADEONScreenInit, and we need to call from there to get mergedfb + pageflip working */
6158 /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for 6156 /*** NOTE: r3/4xx will need sarea and drm pageflip updates to handle the xytile regs for
6159 *** pageflipping! 6157 *** pageflipping!
6160 ***/ 6158 ***/
6161 pSAREAPriv = DRIGetSAREAPrivate(screenInfo.screens[pScrn->scrnIndex]); 6159 pSAREAPriv = DRIGetSAREAPrivate(xf86ScrnToScreen(pScrn));
6162 /* can't get at sarea in a semi-sane way? */ 6160 /* can't get at sarea in a semi-sane way? */
6163 pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec)); 6161 pSAREA = (void *)((char*)pSAREAPriv - sizeof(XF86DRISAREARec));
6164 6162
6165 if (crtc2) { 6163 if (crtc2) {
6166 pSAREAPriv->crtc2_base = Base; 6164 pSAREAPriv->crtc2_base = Base;
6167 } 6165 }
6168 else { 6166 else {
6169 pSAREA->frame.x = (Base / info->CurrentLayout.pixel_bytes) 6167 pSAREA->frame.x = (Base / info->CurrentLayout.pixel_bytes)
6170 % info->CurrentLayout.displayWidth; 6168 % info->CurrentLayout.displayWidth;
6171 pSAREA->frame.y = (Base / info->CurrentLayout.pixel_bytes) 6169 pSAREA->frame.y = (Base / info->CurrentLayout.pixel_bytes)
6172 / info->CurrentLayout.displayWidth; 6170 / info->CurrentLayout.displayWidth;
6173 pSAREA->frame.width = pScrn->frameX1 - x + 1; 6171 pSAREA->frame.width = pScrn->frameX1 - x + 1;
6174 pSAREA->frame.height = pScrn->frameY1 - y + 1; 6172 pSAREA->frame.height = pScrn->frameY1 - y + 1;
@@ -6179,29 +6177,29 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc @@ -6179,29 +6177,29 @@ void RADEONDoAdjustFrame(ScrnInfoPtr pSc
6179 } 6177 }
6180 } 6178 }
6181#endif 6179#endif
6182 6180
6183 if (IS_R300_VARIANT || IS_AVIVO_VARIANT) { 6181 if (IS_R300_VARIANT || IS_AVIVO_VARIANT) {
6184 OUTREG(xytilereg, crtcxytile); 6182 OUTREG(xytilereg, crtcxytile);
6185 } else { 6183 } else {
6186 OUTREG(regcntl, crtcoffsetcntl); 6184 OUTREG(regcntl, crtcoffsetcntl);
6187 } 6185 }
6188 6186
6189 OUTREG(reg, Base); 6187 OUTREG(reg, Base);
6190} 6188}
6191 6189
6192void RADEONAdjustFrame(int scrnIndex, int x, int y, int flags) 6190void RADEONAdjustFrame(ADJUST_FRAME_ARGS_DECL)
6193{ 6191{
6194 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 6192 SCRN_INFO_PTR(arg);
6195 RADEONInfoPtr info = RADEONPTR(pScrn); 6193 RADEONInfoPtr info = RADEONPTR(pScrn);
6196 RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn); 6194 RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
6197 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); 6195 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
6198 xf86OutputPtr output = config->output[config->compat_output]; 6196 xf86OutputPtr output = config->output[config->compat_output];
6199 xf86CrtcPtr crtc = output->crtc; 6197 xf86CrtcPtr crtc = output->crtc;
6200 6198
6201 /* not handled */ 6199 /* not handled */
6202 if (IS_AVIVO_VARIANT) 6200 if (IS_AVIVO_VARIANT)
6203 return; 6201 return;
6204 6202
6205#ifdef XF86DRI 6203#ifdef XF86DRI
6206 if (info->cp->CPStarted && pScrn->pScreen) DRILock(pScrn->pScreen, 0); 6204 if (info->cp->CPStarted && pScrn->pScreen) DRILock(pScrn->pScreen, 0);
6207#endif 6205#endif
@@ -6217,29 +6215,29 @@ void RADEONAdjustFrame(int scrnIndex, in @@ -6217,29 +6215,29 @@ void RADEONAdjustFrame(int scrnIndex, in
6217 crtc->x = output->initial_x + x; 6215 crtc->x = output->initial_x + x;
6218 crtc->y = output->initial_y + y; 6216 crtc->y = output->initial_y + y;
6219 } 6217 }
6220 6218
6221 6219
6222#ifdef XF86DRI 6220#ifdef XF86DRI
6223 if (info->cp->CPStarted && pScrn->pScreen) DRIUnlock(pScrn->pScreen); 6221 if (info->cp->CPStarted && pScrn->pScreen) DRIUnlock(pScrn->pScreen);
6224#endif 6222#endif
6225} 6223}
6226 6224
6227/* Called when VT switching back to the X server. Reinitialize the 6225/* Called when VT switching back to the X server. Reinitialize the
6228 * video mode. 6226 * video mode.
6229 */ 6227 */
6230Bool RADEONEnterVT(int scrnIndex, int flags) 6228Bool RADEONEnterVT(VT_FUNC_ARGS_DECL)
6231{ 6229{
6232 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 6230 SCRN_INFO_PTR(arg);
6233 RADEONInfoPtr info = RADEONPTR(pScrn); 6231 RADEONInfoPtr info = RADEONPTR(pScrn);
6234 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); 6232 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
6235 int i; 6233 int i;
6236 6234
6237 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 6235 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
6238 "RADEONEnterVT\n"); 6236 "RADEONEnterVT\n");
6239 6237
6240 if (!radeon_card_posted(pScrn)) { /* Softboot V_BIOS */ 6238 if (!radeon_card_posted(pScrn)) { /* Softboot V_BIOS */
6241 if (info->IsAtomBios) { 6239 if (info->IsAtomBios) {
6242 rhdAtomASICInit(info->atomBIOS); 6240 rhdAtomASICInit(info->atomBIOS);
6243 } else { 6241 } else {
6244 xf86Int10InfoPtr pInt; 6242 xf86Int10InfoPtr pInt;
6245 6243
@@ -6317,29 +6315,29 @@ Bool RADEONEnterVT(int scrnIndex, int fl @@ -6317,29 +6315,29 @@ Bool RADEONEnterVT(int scrnIndex, int fl
6317 RADEONCP_START(pScrn, info); 6315 RADEONCP_START(pScrn, info);
6318 DRIUnlock(pScrn->pScreen); 6316 DRIUnlock(pScrn->pScreen);
6319 } 6317 }
6320#endif 6318#endif
6321 if (IS_R500_3D || IS_R300_3D) 6319 if (IS_R500_3D || IS_R300_3D)
6322 radeon_load_bicubic_texture(pScrn); 6320 radeon_load_bicubic_texture(pScrn);
6323 6321
6324 return TRUE; 6322 return TRUE;
6325} 6323}
6326 6324
6327/* Called when VT switching away from the X server. Restore the 6325/* Called when VT switching away from the X server. Restore the
6328 * original text mode. 6326 * original text mode.
6329 */ 6327 */
6330void RADEONLeaveVT(int scrnIndex, int flags) 6328void RADEONLeaveVT(VT_FUNC_ARGS_DECL)
6331{ 6329{
6332 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 6330 SCRN_INFO_PTR(arg);
6333 RADEONInfoPtr info = RADEONPTR(pScrn); 6331 RADEONInfoPtr info = RADEONPTR(pScrn);
6334 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); 6332 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
6335 int i; 6333 int i;
6336 6334
6337 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 6335 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
6338 "RADEONLeaveVT\n"); 6336 "RADEONLeaveVT\n");
6339#ifdef XF86DRI 6337#ifdef XF86DRI
6340 if (RADEONPTR(pScrn)->directRenderingInited) { 6338 if (RADEONPTR(pScrn)->directRenderingInited) {
6341 6339
6342 RADEONDRISetVBlankInterrupt (pScrn, FALSE); 6340 RADEONDRISetVBlankInterrupt (pScrn, FALSE);
6343 DRILock(pScrn->pScreen, 0); 6341 DRILock(pScrn->pScreen, 0);
6344 RADEONCP_STOP(pScrn, info); 6342 RADEONCP_STOP(pScrn, info);
6345 6343
@@ -6404,29 +6402,29 @@ void RADEONLeaveVT(int scrnIndex, int fl @@ -6404,29 +6402,29 @@ void RADEONLeaveVT(int scrnIndex, int fl
6404 RADEONRestore(pScrn); 6402 RADEONRestore(pScrn);
6405 6403
6406 for (i = 0; i < config->num_crtc; i++) 6404 for (i = 0; i < config->num_crtc; i++)
6407 radeon_crtc_modeset_ioctl(config->crtc[i], FALSE); 6405 radeon_crtc_modeset_ioctl(config->crtc[i], FALSE);
6408 6406
6409 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 6407 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
6410 "Ok, leaving now...\n"); 6408 "Ok, leaving now...\n");
6411} 6409}
6412 6410
6413/* Called at the end of each server generation. Restore the original 6411/* Called at the end of each server generation. Restore the original
6414 * text mode, unmap video memory, and unwrap and call the saved 6412 * text mode, unmap video memory, and unwrap and call the saved
6415 * CloseScreen function. 6413 * CloseScreen function.
6416 */ 6414 */
6417static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen) 6415static Bool RADEONCloseScreen(CLOSE_SCREEN_ARGS_DECL)
6418{ 6416{
6419 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 6417 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
6420 RADEONInfoPtr info = RADEONPTR(pScrn); 6418 RADEONInfoPtr info = RADEONPTR(pScrn);
6421 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); 6419 xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
6422 int i; 6420 int i;
6423 6421
6424 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 6422 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
6425 "RADEONCloseScreen\n"); 6423 "RADEONCloseScreen\n");
6426 6424
6427 RADEONPMFini(pScrn); 6425 RADEONPMFini(pScrn);
6428 6426
6429 /* Mark acceleration as stopped or we might try to access the engine at 6427 /* Mark acceleration as stopped or we might try to access the engine at
6430 * wrong times, especially if we had DRI, after DRI has been stopped 6428 * wrong times, especially if we had DRI, after DRI has been stopped
6431 */ 6429 */
6432 info->accelOn = FALSE; 6430 info->accelOn = FALSE;
@@ -6489,32 +6487,32 @@ static Bool RADEONCloseScreen(int scrnIn @@ -6489,32 +6487,32 @@ static Bool RADEONCloseScreen(int scrnIn
6489 if (info->cursor) xf86DestroyCursorInfoRec(info->cursor); 6487 if (info->cursor) xf86DestroyCursorInfoRec(info->cursor);
6490 info->cursor = NULL; 6488 info->cursor = NULL;
6491 6489
6492 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 6490 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
6493 "Unmapping memory\n"); 6491 "Unmapping memory\n");
6494 RADEONUnmapMem(pScrn); 6492 RADEONUnmapMem(pScrn);
6495 6493
6496 pScrn->vtSema = FALSE; 6494 pScrn->vtSema = FALSE;
6497 6495
6498 xf86ClearPrimInitDone(info->pEnt->index); 6496 xf86ClearPrimInitDone(info->pEnt->index);
6499 6497
6500 pScreen->BlockHandler = info->BlockHandler; 6498 pScreen->BlockHandler = info->BlockHandler;
6501 pScreen->CloseScreen = info->CloseScreen; 6499 pScreen->CloseScreen = info->CloseScreen;
6502 return (*pScreen->CloseScreen)(scrnIndex, pScreen); 6500 return (*pScreen->CloseScreen)(CLOSE_SCREEN_ARGS);
6503} 6501}
6504 6502
6505void RADEONFreeScreen(int scrnIndex, int flags) 6503void RADEONFreeScreen(FREE_SCREEN_ARGS_DECL)
6506{ 6504{
6507 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 6505 SCRN_INFO_PTR(arg);
6508 RADEONInfoPtr info = RADEONPTR(pScrn); 6506 RADEONInfoPtr info = RADEONPTR(pScrn);
6509  6507
6510 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG, 6508 xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
6511 "RADEONFreeScreen\n"); 6509 "RADEONFreeScreen\n");
6512 6510
6513 /* when server quits at PreInit, we don't need do this anymore*/ 6511 /* when server quits at PreInit, we don't need do this anymore*/
6514 if (!info) return; 6512 if (!info) return;
6515 6513
6516#ifdef WITH_VGAHW 6514#ifdef WITH_VGAHW
6517 if (info->VGAAccess && xf86LoaderCheckSymbol("vgaHWFreeHWRec")) 6515 if (info->VGAAccess && xf86LoaderCheckSymbol("vgaHWFreeHWRec"))
6518 vgaHWFreeHWRec(pScrn); 6516 vgaHWFreeHWRec(pScrn);
6519#endif 6517#endif
6520 RADEONFreeRec(pScrn); 6518 RADEONFreeRec(pScrn);

cvs diff -r1.3 -r1.4 xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c (expand / switch to unified diff)

--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c 2012/06/03 16:42:23 1.3
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c 2012/09/23 20:06:03 1.4
@@ -801,27 +801,27 @@ static void radeon_unload_bicubic_textur @@ -801,27 +801,27 @@ static void radeon_unload_bicubic_textur
801 RADEONInfoPtr info = RADEONPTR(pScrn); 801 RADEONInfoPtr info = RADEONPTR(pScrn);
802 802
803 if (info->bicubic_memory != NULL) { 803 if (info->bicubic_memory != NULL) {
804 radeon_legacy_free_memory(pScrn, info->bicubic_memory); 804 radeon_legacy_free_memory(pScrn, info->bicubic_memory);
805 info->bicubic_memory = NULL; 805 info->bicubic_memory = NULL;
806 } 806 }
807 807
808} 808}
809#endif 809#endif
810 810
811XF86VideoAdaptorPtr 811XF86VideoAdaptorPtr
812RADEONSetupImageTexturedVideo(ScreenPtr pScreen) 812RADEONSetupImageTexturedVideo(ScreenPtr pScreen)
813{ 813{
814 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 814 ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
815 RADEONInfoPtr info = RADEONPTR(pScrn); 815 RADEONInfoPtr info = RADEONPTR(pScrn);
816 RADEONPortPrivPtr pPortPriv; 816 RADEONPortPrivPtr pPortPriv;
817 XF86VideoAdaptorPtr adapt; 817 XF86VideoAdaptorPtr adapt;
818 int i; 818 int i;
819 int num_texture_ports = 16; 819 int num_texture_ports = 16;
820 820
821 adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports * 821 adapt = calloc(1, sizeof(XF86VideoAdaptorRec) + num_texture_ports *
822 (sizeof(RADEONPortPrivRec) + sizeof(DevUnion))); 822 (sizeof(RADEONPortPrivRec) + sizeof(DevUnion)));
823 if (adapt == NULL) 823 if (adapt == NULL)
824 return NULL; 824 return NULL;
825 825
826 xvBicubic = MAKE_ATOM("XV_BICUBIC"); 826 xvBicubic = MAKE_ATOM("XV_BICUBIC");
827 xvVSync = MAKE_ATOM("XV_VSYNC"); 827 xvVSync = MAKE_ATOM("XV_VSYNC");