LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File xscreensaver-slideshow-dri-detect.patch of Package xscreensaver (Project home:zhy20120210:failed_1)

--- hacks/glx/glslideshow.c
+++ hacks/glx/glslideshow.c
@@ -985,6 +985,29 @@
   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)
@@ -994,7 +1017,6 @@
   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();
@@ -1025,22 +1047,7 @@
   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_COCOA */
 }
 
@@ -1080,7 +1087,13 @@
   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);
   }