ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/video_x.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/video_x.cpp (file contents):
Revision 1.11 by cebix, 1999-11-03T10:56:30Z vs.
Revision 1.12 by cebix, 1999-11-03T21:04:23Z

# Line 52 | Line 52
52   #include <X11/extensions/xf86dga.h>
53   #endif
54  
55 + #if ENABLE_XF86_VIDMODE
56 + #include <X11/extensions/xf86vmode.h>
57 + #endif
58 +
59   #if ENABLE_FBDEV_DGA
60   #include <sys/mman.h>
61   #endif
# Line 82 | Line 86 | static volatile bool redraw_thread_cance
86   static pthread_t redraw_thread;                                         // Redraw thread
87  
88   static bool has_dga = false;                                            // Flag: Video DGA capable
89 + static bool has_vidmode = false;                                        // Flag: VidMode extension available
90  
91   static bool ctrl_down = false;                                          // Flag: Ctrl key pressed
92   static bool caps_on = false;                                            // Flag: Caps Lock on
# Line 134 | Line 139 | static pthread_mutex_t frame_buffer_lock
139   const char FBDEVICE_FILE_NAME[] = "/dev/fb";
140   static int fbdev_fd;
141  
142 + #if ENABLE_XF86_VIDMODE
143 + // Variables for XF86 VidMode support
144 + static XF86VidModeModeInfo **x_video_modes;                     // Array of all available modes
145 + static int num_x_video_modes;
146 + #endif
147 +
148  
149   // Prototypes
150   static void *redraw_func(void *arg);
# Line 482 | Line 493 | static bool init_xf86_dga(int width, int
493          // Set relative mouse mode
494          ADBSetRelMouseMode(true);
495  
496 + #if ENABLE_XF86_VIDMODE
497 +        // Switch to best mode
498 +        if (has_vidmode) {
499 +                int best = 0;
500 +                for (int i=1; i<num_x_video_modes; i++) {
501 +                        if (x_video_modes[i]->hdisplay >= width && x_video_modes[i]->vdisplay >= height &&
502 +                                x_video_modes[i]->hdisplay <= x_video_modes[best]->hdisplay && x_video_modes[i]->vdisplay <= x_video_modes[best]->vdisplay) {
503 +                                best = i;
504 +                        }
505 +                }
506 +                XF86VidModeSwitchToMode(x_display, screen, x_video_modes[best]);
507 +                XF86VidModeSetViewPort(x_display, screen, 0, 0);
508 +        }
509 + #endif
510 +
511          // Create window
512          XSetWindowAttributes wattr;
513          wattr.event_mask = eventmask = dga_eventmask;
# Line 635 | Line 661 | bool VideoInit(bool classic)
661          else
662                  has_dga = false;
663   #endif
664 <        
664 >
665   #if ENABLE_XF86_DGA
666          // DGA available?
667 <        int event_base, error_base;
668 <        if (XF86DGAQueryExtension(x_display, &event_base, &error_base)) {
667 >        int dga_event_base, dga_error_base;
668 >        if (XF86DGAQueryExtension(x_display, &dga_event_base, &dga_error_base)) {
669                  int dga_flags = 0;
670                  XF86DGAQueryDirectVideo(x_display, screen, &dga_flags);
671                  has_dga = dga_flags & XF86DGADirectPresent;
# Line 647 | Line 673 | bool VideoInit(bool classic)
673                  has_dga = false;
674   #endif
675  
676 + #if ENABLE_XF86_VIDMODE
677 +        // VidMode available?
678 +        int vm_event_base, vm_error_base;
679 +        has_vidmode = XF86VidModeQueryExtension(x_display, &vm_event_base, &vm_error_base);
680 +        if (has_vidmode)
681 +                XF86VidModeGetAllModeLines(x_display, screen, &num_x_video_modes, &x_video_modes);
682 + #endif
683 +        
684          // Find black and white colors
685          XParseColor(x_display, DefaultColormap(x_display, screen), "rgb:00/00/00", &black);
686          XAllocColor(x_display, DefaultColormap(x_display, screen), &black);
# Line 798 | Line 832 | void VideoExit(void)
832                  }
833   #endif
834  
835 + #if ENABLE_XF86_VIDMODE
836 +                if (has_vidmode && display_type == DISPLAY_DGA)
837 +                        XF86VidModeSwitchToMode(x_display, screen, x_video_modes[0]);
838 + #endif
839 +
840   #if ENABLE_FBDEV_DGA
841                  if (display_type == DISPLAY_DGA) {
842                          XUngrabPointer(x_display, CurrentTime);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines