From 4ba4f031047961763cc5deb90a002c99450759b3 Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Mon, 19 Mar 2012 20:56:55 +0000 Subject: [PATCH] Fix for r.2446 - for Qemu or non-standart videocards. Unfortunately [BytesPerScanLine] does not always equal to [_display.width]*[ScreenBPP]/8 git-svn-id: svn://kolibrios.org@2480 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 2 + kernel/trunk/kernel.asm | 19 +++++++++ kernel/trunk/memmap.inc | 3 +- kernel/trunk/video/blitter.inc | 5 ++- kernel/trunk/video/cursors.inc | 8 +--- kernel/trunk/video/vesa20.inc | 77 +++++----------------------------- 6 files changed, 38 insertions(+), 76 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 70208e97b3..292666c0c0 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -190,6 +190,8 @@ TASK_DATA equ (OS_BASE+0x0003020) TASK_EVENT equ (OS_BASE+0x0003020) d_width_calc_area equ (OS_BASE+0x0005000) +BPSLine_calc_area equ (OS_BASE+0x0339000) + mouseunder equ (OS_BASE+0x0006900) CDDataBuf equ (OS_BASE+0x0007000) FLOPPY_BUFF equ (OS_BASE+0x0008000) diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 452c92ecbd..1a317afda5 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -403,6 +403,10 @@ high_code: mov [_WinMapSize], eax call calculate_fast_getting_offset_for_WinMapAddress +; for Qemu or non standart video cards +; Unfortunately [BytesPerScanLine] does not always +; equal to [_display.width] * [ScreenBPP] / 8 + call calculate_fast_getting_offset_for_LFB mov esi, BOOT_VAR+0x9080 movzx ecx, byte [esi-1] @@ -4849,6 +4853,21 @@ calculate_fast_getting_offset_for_WinMapAddress: ret ;------------------------------------------------------------------------------ align 4 +calculate_fast_getting_offset_for_LFB: +; calculate data area for fast getting offset to LFB + xor eax, eax + mov ecx, [_display.height] + inc ecx + mov edi, BPSLine_calc_area + cld +@@: + stosd + add eax, [BytesPerScanLine] + dec ecx + jnz @r + ret +;------------------------------------------------------------------------------ +align 4 set_screen: cmp eax, [Screen_Max_X] jne .set diff --git a/kernel/trunk/memmap.inc b/kernel/trunk/memmap.inc index 0f9e281ba0..eac5c173d0 100644 --- a/kernel/trunk/memmap.inc +++ b/kernel/trunk/memmap.inc @@ -246,7 +246,8 @@ ; 04 dword draw limit - y start ; 08 dword draw limit - x end ; 0C dword draw limit - y end -; 0x80339000 -> 3BFFF3 free (12k) +; 0x80339000 -> 33A7FF area for fast getting offset to LFB (6k) +; 0x8033A800 -> 3BFFF3 free (6k) ; 0x8033BFF4 -> 33BFFF background info ; 0x8033C000 page map (length b = memsize shr 15) ; 0x8033C000 + b start of static pagetables diff --git a/kernel/trunk/video/blitter.inc b/kernel/trunk/video/blitter.inc index dd7b2b1141..3588f014c2 100644 --- a/kernel/trunk/video/blitter.inc +++ b/kernel/trunk/video/blitter.inc @@ -345,9 +345,10 @@ blit_32: mov edi, ebp - imul edi, [_display.pitch] +; imul edi, [_display.pitch] + mov edi, [BPSLine_calc_area+edi*4] ; imul ebp, [_display.width] - mov ebp, [d_width_calc_area + ebp*4] + mov ebp, [d_width_calc_area+ebp*4] add ebp, ebx add ebp, [_WinMapAddress] diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index 76081341c5..a02c927074 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -618,9 +618,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword mov [_dy], edx ; mul dword [BytesPerScanLine] - mov eax, [d_width_calc_area + eax*4] - lea eax, [eax + eax*2] - + mov eax, [BPSLine_calc_area+eax*4] lea edx, [LFB_BASE+ecx*3] add edx, eax mov [cur_saved_base], edx @@ -737,9 +735,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword mov [_dy], edx ; mul dword [BytesPerScanLine] - mov eax, [d_width_calc_area + eax*4] - shl eax, 2 - + mov eax, [BPSLine_calc_area+eax*4] lea edx, [LFB_BASE+eax+ecx*4] mov [cur_saved_base], edx diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 0165bf7df3..2a92184bb9 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -72,8 +72,7 @@ align 4 .no_mouseunder: ;-------------------------------------- ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier - mov ebx, [d_width_calc_area + ebx*4] - lea ebx, [ebx + ebx*2] + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [eax+eax*2]; edi = x*3 add edi, ebx ; edi = x*3+(y*y multiplier) mov ecx, [LFB_BASE+edi] @@ -105,8 +104,7 @@ align 4 .no_mouseunder: ;-------------------------------------- ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier - mov ebx, [d_width_calc_area + ebx*4] - shl ebx, 2 + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) mov ecx, [LFB_BASE+edi] ;-------------------------------------- @@ -243,19 +241,7 @@ align 4 ; pointer to screen mov edx, [putimg.abs_cy] ; imul edx, [BytesPerScanLine] - - mov edx, [d_width_calc_area + edx*4] - cmp bl, 4 - je .32 - lea edx, [edx+edx*2] - jmp @f -;------------------------------------- -align 4 -.32: - shl edx, 2 -;------------------------------------- -align 4 -@@: + mov edx, [BPSLine_calc_area+edx*4] mov eax, [putimg.abs_cx] ; movzx ebx, byte [ScreenBPP] ; shr ebx, 3 @@ -740,9 +726,7 @@ Vesa20_putpixel24: mov cx, bx ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier - mov ebx, [d_width_calc_area + ebx*4] - lea ebx, [ebx + ebx*2] - + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [eax+eax*2]; edi = x*3 mov eax, [esp+32-8+4] ;-------------------------------------- @@ -771,9 +755,7 @@ Vesa20_putpixel24_new: mov cx, bx ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier - mov ebx, [d_width_calc_area + ebx*4] - lea ebx, [ebx + ebx*2] - + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [eax+eax*2]; edi = x*3 mov eax, [esp+32-8+4] ;-------------------------------------- @@ -819,9 +801,7 @@ Vesa20_putpixel32: mov cx, bx ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier - mov ebx, [d_width_calc_area + ebx*4] - shl ebx, 2 - + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) mov eax, [esp+32-8+4]; eax = color ;-------------------------------------- @@ -849,9 +829,7 @@ Vesa20_putpixel32_new: mov cx, bx ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier - mov ebx, [d_width_calc_area + ebx*4] - shl ebx, 2 - + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) mov eax, [esp+32-8+4]; eax = color ;-------------------------------------- @@ -1238,19 +1216,7 @@ align 4 ; pointer to screen mov edx, [drbar.abs_cy] ; imul edx, [BytesPerScanLine] - - mov edx, [d_width_calc_area + edx*4] - cmp bl, 4 - je .32 - lea edx, [edx+edx*2] - jmp @f -;------------------------------------- -align 4 -.32: - shl edx, 2 -;------------------------------------- -align 4 -@@: + mov edx, [BPSLine_calc_area+edx*4] mov eax, [drbar.abs_cx] imul eax, ebx add edx, eax @@ -1656,18 +1622,7 @@ dp2: ; and LFB data (output for our function) [edi] ; mov eax, [BytesPerScanLine] ; mul ebx - mov eax, [d_width_calc_area + ebx*4] - cmp [ScreenBPP], byte 32 - je .32 - lea eax, [eax+eax*2] - jmp @f -;------------------------------------- -align 4 -.32: - shl eax, 2 -;------------------------------------- -align 4 -@@: + mov eax, [BPSLine_calc_area+ebx*4] xchg ebp, eax add ebp, eax add ebp, eax @@ -1813,19 +1768,7 @@ vesa20_drawbackground_stretch: ; and LFB data (output for our function) [edi] ; mov eax, [BytesPerScanLine] ; mul ebx - mov eax, [d_width_calc_area + ebx*4] - cmp [ScreenBPP], byte 32 - je .32 - lea eax, [eax+eax*2] - jmp @f -;------------------------------------- -align 4 -.32: - shl eax, 2 -;------------------------------------- -align 4 -@@: - + mov eax, [BPSLine_calc_area+ebx*4] xchg ebp, eax add ebp, eax add ebp, eax