kernel: combine display related data in one structure

git-svn-id: svn://kolibrios.org@5351 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2015-01-05 17:59:03 +00:00
parent 5c0b9990c8
commit ff063f54ce
11 changed files with 97 additions and 82 deletions

View File

@ -26,16 +26,26 @@ CURRENT_API = 0x0200
COMPATIBLE_API = 0x0100
API_VERSION = (COMPATIBLE_API shl 16) + CURRENT_API
struct RWSEM
wait_list LHEAD
count dd ?
ends
; Some structures
struct display_t
x dd ?
y dd ?
width dd ?
height dd ?
bpp dd ?
bits_per_pixel dd ?
vrefresh dd ?
pitch dd ?
lfb dd ?
lfb_pitch dd ?
win_map_lock RWSEM
win_map dd ?
win_map_pitch dd ?
win_map_size dd ?
modes dd ?
ddev dd ?
@ -56,6 +66,8 @@ struct display_t
mask_seqno dd ?
check_mouse dd ?
check_m_pixel dd ?
bytes_per_pixel dd ?
ends
struct APPOBJ ; common object header

View File

@ -425,38 +425,6 @@ struct HDLL
parent dd ? ;DLLDESCR
ends
struct display_t
x dd ?
y dd ?
width dd ?
height dd ?
bits_per_pixel dd ?
vrefresh dd ?
pitch dd ?
lfb dd ?
modes dd ?
ddev dd ?
connector dd ?
crtc dd ?
cr_list.next dd ?
cr_list.prev dd ?
cursor dd ?
init_cursor dd ?
select_cursor dd ?
show_cursor dd ?
move_cursor dd ?
restore_cursor dd ?
disable_mouse dd ?
mask_seqno dd ?
check_mouse dd ?
check_m_pixel dd ?
bytes_per_pixel dd ?
ends
struct BOOT_DATA
bpp dd ?
@ -506,6 +474,45 @@ struct RWSEM
count dd ?
ends
struct display_t
x dd ?
y dd ?
width dd ?
height dd ?
bits_per_pixel dd ?
vrefresh dd ?
lfb dd ?
lfb_pitch dd ?
win_map_lock RWSEM
win_map dd ?
win_map_pitch dd ?
win_map_size dd ?
modes dd ?
ddev dd ?
connector dd ?
crtc dd ?
cr_list.next dd ?
cr_list.prev dd ?
cursor dd ?
init_cursor dd ?
select_cursor dd ?
show_cursor dd ?
move_cursor dd ?
restore_cursor dd ?
disable_mouse dd ?
mask_seqno dd ?
check_mouse dd ?
check_m_pixel dd ?
bytes_per_pixel dd ?
ends
struct PCIDEV
bk dd ?
fd dd ?

View File

@ -842,7 +842,7 @@ proc mtrr_validate
; It must be write-combined.
test word [SCR_MODE], 0x4000
jz .exit
mov eax, [_display.pitch]
mov eax, [_display.lfb_pitch]
mul [_display.height]
dec eax
; LFB is mapped to virtual address LFB_BASE,

View File

@ -375,8 +375,6 @@ align 16
_display display_t
_WinMapAddress rd 1
_WinMapSize rd 1
LFBAddress dd ?
@ -423,8 +421,6 @@ cur_saved_base rd 1
cur.lock rd 1 ;1 - lock update, 2- hide
cur.left rd 1 ;cursor clip box
cur.top rd 1
;cur.right rd 1
;cur.bottom rd 1
cur.w rd 1
cur.h rd 1

View File

@ -526,7 +526,7 @@ mouse._.find_sys_window_under_cursor: ;////////////////////////////////////////
mov esi, [mouse.state.pos.y]
mov esi, [d_width_calc_area + esi*4]
add esi, [_WinMapAddress]
add esi, [_display.win_map]
add esi, [mouse.state.pos.x]
movzx esi, byte[esi]
mov edi, esi

View File

@ -1893,7 +1893,7 @@ align 4
mov edi, [d_width_calc_area + ebx*4]
add edi, eax
add edi, [_WinMapAddress]
add edi, [_display.win_map]
pop eax
mov ah, al
push ax
@ -1935,7 +1935,7 @@ align 4
mov eax, [d_width_calc_area + ebx*4]
add eax, [esp]
add eax, [_WinMapAddress]
add eax, [_display.win_map]
mov ebp, eax
mov edi, [edi + APPDATA.wnd_shape]

View File

@ -115,7 +115,7 @@ save_draw_mouse:
; mul ecx
mov eax, [d_width_calc_area + eax*4]
add eax, [_WinMapAddress]
add eax, [_display.win_map]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]

View File

@ -461,10 +461,10 @@ high_code:
je @f
movzx eax, word[BOOT_VARS+BOOT_PITCH] ; for other modes
@@:
mov [_display.pitch], eax
mov [_display.lfb_pitch], eax
mov eax, [_display.width]
mul [_display.height]
mov [_WinMapSize], eax
mov [_display.win_map_size], eax
call calculate_fast_getting_offset_for_WinMapAddress
; for Qemu or non standart video cards
@ -659,8 +659,8 @@ setvideomode:
mov [graph_data_l+4], al
mov [graph_data_l+7], ah
stdcall kernel_alloc, [_WinMapSize]
mov [_WinMapAddress], eax
stdcall kernel_alloc, [_display.win_map_size]
mov [_display.win_map], eax
xor eax, eax
inc eax
@ -2112,7 +2112,7 @@ restore_default_cursor_before_killing:
movzx ebx, word [MOUSE_X]
mov eax, [d_width_calc_area + eax*4]
add eax, [_WinMapAddress]
add eax, [_display.win_map]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
@ -2539,7 +2539,7 @@ sysfn_set_screen_sizes:
pushfd
cli
mov eax, ecx
mov ecx, [_display.pitch]
mov ecx, [_display.lfb_pitch]
mov [_display.width], eax
dec eax
mov [_display.height], edx
@ -3823,7 +3823,7 @@ align 4
.start_x:
add eax, ecx
mov ebp, [d_width_calc_area + ebx*4]
add ebp, [_WinMapAddress]
add ebp, [_display.win_map]
movzx ebp, byte[eax+ebp] ; get value for current point
cmp ebp, edi
jne @f
@ -3868,9 +3868,9 @@ not_this_task:
;-----------------------------------------------------------------------------
align 4
calculatebackground: ; background
mov edi, [_WinMapAddress] ; set os to use all pixels
mov edi, [_display.win_map] ; set os to use all pixels
mov eax, 0x01010101
mov ecx, [_WinMapSize]
mov ecx, [_display.win_map_size]
shr ecx, 2
rep stosd
@ -5026,7 +5026,7 @@ sys_gs: ; direct screen access
mov [esp+32], eax
ret
.3: ; bytes per scanline
mov eax, [_display.pitch]
mov eax, [_display.lfb_pitch]
mov [esp+32], eax
ret
@ -5193,7 +5193,7 @@ syscall_getpixel_WinMap: ; GetPixel WinMap
align 4
@@:
mov eax, [d_width_calc_area + ecx*4]
add eax, [_WinMapAddress]
add eax, [_display.win_map]
movzx eax, byte[eax+ebx] ; get value for current point
;--------------------------------------
align 4
@ -5332,7 +5332,7 @@ align 4
pushad
mov edx, [d_width_calc_area + ebx*4]
add edx, [_WinMapAddress]
add edx, [_display.win_map]
movzx edx, byte [eax+edx]
cmp dl, byte 1
jne @f
@ -5433,7 +5433,7 @@ calculate_fast_getting_offset_for_LFB:
cld
@@:
stosd
add eax, [_display.pitch]
add eax, [_display.lfb_pitch]
dec ecx
jnz @r
ret
@ -5448,7 +5448,7 @@ set_screen:
pushfd
cli
mov [_display.pitch], ecx
mov [_display.lfb_pitch], ecx
mov [screen_workarea.right], eax
mov [screen_workarea.bottom], edx
@ -5462,14 +5462,14 @@ set_screen:
cmp [do_not_touch_winmap], 1
je @f
stdcall kernel_free, [_WinMapAddress]
stdcall kernel_free, [_display.win_map]
mov eax, [_display.width]
mul [_display.height]
mov [_WinMapSize], eax
mov [_display.win_map_size], eax
stdcall kernel_alloc, eax
mov [_WinMapAddress], eax
mov [_display.win_map], eax
test eax, eax
jz .epic_fail
; store for f.18.24

View File

@ -282,7 +282,7 @@ end virtual
mov ebp, [d_width_calc_area+ebp*4]
add ebp, ebx
add ebp, [_WinMapAddress]
add ebp, [_display.win_map]
mov eax, [esp+BLITTER.src_y]
imul eax, [esp+BLITTER.stride]
@ -341,7 +341,7 @@ align 4
jnz .inner32
add esi, [esp+BLITTER.stride]
add edi, [_display.pitch]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
@ -375,7 +375,7 @@ align 4
jnz .hw.inner32
add esi, [esp+BLITTER.stride]
add edi, [_display.pitch]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
@ -452,7 +452,7 @@ align 4
add esi, [esp+BLITTER.stride]
mov edi, [esp+.extra_var1]
add edi, [_display.pitch]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
@ -514,7 +514,7 @@ align 4
add esi, [esp+BLITTER.stride]
mov edi, [esp+.extra_var1]
add edi, [_display.pitch]
add edi, [_display.lfb_pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]

