WOA-Project / SurfaceDuo-Drivers

Collection of driver binaries for Surface Duo devices
Other
155 stars 32 forks source link

Improve downlevel support for the BSP For Surface Duo (1st Gen) devices and Qualcomm Reference Hana Hardware #19

Closed gus33000 closed 1 month ago

gus33000 commented 1 month ago

This PR aims to improve downlevel support for Qualcomm Hana based platforms, namely, it enables compatibility for the following operating systems, previously unsupported or partially supported:

Support for these OSes is done without the need of extra definition files.

This PR also resolves some long lasting issues that broke support for more recent downlevel versions of Windows and also introduces a few workarounds where no fix is applicable at the moment.

gus33000 commented 1 month ago

Test Matrix before RI approval:

gus33000 commented 1 month ago

TI failure during specialize:

SYSTEM_THREAD_EXCEPTION_NOT_HANDLED (7e)
This is a very common BugCheck.  Usually the exception address pinpoints
the driver/function that caused the problem.  Always note this address
as well as the link date of the driver/image that contains this address.
Arguments:
Arg1: ffffffff80000003, The exception code that was not handled
Arg2: fffff8003ea01b04, The address that the exception occurred at
Arg3: fffffa8e029aee60, Exception Record Address
Arg4: fffffa8e029aea60, Context Record Address

CONTEXT:  fffffa8e029aea60 -- (.cxr 0xfffffa8e029aea60)
 x0=000000000000e0f0   x1=fffffa8e029b0360   x2=fffffa8e029afac0   x3=fffffa8e029af420
 x4=0000000000000000   x5=00007fffffff0000   x6=00007ffffffeffff   x7=fffffa8e029a9000
 x8=fffffa8e029af350   x9=fffffa8e029af8e0  x10=fffff8003eb25de0  x11=0000000000000000
x12=0000000000000002  x13=fffffa8e029b0d80  x14=0000000000000002  x15=fffffa8e029b1000
x16=fffff8003ea01b04  x17=ffffdcfa8385d234  x18=0000000000000000  x19=000000000000e0f0
x20=fffffa8e029b0360  x21=fffffa8e029afec0  x22=fffff8003e8ad538  x23=fffffa8e029af420
x24=0000000000000000  x25=fffffa8e029afec0  x26=fffffa8e029b0d90  x27=000000000000000b
x28=0000000000000000   fp=fffffa8e029af300   lr=fffff8003e9b957c   sp=fffffa8e029af300
 pc=fffff8003ea01b04  psr=80000144 N--- EL1
ERROR_CODE: (NTSTATUS) 0x80000003 - {EXCEPTION}  Breakpoint  A breakpoint has been reached.

EXCEPTION_CODE_STR:  80000003

EXCEPTION_PARAMETER1:  0000000000000000

EXCEPTION_STR:  0x80000003

STACK_TEXT:  
fffffa8e`029adcc0 fffff800`3e9e4668     : 00630034`00390000 00340038`00640030 fffffa8e`029b0d30 fffff800`3e9e4668 : nt!KeBugCheck2+0x154
fffffa8e`029ae270 fffff800`3e808ad8     : fffffa8e`029ae2d0 fffff800`3e808ad8 00000000`00000000 fffff800`3eb25de0 : nt!PspSystemThreadStartup$filt$0+0x98
fffffa8e`029ae280 fffff800`3e9b9614     : 00000000`00000000 fffff800`3eb25de0 fffff800`3eb25de0 00000000`000ad534 : nt!_C_ExecuteExceptionFilter+0x38
fffffa8e`029ae2e0 fffff800`3e8089ec     : fffffa8e`029ae340 fffff800`3e8089ec fffffa8e`029aee60 fffffa8e`029aea60 : nt!_C_specific_handler+0xd4
fffffa8e`029ae340 fffff800`3e907d98     : fffffa8e`029ae920 fffff800`3e907d98 fffffa8e`029ae3c0 00000000`00000000 : nt!RtlpExecuteHandlerForException+0x14
fffffa8e`029ae360 fffff800`3e90725c     : 00000000`00000000 00000000`00000000 fffffa8e`029ae398 00000000`00000000 : nt!RtlDispatchException+0x268
fffffa8e`029ae980 fffff800`3e88242c     : 00000000`00000000 00000000`00000000 fffffa8e`029aee60 fffffa8e`029aef90 : nt!KiDispatchException+0x24c
fffffa8e`029aee60 fffff800`3e80305c     : 00000010`80000003 00000000`00000000 fffff800`3ea01b04 00000000`00000001 : nt!KiSynchronousException+0x66c
fffffa8e`029aef90 fffff800`3ea01b08     : 7072544b`00000001 00000000`00000000 fffffa8e`029af0e0 00000000`00000000 : nt!KiArm64ExceptionVectors+0x5c
fffffa8e`029af300 fffff800`3e9b957c     : fffffa8e`029af340 fffff800`3e9b957c fffffa8e`029af3f8 fffffa8e`029af408 : nt!KeCheckStackAndTargetAddress+0xaf840
fffffa8e`029af340 fffff800`3e8089ec     : fffffa8e`029af3a0 fffff800`3e8089ec 00000000`00000000 00000000`00000000 : nt!_C_specific_handler+0x3c
fffffa8e`029af3a0 fffff800`3e907d98     : fffffa8e`029af980 fffff800`3e907d98 fffffa8e`029af420 fffffa8e`029af4e0 : nt!RtlpExecuteHandlerForException+0x14
fffffa8e`029af3c0 fffff800`3e90725c     : 00000000`00000000 00000000`00000000 fffffa8e`029af3f8 fffffa8e`029af4d8 : nt!RtlDispatchException+0x268
fffffa8e`029af9e0 fffff800`3e88242c     : fffff800`3eb99180 00000000`00000000 fffffa8e`029afec0 fffffa8e`029afff0 : nt!KiDispatchException+0x24c
fffffa8e`029afec0 fffff800`3e80305c     : 00000000`c0000005 00000000`00000000 00000000`0000e0f0 00000000`00000002 : nt!KiSynchronousException+0x66c
fffffa8e`029afff0 00000000`0000e0f0     : 7072544b`00000001 00000000`00000000 fffffa8e`029b0140 00000000`00000000 : nt!KiArm64ExceptionVectors+0x5c
fffffa8e`029b0360 fffff800`3bcc4f50     : fffffa8e`029b0390 fffff800`3bcda468 fffff800`3bcc4ed0 ffff968e`39ca2150 : 0xe0f0
fffffa8e`029b0360 fffff800`3bcda468     : fffffa8e`029b0390 fffff800`3bcda468 fffff800`3bcc4ed0 ffff968e`39ca2150 : qcdxkmti8150+0x2c4f50
fffffa8e`029b0390 fffff800`3bcd962c     : fffffa8e`029b03f0 fffff800`3bcd962c 00000000`00000001 ffff968e`3c06f8b0 : qcdxkmti8150+0x2da468
fffffa8e`029b03f0 fffff806`3e8b6abc     : fffffa8e`029b0470 fffff806`3e8b6abc ffff968e`3ac05080 ffff968e`3c149000 : qcdxkmti8150+0x2d962c
fffffa8e`029b0410 fffff806`401810ec     : ffffad84`ffffffff 00000000`00000000 00000002`00000000 00000000`00000000 : dxgkrnl!ADAPTER_RENDER::DdiBuildPagingBuffer+0x1ac
fffffa8e`029b04d0 fffff806`40122b20     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : dxgmms2!VIDMM_GLOBAL::FlushGpuVaTlb+0x1c4
fffffa8e`029b0750 fffff806`40180208     : fffffa8e`029b0840 fffff806`40180208 00000000`00000000 00000000`00000000 : dxgmms2!CVirtualAddressAllocator::FlushGpuVaTlb+0x78
fffffa8e`029b0770 fffff806`40181ee0     : fffffa8e`029b0b78 fffff806`4017ebfc 00000000`00000001 ffff968e`3b87fa01 : dxgmms2!CVirtualAddressAllocator::CommitVirtualAddressRange+0x310
fffffa8e`029b08a0 fffff806`401829b8     : fffffa8e`029b0ab0 fffff806`401829b8 00000000`00000071 ffff968e`3b87fa50 : dxgmms2!VIDMM_GLOBAL::CommitVirtualAddressRangeSystemCommand+0x278
fffffa8e`029b08e0 fffff806`40194acc     : 00000000`00000000 fffffa8e`029b0b40 ffff8480`53fa0101 ffffad84`81128e90 : dxgmms2!VIDMM_GLOBAL::ProcessDeferredCommand+0xac8
fffffa8e`029b0b10 fffff800`3e8ad538     : fffffa8e`029b0b50 fffff800`3f1a1d48 fffffa8e`029b0b70 fffff800`3e894efc : dxgmms2!VIDMM_WORKER_THREAD::Run+0xecc
fffffa8e`029b0d30 fffff800`3e808118     : 00000000`00000000 fffff800`3e808118 fffffa8e`029ae2f0 fffffa8e`029aea60 : nt!PspSystemThreadStartup+0x58
fffffa8e`029b0d90 00000000`00000000     : ffffad84`7fd6d410 fffff806`40193bf0 fffff800`3e8ad4e0 00000000`00000000 : nt!KiStartSystemThread+0x20
[0x0]   nt!KeBugCheck2+0x154   0xfffffa8e029adcc0   0xfffff8003e9e4668   
[0x1]   nt!PspSystemThreadStartup$filt$0+0x98   0xfffffa8e029ae270   0xfffff8003e808ad8   
[0x2]   nt!_C_ExecuteExceptionFilter+0x38   0xfffffa8e029ae280   0xfffff8003e9b9614   
[0x3]   nt!_C_specific_handler+0xd4   0xfffffa8e029ae2e0   0xfffff8003e8089ec   
[0x4]   nt!RtlpExecuteHandlerForException+0x14   0xfffffa8e029ae340   0xfffff8003e907d98   
[0x5]   nt!RtlDispatchException+0x268   0xfffffa8e029ae360   0xfffff8003e90725c   
[0x6]   nt!KiDispatchException+0x24c   0xfffffa8e029ae980   0xfffff8003e88242c   
[0x7]   nt!KiSynchronousException+0x66c   0xfffffa8e029aee60   0xfffff8003e80305c   
[0x8]   nt!KiArm64ExceptionVectors+0x5c   0xfffffa8e029aef90   0xfffff8003ea01b08   
[0x9]   nt!KeCheckStackAndTargetAddress+0xaf840   0xfffffa8e029af300   0xfffff8003e9b957c   
[0xa]   nt!_C_specific_handler+0x3c   0xfffffa8e029af340   0xfffff8003e8089ec   
[0xb]   nt!RtlpExecuteHandlerForException+0x14   0xfffffa8e029af3a0   0xfffff8003e907d98   
[0xc]   nt!RtlDispatchException+0x268   0xfffffa8e029af3c0   0xfffff8003e90725c   
[0xd]   nt!KiDispatchException+0x24c   0xfffffa8e029af9e0   0xfffff8003e88242c   
[0xe]   nt!KiSynchronousException+0x66c   0xfffffa8e029afec0   0xfffff8003e80305c   
[0xf]   nt!KiArm64ExceptionVectors+0x5c   0xfffffa8e029afff0   0xe0f0   
[0x10]   0xe0f0!+   0xfffffa8e029b0360   0xfffff8003bcc4f50   
[0x11]   qcdxkmti8150 + 0x2c4f50!qcdxkmti8150+0x2c4f50   0xfffffa8e029b0360   0xfffff8003bcda468   
[0x12]   qcdxkmti8150 + 0x2da468!qcdxkmti8150+0x2da468   0xfffffa8e029b0390   0xfffff8003bcd962c   
[0x13]   qcdxkmti8150 + 0x2d962c!qcdxkmti8150+0x2d962c   0xfffffa8e029b03f0   0xfffff8063e8b6abc   
[0x14]   dxgkrnl!ADAPTER_RENDER::DdiBuildPagingBuffer+0x1ac   0xfffffa8e029b0410   0xfffff806401810ec   
[0x15]   dxgmms2!VIDMM_GLOBAL::FlushGpuVaTlb+0x1c4   0xfffffa8e029b04d0   0xfffff80640122b20   
[0x16]   dxgmms2!CVirtualAddressAllocator::FlushGpuVaTlb+0x78   0xfffffa8e029b0750   0xfffff80640180208   
[0x17]   dxgmms2!CVirtualAddressAllocator::CommitVirtualAddressRange+0x310   0xfffffa8e029b0770   0xfffff80640181ee0   
[0x18]   dxgmms2!VIDMM_GLOBAL::CommitVirtualAddressRangeSystemCommand+0x278   0xfffffa8e029b08a0   0xfffff806401829b8   
[0x19]   dxgmms2!VIDMM_GLOBAL::ProcessDeferredCommand+0xac8   0xfffffa8e029b08e0   0xfffff80640194acc   
[0x1a]   dxgmms2!VIDMM_WORKER_THREAD::Run+0xecc   0xfffffa8e029b0b10   0xfffff8003e8ad538   
[0x1b]   nt!PspSystemThreadStartup+0x58   0xfffffa8e029b0d30   0xfffff8003e808118   
[0x1c]   nt!KiStartSystemThread+0x20   0xfffffa8e029b0d90   0x0   

Highly probable failure root cause: fffff8063f3b0000 fffff8063f3f1000 qcsmmurs38150 (deferred) incorrect SMMU version loaded.

gus33000 commented 1 month ago

TI Regression crash highlighted in https://github.com/WOA-Project/SurfaceDuo-Drivers/pull/19#issuecomment-2227481091 fixed by 375f2f4f57a51349bb5d7f9d9c71296c30288136

gus33000 commented 1 month ago

TI oempanel load issues are observed as well (failure to set compression algorithm is notable on first boot). Need investigation in the OemPanel DDI later (needs separate issue to be created here)