Video draw some speedup.

git-svn-id: svn://kolibrios.org@2446 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-10 11:37:42 +00:00
parent 134b326402
commit d357a70fe3
7 changed files with 186 additions and 106 deletions

View File

@ -527,9 +527,12 @@ mouse._.find_sys_window_under_cursor: ;////////////////////////////////////////
;< esi = process slot ;< esi = process slot
;< edi = pointer to WDATA struct ;< edi = pointer to WDATA struct
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
mov esi, [Screen_Max_X] ; mov esi, [Screen_Max_X]
inc esi ; inc esi
imul esi, [mouse.state.pos.y] ; imul esi, [mouse.state.pos.y]
mov esi, [mouse.state.pos.y]
mov esi, [d_width_calc_area + esi*4]
add esi, [_WinMapAddress] add esi, [_WinMapAddress]
add esi, [mouse.state.pos.x] add esi, [mouse.state.pos.x]
movzx esi, byte[esi] movzx esi, byte[esi]

View File

@ -1830,10 +1830,14 @@ align 4
; get WinMap start ; get WinMap start
push esi push esi
mov edi, [Screen_Max_X] ; mov edi, [Screen_Max_X]
inc edi ; inc edi
mov esi, edi ; mov esi, edi
imul edi, ebx mov esi, [Screen_Max_X]
inc esi
; imul edi, ebx
mov edi, [d_width_calc_area + ebx*4]
add edi, eax add edi, eax
add edi, [_WinMapAddress] add edi, [_WinMapAddress]
pop eax pop eax
@ -1874,9 +1878,11 @@ align 4
; get WinMap start -> ebp ; get WinMap start -> ebp
push eax push eax
mov eax, [Screen_Max_X] ; screen_sx ; mov eax, [Screen_Max_X] ; screen_sx
inc eax ; inc eax
imul eax, ebx ; imul eax, ebx
mov eax, [d_width_calc_area + ebx*4]
add eax, [esp] add eax, [esp]
add eax, [_WinMapAddress] add eax, [_WinMapAddress]
mov ebp, eax mov ebp, eax

View File

@ -110,9 +110,11 @@ save_draw_mouse:
push eax push eax
push ebx push ebx
mov ecx, [Screen_Max_X] ; mov ecx, [Screen_Max_X]
inc ecx ; inc ecx
mul ecx ; mul ecx
mov eax, [d_width_calc_area + eax*4]
add eax, [_WinMapAddress] add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax] movzx edx, byte [ebx+eax]
shl edx, 8 shl edx, 8

View File

@ -1955,9 +1955,11 @@ restore_default_cursor_before_killing:
movzx eax, word [MOUSE_Y] movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X] movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X] ; mov ecx, [Screen_Max_X]
inc ecx ; inc ecx
mul ecx ; mul ecx
mov eax, [d_width_calc_area + eax*4]
add eax, [_WinMapAddress] add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax] movzx edx, byte [ebx+eax]
shl edx, 8 shl edx, 8
@ -3083,22 +3085,23 @@ modify_pce:
; check if pixel is allowed to be drawn ; check if pixel is allowed to be drawn
checkpixel: ;checkpixel:
push eax edx ; push eax edx
mov edx, [Screen_Max_X] ; screen x size ;; mov edx, [Screen_Max_X] ; screen x size
inc edx ;; inc edx
imul edx, ebx ;; imul edx, ebx
add eax, [_WinMapAddress] ; mov edx, [d_width_calc_area + ebx*4]
mov dl, [eax+edx]; lea eax, [...] ; add eax, [_WinMapAddress]
; mov dl, [eax+edx]; lea eax, [...]
xor ecx, ecx ; xor ecx, ecx
mov eax, [CURRENT_TASK] ; mov eax, [CURRENT_TASK]
cmp al, dl ; cmp al, dl
setne cl ; setne cl
pop edx eax ; pop edx eax
ret ; ret
iglobal iglobal
cpustring db 'CPU',0 cpustring db 'CPU',0
@ -4807,7 +4810,7 @@ paleholder:
align 4 align 4
calculate_fast_getting_offset_for_WinMapAddress: calculate_fast_getting_offset_for_WinMapAddress:
; calculate data area for fast getting offset to _WinMapAddress ; calculate data area for fast getting offset to _WinMapAddress
mov eax, [_display.width] xor eax, eax
mov ecx, [_display.height] mov ecx, [_display.height]
inc ecx inc ecx
mov edi, d_width_calc_area mov edi, d_width_calc_area

