mirror of https://github.com/red-prig/fpPS4.git
This commit is contained in:
parent
72cde2c713
commit
c5ee23c565
|
@ -842,6 +842,10 @@
|
||||||
<Filename Value="sys\vfs\vuio.pas"/>
|
<Filename Value="sys\vfs\vuio.pas"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
</Unit>
|
</Unit>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="sys\dev\display_interface.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit>
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
|
|
|
@ -6,15 +6,24 @@ unit dev_dce;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
sysutils,
|
||||||
vm,
|
vm,
|
||||||
vmparam,
|
vmparam,
|
||||||
kern_conf,
|
kern_conf,
|
||||||
sys_event,
|
sys_event,
|
||||||
time;
|
time,
|
||||||
|
kern_mtx,
|
||||||
|
display_interface;
|
||||||
|
|
||||||
procedure dce_initialize();
|
procedure dce_initialize();
|
||||||
|
|
||||||
var
|
var
|
||||||
|
dce_interface:TAbstractDisplay=TDisplayInterface;
|
||||||
|
|
||||||
|
dce_handle:TDisplayHandle;
|
||||||
|
|
||||||
|
dce_mtx:mtx;
|
||||||
|
|
||||||
dce_page:Pointer;
|
dce_page:Pointer;
|
||||||
|
|
||||||
g_video_out_event_flip:t_knlist;
|
g_video_out_event_flip:t_knlist;
|
||||||
|
@ -29,14 +38,19 @@ uses
|
||||||
sys_vm_object,
|
sys_vm_object,
|
||||||
vm_pager,
|
vm_pager,
|
||||||
kern_event,
|
kern_event,
|
||||||
kern_mtx,
|
|
||||||
md_time,
|
md_time,
|
||||||
kern_proc,
|
kern_proc,
|
||||||
kern_timeout;
|
kern_timeout;
|
||||||
|
|
||||||
const
|
const
|
||||||
EVENTID_FLIP =$0006;
|
EVENTID_FLIP =$0006;
|
||||||
EVENTID_VBLANK=$0007;
|
EVENTID_VBLANK =$0007;
|
||||||
|
EVENTID_SETMODE =$0051;
|
||||||
|
EVENTID_POSITION =$0058;
|
||||||
|
EVENTID_PREVBLANK=$0059;
|
||||||
|
|
||||||
|
//$0062 wZI4fmUJMlw / vXMpe7Murfc
|
||||||
|
//$0063 sys_vblank
|
||||||
|
|
||||||
procedure knote_eventid(event_id:WORD;flipArg:QWORD;lockflags:Integer);
|
procedure knote_eventid(event_id:WORD;flipArg:QWORD;lockflags:Integer);
|
||||||
begin
|
begin
|
||||||
|
@ -139,7 +153,7 @@ type
|
||||||
flipPendingNum0:DWORD;
|
flipPendingNum0:DWORD;
|
||||||
gcQueueNum :DWORD;
|
gcQueueNum :DWORD;
|
||||||
flipPendingNum1:DWORD;
|
flipPendingNum1:DWORD;
|
||||||
submitTsc :DWORD;
|
submitTsc :QWORD;
|
||||||
f_0x40 :QWORD;
|
f_0x40 :QWORD;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -291,8 +305,11 @@ var
|
||||||
poff:PQWORD;
|
poff:PQWORD;
|
||||||
plen:PQWORD;
|
plen:PQWORD;
|
||||||
len:QWORD;
|
len:QWORD;
|
||||||
resl_status:t_resolution_status;
|
u:record
|
||||||
flip_status:t_flip_status;
|
case byte of
|
||||||
|
0:(r_status:t_resolution_status);
|
||||||
|
1:(f_status:t_flip_status);
|
||||||
|
end;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
|
|
||||||
|
@ -304,10 +321,37 @@ begin
|
||||||
if (data^.arg6=0) and (data^.arg2=0) then
|
if (data^.arg6=0) and (data^.arg2=0) then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
//arg3 [0..1]
|
||||||
|
case Integer(data^.arg3) of
|
||||||
|
0:;
|
||||||
|
1:begin
|
||||||
|
//sceSblACMgrIsSystemUcred
|
||||||
|
Exit(EPERM);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Exit(EINVAL);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
dce_handle:=dce_interface.Open;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Result:=EBUSY;
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
if (Result<>0) then Exit;
|
||||||
|
|
||||||
Writeln('dce_video_open');
|
Writeln('dce_video_open');
|
||||||
|
|
||||||
ptr:=Pointer(data^.arg5);
|
ptr:=Pointer(data^.arg5);
|
||||||
len:=111; //canary
|
len:=$a5a5; //canary
|
||||||
copyout(@len,ptr,SizeOf(QWORD));
|
copyout(@len,ptr,SizeOf(QWORD));
|
||||||
|
|
||||||
open_vblank;
|
open_vblank;
|
||||||
|
@ -324,6 +368,22 @@ begin
|
||||||
begin
|
begin
|
||||||
//arg2 -> canary
|
//arg2 -> canary
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
FreeAndNil(dce_handle);
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
if (Result<>0) then Exit;
|
||||||
|
|
||||||
Writeln('dce_video_close:',data^.arg2);
|
Writeln('dce_video_close:',data^.arg2);
|
||||||
|
|
||||||
close_vblank;
|
close_vblank;
|
||||||
|
@ -340,6 +400,24 @@ begin
|
||||||
//arg2 -> canary
|
//arg2 -> canary
|
||||||
//arg3 -> fid
|
//arg3 -> fid
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
|
if (Integer(data^.arg3)>15) then Exit(EINVAL);
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Result:=dce_handle.UnregisterBuffer(Integer(data^.arg3));
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
if (Result<>0) then Exit;
|
||||||
|
|
||||||
Writeln('UnregisterBufferAttribute:',data^.arg2,' ',data^.arg3);
|
Writeln('UnregisterBufferAttribute:',data^.arg2,' ',data^.arg3);
|
||||||
|
|
||||||
Exit(0);
|
Exit(0);
|
||||||
|
@ -354,6 +432,22 @@ begin
|
||||||
//arg2 -> canary
|
//arg2 -> canary
|
||||||
//arg3 -> rate
|
//arg3 -> rate
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Result:=dce_handle.SetFlipRate(Integer(data^.arg3));
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
if (Result<>0) then Exit;
|
||||||
|
|
||||||
Writeln('SetFlipRate:',data^.arg2,' ',data^.arg3);
|
Writeln('SetFlipRate:',data^.arg2,' ',data^.arg3);
|
||||||
|
|
||||||
Exit(0);
|
Exit(0);
|
||||||
|
@ -367,6 +461,8 @@ begin
|
||||||
begin
|
begin
|
||||||
//arg2 -> canary
|
//arg2 -> canary
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
poff:=Pointer(data^.arg3); //output offset //4000..3FFC000
|
poff:=Pointer(data^.arg3); //output offset //4000..3FFC000
|
||||||
plen:=Pointer(data^.arg4); //output len //4000
|
plen:=Pointer(data^.arg4); //output len //4000
|
||||||
|
|
||||||
|
@ -392,20 +488,42 @@ begin
|
||||||
//arg3 = &result;
|
//arg3 = &result;
|
||||||
//arg4 = 72
|
//arg4 = 72
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
ptr:=Pointer(data^.arg3);
|
ptr:=Pointer(data^.arg3);
|
||||||
|
|
||||||
flip_status:=Default(t_flip_status);
|
len:=Integer(data^.arg4);
|
||||||
flip_status.flipArg :=flipArg;
|
if (len>SizeOf(t_flip_status)) then
|
||||||
flip_status.count :=0;
|
begin
|
||||||
flip_status.processTime :=0;
|
len:=SizeOf(t_flip_status);
|
||||||
flip_status.tsc :=0;
|
end;
|
||||||
flip_status.currentBuffer :=0;
|
|
||||||
flip_status.flipPendingNum0:=0;
|
|
||||||
flip_status.gcQueueNum :=0;
|
|
||||||
flip_status.flipPendingNum1:=0;
|
|
||||||
flip_status.submitTsc :=0;
|
|
||||||
|
|
||||||
Result:=copyout(@flip_status,ptr,data^.arg4);
|
u.f_status:=Default(t_flip_status);
|
||||||
|
u.f_status.flipArg :=flipArg;
|
||||||
|
u.f_status.count :=0;
|
||||||
|
u.f_status.processTime :=0;
|
||||||
|
u.f_status.tsc :=0;
|
||||||
|
u.f_status.currentBuffer :=0;
|
||||||
|
u.f_status.flipPendingNum0:=0;
|
||||||
|
u.f_status.gcQueueNum :=0;
|
||||||
|
u.f_status.flipPendingNum1:=0;
|
||||||
|
u.f_status.submitTsc :=0;
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Result:=dce_handle.GetFlipStatus(@u.f_status);
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
if (Result<>0) then Exit;
|
||||||
|
|
||||||
|
Result:=copyout(@u.f_status,ptr,len);
|
||||||
|
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
@ -423,6 +541,8 @@ begin
|
||||||
//arg3 -> ptr
|
//arg3 -> ptr
|
||||||
//arg4 -> 64
|
//arg4 -> 64
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
ptr:=Pointer(data^.arg3);
|
ptr:=Pointer(data^.arg3);
|
||||||
|
|
||||||
len:=0;
|
len:=0;
|
||||||
|
@ -446,17 +566,39 @@ begin
|
||||||
//arg3 = &result;
|
//arg3 = &result;
|
||||||
//arg4 = 44;
|
//arg4 = 44;
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
ptr:=Pointer(data^.arg3);
|
ptr:=Pointer(data^.arg3);
|
||||||
|
|
||||||
resl_status:=Default(t_resolution_status);
|
len:=Integer(data^.arg4);
|
||||||
resl_status.width :=1920;
|
if (len>SizeOf(t_resolution_status)) then
|
||||||
resl_status.heigth :=1080;
|
begin
|
||||||
resl_status.paneWidth :=1920;
|
len:=SizeOf(t_resolution_status);
|
||||||
resl_status.paneHeight :=1080;
|
end;
|
||||||
resl_status.refreshHz :=$426fc28f;
|
|
||||||
resl_status.screenSizeInInch:=32;
|
|
||||||
|
|
||||||
Result:=copyout(@resl_status,ptr,data^.arg4);
|
u.r_status:=Default(t_resolution_status);
|
||||||
|
u.r_status.width :=1920;
|
||||||
|
u.r_status.heigth :=1080;
|
||||||
|
u.r_status.paneWidth :=1920;
|
||||||
|
u.r_status.paneHeight :=1080;
|
||||||
|
u.r_status.refreshHz :=$426fc28f;
|
||||||
|
u.r_status.screenSizeInInch:=32;
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Result:=dce_handle.GetResolutionStatus(@u.r_status);
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
if (Result<>0) then Exit;
|
||||||
|
|
||||||
|
Result:=copyout(@u.r_status,ptr,len);
|
||||||
|
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
@ -469,17 +611,22 @@ begin
|
||||||
begin
|
begin
|
||||||
//arg2 -> canary
|
//arg2 -> canary
|
||||||
//arg4 = 80;
|
//arg4 = 80;
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
Result:=dce_set_cursor_info(dev,data^.arg2,data^.arg5,Pointer(data^.arg3));
|
Result:=dce_set_cursor_info(dev,data^.arg2,data^.arg5,Pointer(data^.arg3));
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
Exit(EINVAL);
|
Exit(EINVAL);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
31: //set vaddr
|
31: //sys
|
||||||
begin
|
begin
|
||||||
//arg2 -> canary
|
//arg2 -> canary
|
||||||
//arg3 <- subtype 0..13
|
//arg3 <- subtype 0..13
|
||||||
|
|
||||||
|
if (data^.arg2<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
if (data^.arg3>13) then Exit(EINVAL);
|
if (data^.arg3>13) then Exit(EINVAL);
|
||||||
|
|
||||||
Writeln('dce_flip_control(',data^.id,'):',data^.arg3,' 0x',HexStr(data^.arg4,16));
|
Writeln('dce_flip_control(',data^.id,'):',data^.arg3,' 0x',HexStr(data^.arg4,16));
|
||||||
|
@ -500,7 +647,7 @@ type
|
||||||
p_register_buffer_attr_args=^t_register_buffer_attr_args;
|
p_register_buffer_attr_args=^t_register_buffer_attr_args;
|
||||||
t_register_buffer_attr_args=packed record
|
t_register_buffer_attr_args=packed record
|
||||||
canary :QWORD; //arg5 data in dce_flip_control:0:pointer(arg5)^
|
canary :QWORD; //arg5 data in dce_flip_control:0:pointer(arg5)^
|
||||||
vid :Byte; //video output port id ?
|
attrid :Byte; //attribute id [0..3]
|
||||||
submit :Byte; //0 = RegisterBuffers ; 1 = SubmitChangeBufferAttribute
|
submit :Byte; //0 = RegisterBuffers ; 1 = SubmitChangeBufferAttribute
|
||||||
f_0xa :WORD;
|
f_0xa :WORD;
|
||||||
pixelFormat:DWORD;
|
pixelFormat:DWORD;
|
||||||
|
@ -519,7 +666,28 @@ Function dce_register_buffer_attr(dev:p_cdev;data:p_register_buffer_attr_args):I
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
|
|
||||||
Writeln('register_buffer_attr:',data^.vid,' ',
|
if (data^.canary<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
|
if (data^.attrid>3) then Exit(EINVAL);
|
||||||
|
if (data^.submit>1) then Exit(EINVAL);
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
case data^.submit of
|
||||||
|
0:Result:=dce_handle.RegisterBufferAttribute(data^.attrid,@data^.pixelFormat);
|
||||||
|
1:Result:=dce_handle.SubmitBufferAttribute (data^.attrid,@data^.pixelFormat);
|
||||||
|
else;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
Writeln('register_buffer_attr:',data^.attrid,' ',
|
||||||
data^.submit,' ',
|
data^.submit,' ',
|
||||||
'0x',HexStr(data^.pixelFormat,8),' ',
|
'0x',HexStr(data^.pixelFormat,8),' ',
|
||||||
data^.tilingMode,' ',
|
data^.tilingMode,' ',
|
||||||
|
@ -534,17 +702,35 @@ type
|
||||||
p_register_buffer_ptrs=^t_register_buffer_ptrs;
|
p_register_buffer_ptrs=^t_register_buffer_ptrs;
|
||||||
t_register_buffer_ptrs=packed record
|
t_register_buffer_ptrs=packed record
|
||||||
canary:QWORD; //arg5 data in dce_flip_control:0:pointer(arg5)^
|
canary:QWORD; //arg5 data in dce_flip_control:0:pointer(arg5)^
|
||||||
index :DWORD; //buffer index
|
index :DWORD; //buffer index [0..15]
|
||||||
vid :DWORD; //video output port id ?
|
attrid:DWORD; //attribute id [0..3]
|
||||||
left :Pointer; //buffer ptr
|
left :Pointer; //buffer ptr
|
||||||
right :Pointer; //Stereo ptr
|
right :Pointer; //Stereo ptr
|
||||||
|
unk :Integer;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function dce_register_buffer_ptrs(dev:p_cdev;data:p_register_buffer_ptrs):Integer;
|
Function dce_register_buffer_ptrs(dev:p_cdev;data:p_register_buffer_ptrs):Integer;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
|
|
||||||
Writeln('register_buffer_ptrs:',data^.vid,' ',
|
if (data^.canary<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
|
if (data^.index>15) then Exit(EINVAL);
|
||||||
|
if (data^.attrid>3) then Exit(EINVAL);
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Result:=dce_handle.RegisterBuffer(@data^.index);
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
|
Writeln('register_buffer_ptrs:',data^.attrid,' ',
|
||||||
data^.index,' ',
|
data^.index,' ',
|
||||||
'0x',HexStr(data^.left),' ',
|
'0x',HexStr(data^.left),' ',
|
||||||
'0x',HexStr(data^.right));
|
'0x',HexStr(data^.right));
|
||||||
|
@ -553,8 +739,8 @@ end;
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
p_submit_flip=^t_submit_flip;
|
p_submit_flip_args=^t_submit_flip_args;
|
||||||
t_submit_flip=packed record
|
t_submit_flip_args=packed record
|
||||||
canary :QWORD; //arg5 data in dce_flip_control:0:pointer(arg5)^
|
canary :QWORD; //arg5 data in dce_flip_control:0:pointer(arg5)^
|
||||||
bufferIndex:QWORD;
|
bufferIndex:QWORD;
|
||||||
flipMode :DWORD;
|
flipMode :DWORD;
|
||||||
|
@ -563,22 +749,53 @@ type
|
||||||
flipArg2 :QWORD;
|
flipArg2 :QWORD;
|
||||||
eop_nz :DWORD;
|
eop_nz :DWORD;
|
||||||
f_0x2c :DWORD;
|
f_0x2c :DWORD;
|
||||||
eop_val :DWORD;
|
eop_val :PQWORD;
|
||||||
f_0x34 :DWORD;
|
|
||||||
f_0x38 :QWORD;
|
f_0x38 :QWORD;
|
||||||
rout :PQWORD; //extraout of result
|
rout :PQWORD; //extraout of result
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function dce_submit_flip(dev:p_cdev;data:p_submit_flip):Integer;
|
Function dce_submit_flip(dev:p_cdev;data:p_submit_flip_args):Integer;
|
||||||
var
|
var
|
||||||
|
submit:t_submit_flip;
|
||||||
|
eop_val:PQWORD;
|
||||||
ures:QWORD;
|
ures:QWORD;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
|
|
||||||
|
if (data^.canary<>$a5a5) then Exit(EINVAL);
|
||||||
|
|
||||||
|
if (data^.bufferIndex>15) then Exit(EINVAL);
|
||||||
|
if (data^.eop_nz>1) then Exit(EINVAL);
|
||||||
|
|
||||||
|
submit.bufferIndex:=data^.bufferIndex;
|
||||||
|
submit.flipMode :=data^.flipMode;
|
||||||
|
submit.flipArg :=data^.flipArg;
|
||||||
|
submit.flipArg2 :=data^.flipArg2;
|
||||||
|
|
||||||
|
if (data^.eop_nz=1) then
|
||||||
|
begin
|
||||||
|
eop_val:=data^.eop_val;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
eop_val:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_lock(dce_mtx);
|
||||||
|
|
||||||
|
if (dce_handle=nil) then
|
||||||
|
begin
|
||||||
|
Result:=EINVAL;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
Result:=dce_handle.SubmitFlip(@submit,eop_val);
|
||||||
|
end;
|
||||||
|
|
||||||
|
mtx_unlock(dce_mtx);
|
||||||
|
|
||||||
Writeln('submit_flip:',data^.bufferIndex,' ',
|
Writeln('submit_flip:',data^.bufferIndex,' ',
|
||||||
data^.flipMode,' ',
|
data^.flipMode,' ',
|
||||||
'0x',HexStr(data^.flipArg,16),' ',
|
'0x',HexStr(data^.flipArg,16),' ',
|
||||||
data^.eop_val);
|
'0x',HexStr(data^.eop_val));
|
||||||
|
|
||||||
knote_eventid(EVENTID_FLIP, data^.flipArg, 0); //SCE_VIDEO_OUT_EVENT_FLIP
|
knote_eventid(EVENTID_FLIP, data^.flipArg, 0); //SCE_VIDEO_OUT_EVENT_FLIP
|
||||||
|
|
||||||
|
@ -734,20 +951,22 @@ begin
|
||||||
event_id:=kn^.kn_kevent.ident shr 48;
|
event_id:=kn^.kn_kevent.ident shr 48;
|
||||||
|
|
||||||
case event_id of
|
case event_id of
|
||||||
EVENTID_FLIP: //SCE_VIDEO_OUT_EVENT_FLIP
|
EVENTID_FLIP, //SCE_VIDEO_OUT_EVENT_FLIP
|
||||||
|
EVENTID_VBLANK, //SCE_VIDEO_OUT_EVENT_VBLANK
|
||||||
|
EVENTID_SETMODE, //8
|
||||||
|
EVENTID_POSITION, //12
|
||||||
|
EVENTID_PREVBLANK, //SCE_VIDEO_OUT_EVENT_PRE_VBLANK_START
|
||||||
|
$0060,
|
||||||
|
$0061,
|
||||||
|
$0062,
|
||||||
|
$0063:
|
||||||
begin
|
begin
|
||||||
knlist_add(@g_video_out_event_flip,kn,0);
|
knlist_add(@g_video_out_event_flip,kn,0);
|
||||||
end;
|
end;
|
||||||
EVENTID_VBLANK: //SCE_VIDEO_OUT_EVENT_VBLANK
|
|
||||||
begin
|
|
||||||
knlist_add(@g_video_out_event_flip,kn,0);
|
|
||||||
end;
|
|
||||||
// $0051:Result:=8;
|
|
||||||
// $0058:Result:=12;
|
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
Writeln(stderr,'filt_display_attach:',event_id);
|
//Writeln(stderr,'filt_display_attach:',event_id);
|
||||||
Assert(false,'filt_display_attach');
|
//Assert(false,'filt_display_attach');
|
||||||
Result:=EINVAL;
|
Result:=EINVAL;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -762,16 +981,18 @@ begin
|
||||||
event_id:=kn^.kn_kevent.ident shr 48;
|
event_id:=kn^.kn_kevent.ident shr 48;
|
||||||
|
|
||||||
case event_id of
|
case event_id of
|
||||||
EVENTID_FLIP: //SCE_VIDEO_OUT_EVENT_FLIP
|
EVENTID_FLIP, //SCE_VIDEO_OUT_EVENT_FLIP
|
||||||
|
EVENTID_VBLANK, //SCE_VIDEO_OUT_EVENT_VBLANK
|
||||||
|
EVENTID_SETMODE, //8
|
||||||
|
EVENTID_POSITION, //12
|
||||||
|
EVENTID_PREVBLANK, //SCE_VIDEO_OUT_EVENT_PRE_VBLANK_START
|
||||||
|
$0060,
|
||||||
|
$0061,
|
||||||
|
$0062,
|
||||||
|
$0063:
|
||||||
begin
|
begin
|
||||||
knlist_remove(@g_video_out_event_flip,kn,0)
|
knlist_remove(@g_video_out_event_flip,kn,0)
|
||||||
end;
|
end;
|
||||||
EVENTID_VBLANK: //SCE_VIDEO_OUT_EVENT_VBLANK
|
|
||||||
begin
|
|
||||||
knlist_remove(@g_video_out_event_flip,kn,0)
|
|
||||||
end;
|
|
||||||
// $0051:Result:=8;
|
|
||||||
// $0058:Result:=12;
|
|
||||||
else;
|
else;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -834,6 +1055,7 @@ var
|
||||||
procedure dce_initialize();
|
procedure dce_initialize();
|
||||||
begin
|
begin
|
||||||
mtx_init(knlist_lock_flip,'knlist_lock_flip');
|
mtx_init(knlist_lock_flip,'knlist_lock_flip');
|
||||||
|
mtx_init(dce_mtx,'dce');
|
||||||
|
|
||||||
knlist_init_mtx(@g_video_out_event_flip,@knlist_lock_flip);
|
knlist_init_mtx(@g_video_out_event_flip,@knlist_lock_flip);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,128 @@
|
||||||
|
unit display_interface;
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
type
|
||||||
|
p_flip_status=^t_flip_status;
|
||||||
|
t_flip_status=packed record
|
||||||
|
flipArg :QWORD;
|
||||||
|
flipArg2 :QWORD;
|
||||||
|
count :QWORD;
|
||||||
|
processTime :QWORD;
|
||||||
|
tsc :QWORD;
|
||||||
|
currentBuffer :DWORD;
|
||||||
|
flipPendingNum0:DWORD;
|
||||||
|
gcQueueNum :DWORD;
|
||||||
|
flipPendingNum1:DWORD;
|
||||||
|
submitTsc :QWORD;
|
||||||
|
end;
|
||||||
|
|
||||||
|
p_resolution_status=^t_resolution_status;
|
||||||
|
t_resolution_status=packed record
|
||||||
|
width :DWORD;
|
||||||
|
heigth :DWORD;
|
||||||
|
paneWidth :DWORD;
|
||||||
|
paneHeight :DWORD;
|
||||||
|
refreshHz :DWORD; //Single
|
||||||
|
screenSizeInInch:DWORD;
|
||||||
|
end;
|
||||||
|
|
||||||
|
p_register_buffer_attr=^t_register_buffer_attr;
|
||||||
|
t_register_buffer_attr=packed record
|
||||||
|
pixelFormat:DWORD;
|
||||||
|
tilingMode :DWORD;
|
||||||
|
pitchPixel :DWORD;
|
||||||
|
width :DWORD;
|
||||||
|
height :DWORD;
|
||||||
|
f_0x20 :Byte;
|
||||||
|
f_0x21 :Byte;
|
||||||
|
options :WORD;
|
||||||
|
end;
|
||||||
|
|
||||||
|
p_register_buffer=^t_register_buffer;
|
||||||
|
t_register_buffer=packed record
|
||||||
|
index :DWORD; //buffer index [0..15]
|
||||||
|
attrid:DWORD; //attribute id [0..3]
|
||||||
|
left :Pointer; //buffer ptr
|
||||||
|
right :Pointer; //Stereo ptr
|
||||||
|
end;
|
||||||
|
|
||||||
|
p_submit_flip=^t_submit_flip;
|
||||||
|
t_submit_flip=packed record
|
||||||
|
bufferIndex:DWORD;
|
||||||
|
flipMode :DWORD;
|
||||||
|
flipArg :QWORD;
|
||||||
|
flipArg2 :QWORD;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TDisplayHandle=class
|
||||||
|
function GetFlipStatus (status:p_flip_status):Integer; virtual;
|
||||||
|
function GetResolutionStatus (status:p_resolution_status):Integer; virtual;
|
||||||
|
function SetFlipRate (rate:Integer):Integer; virtual;
|
||||||
|
function RegisterBufferAttribute(attrid:Byte;attr:p_register_buffer_attr):Integer; virtual;
|
||||||
|
function SubmitBufferAttribute (attrid:Byte;attr:p_register_buffer_attr):Integer; virtual;
|
||||||
|
function RegisterBuffer (buf:p_register_buffer):Integer; virtual;
|
||||||
|
function UnregisterBuffer (index:Integer):Integer; virtual;
|
||||||
|
function SubmitFlip (submit:p_submit_flip;eop_val:PQWORD):Integer; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TDisplayInterface=class
|
||||||
|
class Function Open:TDisplayHandle; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TAbstractDisplay=class of TDisplayInterface;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
class Function TDisplayInterface.Open:TDisplayHandle;
|
||||||
|
begin
|
||||||
|
Result:=TDisplayHandle.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function TDisplayHandle.GetFlipStatus(status:p_flip_status):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDisplayHandle.GetResolutionStatus(status:p_resolution_status):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDisplayHandle.SetFlipRate(rate:Integer):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDisplayHandle.RegisterBufferAttribute(attrid:Byte;attr:p_register_buffer_attr):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDisplayHandle.SubmitBufferAttribute(attrid:Byte;attr:p_register_buffer_attr):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDisplayHandle.RegisterBuffer(buf:p_register_buffer):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDisplayHandle.UnregisterBuffer(index:Integer):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TDisplayHandle.SubmitFlip(submit:p_submit_flip;eop_val:PQWORD):Integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
|
@ -395,19 +395,30 @@ end;
|
||||||
type
|
type
|
||||||
p_jmpq64_trampoline=^t_jmpq64_trampoline;
|
p_jmpq64_trampoline=^t_jmpq64_trampoline;
|
||||||
t_jmpq64_trampoline=packed record
|
t_jmpq64_trampoline=packed record
|
||||||
lea:array[0..6] of Byte;
|
lea :array[0..6] of Byte; //48 8D 3D F9 FF FF FF
|
||||||
|
nop1 :Byte; //90
|
||||||
//
|
//
|
||||||
and_rsp:DWORD; //48 83 E4 F0
|
and_rsp:DWORD; //48 83 E4 F0
|
||||||
//
|
//
|
||||||
inst :Word; //FF 15
|
inst :Word; //FF 15
|
||||||
offset :DWORD; //00
|
offset :DWORD; //02
|
||||||
|
ret :Byte; //C3
|
||||||
|
nop2 :Byte; //90
|
||||||
addr :QWORD;
|
addr :QWORD;
|
||||||
nid :QWORD;
|
nid :QWORD;
|
||||||
libname:PChar;
|
libname:PChar;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
c_jmpq64_trampoline:t_jmpq64_trampoline=(lea:($48,$8D,$3D,$F9,$FF,$FF,$FF);and_rsp:($F0E48348);inst:$15FF;offset:0;addr:0);
|
c_jmpq64_trampoline:t_jmpq64_trampoline=(lea :($48,$8D,$3D,$F9,$FF,$FF,$FF);
|
||||||
|
nop1 :$90;
|
||||||
|
and_rsp:($F0E48348);
|
||||||
|
inst :$15FF;offset:$02;
|
||||||
|
ret :$C3;
|
||||||
|
nop2 :$90;
|
||||||
|
addr :0;
|
||||||
|
nid :0;
|
||||||
|
libname:nil);
|
||||||
|
|
||||||
procedure _unresolve_symbol(data:p_jmpq64_trampoline);
|
procedure _unresolve_symbol(data:p_jmpq64_trampoline);
|
||||||
var
|
var
|
||||||
|
|
|
@ -23,7 +23,7 @@ type
|
||||||
vm_nt_file_obj=packed record
|
vm_nt_file_obj=packed record
|
||||||
hfile:THandle;
|
hfile:THandle;
|
||||||
refs :QWORD;
|
refs :QWORD;
|
||||||
flags:QWORD;
|
flags:Byte;
|
||||||
maxp :Byte;
|
maxp :Byte;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue