From c044312b3c7a2812bfb4b5667fa56e00e1147372 Mon Sep 17 00:00:00 2001 From: rakslice Date: Thu, 12 Nov 2020 22:51:46 -0800 Subject: [PATCH 1/3] In vosf full screen update use chunk size based on pixel size (cherry picked from commit 108071e1a1ed9f43229fc81ca882fbb6c2de7eec) --- BasiliskII/src/CrossPlatform/video_vosf.h | 27 +++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/BasiliskII/src/CrossPlatform/video_vosf.h b/BasiliskII/src/CrossPlatform/video_vosf.h index f99b44bf5..fc26a3472 100644 --- a/BasiliskII/src/CrossPlatform/video_vosf.h +++ b/BasiliskII/src/CrossPlatform/video_vosf.h @@ -540,6 +540,27 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT) #ifndef TEST_VOSF_PERFORMANCE #if REAL_ADDRESSING || DIRECT_ADDRESSING + +static uint32 get_chunk_size_for_depth(const uint32 mode, const uint32 n_pixels) { + assert(n_pixels % 8 == 0); + switch(mode) { + case APPLE_1_BIT: + return n_pixels / 8; + case APPLE_2_BIT: + return n_pixels / 4; + case APPLE_4_BIT: + return n_pixels / 2; + case APPLE_8_BIT: + return n_pixels; + case APPLE_16_BIT: + return n_pixels * 2; + case APPLE_32_BIT: + return n_pixels * 4; + default: + assert(false); + } +} + static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) { VIDEO_MODE_INIT; @@ -574,8 +595,10 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) const uint32 n_pixels = 64; const uint32 n_chunks = VIDEO_MODE_X / n_pixels; const uint32 n_pixels_left = VIDEO_MODE_X - (n_chunks * n_pixels); - const uint32 src_chunk_size = src_bytes_per_row / n_chunks; - const uint32 dst_chunk_size = dst_bytes_per_row / n_chunks; + const uint32 src_chunk_size = get_chunk_size_for_depth(VIDEO_MODE_DEPTH, n_pixels); + const uint32 dst_chunk_size = get_chunk_size_for_depth(DepthModeForPixelDepth(VIDEO_DRV_DEPTH), n_pixels); + assert(src_chunk_size <= src_bytes_per_row); + assert(dst_chunk_size <= dst_bytes_per_row); const uint32 src_chunk_size_left = src_bytes_per_row - (n_chunks * src_chunk_size); const uint32 dst_chunk_size_left = dst_bytes_per_row - (n_chunks * dst_chunk_size); From 85da18e38fb3595b940799d2b0108402c2744b87 Mon Sep 17 00:00:00 2001 From: rakslice Date: Fri, 13 Nov 2020 00:13:34 -0800 Subject: [PATCH 2/3] fix for misaligned rows in screen buffer in VOSF full screen mode when screen buffer has slack and source doesn't (cherry picked from commit cbca0b629f7b4fab0038a0d45c15a302c3216763) --- BasiliskII/src/CrossPlatform/video_vosf.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/BasiliskII/src/CrossPlatform/video_vosf.h b/BasiliskII/src/CrossPlatform/video_vosf.h index fc26a3472..e72cad193 100644 --- a/BasiliskII/src/CrossPlatform/video_vosf.h +++ b/BasiliskII/src/CrossPlatform/video_vosf.h @@ -597,8 +597,8 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) const uint32 n_pixels_left = VIDEO_MODE_X - (n_chunks * n_pixels); const uint32 src_chunk_size = get_chunk_size_for_depth(VIDEO_MODE_DEPTH, n_pixels); const uint32 dst_chunk_size = get_chunk_size_for_depth(DepthModeForPixelDepth(VIDEO_DRV_DEPTH), n_pixels); - assert(src_chunk_size <= src_bytes_per_row); - assert(dst_chunk_size <= dst_bytes_per_row); + assert(src_chunk_size * n_chunks <= src_bytes_per_row); + assert(dst_chunk_size * n_chunks <= dst_bytes_per_row); const uint32 src_chunk_size_left = src_bytes_per_row - (n_chunks * src_chunk_size); const uint32 dst_chunk_size_left = dst_bytes_per_row - (n_chunks * dst_chunk_size); @@ -666,8 +666,6 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) memcpy(the_buffer_copy + i1, the_buffer + i1, src_chunk_size_left); Screen_blit(the_host_buffer + i2, the_buffer + i1, src_chunk_size_left); } - i1 += src_chunk_size_left; - i2 += dst_chunk_size_left; #ifdef USE_SDL_VIDEO const int x = n_chunks * n_pixels; if (x < bb[bbi].x) { @@ -681,7 +679,8 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) bb[bbi].w = x + n_pixels_left - bb[bbi].x; #endif } - i2 += scr_bytes_left; + i1 += src_chunk_size_left; + i2 += dst_chunk_size_left + scr_bytes_left; #ifdef USE_SDL_VIDEO bb[bbi].h++; if (bb[bbi].w && (j == y1 || j == y2 - 1 || j == y2)) { From a897561c11406b0f2c758123ce1ba00e4a8b68d5 Mon Sep 17 00:00:00 2001 From: rakslice Date: Sun, 15 Nov 2020 12:53:54 -0800 Subject: [PATCH 3/3] remove duplicated function and fix BII --- BasiliskII/src/CrossPlatform/video_vosf.h | 24 ++--------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/BasiliskII/src/CrossPlatform/video_vosf.h b/BasiliskII/src/CrossPlatform/video_vosf.h index e72cad193..f1d2f3add 100644 --- a/BasiliskII/src/CrossPlatform/video_vosf.h +++ b/BasiliskII/src/CrossPlatform/video_vosf.h @@ -541,26 +541,6 @@ static void update_display_window_vosf(VIDEO_DRV_WIN_INIT) #ifndef TEST_VOSF_PERFORMANCE #if REAL_ADDRESSING || DIRECT_ADDRESSING -static uint32 get_chunk_size_for_depth(const uint32 mode, const uint32 n_pixels) { - assert(n_pixels % 8 == 0); - switch(mode) { - case APPLE_1_BIT: - return n_pixels / 8; - case APPLE_2_BIT: - return n_pixels / 4; - case APPLE_4_BIT: - return n_pixels / 2; - case APPLE_8_BIT: - return n_pixels; - case APPLE_16_BIT: - return n_pixels * 2; - case APPLE_32_BIT: - return n_pixels * 4; - default: - assert(false); - } -} - static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) { VIDEO_MODE_INIT; @@ -595,8 +575,8 @@ static void update_display_dga_vosf(VIDEO_DRV_DGA_INIT) const uint32 n_pixels = 64; const uint32 n_chunks = VIDEO_MODE_X / n_pixels; const uint32 n_pixels_left = VIDEO_MODE_X - (n_chunks * n_pixels); - const uint32 src_chunk_size = get_chunk_size_for_depth(VIDEO_MODE_DEPTH, n_pixels); - const uint32 dst_chunk_size = get_chunk_size_for_depth(DepthModeForPixelDepth(VIDEO_DRV_DEPTH), n_pixels); + const uint32 src_chunk_size = TrivialBytesPerRow(n_pixels, VIDEO_MODE_DEPTH); + const uint32 dst_chunk_size = TrivialBytesPerRow(n_pixels, DepthModeForPixelDepth(VIDEO_DRV_DEPTH)); assert(src_chunk_size * n_chunks <= src_bytes_per_row); assert(dst_chunk_size * n_chunks <= dst_bytes_per_row); const uint32 src_chunk_size_left = src_bytes_per_row - (n_chunks * src_chunk_size);