View File

@ -340,7 +340,9 @@ blit_32:
mov edi, ebp mov edi, ebp
imul edi, [_display.pitch] imul edi, [_display.pitch]
imul ebp, [_display.width] ; imul ebp, [_display.width]
mov ebp, [d_width_calc_area + ebp*4]
add ebp, ebx add ebp, ebx
add ebp, [_WinMapAddress] add ebp, [_WinMapAddress]

View File

@ -592,7 +592,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov esi, [hcursor] mov esi, [hcursor]
mov ecx, [x] mov ecx, [x]
mov eax, [y] mov eax, [y]
mov ebx, [BytesPerScanLine] ; mov ebx, [BytesPerScanLine]
xor edx, edx xor edx, edx
sub ecx, [esi+CURSOR.hot_x] sub ecx, [esi+CURSOR.hot_x]
@ -618,7 +618,10 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
sub edx, [y] sub edx, [y]
mov [_dy], edx mov [_dy], edx
mul dword [BytesPerScanLine] ; mul dword [BytesPerScanLine]
mov eax, [d_width_calc_area + eax*4]
lea eax, [eax + eax*2]
lea edx, [LFB_BASE+ecx*3] lea edx, [LFB_BASE+ecx*3]
add edx, eax add edx, eax
mov [cur_saved_base], edx mov [cur_saved_base], edx
@ -734,7 +737,10 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
sub edx, [y] sub edx, [y]
mov [_dy], edx mov [_dy], edx
mul dword [BytesPerScanLine] ; mul dword [BytesPerScanLine]
mov eax, [d_width_calc_area + eax*4]
shl eax, 2
lea edx, [LFB_BASE+eax+ecx*4] lea edx, [LFB_BASE+eax+ecx*4]
mov [cur_saved_base], edx mov [cur_saved_base], edx

View File

