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

Comparing SheepShaver/src/Unix/video_x.cpp (file contents):
Revision 1.41 by gbeauche, 2005-04-02T09:54:16Z vs.
Revision 1.52 by cebix, 2010-02-21T09:59:52Z

# Line 1 | Line 1
1   /*
2   *  video_x.cpp - Video/graphics emulation, X11 specific stuff
3   *
4 < *  SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer
4 > *  SheepShaver (C) Marc Hellwig and Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 37 | Line 37
37   #include <sys/shm.h>
38   #include <errno.h>
39   #include <pthread.h>
40 + #include <semaphore.h>
41  
42   #include <algorithm>
43  
# Line 46 | Line 47
47   #endif
48  
49   #ifdef ENABLE_XF86_DGA
50 < # include <X11/extensions/xf86dga.h>
50 > # include <X11/extensions/Xxf86dga.h>
51   #endif
52  
53   #ifdef ENABLE_XF86_VIDMODE
54   # include <X11/extensions/xf86vmode.h>
55   #endif
56  
57 + #ifdef ENABLE_FBDEV_DGA
58 + # include <sys/mman.h>
59 + #endif
60 +
61   #include "main.h"
62   #include "adb.h"
63   #include "prefs.h"
# Line 83 | Line 88 | static pthread_attr_t redraw_thread_attr
88   static volatile bool redraw_thread_cancel;      // Flag: Cancel Redraw thread
89   static pthread_t redraw_thread;                         // Redraw thread
90  
86 static bool local_X11;                                          // Flag: X server running on local machine?
91   static volatile bool thread_stop_req = false;
92 < static volatile bool thread_stop_ack = false;   // Acknowledge for thread_stop_req
92 > static sem_t thread_stop_ack;
93 > static sem_t thread_resume_req;
94  
95 + static bool local_X11;                                          // Flag: X server running on local machine?
96   static bool has_dga = false;                            // Flag: Video DGA capable
97   static bool has_vidmode = false;                        // Flag: VidMode extension available
98  
# Line 164 | Line 170 | static int num_x_video_modes;
170   #endif
171  
172   // Mutex to protect palette
173 < #ifdef HAVE_SPINLOCKS
168 < static spinlock_t x_palette_lock = SPIN_LOCK_UNLOCKED;
169 < #define LOCK_PALETTE spin_lock(&x_palette_lock)
170 < #define UNLOCK_PALETTE spin_unlock(&x_palette_lock)
171 < #elif defined(HAVE_PTHREADS)
173 > #if defined(HAVE_PTHREADS)
174   static pthread_mutex_t x_palette_lock = PTHREAD_MUTEX_INITIALIZER;
175   #define LOCK_PALETTE pthread_mutex_lock(&x_palette_lock)
176   #define UNLOCK_PALETTE pthread_mutex_unlock(&x_palette_lock)
177 + #elif defined(HAVE_SPINLOCKS)
178 + static spinlock_t x_palette_lock = SPIN_LOCK_UNLOCKED;
179 + #define LOCK_PALETTE spin_lock(&x_palette_lock)
180 + #define UNLOCK_PALETTE spin_unlock(&x_palette_lock)
181   #else
182   #define LOCK_PALETTE
183   #define UNLOCK_PALETTE
184   #endif
185  
186   // Mutex to protect frame buffer
187 < #ifdef HAVE_SPINLOCKS
182 < static spinlock_t frame_buffer_lock = SPIN_LOCK_UNLOCKED;
183 < #define LOCK_FRAME_BUFFER spin_lock(&frame_buffer_lock)
184 < #define UNLOCK_FRAME_BUFFER spin_unlock(&frame_buffer_lock)
185 < #elif defined(HAVE_PTHREADS)
187 > #if defined(HAVE_PTHREADS)
188   static pthread_mutex_t frame_buffer_lock = PTHREAD_MUTEX_INITIALIZER;
189   #define LOCK_FRAME_BUFFER pthread_mutex_lock(&frame_buffer_lock);
190   #define UNLOCK_FRAME_BUFFER pthread_mutex_unlock(&frame_buffer_lock);
191 + #elif defined(HAVE_SPINLOCKS)
192 + static spinlock_t frame_buffer_lock = SPIN_LOCK_UNLOCKED;
193 + #define LOCK_FRAME_BUFFER spin_lock(&frame_buffer_lock)
194 + #define UNLOCK_FRAME_BUFFER spin_unlock(&frame_buffer_lock)
195   #else
196   #define LOCK_FRAME_BUFFER
197   #define UNLOCK_FRAME_BUFFER
# Line 577 | Line 583 | static bool open_window(int width, int h
583          use_vosf = true;
584          // Allocate memory for frame buffer (SIZE is extended to page-boundary)
585          the_host_buffer = the_buffer_copy;
586 <        the_buffer_size = page_extend((aligned_height + 2) * (the_host_buffer_row_bytes = img->bytes_per_line));
586 >        the_buffer_size = page_extend((aligned_height + 2) * img->bytes_per_line);
587          the_buffer = (uint8 *)vm_acquire(the_buffer_size);
588          the_buffer_copy = (uint8 *)malloc(the_buffer_size);
589          D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
# Line 633 | Line 639 | static bool open_window(int width, int h
639          return true;
640   }
641  
642 < // Open FBDev display
643 < static bool open_fbdev(int width, int height)
642 > // Open FBDev DGA display
643 > static bool open_fbdev_dga(int width, int height)
644   {
645   #ifdef ENABLE_FBDEV_DGA
646 + #ifdef ENABLE_XF86_VIDMODE
647 +        // Switch to best mode
648 +        if (has_vidmode) {
649 +                int best = -1;
650 +                for (int i = 0; i < num_x_video_modes; i++) {
651 +                        if (x_video_modes[i]->hdisplay == width && x_video_modes[i]->vdisplay == height) {
652 +                                best = i;
653 +                                break;
654 +                        }
655 +                };
656 +                assert(best != -1);
657 +                XF86VidModeSwitchToMode(x_display, screen, x_video_modes[best]);
658 +                XF86VidModeSetViewPort(x_display, screen, 0, 0);
659 +                D(bug("[fbdev] VideoMode %d: %d x %d @ %d\n", best,
660 +                          x_video_modes[best]->hdisplay, x_video_modes[best]->vdisplay,
661 +                          1000 * x_video_modes[best]->dotclock / (x_video_modes[best]->htotal * x_video_modes[best]->vtotal)));
662 +        }
663 + #endif
664 +
665          if (ioctl(fb_dev_fd, FBIOGET_FSCREENINFO, &fb_finfo) != 0) {
666                  D(bug("[fbdev] Can't get FSCREENINFO: %s\n", strerror(errno)));
667                  return false;
# Line 674 | Line 699 | static bool open_fbdev(int width, int he
699          }
700          D(bug("[fbdev] visual: %s\n", fb_visual_str));
701  
702 <        if (fb_visual != FB_VISUAL_TRUECOLOR) {
702 >        if (fb_visual != FB_VISUAL_TRUECOLOR && fb_visual != FB_VISUAL_DIRECTCOLOR) {
703                  D(bug("[fbdev] visual '%s' not supported\n", fb_visual_str));
704                  return false;
705          }
# Line 706 | Line 731 | static bool open_fbdev(int width, int he
731                                    GrabModeAsync, GrabModeAsync, CurrentTime);
732          XGrabPointer(x_display, the_win, True,
733                                   PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
734 <                                 GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
734 >                                 GrabModeAsync, GrabModeAsync, the_win, None, CurrentTime);
735          disable_mouse_accel();
736  
737          // Create no_cursor
# Line 717 | Line 742 | static bool open_fbdev(int width, int he
742          XDefineCursor(x_display, the_win, mac_cursor);
743  
744          // Init blitting routines
745 +        int bytes_per_row = TrivialBytesPerRow((width + 7) & ~7, DepthModeForPixelDepth(depth));
746   #if ENABLE_VOSF
747          // Extract current screen color masks (we are in True Color mode)
748          VisualFormat visualFormat;
# Line 743 | Line 769 | static bool open_fbdev(int width, int he
769          // Allocate memory for frame buffer (SIZE is extended to page-boundary)
770          use_vosf = true;
771          the_host_buffer = the_buffer;
772 <        the_host_buffer_row_bytes = TrivialBytesPerRow((width + 7) & ~7, DepthModeForPixelDepth(visualFormat.depth));
747 <        the_buffer_size = page_extend((height + 2) * the_host_buffer_row_bytes);
772 >        the_buffer_size = page_extend((height + 2) * bytes_per_row);
773          the_buffer_copy = (uint8 *)malloc(the_buffer_size);
774          the_buffer = (uint8 *)vm_acquire(the_buffer_size);
775          D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
# Line 753 | Line 778 | static bool open_fbdev(int width, int he
778          // Set frame buffer base
779          D(bug("the_buffer = %p, use_vosf = %d\n", the_buffer, use_vosf));
780          screen_base = Host2MacAddr(the_buffer);
781 <        VModes[cur_mode].viRowBytes = TrivialBytesPerRow((width + 7) & ~7, DepthModeForPixelDepth(depth));
781 >        VModes[cur_mode].viRowBytes = bytes_per_row;
782          return true;
783   #else
784          ErrorAlert("SheepShaver has been compiled with DGA support disabled.");
# Line 761 | Line 786 | static bool open_fbdev(int width, int he
786   #endif
787   }
788  
789 < // Open DGA display (!! should use X11 VidMode extensions to set mode)
790 < static bool open_dga(int width, int height)
789 > // Open XF86 DGA display (!! should use X11 VidMode extensions to set mode)
790 > static bool open_xf86_dga(int width, int height)
791   {
792          if (is_fbdev_dga_mode)
793                  return false;
# Line 835 | Line 860 | static bool open_dga(int width, int heig
860          if (use_vosf) {
861            // Allocate memory for frame buffer (SIZE is extended to page-boundary)
862            the_host_buffer = the_buffer;
863 <          the_buffer_size = page_extend((height + 2) * (the_host_buffer_row_bytes = bytes_per_row));
863 >          the_buffer_size = page_extend((height + 2) * bytes_per_row);
864            the_buffer_copy = (uint8 *)malloc(the_buffer_size);
865            the_buffer = (uint8 *)vm_acquire(the_buffer_size);
866            D(bug("the_buffer = %p, the_buffer_copy = %p, the_host_buffer = %p\n", the_buffer, the_buffer_copy, the_host_buffer));
# Line 856 | Line 881 | static bool open_dga(int width, int heig
881   #endif
882   }
883  
884 + // Open DGA display
885 + static bool open_dga(int width, int height)
886 + {
887 +        bool display_open;
888 +
889 +        display_open = open_xf86_dga(width, height);
890 + #ifdef ENABLE_FBDEV_DGA
891 +        // Try to fallback to FBDev DGA mode
892 +        if (!display_open) {
893 +                is_fbdev_dga_mode = true;
894 +                display_open = open_fbdev_dga(width, height);
895 +        }
896 + #endif
897 +
898 +        // Common DGA display initialization
899 +        if (display_open) {
900 +
901 +                // Fake image to get display bounds in the refresh function
902 +                if ((img = (XImage *)malloc(sizeof(*img))) == NULL)
903 +                        return false;
904 +                img->width = DisplayWidth(x_display, screen);
905 +                img->height = DisplayHeight(x_display, screen);
906 +                img->depth = is_fbdev_dga_mode ? xdepth : depth;
907 +                img->bytes_per_line = TrivialBytesPerRow(img->width, DepthModeForPixelDepth(img->depth));
908 +        }
909 +
910 +        return display_open;
911 + }
912 +
913   static bool open_display(void)
914   {
915          D(bug("open_display()\n"));
# Line 944 | Line 998 | static bool open_display(void)
998          display_type = mode.viType;
999          depth = depth_of_video_mode(mode.viAppleMode);
1000  
1001 <        bool display_open = false;
1002 <        if (display_type == DIS_SCREEN) {
1001 >        bool display_open;
1002 >        switch (display_type) {
1003 >        case DIS_SCREEN:
1004                  display_open = open_dga(VModes[cur_mode].viXsize, VModes[cur_mode].viYsize);
1005 < #ifdef ENABLE_FBDEV_DGA
1006 <                // Try to fallback to FBDev DGA mode
952 <                if (!display_open) {
953 <                        is_fbdev_dga_mode = true;
954 <                        display_open = open_fbdev(VModes[cur_mode].viXsize, VModes[cur_mode].viYsize);
955 <                }
956 < #endif
957 <                
958 <        }
959 <        else if (display_type == DIS_WINDOW)
1005 >                break;
1006 >        case DIS_WINDOW:
1007                  display_open = open_window(VModes[cur_mode].viXsize, VModes[cur_mode].viYsize);
1008 +                break;
1009 +        default:
1010 +                display_open = false;
1011 +                break;
1012 +        }
1013  
1014   #ifdef ENABLE_VOSF
1015          if (use_vosf) {
# Line 973 | Line 1025 | static bool open_display(void)
1025   #endif
1026  
1027          // Zero screen buffers, viRowBytes is initialized at this stage
1028 <        memset(the_buffer, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize);
1029 <        memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize);
1028 >        if (display_open) {
1029 >                memset(the_buffer, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize);
1030 >                memset(the_buffer_copy, 0, VModes[cur_mode].viRowBytes * VModes[cur_mode].viYsize);
1031 >        }
1032          return display_open;
1033   }
1034  
# Line 1011 | Line 1065 | static void close_window(void)
1065   }
1066  
1067   // Close FBDev mode
1068 < static void close_fbdev(void)
1068 > static void close_fbdev_dga(void)
1069   {
1070   #ifdef ENABLE_FBDEV_DGA
1017        XUngrabPointer(x_display, CurrentTime);
1018        XUngrabKeyboard(x_display, CurrentTime);
1019
1071          uint8 *fb_base;
1072 <        if (!use_vosf) {
1022 <                // don't free() the screen buffer in driver_base dtor
1072 >        if (!use_vosf)
1073                  fb_base = the_buffer;
1024                the_buffer = NULL;
1025        }
1074   #ifdef ENABLE_VOSF
1075 <        else {
1028 <                // don't free() the screen buffer in driver_base dtor
1075 >        else
1076                  fb_base = the_host_buffer;
1030                the_host_buffer = NULL;
1031        }
1077   #endif
1078          munmap(fb_base, fb_finfo.smem_len);
1079   #endif
1080   }
1081  
1082 + // Close XF86 DGA mode
1083 + static void close_xf86_dga(void)
1084 + {
1085 + #ifdef ENABLE_XF86_DGA
1086 +        XF86DGADirectVideo(x_display, screen, 0);
1087 + #endif
1088 + }
1089 +
1090   // Close DGA mode
1091   static void close_dga(void)
1092   {
1093          if (is_fbdev_dga_mode)
1094 <                return;
1094 >                close_fbdev_dga();
1095 >        else
1096 >                close_xf86_dga();
1097  
1043 #ifdef ENABLE_XF86_DGA
1044        XF86DGADirectVideo(x_display, screen, 0);
1098          XUngrabPointer(x_display, CurrentTime);
1099          XUngrabKeyboard(x_display, CurrentTime);
1047 #endif
1100  
1101   #ifdef ENABLE_XF86_VIDMODE
1102          if (has_vidmode)
1103                  XF86VidModeSwitchToMode(x_display, screen, x_video_modes[0]);
1104   #endif
1105  
1106 +        // Release fake image (it's not a normal XImage!)
1107 +        free(img);
1108 +        img = NULL;
1109 +
1110          if (!use_vosf) {
1111                  // don't free() the screen buffer in driver_base dtor
1112                  the_buffer = NULL;
# Line 1065 | Line 1121 | static void close_dga(void)
1121  
1122   static void close_display(void)
1123   {
1124 <        if (display_type == DIS_SCREEN) {
1125 <                if (is_fbdev_dga_mode)
1070 <                        close_fbdev();
1071 <                else
1072 <                        close_dga();
1073 <        }
1124 >        if (display_type == DIS_SCREEN)
1125 >                close_dga();
1126          else if (display_type == DIS_WINDOW)
1127                  close_window();
1128  
# Line 1300 | Line 1352 | static void add_window_modes(VideoInfo *
1352   static bool has_mode(int x, int y)
1353   {
1354   #ifdef ENABLE_XF86_VIDMODE
1355 <        for (int i=0; i<num_x_video_modes; i++)
1356 <                if (x_video_modes[i]->hdisplay >= x && x_video_modes[i]->vdisplay >= y)
1357 <                        return true;
1358 <        return false;
1359 < #else
1360 <        return DisplayWidth(x_display, screen) >= x && DisplayHeight(x_display, screen) >= y;
1355 >        if (has_vidmode) {
1356 >                for (int i=0; i<num_x_video_modes; i++)
1357 >                        if (x_video_modes[i]->hdisplay == x && x_video_modes[i]->vdisplay == y)
1358 >                                return true;
1359 >                return false;
1360 >        }
1361   #endif
1362 +        return DisplayWidth(x_display, screen) >= x && DisplayHeight(x_display, screen) >= y;
1363   }
1364  
1365   bool VideoInit(void)
# Line 1319 | Line 1372 | bool VideoInit(void)
1372          
1373          // Check if X server runs on local machine
1374          local_X11 = (strncmp(XDisplayName(x_display_name), ":", 1) == 0)
1375 +                 || (strncmp(XDisplayName(x_display_name), "/", 1) == 0)
1376                   || (strncmp(XDisplayName(x_display_name), "unix:", 5) == 0);
1377      
1378          // Init keycode translation
# Line 1373 | Line 1427 | bool VideoInit(void)
1427          // VidMode available?
1428          int vm_event_base, vm_error_base;
1429          has_vidmode = XF86VidModeQueryExtension(x_display, &vm_event_base, &vm_error_base);
1430 <        if (has_vidmode)
1430 >        if (has_vidmode) {
1431 >                int vm_major_version, vm_minor_version;
1432 >                XF86VidModeQueryVersion(x_display, &vm_major_version, &vm_minor_version);
1433 >                D(bug("VidMode extension %d.%d available\n", vm_major_version, vm_minor_version));
1434                  XF86VidModeGetAllModeLines(x_display, screen, &num_x_video_modes, &x_video_modes);
1435 +        }
1436   #endif
1437  
1438   #ifdef ENABLE_FBDEV_DGA
# Line 1486 | Line 1544 | bool VideoInit(void)
1544   #endif
1545                  } else
1546                          add_custom_mode(p, display_type, default_width, default_height, default_mode, APPLE_CUSTOM);
1547 +
1548 +                // Add extra VidMode capable modes
1549 +                if (display_type == DIS_SCREEN) {
1550 +                        struct {
1551 +                                int w;
1552 +                                int h;
1553 +                                int apple_id;
1554 +                        }
1555 +                        video_modes[] = {
1556 +                                {  640,  480, APPLE_640x480   },
1557 +                                {  800,  600, APPLE_800x600   },
1558 +                                { 1024,  768, APPLE_1024x768  },
1559 +                                { 1152,  768, APPLE_1152x768  },
1560 +                                { 1152,  900, APPLE_1152x900  },
1561 +                                { 1280, 1024, APPLE_1280x1024 },
1562 +                                { 1600, 1200, APPLE_1600x1200 },
1563 +                                { 0, }
1564 +                        };
1565 +
1566 +                        for (int i = 0; video_modes[i].w != 0; i++) {
1567 +                                const int w = video_modes[i].w;
1568 +                                const int h = video_modes[i].h;
1569 +                                if (w >= default_width || h >= default_height)
1570 +                                        continue;
1571 +                                if (has_mode(w, h)) {
1572 + #ifdef ENABLE_VOSF
1573 +                                        if (is_fbdev_dga_mode) {
1574 +                                                for (unsigned int d = APPLE_1_BIT; d <= default_mode; d++)
1575 +                                                        if (find_visual_for_depth(d))
1576 +                                                                add_custom_mode(p, display_type, w, h, d, video_modes[i].apple_id);
1577 +                                        } else
1578 + #endif
1579 +                                                add_custom_mode(p, display_type, w, h, default_mode, video_modes[i].apple_id);
1580 +                                }
1581 +                        }
1582 +                }
1583          } else if (window_modes) {
1584                  for (unsigned int d = APPLE_1_BIT; d <= APPLE_32_BIT; d++)
1585                          if (find_visual_for_depth(d))
# Line 1554 | Line 1648 | bool VideoInit(void)
1648   #endif
1649  
1650          // Open window/screen
1651 <        if (!open_display())
1651 >        if (!open_display()) {
1652 >                ErrorAlert(GetString(STR_OPEN_WINDOW_ERR));
1653                  return false;
1654 +        }
1655  
1656   #if 0
1657          // Ignore errors from now on
# Line 1568 | Line 1664 | bool VideoInit(void)
1664  
1665          // Start periodic thread
1666          XSync(x_display, false);
1667 +        if (sem_init(&thread_stop_ack, 0, 0) < 0)
1668 +                return false;
1669 +        if (sem_init(&thread_resume_req, 0, 0) < 0)
1670 +                return false;
1671          Set_pthread_attr(&redraw_thread_attr, 0);
1672          redraw_thread_cancel = false;
1673          redraw_thread_active = (pthread_create(&redraw_thread, &redraw_thread_attr, redraw_func, NULL) == 0);
# Line 1587 | Line 1687 | void VideoExit(void)
1687                  redraw_thread_cancel = true;
1688                  pthread_cancel(redraw_thread);
1689                  pthread_join(redraw_thread, NULL);
1690 +                sem_destroy(&thread_stop_ack);
1691 +                sem_destroy(&thread_resume_req);
1692                  redraw_thread_active = false;
1693          }
1694  
# Line 1681 | Line 1783 | static void resume_emul(void)
1783          XWarpPointer(x_display, None, rootwin, 0, 0, 0, 0, 0, 0);
1784          Window w = is_fbdev_dga_mode ? the_win : rootwin;
1785          XGrabKeyboard(x_display, w, True, GrabModeAsync, GrabModeAsync, CurrentTime);
1786 <        XGrabPointer(x_display, w, True, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
1786 >        XGrabPointer(x_display, w, True, PointerMotionMask | ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync, is_fbdev_dga_mode ? w : None, None, CurrentTime);
1787          disable_mouse_accel();
1788   #ifdef ENABLE_XF86_DGA
1789          if (!is_fbdev_dga_mode) {
# Line 2064 | Line 2166 | int16 video_mode_change(VidLocals *csSav
2166                          csSave->savePage = ReadMacInt16(ParamPtr + csPage);
2167  
2168                          // Disable interrupts and pause redraw thread
2067                        DisableInterrupt();
2068                        thread_stop_ack = false;
2169                          thread_stop_req = true;
2170 <                        while (!thread_stop_ack) ;
2170 >                        sem_wait(&thread_stop_ack);
2171 >                        thread_stop_req = false;
2172 >                        DisableInterrupt();
2173  
2174                          /* close old display */
2175                          close_display();
# Line 2088 | Line 2190 | int16 video_mode_change(VidLocals *csSav
2190                          csSave->saveMode=VModes[cur_mode].viAppleMode;
2191  
2192                          // Enable interrupts and resume redraw thread
2091                        thread_stop_req = false;
2193                          EnableInterrupt();
2194 +                        sem_post(&thread_resume_req);
2195                          return noErr;
2196                  }
2197          }
# Line 2341 | Line 2443 | static void *redraw_func(void *arg)
2443          while (!redraw_thread_cancel) {
2444  
2445                  // Pause if requested (during video mode switches)
2446 <                while (thread_stop_req)
2447 <                        thread_stop_ack = true;
2446 >                if (thread_stop_req) {
2447 >                        sem_post(&thread_stop_ack);
2448 >                        sem_wait(&thread_resume_req);
2449 >                }
2450  
2451                  int64 delay = next - GetTicks_usec();
2452                  if (delay < -VIDEO_REFRESH_DELAY) {
# Line 2366 | Line 2470 | static void *redraw_func(void *arg)
2470                                          XDisplayLock();
2471   #if defined(ENABLE_XF86_DGA) || defined(ENABLE_FBDEV_DGA)
2472   #ifdef ENABLE_XF86_DGA
2473 <                                        if (is_fbdev_dga_mode)
2473 >                                        if (!is_fbdev_dga_mode)
2474                                                  XF86DGADirectVideo(x_display, screen, 0);
2475   #endif
2476                                          XUngrabPointer(x_display, CurrentTime);
# Line 2456 | Line 2560 | static void *redraw_func(void *arg)
2560          }
2561          return NULL;
2562   }
2563 +
2564 +
2565 + /*
2566 + *  Record dirty area from NQD
2567 + */
2568 +
2569 + void video_set_dirty_area(int x, int y, int w, int h)
2570 + {
2571 +        VideoInfo const & mode = VModes[cur_mode];
2572 +        const int screen_width = VIDEO_MODE_X;
2573 +        const int screen_height = VIDEO_MODE_Y;
2574 +        const int bytes_per_row = VIDEO_MODE_ROW_BYTES;
2575 +
2576 + #ifdef ENABLE_VOSF
2577 +        if (use_vosf) {
2578 +                vosf_set_dirty_area(x, y, w, h, screen_width, screen_height, bytes_per_row);
2579 +                return;
2580 +        }
2581 + #endif
2582 +
2583 +        // XXX handle dirty bounding boxes for non-VOSF modes
2584 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines