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

View File

@ -425,38 +425,6 @@ struct HDLL
parent dd ? ;DLLDESCR parent dd ? ;DLLDESCR
ends 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 struct BOOT_DATA
bpp dd ? bpp dd ?
@ -506,6 +474,45 @@ struct RWSEM
count dd ? count dd ?
ends 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 struct PCIDEV
bk dd ? bk dd ?
fd dd ? fd dd ?

View File

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

View File

@ -375,8 +375,6 @@ align 16
_display display_t _display display_t
_WinMapAddress rd 1
_WinMapSize rd 1
LFBAddress dd ? LFBAddress dd ?
@ -423,8 +421,6 @@ cur_saved_base rd 1
cur.lock rd 1 ;1 - lock update, 2- hide cur.lock rd 1 ;1 - lock update, 2- hide
cur.left rd 1 ;cursor clip box cur.left rd 1 ;cursor clip box
cur.top rd 1 cur.top rd 1
;cur.right rd 1
;cur.bottom rd 1
cur.w rd 1 cur.w rd 1
cur.h 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, [mouse.state.pos.y]
mov esi, [d_width_calc_area + esi*4] mov esi, [d_width_calc_area + esi*4]
add esi, [_WinMapAddress] add esi, [_display.win_map]
add esi, [mouse.state.pos.x] add esi, [mouse.state.pos.x]
movzx esi, byte[esi] movzx esi, byte[esi]
mov edi, esi mov edi, esi

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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