Module Name:    xsrc
Committed By:   mrg
Date:           Tue Jul 29 21:55:23 UTC 2014

Modified Files:
        xsrc/external/mit/xf86-video-ati/dist/src: r600_exa.c
            r600_textured_videofuncs.c r6xx_accel.c radeon_exa.c
            radeon_exa_funcs.c radeon_textured_video.c

Log Message:
make sure all the KMS code is only ever run when in KMS mode.  fixes
problems with the UMS (aka existing) driver type when KMS is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c
cvs rdiff -u -r1.1.1.9 -r1.2 \
    xsrc/external/mit/xf86-video-ati/dist/src/r600_textured_videofuncs.c
cvs rdiff -u -r1.6 -r1.7 \
    xsrc/external/mit/xf86-video-ati/dist/src/r6xx_accel.c
cvs rdiff -u -r1.1.1.10 -r1.2 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa.c
cvs rdiff -u -r1.9 -r1.10 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c
cvs rdiff -u -r1.4 -r1.5 \
    xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c:1.5 xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c:1.6
--- xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c:1.5	Sun Sep 23 20:06:02 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/r600_exa.c	Tue Jul 29 21:55:23 2014
@@ -246,7 +246,8 @@ R600PrepareSolid(PixmapPtr pPix, int alu
     cb_conf.base = accel_state->dst_obj.offset;
     cb_conf.bo = accel_state->dst_obj.bo;
 #ifdef XF86DRM_MODE
-    cb_conf.surface = accel_state->dst_obj.surface;
+    if (info->cs) 
+        cb_conf.surface = accel_state->dst_obj.surface;
 #endif
 
     if (accel_state->dst_obj.bpp == 8) {
@@ -428,7 +429,8 @@ R600DoPrepareCopy(ScrnInfoPtr pScrn)
     tex_res.bo                  = accel_state->src_obj[0].bo;
     tex_res.mip_bo              = accel_state->src_obj[0].bo;
 #ifdef XF86DRM_MODE
-    tex_res.surface             = accel_state->src_obj[0].surface;
+    if (info->cs) 
+        tex_res.surface             = accel_state->src_obj[0].surface;
 #endif
     if (accel_state->src_obj[0].bpp == 8) {
 	tex_res.format              = FMT_8;
@@ -475,7 +477,8 @@ R600DoPrepareCopy(ScrnInfoPtr pScrn)
     cb_conf.base = accel_state->dst_obj.offset;
     cb_conf.bo = accel_state->dst_obj.bo;
 #ifdef XF86DRM_MODE
-    cb_conf.surface = accel_state->dst_obj.surface;
+    if (info->cs) 
+        cb_conf.surface = accel_state->dst_obj.surface;
 #endif
     if (accel_state->dst_obj.bpp == 8) {
 	cb_conf.format = COLOR_8;
@@ -626,15 +629,10 @@ R600PrepareCopy(PixmapPtr pSrc,   Pixmap
 
     if (accel_state->same_surface == TRUE) {
 #if defined(XF86DRM_MODE)
-	unsigned long size = accel_state->dst_obj.surface->bo_size;
-	unsigned long align = accel_state->dst_obj.surface->bo_alignment;
-#else
-	unsigned height = pDst->drawable.height;
-	unsigned long size = height * accel_state->dst_obj.pitch * pDst->drawable.bitsPerPixel/8;
-#endif
-
-#if defined(XF86DRM_MODE)
 	if (info->cs) {
+	    unsigned long size = accel_state->dst_obj.surface->bo_size;
+	    unsigned long align = accel_state->dst_obj.surface->bo_alignment;
+
 	    if (accel_state->copy_area_bo) {
 		radeon_bo_unref(accel_state->copy_area_bo);
 		accel_state->copy_area_bo = NULL;
@@ -656,6 +654,9 @@ R600PrepareCopy(PixmapPtr pSrc,   Pixmap
 	} else
 #endif
 	{
+	    unsigned height = pDst->drawable.height;
+	    unsigned long size = height * accel_state->dst_obj.pitch * pDst->drawable.bitsPerPixel/8;
+
 	    if (accel_state->copy_area) {
 		exaOffscreenFree(pDst->drawable.pScreen, accel_state->copy_area);
 		accel_state->copy_area = NULL;
@@ -978,7 +979,8 @@ static Bool R600TextureSetup(PicturePtr 
     tex_res.bo                  = accel_state->src_obj[unit].bo;
     tex_res.mip_bo              = accel_state->src_obj[unit].bo;
 #ifdef XF86DRM_MODE
-    tex_res.surface             = accel_state->src_obj[unit].surface;
+    if (info->cs) 
+        tex_res.surface             = accel_state->src_obj[unit].surface;
 #endif
     tex_res.request_size        = 1;
 
@@ -1447,7 +1449,8 @@ static Bool R600PrepareComposite(int op,
     cb_conf.format = dst_format;
     cb_conf.bo = accel_state->dst_obj.bo;
 #ifdef XF86DRM_MODE
-    cb_conf.surface = accel_state->dst_obj.surface;
+    if (info->cs) 
+        cb_conf.surface = accel_state->dst_obj.surface;
 #endif
 
     switch (pDstPicture->format) {
@@ -1899,9 +1902,7 @@ R600UploadToScreenCS(PixmapPtr pDst, int
     src_obj.domain = RADEON_GEM_DOMAIN_GTT;
     src_obj.bo = scratch;
     src_obj.tiling_flags = 0;
-#ifdef XF86DRM_MODE
     src_obj.surface = NULL;
-#endif
 
     dst_obj.pitch = dst_pitch_hw;
     dst_obj.width = pDst->drawable.width;
@@ -1911,9 +1912,7 @@ R600UploadToScreenCS(PixmapPtr pDst, int
     dst_obj.domain = RADEON_GEM_DOMAIN_VRAM;
     dst_obj.bo = radeon_get_pixmap_bo(pDst);
     dst_obj.tiling_flags = radeon_get_pixmap_tiling(pDst);
-#ifdef XF86DRM_MODE
     dst_obj.surface = radeon_get_pixmap_surface(pDst);
-#endif
 
     if (!R600SetAccelState(pScrn,
 			   &src_obj,
@@ -2040,9 +2039,7 @@ R600DownloadFromScreenCS(PixmapPtr pSrc,
     src_obj.domain = RADEON_GEM_DOMAIN_VRAM | RADEON_GEM_DOMAIN_GTT;
     src_obj.bo = radeon_get_pixmap_bo(pSrc);
     src_obj.tiling_flags = radeon_get_pixmap_tiling(pSrc);
-#ifdef XF86DRM_MODE
     src_obj.surface = radeon_get_pixmap_surface(pSrc);
-#endif
 
     dst_obj.pitch = scratch_pitch;
     dst_obj.width = w;
@@ -2052,9 +2049,7 @@ R600DownloadFromScreenCS(PixmapPtr pSrc,
     dst_obj.bpp = bpp;
     dst_obj.domain = RADEON_GEM_DOMAIN_GTT;
     dst_obj.tiling_flags = 0;
-#ifdef XF86DRM_MODE
     dst_obj.surface = NULL;
-#endif
 
     if (!R600SetAccelState(pScrn,
 			   &src_obj,

Index: xsrc/external/mit/xf86-video-ati/dist/src/r600_textured_videofuncs.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/r600_textured_videofuncs.c:1.1.1.9 xsrc/external/mit/xf86-video-ati/dist/src/r600_textured_videofuncs.c:1.2
--- xsrc/external/mit/xf86-video-ati/dist/src/r600_textured_videofuncs.c:1.1.1.9	Sun Sep 23 19:49:22 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/r600_textured_videofuncs.c	Tue Jul 29 21:55:23 2014
@@ -275,7 +275,8 @@ R600DisplayTexturedVideo(ScrnInfoPtr pSc
 	tex_res.bo                  = accel_state->src_obj[0].bo;
 	tex_res.mip_bo              = accel_state->src_obj[0].bo;
 #ifdef XF86DRM_MODE
-	tex_res.surface             = NULL;
+	if (info->cs)
+		tex_res.surface     = NULL;
 #endif
 
 	tex_res.format              = FMT_8;
@@ -412,7 +413,8 @@ R600DisplayTexturedVideo(ScrnInfoPtr pSc
     cb_conf.base = accel_state->dst_obj.offset;
     cb_conf.bo = accel_state->dst_obj.bo;
 #ifdef XF86DRM_MODE
-    cb_conf.surface = accel_state->dst_obj.surface;
+    if (info->cs)
+        cb_conf.surface = accel_state->dst_obj.surface;
 #endif
 
     switch (accel_state->dst_obj.bpp) {

Index: xsrc/external/mit/xf86-video-ati/dist/src/r6xx_accel.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/r6xx_accel.c:1.6 xsrc/external/mit/xf86-video-ati/dist/src/r6xx_accel.c:1.7
--- xsrc/external/mit/xf86-video-ati/dist/src/r6xx_accel.c:1.6	Sun Jun  3 16:42:23 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/r6xx_accel.c	Tue Jul 29 21:55:23 2014
@@ -228,7 +228,7 @@ r600_set_render_target(ScrnInfoPtr pScrn
 
 
 #if defined(XF86DRM_MODE)
-    if (cb_conf->surface) {
+    if (info->cs && cb_conf->surface) {
 	switch (cb_conf->surface->level[0].mode) {
 	case RADEON_SURF_MODE_1D:
 		array_mode = 2;
@@ -626,7 +626,7 @@ r600_set_tex_resource(ScrnInfoPtr pScrn,
     uint32_t array_mode, pitch;
 
 #if defined(XF86DRM_MODE)
-    if (tex_res->surface) {
+    if (info->cs && tex_res->surface) {
 	switch (tex_res->surface->level[0].mode) {
 	case RADEON_SURF_MODE_1D:
 		array_mode = 2;

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa.c:1.1.1.10 xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa.c:1.2
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa.c:1.1.1.10	Sun Sep 23 19:49:35 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa.c	Tue Jul 29 21:55:23 2014
@@ -498,7 +498,7 @@ void *RADEONEXACreatePixmap2(ScreenPtr p
     memset(&surface, 0, sizeof(struct radeon_surface));
 
 #ifdef XF86DRM_MODE
-    if (info->ChipFamily >= CHIP_FAMILY_R600 && info->surf_man) {
+    if (info->cs && info->ChipFamily >= CHIP_FAMILY_R600 && info->surf_man) {
 		if (width) {
 			surface.npix_x = width;
 			/* need to align height to 8 for old kernel */

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c:1.9 xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c:1.10
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c:1.9	Sun Sep 23 20:06:02 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_exa_funcs.c	Tue Jul 29 21:55:23 2014
@@ -814,7 +814,7 @@ Bool FUNC_NAME(RADEONDrawInit)(ScreenPtr
 	    info->accel_state->exa->DownloadFromScreen = RADEONDownloadFromScreenCP;
     }
 # if defined(XF86DRM_MODE)
-    else {
+    else if (info->cs) {
 	info->accel_state->exa->UploadToScreen = &RADEONUploadToScreenCS;
         info->accel_state->exa->DownloadFromScreen = &RADEONDownloadFromScreenCS;
     }

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c:1.4 xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c:1.5
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c:1.4	Sun Sep 23 20:06:03 2012
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_textured_video.c	Tue Jul 29 21:55:23 2014
@@ -251,14 +251,17 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn
     BoxRec dstBox;
     int dst_width = width, dst_height = height;
     int aligned_height;
-#ifdef XF86DRM_MODE
-    int h_align = drmmode_get_height_align(pScrn, 0);
-#else
-    int h_align = 1;
-#endif
+    int h_align;
     /* make the compiler happy */
     s2offset = s3offset = srcPitch2 = 0;
 
+#ifdef XF86DRM_MODE
+    if (info->cs)
+        h_align = drmmode_get_height_align(pScrn, 0);
+    else
+#endif
+        h_align = 1;
+
     /* Clip */
     x1 = src_x;
     x2 = src_x + src_w;
@@ -496,7 +499,7 @@ RADEONPutImageTextured(ScrnInfoPtr pScrn
 #ifdef XF86DRI
     if (info->directRenderingEnabled) {
 #ifdef XF86DRM_MODE
-	if (IS_EVERGREEN_3D)
+	if (info->cs && IS_EVERGREEN_3D)
 	    EVERGREENDisplayTexturedVideo(pScrn, pPriv);
 	else
 #endif

Reply via email to