@ -61,7 +61,9 @@ Vesa20_getpixel24:
jnz @f jnz @f
.no_mouseunder: .no_mouseunder:
;-------------------------------------- ;--------------------------------------
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
lea ebx, [ebx + ebx*2]
lea edi, [eax+eax*2]; edi = x*3 lea edi, [eax+eax*2]; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier) add edi, ebx ; edi = x*3+(y*y multiplier)
mov ecx, [LFB_BASE+edi] mov ecx, [LFB_BASE+edi]
@ -82,7 +84,9 @@ Vesa20_getpixel32:
jnz @f jnz @f
.no_mouseunder: .no_mouseunder:
;-------------------------------------- ;--------------------------------------
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
shl ebx, 2
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov ecx, [LFB_BASE+edi] mov ecx, [LFB_BASE+edi]
;-------------------------------------- ;--------------------------------------
@ -218,16 +222,31 @@ align 4
mov esi, [putimg.pti] mov esi, [putimg.pti]
; pointer to screen ; pointer to screen
mov edx, [putimg.abs_cy] mov edx, [putimg.abs_cy]
imul edx, [BytesPerScanLine] ; 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 eax, [putimg.abs_cx] mov eax, [putimg.abs_cx]
movzx ebx, byte [ScreenBPP] ; movzx ebx, byte [ScreenBPP]
shr ebx, 3 ; shr ebx, 3
imul eax, ebx imul eax, ebx
add edx, eax add edx, eax
; pointer to pixel map ; pointer to pixel map
mov eax, [putimg.abs_cy] mov eax, [putimg.abs_cy]
imul eax, [Screen_Max_X] ; imul eax, [Screen_Max_X]
add eax, [putimg.abs_cy] ; add eax, [putimg.abs_cy]
mov eax, [d_width_calc_area + eax*4]
add eax, [putimg.abs_cx] add eax, [putimg.abs_cx]
add eax, [_WinMapAddress] add eax, [_WinMapAddress]
xchg eax, ebp xchg eax, ebp
@ -557,7 +576,6 @@ __sys_putpixel:
; not forced: ; not forced:
mov edx, [d_width_calc_area + ebx*4] mov edx, [d_width_calc_area + ebx*4]
sub edx, [_display.width]
add edx, [_WinMapAddress] add edx, [_WinMapAddress]
movzx edx, byte [eax+edx] movzx edx, byte [eax+edx]
cmp edx, [CURRENT_TASK] cmp edx, [CURRENT_TASK]
@ -595,7 +613,10 @@ Vesa20_putpixel24:
shl ecx, 16 shl ecx, 16
mov cx, bx mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
lea ebx, [ebx + ebx*2]
lea edi, [eax+eax*2]; edi = x*3 lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4] mov eax, [esp+32-8+4]
;-------------------------------------- ;--------------------------------------
@ -620,7 +641,10 @@ Vesa20_putpixel24_new:
shl ecx, 16 shl ecx, 16
mov cx, bx mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
lea ebx, [ebx + ebx*2]
lea edi, [eax+eax*2]; edi = x*3 lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4] mov eax, [esp+32-8+4]
;-------------------------------------- ;--------------------------------------
@ -662,7 +686,10 @@ Vesa20_putpixel32:
shl ecx, 16 shl ecx, 16
mov cx, bx mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
shl ebx, 2
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4]; eax = color mov eax, [esp+32-8+4]; eax = color
;-------------------------------------- ;--------------------------------------
@ -686,7 +713,10 @@ Vesa20_putpixel32_new:
shl ecx, 16 shl ecx, 16
mov cx, bx mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier ; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
shl ebx, 2
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4]; eax = color mov eax, [esp+32-8+4]; eax = color
;-------------------------------------- ;--------------------------------------
@ -721,9 +751,10 @@ align 4
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
calculate_edi: calculate_edi:
mov edi, ebx ; mov edi, ebx
imul edi, [Screen_Max_X] ; imul edi, [Screen_Max_X]
add edi, ebx ; add edi, ebx
mov edi, [d_width_calc_area + ebx*4]
add edi, eax add edi, eax
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
@ -1056,16 +1087,29 @@ align 4
mov [drbar.line_inc_scr], eax mov [drbar.line_inc_scr], eax
; pointer to screen ; pointer to screen
mov edx, [drbar.abs_cy] mov edx, [drbar.abs_cy]
imul edx, [BytesPerScanLine] ; 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 eax, [drbar.abs_cx] mov eax, [drbar.abs_cx]
; movzx ebx, byte [ScreenBPP]
; shr ebx, 3
imul eax, ebx imul eax, ebx
add edx, eax add edx, eax
; pointer to pixel map ; pointer to pixel map
mov eax, [drbar.abs_cy] mov eax, [drbar.abs_cy]
imul eax, [Screen_Max_X] ; imul eax, [Screen_Max_X]
add eax, [drbar.abs_cy] ; add eax, [drbar.abs_cy]
mov eax, [d_width_calc_area + eax*4]
add eax, [drbar.abs_cx] add eax, [drbar.abs_cx]
add eax, [_WinMapAddress] add eax, [_WinMapAddress]
xchg eax, ebp xchg eax, ebp
@ -1080,23 +1124,23 @@ align 4
add edx, LFB_BASE add edx, LFB_BASE
;-------------------------------------- ;--------------------------------------
; get process number ; get process number
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK] ; bl - process num
mov esi, [drbar.real_sy]
mov eax, [drbar.color] ; BBGGRR00
rol eax, 8
mov bh, al ; 0x80 drawing gradient bars
ror eax, 8
cmp byte [ScreenBPP], 24 cmp byte [ScreenBPP], 24
jne draw_bar_end_32 jne draw_bar_end_32
;-------------------------------------- ;--------------------------------------
align 4 align 4
draw_bar_end_24: draw_bar_end_24:
mov eax, [drbar.color] ;; BBGGRR00 ; eax - color high RRGGBB
mov bh, al ;; bh = BB
shr eax, 8 ;; eax = RRGG
; eax - color high RRGG
; bl - process num ; bl - process num
; bh - color low BB
; ecx - temp ; ecx - temp
; edx - pointer to screen ; edx - pointer to screen
; esi - counter ; esi - counter
; edi - counter ; edi - counter
mov esi, [drbar.real_sy]
cmp [_display.select_cursor], 0 cmp [_display.select_cursor], 0
jne draw_bar_end_24_new jne draw_bar_end_24_new
;-------------------------------------- ;--------------------------------------
@ -1109,23 +1153,19 @@ align 4
cmp byte [ebp], bl cmp byte [ebp], bl
jne .skip jne .skip
;-------------------------------------- ;--------------------------------------
push eax mov ecx, [drbar.real_sx_and_abs_cx]
mov ecx, [drbar.real_sx_and_abs_cx + 4]
sub ecx, edi sub ecx, edi
shl ecx, 16 shl ecx, 16
add ecx, [drbar.real_sy_and_abs_cy + 4] add ecx, [drbar.real_sy_and_abs_cy]
sub ecx, esi sub ecx, esi
shl eax, 8
mov al, bh
; check mouse area for putpixel ; check mouse area for putpixel
call check_mouse_area_for_putpixel call check_mouse_area_for_putpixel
; store to real LFB ; store to real LFB
mov [edx], ax mov [edx], ax
shr eax, 16 shr eax, 16
mov [edx + 2], al mov [edx + 2], al
pop eax mov eax, [drbar.color]
;-------------------------------------- ;--------------------------------------
align 4 align 4
.skip: .skip:
@ -1137,16 +1177,15 @@ align 4
; add line ; add line
add edx, [drbar.line_inc_scr] add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map] add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars ; drawing gradient bars
test eax, 0x00800000 test bh, 0x80
jz @f jz @f
test bh, bh test al, al
jz @f jz @f
dec bh dec al
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
; </Ivan 15.10.04>
dec esi dec esi
jnz .new_y jnz .new_y
;-------------------------------------- ;--------------------------------------
@ -1191,24 +1230,20 @@ align 4
jae .no_mouse_area jae .no_mouse_area
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel ; check mouse area for putpixel
push eax
shl eax, 8
mov al, bh
call check_mouse_area_for_putpixel_new.1 call check_mouse_area_for_putpixel_new.1
; store to real LFB
mov [edx], ax mov [edx], ax
shr eax, 16 shr eax, 16
mov [edx + 2], al mov [edx + 2], al
pop eax mov eax, [drbar.color]
jmp .skip jmp .skip
; store to real LFB ; store to real LFB
;-------------------------------------- ;--------------------------------------
align 4 align 4
.no_mouse_area: .no_mouse_area:
mov [edx], bh mov [edx], ax
mov [edx + 1], ax ror eax, 16
mov [edx + 2], al
rol eax, 16
;-------------------------------------- ;--------------------------------------
align 4 align 4
.skip: .skip:
@ -1220,24 +1255,27 @@ align 4
; add line ; add line
add edx, [drbar.line_inc_scr] add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map] add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars ; drawing gradient bars
test eax, 0x00800000 test bh, 0x80
jz @f jz @f
test bh, bh test al, al
jz @f jz @f
dec bh dec al
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
; </Ivan 15.10.04>
dec esi dec esi
jnz .new_y jnz .new_y
jmp draw_bar_end_24.end jmp draw_bar_end_24.end
;-------------------------------------- ;--------------------------------------
align 4 align 4
draw_bar_end_32: draw_bar_end_32:
mov eax, [drbar.color] ;; BBGGRR00 ; eax - color high RRGGBB
mov esi, [drbar.real_sy] ; bl - process num
; ecx - temp
; edx - pointer to screen
; esi - counter
; edi - counter
cmp [_display.select_cursor], 0 cmp [_display.select_cursor], 0
jne draw_bar_end_32_new jne draw_bar_end_32_new
;-------------------------------------- ;--------------------------------------
@ -1250,19 +1288,17 @@ align 4
cmp byte [ebp], bl cmp byte [ebp], bl
jne .skip jne .skip
;-------------------------------------- ;--------------------------------------
push eax mov ecx, [drbar.real_sx_and_abs_cx]
mov ecx, [drbar.real_sx_and_abs_cx + 4]
sub ecx, edi sub ecx, edi
shl ecx, 16 shl ecx, 16
add ecx, [drbar.real_sy_and_abs_cy + 4] add ecx, [drbar.real_sy_and_abs_cy]
sub ecx, esi sub ecx, esi
; check mouse area for putpixel ; check mouse area for putpixel
call check_mouse_area_for_putpixel call check_mouse_area_for_putpixel
; store to real LFB ; store to real LFB
mov [edx], eax mov [edx], eax
pop eax mov eax, [drbar.color]
;-------------------------------------- ;--------------------------------------
align 4 align 4
.skip: .skip:
@ -1274,8 +1310,8 @@ align 4
; add line ; add line
add edx, [drbar.line_inc_scr] add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map] add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars ; drawing gradient bars
test eax, 0x80000000 test bh, 0x80
jz @f jz @f
test al, al test al, al
jz @f jz @f
@ -1283,7 +1319,6 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
; </Ivan 15.10.04>
dec esi dec esi
jnz .new_y jnz .new_y
;-------------------------------------- ;--------------------------------------
@ -1335,10 +1370,9 @@ align 4
jae .no_mouse_area jae .no_mouse_area
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel ; check mouse area for putpixel
push eax
call check_mouse_area_for_putpixel_new.1 call check_mouse_area_for_putpixel_new.1
mov [edx], eax mov [edx], eax
pop eax mov eax, [drbar.color]
jmp .skip jmp .skip
; store to real LFB ; store to real LFB
;-------------------------------------- ;--------------------------------------
@ -1356,8 +1390,8 @@ align 4
; add line ; add line
add edx, [drbar.line_inc_scr] add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map] add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars ; drawing gradient bars
test eax, 0x80000000 test bh, 0x80
jz @f jz @f
test al, al test al, al
jz @f jz @f
@ -1365,7 +1399,6 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
; </Ivan 15.10.04>
dec esi dec esi
jnz .new_y jnz .new_y
jmp draw_bar_end_32.end jmp draw_bar_end_32.end
@ -1381,8 +1414,20 @@ dp2:
mov ebp, [draw_data+32+RECT.left] ; x start mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi] ; and LFB data (output for our function) [edi]
mov eax, [BytesPerScanLine] ; mov eax, [BytesPerScanLine]
mul ebx ; 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
@@:
xchg ebp, eax xchg ebp, eax
add ebp, eax add ebp, eax
add ebp, eax add ebp, eax
@ -1514,8 +1559,21 @@ vesa20_drawbackground_stretch:
mov ebp, [draw_data+32+RECT.left] ; x start mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi] ; and LFB data (output for our function) [edi]
mov eax, [BytesPerScanLine] ; mov eax, [BytesPerScanLine]
mul ebx ; 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
@@:
xchg ebp, eax xchg ebp, eax
add ebp, eax add ebp, eax
add ebp, eax add ebp, eax