Bug 54570 - New Prime bits cause a segfault during setup
Summary: New Prime bits cause a segfault during setup
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/Radeon (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: xf86-video-ati maintainers
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-05 17:43 UTC by Mike Lothian
Modified: 2012-12-19 02:48 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Xorg Log (30.47 KB, text/plain)
2012-09-05 17:43 UTC, Mike Lothian
no flags Details
Dmesg (57.36 KB, text/plain)
2012-09-05 17:44 UTC, Mike Lothian
no flags Details
Latest xorg.0.log (44.39 KB, text/plain)
2012-09-08 10:07 UTC, Mike Lothian
no flags Details
Failed Xorg.0.log (30.65 KB, text/plain)
2012-09-08 10:20 UTC, Mike Lothian
no flags Details
Segfault Xorg.0.log (31.29 KB, text/plain)
2012-09-08 10:32 UTC, Mike Lothian
no flags Details
Next Segfault Xorg.0.log (31.30 KB, text/plain)
2012-09-08 10:38 UTC, Mike Lothian
no flags Details
Segfault with added debugging (31.36 KB, text/plain)
2012-09-08 10:52 UTC, Mike Lothian
no flags Details
More debugging (32.17 KB, text/plain)
2012-09-08 10:59 UTC, Mike Lothian
no flags Details
Patch 7 output (31.74 KB, text/plain)
2012-09-08 11:08 UTC, Mike Lothian
no flags Details
Patch 8 output (45.19 KB, text/plain)
2012-09-08 11:14 UTC, Mike Lothian
no flags Details
Almost working Xorg.0.log (43.69 KB, text/plain)
2012-09-11 07:36 UTC, Mike Lothian
no flags Details
Latest dmesg (58.40 KB, text/plain)
2012-09-11 07:37 UTC, Mike Lothian
no flags Details
Glxgears (451.11 KB, image/png)
2012-10-08 21:11 UTC, Mike Lothian
no flags Details
World of Warcraft (912.08 KB, image/png)
2012-10-08 21:12 UTC, Mike Lothian
no flags Details

Description Mike Lothian 2012-09-05 17:43:35 UTC
Created attachment 66690 [details]
Xorg Log

I was having issues getting my radeon card showing up as a provider in xrandr

After removing my xorg.conf.d folder and restarting X I now get a segfault - RADEON is now initalised though

I'm attaching the Xorg.0.log.old and the dmesg

If there's anything else I can do to help diagnose the problem please let me know
Comment 1 Mike Lothian 2012-09-05 17:44:34 UTC
Created attachment 66691 [details]
Dmesg
Comment 2 Mike Lothian 2012-09-08 10:06:12 UTC
With the given patch from airlied:

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;

The crash goes away however radeon still isn't listed as a provider
Comment 3 Mike Lothian 2012-09-08 10:07:02 UTC
Created attachment 66831 [details]
Latest xorg.0.log
Comment 4 Mike Lothian 2012-09-08 10:19:13 UTC
With the latest patch xorg failed to start:

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..94aa19c 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }
Comment 5 Mike Lothian 2012-09-08 10:20:05 UTC
Created attachment 66832 [details]
Failed Xorg.0.log
Comment 6 Mike Lothian 2012-09-08 10:31:38 UTC
With the latest patch I get a segfault

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..020bd99 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }
@@ -1427,6 +1427,9 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	} else
 	    tiling_flags |= RADEON_TILING_MACRO;
     }
+
+    if (pScrn->is_gpu && !pScrn->virtualX && !pScrn->virtualY)
+        return;
     pitch = RADEON_ALIGN(pScrn->virtualX, drmmode_get_pitch_align(pScrn, cpp, tiling_flags)) * cpp;
     screen_size = RADEON_ALIGN(pScrn->virtualY, drmmode_get_height_align(pScrn, tiling_flags)) * pitch;
     base_align = drmmode_get_base_align(pScrn, cpp, tiling_flags);
Comment 7 Mike Lothian 2012-09-08 10:32:17 UTC
Created attachment 66833 [details]
Segfault Xorg.0.log
Comment 8 Mike Lothian 2012-09-08 10:37:36 UTC
With the next patch I again get a segfault:

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..af0ac88 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }
@@ -1152,32 +1152,35 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "radeon_setup_kernel_mem failed\n");
 	return FALSE;
     }
-    front_ptr = info->front_bo->ptr;
 
-    if (info->r600_shadow_fb) {
-	info->fb_shadow = calloc(1,
-				 pScrn->displayWidth * pScrn->virtualY *
-				 ((pScrn->bitsPerPixel + 7) >> 3));
-	if (info->fb_shadow == NULL) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "Failed to allocate shadow framebuffer\n");
-	    info->r600_shadow_fb = FALSE;
-	} else {
-	    if (!fbScreenInit(pScreen, info->fb_shadow,
-			      pScrn->virtualX, pScrn->virtualY,
-			      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			      pScrn->bitsPerPixel))
-		return FALSE;
-	}
-    }
-
-    if (info->r600_shadow_fb == FALSE) {
-	/* Init fb layer */
-	if (!fbScreenInit(pScreen, front_ptr,
-			  pScrn->virtualX, pScrn->virtualY,
-			  pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			  pScrn->bitsPerPixel))
-	    return FALSE;
+    if (info->front_bo) {
+	    front_ptr = info->front_bo->ptr;
+
+	    if (info->r600_shadow_fb) {
+		    info->fb_shadow = calloc(1,
+					     pScrn->displayWidth * pScrn->virtualY *
+					     ((pScrn->bitsPerPixel + 7) >> 3));
+		    if (info->fb_shadow == NULL) {
+			    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+				       "Failed to allocate shadow framebuffer\n");
+			    info->r600_shadow_fb = FALSE;
+		    } else {
+			    if (!fbScreenInit(pScreen, info->fb_shadow,
+					      pScrn->virtualX, pScrn->virtualY,
+					      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+					      pScrn->bitsPerPixel))
+				    return FALSE;
+		    }
+	    }
+	    
+	    if (info->r600_shadow_fb == FALSE) {
+		    /* Init fb layer */
+		    if (!fbScreenInit(pScreen, front_ptr,
+				      pScrn->virtualX, pScrn->virtualY,
+				      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+				      pScrn->bitsPerPixel))
+			    return FALSE;
+	    }
     }
 
     xf86SetBlackWhitePixels(pScreen);
@@ -1427,6 +1430,9 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	} else
 	    tiling_flags |= RADEON_TILING_MACRO;
     }
+
+    if (pScrn->is_gpu && !pScrn->virtualX && !pScrn->virtualY)
+        return;
     pitch = RADEON_ALIGN(pScrn->virtualX, drmmode_get_pitch_align(pScrn, cpp, tiling_flags)) * cpp;
     screen_size = RADEON_ALIGN(pScrn->virtualY, drmmode_get_height_align(pScrn, tiling_flags)) * pitch;
     base_align = drmmode_get_base_align(pScrn, cpp, tiling_flags);
Comment 9 Mike Lothian 2012-09-08 10:38:15 UTC
Created attachment 66834 [details]
Next Segfault Xorg.0.log
Comment 10 Mike Lothian 2012-09-08 10:51:59 UTC
Latest patch with added debugging:

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..f927ad2 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }
@@ -1152,36 +1152,41 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "radeon_setup_kernel_mem failed\n");
 	return FALSE;
     }
-    front_ptr = info->front_bo->ptr;
 
-    if (info->r600_shadow_fb) {
-	info->fb_shadow = calloc(1,
-				 pScrn->displayWidth * pScrn->virtualY *
-				 ((pScrn->bitsPerPixel + 7) >> 3));
-	if (info->fb_shadow == NULL) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "Failed to allocate shadow framebuffer\n");
-	    info->r600_shadow_fb = FALSE;
-	} else {
-	    if (!fbScreenInit(pScreen, info->fb_shadow,
-			      pScrn->virtualX, pScrn->virtualY,
-			      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			      pScrn->bitsPerPixel))
-		return FALSE;
-	}
-    }
-
-    if (info->r600_shadow_fb == FALSE) {
-	/* Init fb layer */
-	if (!fbScreenInit(pScreen, front_ptr,
-			  pScrn->virtualX, pScrn->virtualY,
-			  pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			  pScrn->bitsPerPixel))
-	    return FALSE;
+    ErrorF("front bo is %p\n", info->front_bo);
+    if (info->front_bo) {
+	    front_ptr = info->front_bo->ptr;
+
+	    if (info->r600_shadow_fb) {
+		    info->fb_shadow = calloc(1,
+					     pScrn->displayWidth * pScrn->virtualY *
+					     ((pScrn->bitsPerPixel + 7) >> 3));
+		    if (info->fb_shadow == NULL) {
+			    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+				       "Failed to allocate shadow framebuffer\n");
+			    info->r600_shadow_fb = FALSE;
+		    } else {
+			    if (!fbScreenInit(pScreen, info->fb_shadow,
+					      pScrn->virtualX, pScrn->virtualY,
+					      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+					      pScrn->bitsPerPixel))
+				    return FALSE;
+		    }
+	    }
+	    
+	    if (info->r600_shadow_fb == FALSE) {
+		    /* Init fb layer */
+		    if (!fbScreenInit(pScreen, front_ptr,
+				      pScrn->virtualX, pScrn->virtualY,
+				      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+				      pScrn->bitsPerPixel))
+			    return FALSE;
+	    }
     }
 
     xf86SetBlackWhitePixels(pScreen);
 
+    ErrorF("bpp is %d\n", pScrn->bitsPerPixel);
     if (pScrn->bitsPerPixel > 8) {
 	VisualPtr  visual;
 
@@ -1201,6 +1206,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     /* Must be after RGB order fixed */
     fbPictureInit (pScreen, 0, 0);
 
+    ErrorF("after pic init\n");
 #ifdef RENDER
     if ((s = xf86GetOptValString(info->Options, OPTION_SUBPIXEL_ORDER))) {
 	if (strcmp(s, "RGB") == 0) subPixelOrder = SubPixelHorizontalRGB;
@@ -1210,6 +1216,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     }
 #endif
 
+    ErrorF("pre vt sema\n");
     pScrn->vtSema = TRUE;
     /* Backing store setup */
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -1427,6 +1434,9 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	} else
 	    tiling_flags |= RADEON_TILING_MACRO;
     }
+
+    if (pScrn->is_gpu && !pScrn->virtualX && !pScrn->virtualY)
+        return;
     pitch = RADEON_ALIGN(pScrn->virtualX, drmmode_get_pitch_align(pScrn, cpp, tiling_flags)) * cpp;
     screen_size = RADEON_ALIGN(pScrn->virtualY, drmmode_get_height_align(pScrn, tiling_flags)) * pitch;
     base_align = drmmode_get_base_align(pScrn, cpp, tiling_flags);
Comment 11 Mike Lothian 2012-09-08 10:52:44 UTC
Created attachment 66835 [details]
Segfault with added debugging
Comment 12 Mike Lothian 2012-09-08 10:58:31 UTC
Again another seg fault with the latest patch:

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..518e0ba 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }
@@ -1152,37 +1152,42 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "radeon_setup_kernel_mem failed\n");
 	return FALSE;
     }
-    front_ptr = info->front_bo->ptr;
 
-    if (info->r600_shadow_fb) {
-	info->fb_shadow = calloc(1,
-				 pScrn->displayWidth * pScrn->virtualY *
-				 ((pScrn->bitsPerPixel + 7) >> 3));
-	if (info->fb_shadow == NULL) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "Failed to allocate shadow framebuffer\n");
-	    info->r600_shadow_fb = FALSE;
-	} else {
-	    if (!fbScreenInit(pScreen, info->fb_shadow,
-			      pScrn->virtualX, pScrn->virtualY,
-			      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			      pScrn->bitsPerPixel))
-		return FALSE;
-	}
-    }
-
-    if (info->r600_shadow_fb == FALSE) {
-	/* Init fb layer */
-	if (!fbScreenInit(pScreen, front_ptr,
-			  pScrn->virtualX, pScrn->virtualY,
-			  pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			  pScrn->bitsPerPixel))
-	    return FALSE;
+    ErrorF("front bo is %p\n", info->front_bo);
+    if (info->front_bo) {
+	    front_ptr = info->front_bo->ptr;
+
+	    if (info->r600_shadow_fb) {
+		    info->fb_shadow = calloc(1,
+					     pScrn->displayWidth * pScrn->virtualY *
+					     ((pScrn->bitsPerPixel + 7) >> 3));
+		    if (info->fb_shadow == NULL) {
+			    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+				       "Failed to allocate shadow framebuffer\n");
+			    info->r600_shadow_fb = FALSE;
+		    } else {
+			    if (!fbScreenInit(pScreen, info->fb_shadow,
+					      pScrn->virtualX, pScrn->virtualY,
+					      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+					      pScrn->bitsPerPixel))
+				    return FALSE;
+		    }
+	    }
+	    
+	    if (info->r600_shadow_fb == FALSE) {
+		    /* Init fb layer */
+		    if (!fbScreenInit(pScreen, front_ptr,
+				      pScrn->virtualX, pScrn->virtualY,
+				      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+				      pScrn->bitsPerPixel))
+			    return FALSE;
+	    }
     }
 
     xf86SetBlackWhitePixels(pScreen);
 
-    if (pScrn->bitsPerPixel > 8) {
+    ErrorF("bpp is %d\n", pScrn->bitsPerPixel);
+    if (pScrn->bitsPerPixel > 8 && pScreen->visuals) {
 	VisualPtr  visual;
 
 	visual = pScreen->visuals + pScreen->numVisuals;
@@ -1201,6 +1206,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     /* Must be after RGB order fixed */
     fbPictureInit (pScreen, 0, 0);
 
+    ErrorF("after pic init\n");
 #ifdef RENDER
     if ((s = xf86GetOptValString(info->Options, OPTION_SUBPIXEL_ORDER))) {
 	if (strcmp(s, "RGB") == 0) subPixelOrder = SubPixelHorizontalRGB;
@@ -1210,6 +1216,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     }
 #endif
 
+    ErrorF("pre vt sema\n");
     pScrn->vtSema = TRUE;
     /* Backing store setup */
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -1427,6 +1434,9 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	} else
 	    tiling_flags |= RADEON_TILING_MACRO;
     }
+
+    if (pScrn->is_gpu && !pScrn->virtualX && !pScrn->virtualY)
+        return;
     pitch = RADEON_ALIGN(pScrn->virtualX, drmmode_get_pitch_align(pScrn, cpp, tiling_flags)) * cpp;
     screen_size = RADEON_ALIGN(pScrn->virtualY, drmmode_get_height_align(pScrn, tiling_flags)) * pitch;
     base_align = drmmode_get_base_align(pScrn, cpp, tiling_flags);
Comment 13 Mike Lothian 2012-09-08 10:59:01 UTC
Created attachment 66836 [details]
More debugging
Comment 14 Mike Lothian 2012-09-08 11:06:54 UTC
Trying out patch 7

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..518e0ba 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }
@@ -1152,37 +1152,42 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "radeon_setup_kernel_mem failed\n");
 	return FALSE;
     }
-    front_ptr = info->front_bo->ptr;
 
-    if (info->r600_shadow_fb) {
-	info->fb_shadow = calloc(1,
-				 pScrn->displayWidth * pScrn->virtualY *
-				 ((pScrn->bitsPerPixel + 7) >> 3));
-	if (info->fb_shadow == NULL) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "Failed to allocate shadow framebuffer\n");
-	    info->r600_shadow_fb = FALSE;
-	} else {
-	    if (!fbScreenInit(pScreen, info->fb_shadow,
-			      pScrn->virtualX, pScrn->virtualY,
-			      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			      pScrn->bitsPerPixel))
-		return FALSE;
-	}
-    }
-
-    if (info->r600_shadow_fb == FALSE) {
-	/* Init fb layer */
-	if (!fbScreenInit(pScreen, front_ptr,
-			  pScrn->virtualX, pScrn->virtualY,
-			  pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			  pScrn->bitsPerPixel))
-	    return FALSE;
+    ErrorF("front bo is %p\n", info->front_bo);
+    if (info->front_bo) {
+	    front_ptr = info->front_bo->ptr;
+
+	    if (info->r600_shadow_fb) {
+		    info->fb_shadow = calloc(1,
+					     pScrn->displayWidth * pScrn->virtualY *
+					     ((pScrn->bitsPerPixel + 7) >> 3));
+		    if (info->fb_shadow == NULL) {
+			    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+				       "Failed to allocate shadow framebuffer\n");
+			    info->r600_shadow_fb = FALSE;
+		    } else {
+			    if (!fbScreenInit(pScreen, info->fb_shadow,
+					      pScrn->virtualX, pScrn->virtualY,
+					      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+					      pScrn->bitsPerPixel))
+				    return FALSE;
+		    }
+	    }
+	    
+	    if (info->r600_shadow_fb == FALSE) {
+		    /* Init fb layer */
+		    if (!fbScreenInit(pScreen, front_ptr,
+				      pScrn->virtualX, pScrn->virtualY,
+				      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+				      pScrn->bitsPerPixel))
+			    return FALSE;
+	    }
     }
 
     xf86SetBlackWhitePixels(pScreen);
 
-    if (pScrn->bitsPerPixel > 8) {
+    ErrorF("bpp is %d\n", pScrn->bitsPerPixel);
+    if (pScrn->bitsPerPixel > 8 && pScreen->visuals) {
 	VisualPtr  visual;
 
 	visual = pScreen->visuals + pScreen->numVisuals;
@@ -1201,6 +1206,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     /* Must be after RGB order fixed */
     fbPictureInit (pScreen, 0, 0);
 
+    ErrorF("after pic init\n");
 #ifdef RENDER
     if ((s = xf86GetOptValString(info->Options, OPTION_SUBPIXEL_ORDER))) {
 	if (strcmp(s, "RGB") == 0) subPixelOrder = SubPixelHorizontalRGB;
@@ -1210,6 +1216,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     }
 #endif
 
+    ErrorF("pre vt sema\n");
     pScrn->vtSema = TRUE;
     /* Backing store setup */
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -1427,6 +1434,9 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	} else
 	    tiling_flags |= RADEON_TILING_MACRO;
     }
+
+    if (pScrn->is_gpu && !pScrn->virtualX && !pScrn->virtualY)
+        return;
     pitch = RADEON_ALIGN(pScrn->virtualX, drmmode_get_pitch_align(pScrn, cpp, tiling_flags)) * cpp;
     screen_size = RADEON_ALIGN(pScrn->virtualY, drmmode_get_height_align(pScrn, tiling_flags)) * pitch;
     base_align = drmmode_get_base_align(pScrn, cpp, tiling_flags);
Comment 15 Mike Lothian 2012-09-08 11:08:40 UTC
Created attachment 66838 [details]
Patch 7 output
Comment 16 Mike Lothian 2012-09-08 11:14:08 UTC
Patch 8:

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 9b9fc83..6bb882b 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1553,7 +1553,8 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
 	xf86ProviderSetup(pScrn, NULL, "radeon");
 #endif
 
-	xf86InitialConfiguration(pScrn, TRUE);
+	if (drmmode->mode_res->count_connectors != 0)
+		xf86InitialConfiguration(pScrn, TRUE);
 
 	drmmode->event_context.version = DRM_EVENT_CONTEXT_VERSION;
 	drmmode->event_context.vblank_handler = drmmode_vblank_handler;
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e953082..8a99dda 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -954,7 +954,7 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn, int flags)
 	if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE;
     }
 
-    if (pScrn->modes == NULL) {
+    if (!pScrn->is_gpu && pScrn->modes == NULL) {
       xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes.\n");
       goto fail;
    }
@@ -1152,37 +1152,42 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "radeon_setup_kernel_mem failed\n");
 	return FALSE;
     }
-    front_ptr = info->front_bo->ptr;
 
-    if (info->r600_shadow_fb) {
-	info->fb_shadow = calloc(1,
-				 pScrn->displayWidth * pScrn->virtualY *
-				 ((pScrn->bitsPerPixel + 7) >> 3));
-	if (info->fb_shadow == NULL) {
-	    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-                       "Failed to allocate shadow framebuffer\n");
-	    info->r600_shadow_fb = FALSE;
-	} else {
-	    if (!fbScreenInit(pScreen, info->fb_shadow,
-			      pScrn->virtualX, pScrn->virtualY,
-			      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			      pScrn->bitsPerPixel))
-		return FALSE;
-	}
-    }
-
-    if (info->r600_shadow_fb == FALSE) {
-	/* Init fb layer */
-	if (!fbScreenInit(pScreen, front_ptr,
-			  pScrn->virtualX, pScrn->virtualY,
-			  pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
-			  pScrn->bitsPerPixel))
-	    return FALSE;
+    ErrorF("front bo is %p\n", info->front_bo);
+    if (info->front_bo) {
+	    front_ptr = info->front_bo->ptr;
+
+	    if (info->r600_shadow_fb) {
+		    info->fb_shadow = calloc(1,
+					     pScrn->displayWidth * pScrn->virtualY *
+					     ((pScrn->bitsPerPixel + 7) >> 3));
+		    if (info->fb_shadow == NULL) {
+			    xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+				       "Failed to allocate shadow framebuffer\n");
+			    info->r600_shadow_fb = FALSE;
+		    } else {
+			    if (!fbScreenInit(pScreen, info->fb_shadow,
+					      pScrn->virtualX, pScrn->virtualY,
+					      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+					      pScrn->bitsPerPixel))
+				    return FALSE;
+		    }
+	    }
+	    
+	    if (info->r600_shadow_fb == FALSE) {
+		    /* Init fb layer */
+		    if (!fbScreenInit(pScreen, front_ptr,
+				      pScrn->virtualX, pScrn->virtualY,
+				      pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth,
+				      pScrn->bitsPerPixel))
+			    return FALSE;
+	    }
     }
 
     xf86SetBlackWhitePixels(pScreen);
 
-    if (pScrn->bitsPerPixel > 8) {
+    ErrorF("bpp is %d\n", pScrn->bitsPerPixel);
+    if (pScrn->bitsPerPixel > 8 && pScreen->visuals) {
 	VisualPtr  visual;
 
 	visual = pScreen->visuals + pScreen->numVisuals;
@@ -1201,6 +1206,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     /* Must be after RGB order fixed */
     fbPictureInit (pScreen, 0, 0);
 
+    ErrorF("after pic init\n");
 #ifdef RENDER
     if ((s = xf86GetOptValString(info->Options, OPTION_SUBPIXEL_ORDER))) {
 	if (strcmp(s, "RGB") == 0) subPixelOrder = SubPixelHorizontalRGB;
@@ -1210,6 +1216,7 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     }
 #endif
 
+    ErrorF("pre vt sema\n");
     pScrn->vtSema = TRUE;
     /* Backing store setup */
     xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, RADEON_LOGLEVEL_DEBUG,
@@ -1254,11 +1261,13 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
     xf86SetSilkenMouse(pScreen);
 
     /* Cursor setup */
-    miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+    if (info->front_bo) {
+	    miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
 
-    if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
-	if (RADEONCursorInit_KMS(pScreen)) {
-	}
+	    if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) {
+		    if (RADEONCursorInit_KMS(pScreen)) {
+		    }
+	    }
     }
 
     /* DGA setup */
@@ -1310,8 +1319,10 @@ Bool RADEONScreenInit_KMS(SCREEN_INIT_ARGS_DECL)
 //    info->PointerMoved = pScrn->PointerMoved;
 //    pScrn->PointerMoved = RADEONPointerMoved;
 
-    if (!drmmode_setup_colormap(pScreen, pScrn))
-	return FALSE;
+    if (info->front_bo) {
+	    if (!drmmode_setup_colormap(pScreen, pScrn))
+		    return FALSE;
+    }
 
    /* Note unused options */
     if (serverGeneration == 1)
@@ -1427,6 +1438,9 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)
 	} else
 	    tiling_flags |= RADEON_TILING_MACRO;
     }
+
+    if (pScrn->is_gpu && !pScrn->virtualX && !pScrn->virtualY)
+        return;
     pitch = RADEON_ALIGN(pScrn->virtualX, drmmode_get_pitch_align(pScrn, cpp, tiling_flags)) * cpp;
     screen_size = RADEON_ALIGN(pScrn->virtualY, drmmode_get_height_align(pScrn, tiling_flags)) * pitch;
     base_align = drmmode_get_base_align(pScrn, cpp, tiling_flags);
