File xscreensaver-slideshow-dri-detect.patch of Package xscreensaver

Index: xscreensaver-5.36/hacks/glx/glslideshow.c
===================================================================
--- xscreensaver-5.36.orig/hacks/glx/glslideshow.c
+++ xscreensaver-5.36/hacks/glx/glslideshow.c
@@ -992,7 +992,29 @@ sanity_check (ModeInfo *mi)
   else if (fps_cutoff > 30) fps_cutoff = 30;
 }
 
+static void
+low_fps_mode(ModeInfo *mi)
+{
+  int i;
+  slideshow_state *ss = &sss[MI_SCREEN(mi)];
+
+  zoom = 100;
+  fade_seconds = 0;
 
+  sanity_check (mi);
+
+  for (i = 0; i < ss->nsprites; i++)
+	{
+    sprite *sp = ss->sprites[i];
+    randomize_sprite (mi, sp);
+	sp->state = FULL;
+  }
+
+ss->redisplay_needed_p = True;
+
+/* Need this in case zoom changed. */
+reshape_slideshow (mi, mi->xgwa.width, mi->xgwa.height);
+}
 static void
 check_fps (ModeInfo *mi)
 {
@@ -1001,7 +1023,6 @@ check_fps (ModeInfo *mi)
   slideshow_state *ss = &sss[MI_SCREEN(mi)];
 
   double start_time, end_time, wall_elapsed, frame_duration, fps;
-  int i;
 
   start_time = ss->now;
   end_time = double_time();
@@ -1032,22 +1053,7 @@ check_fps (ModeInfo *mi)
   fprintf (stderr,
            "%s: only %.1f fps!  Turning off pan/fade to compensate...\n",
            blurb(), fps);
-  zoom = 100;
-  fade_seconds = 0;
-
-  sanity_check (mi);
-
-  for (i = 0; i < ss->nsprites; i++)
-    {
-      sprite *sp = ss->sprites[i];
-      randomize_sprite (mi, sp);
-      sp->state = FULL;
-    }
-
-  ss->redisplay_needed_p = True;
-
-  /* Need this in case zoom changed. */
-  reshape_slideshow (mi, mi->xgwa.width, mi->xgwa.height);
+low_fps_mode (mi);
 #endif /* HAVE_JWXYZ */
 }
 
@@ -1087,7 +1093,12 @@ init_slideshow (ModeInfo *mi)
   ss = &sss[screen];
 
   if ((ss->glx_context = init_GL(mi)) != NULL) {
-    reshape_slideshow (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
+	if (glXIsDirect (MI_DISPLAY(mi), *ss->glx_context) == True) {
+	  reshape_slideshow (mi, MI_WIDTH(mi), MI_HEIGHT(mi));
+  } else {
+	 low_fps_mode (mi);
+  }
+
   } else {
     MI_CLEARWINDOW(mi);
   }