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
;< edi = pointer to WDATA struct
;------------------------------------------------------------------------------
mov esi, [Screen_Max_X]
inc esi
imul esi, [mouse.state.pos.y]
; mov esi, [Screen_Max_X]
; inc esi
; 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, [mouse.state.pos.x]
movzx esi, byte[esi]

View File

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

View File

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

View File

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

View File

@ -340,7 +340,9 @@ blit_32:
mov edi, ebp
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, [_WinMapAddress]

View File

@ -592,7 +592,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov esi, [hcursor]
mov ecx, [x]
mov eax, [y]
mov ebx, [BytesPerScanLine]
; mov ebx, [BytesPerScanLine]
xor edx, edx
sub ecx, [esi+CURSOR.hot_x]
@ -618,7 +618,10 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
sub edx, [y]
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]
add edx, eax
mov [cur_saved_base], edx
@ -734,7 +737,10 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
sub edx, [y]
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]
mov [cur_saved_base], edx

View File

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