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.35 by gbeauche, 2001-01-11T18:00:40Z vs.
Revision 1.36 by gbeauche, 2001-01-28T14:05:19Z

# Line 1 | Line 1
1   /*
2   *  video_x.cpp - Video/graphics emulation, X11 specific stuff
3   *
4 < *  Basilisk II (C) 1997-2000 Christian Bauer
4 > *  Basilisk II (C) 1997-2001 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 197 | Line 197 | struct ScreenInfo {
197      int pageBits;                               // Shift count to get the page number
198      uint32 pageCount;                   // Number of pages allocated to the screen
199      
200 +        bool dirty;                                     // Flag: set if the frame buffer was touched
201      char * dirtyPages;                  // Table of flags set if page was altered
202      ScreenPageInfo * pageInfo;  // Table of mappings page -> Mac scanlines
203   };
# Line 234 | Line 235 | static ScreenInfo mainBuffer;
235          memset(mainBuffer.dirtyPages + (first_page), PFLAG_CLEAR_VALUE, \
236                  (last_page) - (first_page))
237  
238 < #define PFLAG_SET_ALL \
239 <        PFLAG_SET_RANGE(0, mainBuffer.pageCount)
240 <
241 < #define PFLAG_CLEAR_ALL \
242 <        PFLAG_CLEAR_RANGE(0, mainBuffer.pageCount)
238 > #define PFLAG_SET_ALL do { \
239 >        PFLAG_SET_RANGE(0, mainBuffer.pageCount); \
240 >        mainBuffer.dirty = true; \
241 > } while (0)
242 >
243 > #define PFLAG_CLEAR_ALL do { \
244 >        PFLAG_CLEAR_RANGE(0, mainBuffer.pageCount); \
245 >        mainBuffer.dirty = false; \
246 > } while (0)
247  
248   // Set the following macro definition to 1 if your system
249   // provides a really fast strchr() implementation
# Line 575 | Line 580 | static bool init_window(int width, int h
580          native_byte_order = (XImageByteOrder(x_display) == LSBFirst);
581   #endif
582   #ifdef ENABLE_VOSF
583 <        do_update_framebuffer = GET_FBCOPY_FUNC(depth, native_byte_order, DISPLAY_WINDOW);
583 >        Screen_blitter_init(&visualInfo, native_byte_order);
584   #endif
585          set_video_monitor(width, height, img->bytes_per_line, native_byte_order);
586          
# Line 714 | Line 719 | static bool init_fbdev_dga(char *in_fb_n
719          
720   #if ENABLE_VOSF
721   #if REAL_ADDRESSING || DIRECT_ADDRESSING
722 <        // If the blit function is null, i.e. just a copy of the buffer,
723 <        // we first try to avoid the allocation of a temporary frame buffer
724 <        use_vosf = true;
720 <        do_update_framebuffer = GET_FBCOPY_FUNC(depth, true, DISPLAY_DGA);
721 <        if (do_update_framebuffer == FBCOPY_FUNC(fbcopy_raw))
722 <                use_vosf = false;
722 >        // Screen_blitter_init() returns TRUE if VOSF is mandatory
723 >        // i.e. the framebuffer update function is not Blit_Copy_Raw
724 >        use_vosf = Screen_blitter_init(&visualInfo, true);
725          
726          if (use_vosf) {
727                  the_host_buffer = the_buffer;
# Line 824 | Line 826 | static bool init_xf86_dga(int width, int
826          }
827          
828   #if REAL_ADDRESSING || DIRECT_ADDRESSING
829 <        // If the blit function is null, i.e. just a copy of the buffer,
830 <        // we first try to avoid the allocation of a temporary frame buffer
831 <        use_vosf = true;
830 <        do_update_framebuffer = GET_FBCOPY_FUNC(depth, true, DISPLAY_DGA);
831 <        if (do_update_framebuffer == FBCOPY_FUNC(fbcopy_raw))
832 <                use_vosf = false;
829 >        // Screen_blitter_init() returns TRUE if VOSF is mandatory
830 >        // i.e. the framebuffer update function is not Blit_Copy_Raw
831 >        use_vosf = Screen_blitter_init(&visualInfo, true);
832          
833          if (use_vosf) {
834                  the_host_buffer = the_buffer;
# Line 952 | Line 951 | bool VideoInitBuffer()
951  
952                  if ((mainBuffer.dirtyPages == 0) || (mainBuffer.pageInfo == 0))
953                          return false;
954 +                
955 +                mainBuffer.dirty = false;
956  
957                  PFLAG_CLEAR_ALL;
958                  // Safety net to insure the loops in the update routines will terminate
# Line 2024 | Line 2025 | static void video_refresh_dga_vosf(void)
2025          static int tick_counter = 0;
2026          if (++tick_counter >= frame_skip) {
2027                  tick_counter = 0;
2028 <                LOCK_VOSF;
2029 <                update_display_dga_vosf();
2030 <                UNLOCK_VOSF;
2028 >                if (mainBuffer.dirty) {
2029 >                        LOCK_VOSF;
2030 >                        update_display_dga_vosf();
2031 >                        UNLOCK_VOSF;
2032 >                }
2033          }
2034   }
2035   #endif
# Line 2046 | Line 2049 | static void video_refresh_window_vosf(vo
2049          static int tick_counter = 0;
2050          if (++tick_counter >= frame_skip) {
2051                  tick_counter = 0;
2052 <                LOCK_VOSF;
2053 <                update_display_window_vosf();
2054 <                UNLOCK_VOSF;
2052 >                if (mainBuffer.dirty) {
2053 >                        LOCK_VOSF;
2054 >                        update_display_window_vosf();
2055 >                        UNLOCK_VOSF;
2056 >                }
2057          }
2058   }
2059   #endif // def ENABLE_VOSF

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines