summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-09-24 17:37:41 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-09-26 09:50:44 +0100
commit537e73f3f935b917f2f5f9b51499cb29d65e3889 (patch)
treede5610702320c7f9ca7b465c60f6c16cf025a79b /src
parentb84925b9c0842ba4dfa3481c09d3a80f84db4838 (diff)
Disable dri2 after forcing fallbacks
If we force fallbacks, then we will only create pixmaps in system memory, preventing DRI2 from passing valid bo names to the clients. In this case, they will just fallback to swrast. If we disable DRI2 after forcing fallbacks (e.g. regenerating after a GPU hang or explicitly disabled with the shadow buffer) then it is simpler just to disable the extension and allow mesa to use pure swrast. Reported-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/intel_dri.c6
-rw-r--r--src/intel_driver.c107
2 files changed, 60 insertions, 53 deletions
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 4f669372..98042722 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -1029,6 +1029,12 @@ Bool I830DRI2ScreenInit(ScreenPtr screen)
const char *driverNames[1];
#endif
+ if (intel->force_fallback) {
+ xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+ "cannot enable DRI2 whilst forcing software fallbacks\n");
+ return FALSE;
+ }
+
if (xf86LoaderCheckSymbol("DRI2Version"))
DRI2Version(&dri2_major, &dri2_minor);
diff --git a/src/intel_driver.c b/src/intel_driver.c
index c0ad69e9..d086d941 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -588,13 +588,59 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
intel_check_chipset_option(scrn);
intel_check_dri_option(scrn);
- I830XvInit(scrn);
-
if (!intel_init_bufmgr(intel)) {
PreInitCleanup(scrn);
return FALSE;
}
+ intel->force_fallback =
+ drmCommandNone(intel->drmSubFD, DRM_I915_GEM_THROTTLE) != 0;
+ intel->use_shadow = FALSE;
+
+ /* Enable tiling by default */
+ intel->tiling = TRUE;
+
+ /* Allow user override if they set a value */
+ if (xf86IsOptionSet(intel->Options, OPTION_TILING)) {
+ if (xf86ReturnOptValBool(intel->Options, OPTION_TILING, FALSE))
+ intel->tiling = TRUE;
+ else
+ intel->tiling = FALSE;
+ }
+
+ if (xf86IsOptionSet(intel->Options, OPTION_SHADOW)) {
+ if (xf86ReturnOptValBool(intel->Options, OPTION_SHADOW, FALSE))
+ intel->force_fallback = intel->use_shadow = TRUE;
+ }
+
+ if (intel->use_shadow) {
+ xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
+ "Shadow buffer enabled,"
+ " GPU acceleration disabled.\n");
+ }
+
+ /* SwapBuffers delays to avoid tearing */
+ intel->swapbuffers_wait = TRUE;
+
+ /* Allow user override if they set a value */
+ if (xf86IsOptionSet(intel->Options, OPTION_SWAPBUFFERS_WAIT)) {
+ if (xf86ReturnOptValBool
+ (intel->Options, OPTION_SWAPBUFFERS_WAIT, FALSE))
+ intel->swapbuffers_wait = TRUE;
+ else
+ intel->swapbuffers_wait = FALSE;
+ }
+
+ if (IS_GEN6(intel))
+ intel->swapbuffers_wait = FALSE;
+
+ xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Tiling %sabled\n",
+ intel->tiling ? "en" : "dis");
+ xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "SwapBuffers wait %sabled\n",
+ intel->swapbuffers_wait ? "en" : "dis");
+
+ I830XvInit(scrn);
+
if (!intel_mode_pre_init(scrn, intel->drmSubFD, intel->cpp)) {
PreInitCleanup(scrn);
return FALSE;
@@ -830,57 +876,6 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
scrn->videoRam = device->regions[fb_bar].size / 1024;
-#ifdef DRI2
- if (intel->directRenderingType == DRI_NONE
- && I830DRI2ScreenInit(screen))
- intel->directRenderingType = DRI_DRI2;
-#endif
-
- intel->force_fallback = FALSE;
- intel->use_shadow = FALSE;
-
- /* Enable tiling by default */
- intel->tiling = TRUE;
-
- /* Allow user override if they set a value */
- if (xf86IsOptionSet(intel->Options, OPTION_TILING)) {
- if (xf86ReturnOptValBool(intel->Options, OPTION_TILING, FALSE))
- intel->tiling = TRUE;
- else
- intel->tiling = FALSE;
- }
-
- if (xf86IsOptionSet(intel->Options, OPTION_SHADOW)) {
- if (xf86ReturnOptValBool(intel->Options, OPTION_SHADOW, FALSE))
- intel->force_fallback = intel->use_shadow = TRUE;
- }
-
- if (intel->use_shadow) {
- xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
- "Shadow buffer enabled,"
- " GPU acceleration disabled.\n");
- }
-
- /* SwapBuffers delays to avoid tearing */
- intel->swapbuffers_wait = TRUE;
-
- /* Allow user override if they set a value */
- if (xf86IsOptionSet(intel->Options, OPTION_SWAPBUFFERS_WAIT)) {
- if (xf86ReturnOptValBool
- (intel->Options, OPTION_SWAPBUFFERS_WAIT, FALSE))
- intel->swapbuffers_wait = TRUE;
- else
- intel->swapbuffers_wait = FALSE;
- }
-
- if (IS_GEN6(intel))
- intel->swapbuffers_wait = FALSE;
-
- xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "Tiling %sabled\n",
- intel->tiling ? "en" : "dis");
- xf86DrvMsg(scrn->scrnIndex, X_CONFIG, "SwapBuffers wait %sabled\n",
- intel->swapbuffers_wait ? "en" : "dis");
-
intel->last_3d = LAST_3D_OTHER;
intel->overlayOn = FALSE;
@@ -894,6 +889,12 @@ I830ScreenInit(int scrnIndex, ScreenPtr screen, int argc, char **argv)
intel->pEnt->device->videoRam ? X_CONFIG : X_DEFAULT,
"VideoRam: %d KB\n", scrn->videoRam);
+#ifdef DRI2
+ if (intel->directRenderingType == DRI_NONE
+ && I830DRI2ScreenInit(screen))
+ intel->directRenderingType = DRI_DRI2;
+#endif
+
if (!intel_init_initial_framebuffer(scrn))
return FALSE;