--- BasiliskII/src/Unix/video_x.cpp 2000/09/25 21:49:19 1.20 +++ BasiliskII/src/Unix/video_x.cpp 2000/10/11 17:55:06 1.24 @@ -583,6 +583,7 @@ static bool init_fbdev_dga(char *in_fb_n } } +#if ENABLE_VOSF #if REAL_ADDRESSING || DIRECT_ADDRESSING // If the blit function is null, i.e. just a copy of the buffer, // we first try to avoid the allocation of a temporary frame buffer @@ -599,9 +600,10 @@ static bool init_fbdev_dga(char *in_fb_n the_buffer = (uint8 *)allocate_framebuffer(the_buffer_size); memset(the_buffer, 0, the_buffer_size); } -#elif ENABLE_VOSF +#else use_vosf = false; #endif +#endif set_video_monitor(width, height, bytes_per_row, true); #if REAL_ADDRESSING || DIRECT_ADDRESSING @@ -703,7 +705,7 @@ static bool init_xf86_dga(int width, int the_buffer = (uint8 *)allocate_framebuffer(the_buffer_size); memset(the_buffer, 0, the_buffer_size); } -#elif ENABLE_VOSF +#elif defined(ENABLE_VOSF) // The UAE memory handlers will already handle color conversion, if needed. use_vosf = false; #endif @@ -1288,27 +1290,30 @@ static void resume_emul(void) XF86DGASetViewPort(x_display, screen, 0, 0); #endif XSync(x_display, false); - - // Restore frame buffer - if (fb_save) { -#if REAL_ADDRESSING || DIRECT_ADDRESSING - if (use_vosf) - mprotect((caddr_t)mainBuffer.memStart, mainBuffer.memLength, PROT_READ|PROT_WRITE); -#endif - memcpy(the_buffer, fb_save, VideoMonitor.y * VideoMonitor.bytes_per_row); -#if REAL_ADDRESSING || DIRECT_ADDRESSING - if (use_vosf) { - mprotect((caddr_t)mainBuffer.memStart, mainBuffer.memLength, PROT_READ); - do_update_framebuffer(the_host_buffer, the_buffer, VideoMonitor.x * VideoMonitor.bytes_per_row); + + // the_buffer already contains the data to restore. i.e. since a temporary + // frame buffer is used when VOSF is actually used, fb_save is therefore + // not necessary. +#ifdef ENABLE_VOSF + if (use_vosf) { #ifdef HAVE_PTHREADS - pthread_mutex_lock(&Screen_draw_lock); + pthread_mutex_lock(&Screen_draw_lock); #endif - PFLAG_CLEAR_ALL; + PFLAG_SET_ALL; #ifdef HAVE_PTHREADS - pthread_mutex_unlock(&Screen_draw_lock); + pthread_mutex_unlock(&Screen_draw_lock); #endif - } + memset(the_buffer_copy, 0, VideoMonitor.bytes_per_row * VideoMonitor.y); + } +#endif + + // Restore frame buffer + if (fb_save) { +#ifdef ENABLE_VOSF + // Don't copy fb_save to the temporary frame buffer in VOSF mode + if (!use_vosf) #endif + memcpy(the_buffer, fb_save, VideoMonitor.y * VideoMonitor.bytes_per_row); free(fb_save); fb_save = NULL; } @@ -1589,14 +1594,8 @@ static void handle_events(void) // Hidden parts exposed, force complete refresh of window case Expose: if (display_type == DISPLAY_WINDOW) { - if (frame_skip == 0) { // Dynamic refresh - int x1, y1; - for (y1=0; y1<16; y1++) - for (x1=0; x1<16; x1++) - updt_box[x1][y1] = true; - nr_boxes = 16 * 16; - } else { #ifdef ENABLE_VOSF + if (use_vosf) { // VOSF refresh #ifdef HAVE_PTHREADS pthread_mutex_lock(&Screen_draw_lock); #endif @@ -1604,9 +1603,18 @@ static void handle_events(void) #ifdef HAVE_PTHREADS pthread_mutex_unlock(&Screen_draw_lock); #endif -#endif memset(the_buffer_copy, 0, VideoMonitor.bytes_per_row * VideoMonitor.y); } + else +#endif + if (frame_skip == 0) { // Dynamic refresh + int x1, y1; + for (y1=0; y1<16; y1++) + for (x1=0; x1<16; x1++) + updt_box[x1][y1] = true; + nr_boxes = 16 * 16; + } else // Static refresh + memset(the_buffer_copy, 0, VideoMonitor.bytes_per_row * VideoMonitor.y); } break; } @@ -1737,7 +1745,7 @@ static void update_display_static(void) // Check for first column from left and first column from right that have changed if (high) { if (depth == 1) { - x1 = VideoMonitor.x; + x1 = VideoMonitor.x - 1; for (j=y1; j<=y2; j++) { p = &the_buffer[j * bytes_per_row]; p2 = &the_buffer_copy[j * bytes_per_row]; @@ -1899,6 +1907,7 @@ static void video_refresh_dga(void) handle_palette_changes(depth, DISPLAY_DGA); } +#ifdef ENABLE_VOSF #if REAL_ADDRESSING || DIRECT_ADDRESSING static void video_refresh_dga_vosf(void) { @@ -1926,7 +1935,6 @@ static void video_refresh_dga_vosf(void) } #endif -#ifdef ENABLE_VOSF static void video_refresh_window_vosf(void) { // Quit DGA mode if requested @@ -1951,7 +1959,7 @@ static void video_refresh_window_vosf(vo #endif } } -#endif +#endif // def ENABLE_VOSF static void video_refresh_window_static(void) { @@ -1992,7 +2000,7 @@ void VideoRefreshInit(void) { // TODO: set up specialised 8bpp VideoRefresh handlers ? if (display_type == DISPLAY_DGA) { -#if REAL_ADDRESSING || DIRECT_ADDRESSING +#if ENABLE_VOSF && (REAL_ADDRESSING || DIRECT_ADDRESSING) if (use_vosf) video_refresh = video_refresh_dga_vosf; else