rpms/xorg-x11-drv-ati/devel radeon-modeset.patch,1.1,1.2

Dave Airlie (airlied) fedora-extras-commits at redhat.com
Tue Aug 5 05:43:06 UTC 2008


Author: airlied

Update of /cvs/pkgs/rpms/xorg-x11-drv-ati/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv6111

Modified Files:
	radeon-modeset.patch 
Log Message:
* Fri Aug 01 2008 Dave Airlie <airlied at redhat.com> 6.8.0-20
- DDX modesetting code


radeon-modeset.patch:

Index: radeon-modeset.patch
===================================================================
RCS file: /cvs/pkgs/rpms/xorg-x11-drv-ati/devel/radeon-modeset.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- radeon-modeset.patch	1 Aug 2008 07:00:59 -0000	1.1
+++ radeon-modeset.patch	5 Aug 2008 05:42:36 -0000	1.2
@@ -821,7 +821,7 @@
 +#endif
 +#endif
 diff --git a/src/radeon.h b/src/radeon.h
-index 8f25fdf..ff4d3fe 100644
+index 8f25fdf..4f05610 100644
 --- a/src/radeon.h
 +++ b/src/radeon.h
 @@ -46,6 +46,8 @@
@@ -893,7 +893,7 @@
  				/* DRI screen private data */
      int               fbX;
      int               fbY;
-@@ -804,6 +829,42 @@ typedef struct {
+@@ -804,6 +829,43 @@ typedef struct {
  
      int num_gb_pipes;
      Bool has_tcl;
@@ -901,6 +901,7 @@
 +    Bool new_cs; // new command submission routine
 +    struct radeon_2d_state state_2d;
 +    void (*reemit_current2d)(ScrnInfoPtr pScrn, int op); // emit the current 2D state into the IB 
++    Bool cs_used_depth;
 +    Bool drm_mm; // the drm memory manager exists and is initialised 
 +    struct {
 +      uint64_t vram_start;
@@ -936,7 +937,7 @@
  } RADEONInfoRec, *RADEONInfoPtr;
  
  #define RADEONWaitForFifo(pScrn, entries)				\
-@@ -1033,6 +1094,11 @@ extern void RADEONUpdateHVPosition(xf86OutputPtr output, DisplayModePtr mode);
+@@ -1033,6 +1095,11 @@ extern void RADEONUpdateHVPosition(xf86OutputPtr output, DisplayModePtr mode);
  extern void RADEONInitVideo(ScreenPtr pScreen);
  extern void RADEONResetVideo(ScrnInfoPtr pScrn);
  
@@ -948,7 +949,7 @@
  #ifdef XF86DRI
  #  ifdef USE_XAA
  /* radeon_accelfuncs.c */
-@@ -1051,7 +1117,9 @@ do {									\
+@@ -1051,7 +1118,9 @@ do {									\
  
  #define RADEONCP_RELEASE(pScrn, info)					\
  do {									\
@@ -959,7 +960,7 @@
  	RADEON_PURGE_CACHE();						\
  	RADEON_WAIT_UNTIL_IDLE();					\
  	RADEONCPReleaseIndirect(pScrn);					\
-@@ -1085,7 +1153,7 @@ do {									\
+@@ -1085,7 +1154,7 @@ do {									\
  
  #define RADEONCP_REFRESH(pScrn, info)					\
  do {									\
@@ -968,7 +969,7 @@
  	if (info->needCacheFlush) {					\
  	    RADEON_PURGE_CACHE();					\
  	    RADEON_PURGE_ZCACHE();					\
-@@ -1124,6 +1192,13 @@ do {									\
+@@ -1124,6 +1193,13 @@ do {									\
  #define RING_LOCALS	uint32_t *__head = NULL; int __expected; int __count = 0
  
  #define BEGIN_RING(n) do {						\
@@ -982,7 +983,7 @@
      if (RADEON_VERBOSE) {						\
  	xf86DrvMsg(pScrn->scrnIndex, X_INFO,				\
  		   "BEGIN_RING(%d) in %s\n", (unsigned int)n, __FUNCTION__);\
-@@ -1136,13 +1211,6 @@ do {									\
+@@ -1136,13 +1212,6 @@ do {									\
      }									\
      info->dma_debug_func = __FILE__;					\
      info->dma_debug_lineno = __LINE__;					\
@@ -996,7 +997,7 @@
      __expected = n;							\
      __head = (pointer)((char *)info->indirectBuffer->address +		\
  		       info->indirectBuffer->used);			\
-@@ -1185,6 +1253,17 @@ do {									\
+@@ -1185,6 +1254,17 @@ do {									\
      OUT_RING(val);							\
  } while (0)
  
@@ -1014,7 +1015,7 @@
  #define FLUSH_RING()							\
  do {									\
      if (RADEON_VERBOSE)							\
-@@ -1297,4 +1376,9 @@ static __inline__ int radeon_timedout(const struct timeval *endtime)
+@@ -1297,4 +1377,10 @@ static __inline__ int radeon_timedout(const struct timeval *endtime)
          now.tv_usec > endtime->tv_usec : now.tv_sec > endtime->tv_sec;
  }
  
@@ -1023,9 +1024,10 @@
 +void radeon_unmap_memory(ScrnInfoPtr pScrn, struct radeon_memory *mem);
 +void radeon_free_memory(ScrnInfoPtr pScrn, struct radeon_memory *mem);
 +Bool radeon_bind_memory(ScrnInfoPtr pScrn, struct radeon_memory *mem);
++Bool radeon_free_all_memory(ScrnInfoPtr pScrn);
  #endif /* _RADEON_H_ */
 diff --git a/src/radeon_accel.c b/src/radeon_accel.c
-index 91f463a..186c2cc 100644
+index 91f463a..ad539f0 100644
 --- a/src/radeon_accel.c
 +++ b/src/radeon_accel.c
 @@ -313,6 +313,9 @@ void RADEONEngineRestore(ScrnInfoPtr pScrn)
@@ -1169,7 +1171,7 @@
  }
  
  
-@@ -573,6 +578,141 @@ int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info)
+@@ -573,6 +578,145 @@ int RADEONCPStop(ScrnInfoPtr pScrn, RADEONInfoPtr info)
      }
  }
  
@@ -1197,7 +1199,11 @@
 +    info->indirectBuffer->total += 16 * 4;
 +    
 +    /* end of IB purge caches */
-+    RADEON_PURGE_ZCACHE();
++    if (info->cs_used_depth) {
++	RADEON_PURGE_ZCACHE();
++	info->cs_used_depth = 0;
++    }
++
 +    RADEON_PURGE_CACHE();
 +    RADEON_WAIT_UNTIL_IDLE();
 +
@@ -1255,7 +1261,7 @@
 +	radeon_free_memory(pScrn, info->mm.gem_ib_memory);
 +	return NULL;
 +    }
-+    info->ib_gem_fake.address = (void *)(unsigned long)info->mm.gem_ib_memory->bus_addr;
++    info->ib_gem_fake.address = info->mm.gem_ib_memory->map;
 +    info->ib_gem_fake.used = 0;
 +    info->ib_gem_fake.total = RADEON_BUFFER_SIZE;
 +    
@@ -1311,7 +1317,7 @@
  /* Get an indirect buffer for the CP 2D acceleration commands  */
  drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn)
  {
-@@ -583,6 +723,9 @@ drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn)
+@@ -583,6 +727,9 @@ drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn)
      int            size = 0;
      int            i = 0;
      int            ret;
@@ -1321,7 +1327,7 @@
  
  #if 0
      /* FIXME: pScrn->pScreen has not been initialized when this is first
-@@ -648,6 +791,11 @@ void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard)
+@@ -648,6 +795,11 @@ void RADEONCPFlushIndirect(ScrnInfoPtr pScrn, int discard)
      if (!buffer) return;
      if (start == buffer->used && !discard) return;
  
@@ -1333,7 +1339,7 @@
      if (RADEON_VERBOSE) {
  	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Flushing buffer %d\n",
  		   buffer->idx);
-@@ -682,10 +830,17 @@ void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn)
+@@ -682,10 +834,17 @@ void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn)
      int                start  = info->indirectStart;
      drmRadeonIndirect  indirect;
  
@@ -1351,7 +1357,7 @@
  
      if (RADEON_VERBOSE) {
  	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Releasing buffer %d\n",
-@@ -949,7 +1104,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
+@@ -949,7 +1108,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
  #ifdef USE_EXA
      if (info->useEXA) {
  # ifdef XF86DRI
@@ -1360,7 +1366,7 @@
  	    if (!RADEONDrawInitCP(pScreen))
  		return FALSE;
  	} else
-@@ -970,7 +1125,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
+@@ -970,7 +1129,7 @@ Bool RADEONAccelInit(ScreenPtr pScreen)
  	}
  
  #ifdef XF86DRI
@@ -1369,7 +1375,7 @@
  	    RADEONAccelInitCP(pScreen, a);
  	else
  #endif /* XF86DRI */
-@@ -992,11 +1147,13 @@ void RADEONInit3DEngine(ScrnInfoPtr pScrn)
+@@ -992,11 +1151,13 @@ void RADEONInit3DEngine(ScrnInfoPtr pScrn)
      RADEONInfoPtr info = RADEONPTR (pScrn);
  
  #ifdef XF86DRI
@@ -1449,7 +1455,7 @@
  
  	FLUSH_RING();
 diff --git a/src/radeon_cursor.c b/src/radeon_cursor.c
-index 13c2b9c..97870dc 100644
+index 13c2b9c..1e1835a 100644
 --- a/src/radeon_cursor.c
 +++ b/src/radeon_cursor.c
 @@ -96,12 +96,19 @@ avivo_setup_cursor(xf86CrtcPtr crtc, Bool enable)
@@ -1520,7 +1526,7 @@
      RADEONCTRACE(("RADEONLoadCursorARGB\n"));
  
 +    if (info->drm_mm) 
-+      d = (uint32_t *)(pointer)radeon_crtc->cursor->bus_addr;
++      d = (uint32_t *)radeon_crtc->cursor->map;
 +    else
 +      d = (uint32_t *)(pointer)(info->FB + radeon_crtc->cursor_offset);
 +
@@ -2257,7 +2263,7 @@
 +
 +}
 diff --git a/src/radeon_driver.c b/src/radeon_driver.c
-index 010f1b9..bbff0f1 100644
+index 010f1b9..a2a9aa0 100644
 --- a/src/radeon_driver.c
 +++ b/src/radeon_driver.c
 @@ -1621,7 +1621,10 @@ static Bool RADEONPreInitVRAM(ScrnInfoPtr pScrn)
@@ -2781,9 +2787,11 @@
 +
 +	if (!RADEONPreInitControllers(pScrn))
 +	    goto fail;
-+
  
 -    RADEONPreInitDDC(pScrn);
+ 
+-    if (!RADEONPreInitControllers(pScrn))
+-       goto fail;
 +	ErrorF("before xf86InitialConfiguration\n");
 +	
 +	if (!xf86InitialConfiguration (pScrn, FALSE))
@@ -2793,9 +2801,7 @@
 +	}
 +	
 +	ErrorF("after xf86InitialConfiguration\n");
- 
--    if (!RADEONPreInitControllers(pScrn))
--       goto fail;
++
 +    } else {
 +#ifdef XF86DRM_MODE
 +	char *bus_id;
@@ -3044,7 +3050,7 @@
 +    front_ptr = info->FB;
 +    if (info->drm_mm) {
 +	radeon_setup_kernel_mem(pScreen);
-+	front_ptr = info->mm.front_buffer->bus_addr;
++	front_ptr = info->mm.front_buffer->map;
 +	pScrn->fbOffset = info->mm.front_buffer->offset;
 +	info->dst_pitch_offset = (((pScrn->displayWidth * info->CurrentLayout.pixel_bytes / 64)
 +				   << 22) | ((info->fbLocation + pScrn->fbOffset) >> 10));
@@ -3157,12 +3163,12 @@
  	    }
  	}
 -    }
+-
+-    /* Makes sure the engine is idle before doing anything */
+-    RADEONWaitForIdleMMIO(pScrn);
 +	/* Makes sure the engine is idle before doing anything */
 +	RADEONWaitForIdleMMIO(pScrn);
  
--    /* Makes sure the engine is idle before doing anything */
--    RADEONWaitForIdleMMIO(pScrn);
--
 -    if (info->IsMobility && !IS_AVIVO_VARIANT) {
 -	if (xf86ReturnOptValBool(info->Options, OPTION_DYNAMIC_CLOCKS, FALSE)) {
 -	    RADEONSetDynamicClock(pScrn, 1);
@@ -3301,12 +3307,12 @@
 -    RADEONRestore(pScrn);
 +    if (info->drm_mm)
 +	radeon_unbind_all_memory(pScrn);
-+
-+    if (!info->drm_mode_setting) {
-+	RADEONRestore(pScrn);
  
 -    for (i = 0; i < config->num_crtc; i++)
 -	radeon_crtc_modeset_ioctl(config->crtc[i], FALSE);
++    if (!info->drm_mode_setting) {
++	RADEONRestore(pScrn);
++
 +	for (i = 0; i < config->num_crtc; i++)
 +	    radeon_crtc_modeset_ioctl(config->crtc[i], FALSE);
 +    }
@@ -3323,13 +3329,15 @@
      }
  
      xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
-@@ -5622,6 +5777,10 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen)
+@@ -5622,6 +5777,12 @@ static Bool RADEONCloseScreen(int scrnIndex, ScreenPtr pScreen)
      info->DGAModes = NULL;
      xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
  		   "Unmapping memory\n");
 +
-+    if (info->drm_mm)
++    if (info->drm_mm) {
 +	radeon_unbind_all_memory(pScrn);
++	radeon_free_all_memory(pScrn);
++    }
 +
      RADEONUnmapMem(pScrn);
  
@@ -3658,7 +3666,7 @@
 +}
 +
 diff --git a/src/radeon_exa_funcs.c b/src/radeon_exa_funcs.c
-index 56de23e..9a6d53d 100644
+index 56de23e..96ce0ef 100644
 --- a/src/radeon_exa_funcs.c
 +++ b/src/radeon_exa_funcs.c
 @@ -77,13 +77,65 @@ FUNC_NAME(RADEONSync)(ScreenPtr pScreen, int marker)
@@ -3878,7 +3886,7 @@
  	return FALSE;
  
 +    if (info->drm_mode_setting)
-+	    dst = (void *)info->mm.front_buffer->bus_addr + exaGetPixmapOffset(pDst);
++	    dst = info->mm.front_buffer->map + exaGetPixmapOffset(pDst);
 +
  #ifdef ACCEL_CP
 -    if (info->directRenderingEnabled &&
@@ -3913,7 +3921,7 @@
      TRACE;
  
 +    if (info->drm_mode_setting)
-+      src = (void *)info->mm.front_buffer->bus_addr + exaGetPixmapOffset(pSrc);
++      src = info->mm.front_buffer->map + exaGetPixmapOffset(pSrc);
 +
  #ifdef ACCEL_CP
      /*
@@ -4059,10 +4067,10 @@
      blendcntl = RADEONGetBlendCntl(op, pMaskPicture, pDstPicture->format);
 diff --git a/src/radeon_memory.c b/src/radeon_memory.c
 new file mode 100644
-index 0000000..5f79e98
+index 0000000..56e4165
 --- /dev/null
 +++ b/src/radeon_memory.c
-@@ -0,0 +1,390 @@
+@@ -0,0 +1,405 @@
 +
 +#include <errno.h>
 +#include <sys/ioctl.h>
@@ -4143,7 +4151,7 @@
 +	if (mem == NULL)
 +		return;
 +
-+	if (mem->bus_addr)
++	if (mem->map)
 +	    radeon_unmap_memory(pScrn, mem);
 +	    
 +	radeon_unbind_memory(pScrn, mem);
@@ -4227,7 +4235,7 @@
 +    int i;
 +
 +    for (i = 0; i < 2; i++) {
-+	for (mem = info->mm.bo_list[i]; mem->next != NULL;
++	for (mem = info->mm.bo_list[i]; mem != NULL;
 +	     mem = mem->next) {
 +	    if (!radeon_bind_memory(pScrn, mem)) {
 +		FatalError("Couldn't bind %s\n", mem->name);
@@ -4245,7 +4253,7 @@
 +    int i;
 +
 +    for (i = 0; i < 2; i++) {
-+	for (mem = info->mm.bo_list[i]; mem->next != NULL;
++	for (mem = info->mm.bo_list[i]; mem != NULL;
 +	     mem = mem->next) {
 +	    radeon_unbind_memory(pScrn, mem);
 +	}
@@ -4253,6 +4261,21 @@
 +    return TRUE;
 +}
 +
++Bool radeon_free_all_memory(ScrnInfoPtr pScrn)
++{
++    RADEONInfoPtr  info   = RADEONPTR(pScrn);	
++    struct radeon_memory *mem;
++    int i;
++
++    for (i = 0; i < 2; i++) {
++	for (mem = info->mm.bo_list[i]; mem != NULL;
++	     mem = mem->next) {
++	    radeon_free_memory(pScrn, mem);
++	}
++    }
++    return TRUE;
++}
++
 +int radeon_map_memory(ScrnInfoPtr pScrn, struct radeon_memory *mem)
 +{
 +    struct drm_radeon_gem_mmap args;
@@ -4264,15 +4287,15 @@
 +    ret = drmCommandWriteRead(info->drmFD, DRM_RADEON_GEM_MMAP, &args, sizeof(args));
 +
 +    if (!ret)
-+	mem->bus_addr = args.addr_ptr;
-+    ErrorF("Mapped %s size %d at %d %p\n", mem->name, mem->size, mem->offset, (void *)(unsigned long)mem->bus_addr);
++	mem->map = (void *)(unsigned long)args.addr_ptr;
++    ErrorF("Mapped %s size %d at %d %p\n", mem->name, mem->size, mem->offset, mem->map);
 +    return ret;
 +}
 +
 +void radeon_unmap_memory(ScrnInfoPtr pScrn, struct radeon_memory *mem)
 +{
-+    munmap((void *)(unsigned long)mem->bus_addr, mem->size);
-+    mem->bus_addr = NULL;
++    munmap(mem->map, mem->size);
++    mem->map = NULL;
 +}
 +
 +/* Okay radeon
@@ -4325,7 +4348,7 @@
 +		RADEONCrtcPrivatePtr radeon_crtc = crtc->driver_private;
 +		radeon_crtc->cursor = info->mm.cursor[c];
 +	    } else {
-+		drmmode_set_cursor(pScrn, &info->drmmode, c, (void *)info->mm.cursor[c]->bus_addr, info->mm.cursor[c]->kernel_bo_handle);
++		drmmode_set_cursor(pScrn, &info->drmmode, c, (void *)info->mm.cursor[c]->map, info->mm.cursor[c]->kernel_bo_handle);
 +	    }
 +	    total_size_bytes += cursor_size;
 +	}
@@ -4401,7 +4424,7 @@
 +	ErrorF("Failed to map front buffer memory\n");
 +    }
 +#endif
-+    info->exa->memoryBase = (void *)(unsigned long)info->mm.front_buffer->bus_addr;
++    info->exa->memoryBase = info->mm.front_buffer->map;
 +    info->exa->offScreenBase = screen_size;
 +    info->exa->memorySize = fb_size_bytes;
 +
@@ -4454,7 +4477,7 @@
 +
 +
 diff --git a/src/radeon_probe.h b/src/radeon_probe.h
-index 944ab9f..d039b0b 100644
+index 944ab9f..59f7f95 100644
 --- a/src/radeon_probe.h
 +++ b/src/radeon_probe.h
 @@ -178,6 +178,26 @@ typedef struct
@@ -4468,7 +4491,7 @@
 +
 +    unsigned long size;
 +    unsigned long allocated_size;
-+    uint64_t bus_addr;
++    void *map;
 +    int key;
 +
 +    Bool bound;
@@ -4513,10 +4536,26 @@
 +typedef drm_radeon_sarea_t RADEONSAREAPriv, *RADEONSAREAPrivPtr;
 +#endif
 diff --git a/src/radeon_textured_video.c b/src/radeon_textured_video.c
-index cfa349d..694f10d 100644
+index cfa349d..521c3e9 100644
 --- a/src/radeon_textured_video.c
 +++ b/src/radeon_textured_video.c
-@@ -179,7 +179,8 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
+@@ -85,6 +85,7 @@ static __inline__ uint32_t F_TO_DW(float val)
+ #define BEGIN_VIDEO(n)		RADEONWaitForFifo(pScrn, (n))
+ #define OUT_VIDEO_REG(reg, val)	OUTREG(reg, val)
+ #define OUT_VIDEO_REG_F(reg, val) OUTREG(reg, F_TO_DW(val))
++#define OUT_RELOC(x) do {} while(0)
+ #define FINISH_VIDEO()
+ 
+ #include "radeon_textured_videofuncs.c"
+@@ -105,6 +106,7 @@ static __inline__ uint32_t F_TO_DW(float val)
+ #define OUT_VIDEO_REG(reg, val)	OUT_RING_REG(reg, val)
+ #define FINISH_VIDEO()		ADVANCE_RING()
+ #define OUT_VIDEO_RING_F(x) OUT_RING(F_TO_DW(x))
++#define OUT_RELOC(x) OUT_RING_RELOC(x)
+ 
+ #include "radeon_textured_videofuncs.c"
+ 
+@@ -179,7 +181,8 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
      }
  
  #ifdef XF86DRI
@@ -4526,7 +4565,22 @@
         /* The upload blit only supports multiples of 64 bytes */
         dstPitch = (dstPitch + 63) & ~63;
     else
-@@ -283,7 +284,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
+@@ -226,8 +229,12 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
+     left = (x1 >> 16) & ~1;
+     npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left;
+ 
+-    pPriv->src_offset = pPriv->video_offset + info->fbLocation + pScrn->fbOffset;
+-    pPriv->src_addr = (uint8_t *)(info->FB + pPriv->video_offset + (top * dstPitch));
++    pPriv->src_offset = pPriv->video_offset;
++    if (info->drm_mm) {
++        pPriv->src_addr = (uint8_t *)(info->mm.front_buffer->map + pPriv->video_offset + (top * dstPitch));
++    } else {
++        pPriv->src_addr = (uint8_t *)(info->FB + pPriv->video_offset + (top * dstPitch));
++    }
+     pPriv->src_pitch = dstPitch;
+     pPriv->size = size;
+     pPriv->pDraw = pDraw;
+@@ -283,7 +290,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn,
      pPriv->h = height;
  
  #ifdef XF86DRI
@@ -4535,6 +4589,106 @@
  	RADEONDisplayTexturedVideoCP(pScrn, pPriv);
      else
  #endif
+diff --git a/src/radeon_textured_videofuncs.c b/src/radeon_textured_videofuncs.c
+index 98dc9a4..ad8136d 100644
+--- a/src/radeon_textured_videofuncs.c
++++ b/src/radeon_textured_videofuncs.c
+@@ -82,19 +82,19 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+     int dstxoff, dstyoff, pixel_shift;
+     BoxPtr pBox = REGION_RECTS(&pPriv->clip);
+     int nBox = REGION_NUM_RECTS(&pPriv->clip);
++    int qwords;
+     VIDEO_PREAMBLE();
+ 
+     pixel_shift = pPixmap->drawable.bitsPerPixel >> 4;
+ 
+ #ifdef USE_EXA
+     if (info->useEXA) {
+-	dst_offset = exaGetPixmapOffset(pPixmap) + info->fbLocation + pScrn->fbOffset;
++	dst_offset = exaGetPixmapOffset(pPixmap);
+ 	dst_pitch = exaGetPixmapPitch(pPixmap);
+     } else
+ #endif
+ 	{
+-	    dst_offset = (pPixmap->devPrivate.ptr - info->FB) +
+-		info->fbLocation + pScrn->fbOffset;
++	    dst_offset = (pPixmap->devPrivate.ptr - info->FB);
+ 	    dst_pitch = pPixmap->devKind;
+ 	}
+ 
+@@ -183,13 +183,21 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+ 
+ 	txoffset = pPriv->src_offset;
+ 
+-	BEGIN_VIDEO(6);
++	qwords = info->new_cs ? 8 : 6;
++	BEGIN_VIDEO(qwords);
+ 	OUT_VIDEO_REG(R300_TX_FILTER0_0, txfilter);
+ 	OUT_VIDEO_REG(R300_TX_FILTER1_0, 0);
+ 	OUT_VIDEO_REG(R300_TX_FORMAT0_0, txformat0);
+ 	OUT_VIDEO_REG(R300_TX_FORMAT1_0, txformat1);
+ 	OUT_VIDEO_REG(R300_TX_FORMAT2_0, txpitch);
+-	OUT_VIDEO_REG(R300_TX_OFFSET_0, txoffset);
++
++	if (info->new_cs) {
++	    OUT_VIDEO_REG(R300_TX_OFFSET_0, txoffset);
++	    OUT_RELOC(info->mm.front_buffer->kernel_bo_handle);
++	} else {
++	    txoffset += info->fbLocation + pScrn->fbOffset;
++	    OUT_VIDEO_REG(R300_TX_OFFSET_0, txoffset);
++	}
+ 	FINISH_VIDEO();
+ 
+ 	txenable = R300_TEX_0_ENABLE;
+@@ -408,11 +416,18 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+ 	    FINISH_VIDEO();
+ 	}
+ 
+-	BEGIN_VIDEO(5);
++	qwords = info->new_cs ? 7 : 5;
++	BEGIN_VIDEO(qwords);
+ 	OUT_VIDEO_REG(R300_TX_INVALTAGS, 0);
+ 	OUT_VIDEO_REG(R300_TX_ENABLE, txenable);
+ 
+-	OUT_VIDEO_REG(R300_RB3D_COLOROFFSET0, dst_offset);
++	if (info->new_cs) {
++	    OUT_VIDEO_REG(R300_RB3D_COLOROFFSET0, dst_offset);
++	    OUT_RELOC(info->mm.front_buffer->kernel_bo_handle);
++	} else {
++	    dst_offset += info->fbLocation + pScrn->fbOffset;
++	    OUT_VIDEO_REG(R300_RB3D_COLOROFFSET0, dst_offset);
++	}
+ 	OUT_VIDEO_REG(R300_RB3D_COLORPITCH0, colorpitch);
+ 
+ 	blendcntl = RADEON_SRC_BLEND_GL_ONE | RADEON_DST_BLEND_GL_ZERO;
+@@ -459,6 +474,7 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+ 		    RADEON_TEX_0_ENABLE | RADEON_TEX_BLEND_0_ENABLE);
+ 	OUT_VIDEO_REG(RADEON_RB3D_CNTL,
+ 		    dst_format | RADEON_ALPHA_BLEND_ENABLE);
++	dst_offset += info->fbLocation + pScrn->fbOffset;
+ 	OUT_VIDEO_REG(RADEON_RB3D_COLOROFFSET, dst_offset);
+ 
+ 	OUT_VIDEO_REG(RADEON_RB3D_COLORPITCH, colorpitch);
+@@ -496,7 +512,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+ 			((pPriv->h - 1) << RADEON_TEX_VSIZE_SHIFT));
+ 	    OUT_VIDEO_REG(R200_PP_TXPITCH_0, pPriv->src_pitch - 32);
+ 
+-	    OUT_VIDEO_REG(R200_PP_TXOFFSET_0, pPriv->src_offset);
++	    OUT_VIDEO_REG(R200_PP_TXOFFSET_0, pPriv->src_offset +
++			  info->fbLocation + pScrn->fbOffset);
+ 
+ 	    OUT_VIDEO_REG(R200_PP_TXCBLEND_0,
+ 			R200_TXC_ARG_A_ZERO |
+@@ -530,7 +547,8 @@ FUNC_NAME(RADEONDisplayTexturedVideo)(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv
+ 			RADEON_CLAMP_T_CLAMP_LAST |
+ 			RADEON_YUV_TO_RGB);
+ 	    OUT_VIDEO_REG(RADEON_PP_TXFORMAT_0, txformat);
+-	    OUT_VIDEO_REG(RADEON_PP_TXOFFSET_0, pPriv->src_offset);
++	    OUT_VIDEO_REG(RADEON_PP_TXOFFSET_0, pPriv->src_offset +
++			  info->fbLocation + pScrn->fbOffset);
+ 	    OUT_VIDEO_REG(RADEON_PP_TXCBLEND_0,
+ 			RADEON_COLOR_ARG_A_ZERO |
+ 			RADEON_COLOR_ARG_B_ZERO |
 diff --git a/src/radeon_video.c b/src/radeon_video.c
 index ac60166..d9233a7 100644
 --- a/src/radeon_video.c




More information about the fedora-extras-commits mailing list