View File

@ -528,7 +528,7 @@ proc restore_24 stdcall, x:dword, y:dword
align 4
@@:
mov edi, ebx
add ebx, [_display.pitch]
add ebx, [_display.lfb_pitch]
mov ecx, [esp]
rep movsb
@ -563,7 +563,7 @@ proc restore_32 stdcall, x:dword, y:dword
align 4
@@:
mov edi, ebx
add ebx, [_display.pitch]
add ebx, [_display.lfb_pitch]
mov ecx, [cur.w]
rep movsd
@ -597,7 +597,7 @@ proc restore_16 stdcall, x:dword, y:dword
align 4
@@:
mov edi, ebx
add ebx, [_display.pitch]
add ebx, [_display.lfb_pitch]
mov ecx, [cur.w]
rep movsw
@ -684,7 +684,7 @@ align 4
align 4
@@:
mov esi, edx
add edx, [_display.pitch]
add edx, [_display.lfb_pitch]
mov ecx, [cur.w]
lea ecx, [ecx+ecx*2]
rep movsb
@ -707,7 +707,7 @@ align 4
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [_display.pitch]
add ebx, [_display.lfb_pitch]
;--------------------------------------
align 4
.pix:
@ -797,7 +797,7 @@ align 4
align 4
@@:
mov esi, edx
add edx, [_display.pitch]
add edx, [_display.lfb_pitch]
mov ecx, [cur.w]
rep movsd
dec eax
@ -819,7 +819,7 @@ align 4
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [_display.pitch]
add ebx, [_display.lfb_pitch]
;--------------------------------------
align 4
.pix:
@ -907,7 +907,7 @@ align 4
align 4
@@:
mov esi, edx
add edx, [_display.pitch]
add edx, [_display.lfb_pitch]
mov ecx, [cur.w]
rep movsw
@ -930,7 +930,7 @@ align 4
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [_display.pitch]
add ebx, [_display.lfb_pitch]
;--------------------------------------
align 4
.pix:

View File

@ -240,7 +240,7 @@ end virtual
sub eax, [putimg.real_sx]
mov [putimg.winmap_newline], eax
; screen new line increment
mov eax, [_display.pitch]
mov eax, [_display.lfb_pitch]
mov ebx, [_display.bytes_per_pixel]
imul ecx, ebx
sub eax, ecx
@ -261,7 +261,7 @@ end virtual
mov eax, [d_width_calc_area + eax*4]
add eax, [putimg.abs_cx]
add eax, [_WinMapAddress]
add eax, [_display.win_map]
xchg eax, ebp
mov ecx, [putimg.real_sx]
@ -884,7 +884,7 @@ __sys_putpixel:
; not forced
mov edx, [d_width_calc_area + ebx*4]
add edx, [_WinMapAddress]
add edx, [_display.win_map]
movzx edx, byte [eax+edx]
cmp edx, [CURRENT_TASK]
jne .exit
@ -1448,7 +1448,7 @@ end virtual
mov ebx, [_display.bytes_per_pixel]
imul eax, ebx
neg eax
add eax, [_display.pitch]
add eax, [_display.lfb_pitch]
mov [drbar.line_inc_scr], eax
; pointer to screen
mov edx, [drbar.abs_cy]
@ -1464,7 +1464,7 @@ end virtual
mov eax, [d_width_calc_area + eax*4]
add eax, [drbar.abs_cx]
add eax, [_WinMapAddress]
add eax, [_display.win_map]
xchg eax, ebp
mov ebx, [drbar.real_sx]
@ -2034,7 +2034,7 @@ vesa20_drawbackground_tiled:
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
xchg edi, ebp
add ebp, [_WinMapAddress]
add ebp, [_display.win_map]
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
; 2) Calculate offset in background memory block
push eax
@ -2256,7 +2256,7 @@ vesa20_drawbackground_stretch:
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
sdp3a:
mov eax, [_WinMapAddress]
mov eax, [_display.win_map]
cmp [ebp+eax], byte 1
jnz snbgp
mov eax, [bgr_cur_line+esi]
@ -2332,7 +2332,7 @@ vesa20_drawbackground_stretch:
sub edi, eax
@@:
add edi, [_display.pitch]
add edi, [_display.lfb_pitch]
; restore ecx,edx; advance esi to next background line
mov eax, [esp+28]
mov ebx, [esp+32]