Comment 17 Mike Lothian 2012-09-08 11:14:39 UTC
Created attachment 66839 [details]
Patch 8 output
Comment 18 Dave Airlie 2012-09-10 01:46:56 UTC
okay this is two bugs.

One in -ati, which I've fixed in master,

the other is in the X server, I've sent the patch 
[PATCH] xf86: return NULL for compat output if no outputs.

to xorg-devel for review.
Comment 19 Mike Lothian 2012-09-10 07:14:40 UTC
This prevents all crashing and now offers radeon as a provider:

Providers: number : 2
Provider 0: id: 125 cap: 0xb, Source Output, Sink Output, Sink Offload crtcs: 2 outputs: 6 associated providers: 1 name:Intel
Provider 1: id: 85 cap: 0xd, Source Output, Source Offload, Sink Offload crtcs: 6 outputs: 0 associated providers: 1 name:radeon

DRI_PRIME=1 glxinfo now gives:

OpenGL vendor string: X.Org
OpenGL renderer string: Gallium 0.4 on AMD TURKS
OpenGL version string: 3.0 Mesa 9.0-devel (git-10a96f4)
OpenGL shading language version string: 1.30

However when I run glxgears the box is black



8142 frames in 5.0 seconds = 1628.246 FPS
9689 frames in 5.0 seconds = 1937.731 FPS
8446 frames in 5.0 seconds = 1689.154 FPS
9320 frames in 5.0 seconds = 1863.905 FPS

Nothing shows in in the Xorg.0.log or Dmesg

So we're getting closer...

Would you like a new bug report for this issue?
Comment 20 Dave Airlie 2012-09-10 08:36:33 UTC
are you running a compositing manager?

have you got the latest intel driver?
Comment 21 Mike Lothian 2012-09-11 07:34:05 UTC
I was running Kwin - I've disabled it and the same happens

I'm running the latest X stack from git

I've tried the intel driver with both SNA and UXA but both give the same effect

I tried replying yesterday but looks like bugzilla was having issues
Comment 22 Mike Lothian 2012-09-11 07:36:31 UTC
Created attachment 66950 [details]
Almost working Xorg.0.log
Comment 23 Mike Lothian 2012-09-11 07:37:50 UTC
Created attachment 66951 [details]
Latest dmesg
Comment 24 Mike Lothian 2012-09-13 07:01:13 UTC
I've got an update
 
I still have the same problem when I start glxgears however I've not noticed that if I resize the window it starts to render all be it slightly skewed to the left and up a bit

I confirmed this by running World of Warcraft in Windowed Mode - again nothing rendering until I resized the window - full screen never rendered at all

Again everything was squished to the left and up a bit - but the buttons still needed to be clicked in the correct area ie moving the mouse futher right and down from where the rendering was showing it

Upon clicking login my machine promptly froze up I'm afraid I've not collected any information on this crash yet but will do so after work if you tell me what you'd like
Comment 25 Mike Lothian 2012-09-13 07:04:59 UTC
I should add that none of this works unless KWin _is_ running
Comment 26 Mike Lothian 2012-10-08 21:11:14 UTC
Created attachment 68286 [details]
Glxgears
Comment 27 Mike Lothian 2012-10-08 21:12:04 UTC
Created attachment 68287 [details]
World of Warcraft
Comment 28 Mike Lothian 2012-11-14 03:26:09 UTC
It appears rendering has stopped with UXA now too

Glxgears only renders if the window is resized

I guess either something has changed in the graphics stack or it's been caused by the upgrade from kwin-4.9.2 to 4.9.3

SNA still doesn't render at all - am I best contacting Chris Wilson about that?
Comment 29 Mike Lothian 2012-12-07 02:18:55 UTC
Not only has rendering now stopped but the Radeon sink has disappeared from xrandr --listproviders too
Comment 30 Mike Lothian 2012-12-19 02:48:20 UTC
That's it back to working again - I even has limited success with getting SNA working with it too


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.