Skip to content

Commit e6f392f

Browse files
malayakusraman4
authored andcommitted
ZC v1447 : Bug fixes on ZC UMD and KMD
1 parent 3814a14 commit e6f392f

File tree

14 files changed

+33
-109
lines changed

14 files changed

+33
-109
lines changed

DVInstaller.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function Register_ScheduledTask()
141141
Register-ScheduledTask -TaskName "DVEnabler" -Trigger @($tr, $onUnlockTrigger) -TaskPath "\Microsoft\Windows\DVEnabler" -Action $ac -Principal $pr -Settings $settings -ErrorAction Stop
142142

143143
#Register a task to Stop the dvenabler.dll during every user lock
144-
$ac = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -Command `"Stop-ScheduledTask -TaskName '\Microsoft\Windows\DVEnabler\DvEnabler'`""
144+
$ac = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-Command `"`$`processes = Get-Process | Where-Object { `$`_.Modules.ModuleName -contains 'DVEnabler.dll' } | Sort-Object StartTime; if (`$`processes.Count -gt 0) { taskkill /F /PID `$`processes[0].Id }`""
145145
$pr = New-ScheduledTaskPrincipal -Groupid $interactiveSID -RunLevel Highest
146146
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -ExecutionTimeLimit 0 -MultipleInstances Queue
147147
Register-ScheduledTask -TaskName "StopDVEnabler" -Trigger $onLockTrigger -TaskPath "\Microsoft\Windows\DVEnabler" -Action $ac -Principal $pr -Settings $settings -ErrorAction Stop

DVServerKMD/DVServerKMD.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@
106106
</Inf>
107107
<PostBuildEvent>
108108
<Command>makecert -r -pe -ss PrivateCertStore -n CN=DVServerKMD -eku 1.3.6.1.5.5.7.3.3 $(OutDir)DVServerKMD.cer
109-
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServerKMD /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServerKMD\dvserverkmd.cat
110109
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServerKMD /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServerKMD\DVServerKMD.sys
110+
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServerKMD /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServerKMD\dvserverkmd.cat
111111
certmgr -del -c -n "DVServerKMD" -s PrivateCertStore</Command>
112112
</PostBuildEvent>
113113
<DriverSign>
@@ -131,8 +131,8 @@ certmgr -del -c -n "DVServerKMD" -s PrivateCertStore</Command>
131131
</Inf>
132132
<PostBuildEvent>
133133
<Command>makecert -r -pe -ss PrivateCertStore -n CN=DVServerKMD -eku 1.3.6.1.5.5.7.3.3 $(OutDir)DVServerKMD.cer
134-
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServerKMD /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServerKMD\dvserverkmd.cat
135134
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServerKMD /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServerKMD\DVServerKMD.sys
135+
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServerKMD /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServerKMD\dvserverkmd.cat
136136
certmgr -del -c -n "DVServerKMD" -s PrivateCertStore</Command>
137137
</PostBuildEvent>
138138
<DriverSign>

DVServerKMD/Queue.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ static NTSTATUS IoctlRequestSetMode(
360360
tempCurrentMode.DispInfo.TargetId = ptr->screen_num;
361361
tempCurrentMode.DispInfo.ColorFormat = (D3DDDIFORMAT)ptr->format;
362362
tempCurrentMode.FrameBuffer.Ptr = (BYTE*)ptr->addr;
363+
tempCurrentMode.Stride = ptr->stride;
363364

364365
status = pAdapter->SetCurrentModeExt(&tempCurrentMode);
365366
if (status != STATUS_SUCCESS) {
@@ -426,7 +427,8 @@ static NTSTATUS IoctlRequestPresentFb(
426427
ptr->pitch,
427428
ptr->width,
428429
ptr->height,
429-
ptr->screen_num);
430+
ptr->screen_num,
431+
ptr->stride);
430432

431433
if (status != STATUS_SUCCESS) {
432434
ERR("ExecutePresentDisplayZeroCopy failed with status = %d\n", status);

DVServerKMD/viogpu_queue.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,10 @@ void CtrlQueue::CreateResource(UINT res_id, UINT format, UINT width, UINT height
347347
QueueBuffer(vbuf);
348348
}
349349

350-
void CtrlQueue::CreateResourceBlob(UINT res_id, PGPU_MEM_ENTRY ents, UINT nents, ULONGLONG width, ULONGLONG height)
350+
void CtrlQueue::CreateResourceBlob(UINT res_id, PGPU_MEM_ENTRY ents, UINT nents, ULONGLONG width, ULONGLONG height, ULONGLONG stride)
351351
{
352352
PAGED_CODE();
353+
UNREFERENCED_PARAMETER(width);
353354
TRACING();
354355

355356
PGPU_RES_CREATE_BLOB cmd;
@@ -368,7 +369,7 @@ void CtrlQueue::CreateResourceBlob(UINT res_id, PGPU_MEM_ENTRY ents, UINT nents,
368369
cmd->blob_id = 0;
369370
cmd->nr_entries = nents;
370371
/* TODO: Check if ROUND_TO_PAGES (round up) should be used or PAGE_ALIGN (round down) */
371-
cmd->size = ROUND_TO_PAGES(width * height * 4);
372+
cmd->size = ROUND_TO_PAGES(stride * height * 4);
372373

373374
vbuf->data_buf = ents;
374375
vbuf->data_size = sizeof(*ents) * nents;
@@ -449,7 +450,7 @@ void CtrlQueue::SetScanout(UINT scan_id, UINT res_id, UINT width, UINT height, U
449450
QueueBuffer(vbuf);
450451
}
451452

452-
void CtrlQueue::SetScanoutBlob(UINT scan_id, UINT res_id, UINT width, UINT height, UINT format, UINT x, UINT y)
453+
void CtrlQueue::SetScanoutBlob(UINT scan_id, UINT res_id, UINT width, UINT height, UINT format, UINT x, UINT y, UINT stride)
453454
{
454455
PAGED_CODE();
455456
TRACING();
@@ -472,7 +473,7 @@ void CtrlQueue::SetScanoutBlob(UINT scan_id, UINT res_id, UINT width, UINT heigh
472473

473474
/* TODO: Check strides and offsets */
474475
for (int i = 0; i < 4; i++) {
475-
cmd->strides[i] = width * 4;
476+
cmd->strides[i] = stride * 4;
476477
cmd->offsets[i] = 0;
477478
}
478479

DVServerKMD/viogpu_queue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,11 @@ class CtrlQueue : public VioGpuQueue
185185
PGPU_VBUFFER DequeueBuffer(_Out_ UINT* len);
186186

187187
void CreateResource(UINT res_id, UINT format, UINT width, UINT height);
188-
void CreateResourceBlob(UINT res_id, PGPU_MEM_ENTRY ents, UINT nents, ULONGLONG width, ULONGLONG height);
188+
void CreateResourceBlob(UINT res_id, PGPU_MEM_ENTRY ents, UINT nents, ULONGLONG width, ULONGLONG height, ULONGLONG stride);
189189
void UnrefResource(UINT id);
190190
void InvalBacking(UINT id);
191191
void SetScanout(UINT scan_id, UINT res_id, UINT width, UINT height, UINT x, UINT y);
192-
void SetScanoutBlob(UINT scan_id, UINT res_id, UINT width, UINT height, UINT format, UINT x, UINT y);
192+
void SetScanoutBlob(UINT scan_id, UINT res_id, UINT width, UINT height, UINT format, UINT x, UINT y, UINT stride);
193193
void ResFlush(UINT res_id, UINT width, UINT height, UINT x, UINT y, UINT screen_num, KEVENT* event);
194194
void TransferToHost2D(UINT res_id, ULONG offset, UINT width, UINT height, UINT x, UINT y, PUINT fence_id);
195195
void AttachBacking(UINT res_id, PGPU_MEM_ENTRY ents, UINT nents);

DVServerKMD/viogpulite.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ static BOOLEAN IsSameMode(PVIDEO_MODE_INFORMATION pModeInfo, CURRENT_MODE* pCurr
142142
return result;
143143

144144
if (pModeInfo->VisScreenWidth == pCurrentMode->DispInfo.Width &&
145-
pModeInfo->VisScreenHeight == pCurrentMode->DispInfo.Height &&
146-
pModeInfo->ScreenStride == pCurrentMode->DispInfo.Pitch)
145+
pModeInfo->VisScreenHeight == pCurrentMode->DispInfo.Height)
147146
result = TRUE;
148147

149148
return result;
@@ -586,7 +585,8 @@ NTSTATUS VioGpuAdapterLite::ExecutePresentDisplayZeroCopy(
586585
_In_ LONG SrcPitch,
587586
_In_ UINT SrcWidth,
588587
_In_ UINT SrcHeight,
589-
_In_ UINT ScreenNum)
588+
_In_ UINT ScreenNum,
589+
_In_ UINT Stride)
590590
{
591591
PAGED_CODE();
592592
TRACING();
@@ -605,6 +605,7 @@ NTSTATUS VioGpuAdapterLite::ExecutePresentDisplayZeroCopy(
605605
tempCurrentMode.DispInfo.TargetId = ScreenNum;
606606
tempCurrentMode.DispInfo.ColorFormat = D3DDDIFMT_X8R8G8B8;
607607
tempCurrentMode.FrameBuffer.Ptr = SrcAddr;
608+
tempCurrentMode.Stride = Stride;
608609

609610
status = SetCurrentModeExt(&tempCurrentMode);
610611

@@ -844,14 +845,12 @@ void ScreenInfo::SetVideoModeInfo(UINT Idx, PGPU_DISP_MODE_EXT pModeInfo)
844845
PAGED_CODE();
845846
TRACING();
846847
PVIDEO_MODE_INFORMATION pMode = NULL;
847-
UINT bytes_pp = (VGPU_BPP + 7) / 8;
848848

849849
pMode = &m_ModeInfo[Idx];
850850
pMode->Length = sizeof(VIDEO_MODE_INFORMATION);
851851
pMode->ModeIndex = Idx;
852852
pMode->VisScreenWidth = pModeInfo->XResolution;
853853
pMode->VisScreenHeight = pModeInfo->YResolution;
854-
pMode->ScreenStride = (pModeInfo->XResolution * bytes_pp + 3) & ~0x3;
855854
}
856855

857856
void ScreenInfo::SetCustomDisplay(_In_ USHORT xres, _In_ USHORT yres)
@@ -1178,7 +1177,7 @@ void VioGpuAdapterLite::CreateFrameBufferObj(PVIDEO_MODE_INFORMATION pModeInfo,
11781177
DBGPRINT("%d: %d, (%d x %d)\n", m_Id, pCurrentMode->DispInfo.TargetId,
11791178
pModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight);
11801179
ASSERT(m_screen[pCurrentMode->DispInfo.TargetId].m_pFrameBuf == NULL);
1181-
size = pModeInfo->ScreenStride * pModeInfo->VisScreenHeight;
1180+
size = pCurrentMode->DispInfo.Pitch * pModeInfo->VisScreenHeight;
11821181
format = ColorFormat(pCurrentMode->DispInfo.ColorFormat);
11831182
DBGPRINT("(%d -> %d)\n", pCurrentMode->DispInfo.ColorFormat, format);
11841183
resid = m_Idr.GetId();
@@ -1204,11 +1203,11 @@ void VioGpuAdapterLite::CreateFrameBufferObj(PVIDEO_MODE_INFORMATION pModeInfo,
12041203
return;
12051204
}
12061205

1207-
GpuObjectAttach(resid, obj, pModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight);
1206+
GpuObjectAttach(resid, obj, pModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight,pCurrentMode->Stride);
12081207

12091208
if (m_bBlobSupported)
12101209
{
1211-
m_CtrlQueue.SetScanoutBlob(pCurrentMode->DispInfo.TargetId, resid, pModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight, format, 0, 0);
1210+
m_CtrlQueue.SetScanoutBlob(pCurrentMode->DispInfo.TargetId, resid, pModeInfo->VisScreenWidth, pModeInfo->VisScreenHeight, format, 0, 0,pCurrentMode->Stride);
12121211
}
12131212
else
12141213
{
@@ -1278,7 +1277,8 @@ BOOLEAN VioGpuAdapterLite::CreateCursor(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSet
12781277
delete obj;
12791278
return FALSE;
12801279
}
1281-
if (!GpuObjectAttach(resid, obj, POINTER_SIZE, POINTER_SIZE))
1280+
//TODO: Stride is set to zero as cursor does not use.
1281+
if (!GpuObjectAttach(resid, obj, POINTER_SIZE, POINTER_SIZE,0))
12821282
{
12831283
VioGpuDbgBreak();
12841284
ERR("Failed to attach gpu object\n");
@@ -1345,7 +1345,7 @@ void VioGpuAdapterLite::DestroyCursor()
13451345
}
13461346
}
13471347

1348-
BOOLEAN VioGpuAdapterLite::GpuObjectAttach(UINT res_id, VioGpuObj* obj, ULONGLONG width, ULONGLONG height)
1348+
BOOLEAN VioGpuAdapterLite::GpuObjectAttach(UINT res_id, VioGpuObj* obj, ULONGLONG width, ULONGLONG height , ULONGLONG stride)
13491349
{
13501350
PAGED_CODE();
13511351
TRACING();
@@ -1372,7 +1372,7 @@ BOOLEAN VioGpuAdapterLite::GpuObjectAttach(UINT res_id, VioGpuObj* obj, ULONGLON
13721372
}
13731373

13741374
if (m_bBlobSupported) {
1375-
m_CtrlQueue.CreateResourceBlob(res_id, ents, sgl->NumberOfElements, width, height);
1375+
m_CtrlQueue.CreateResourceBlob(res_id, ents, sgl->NumberOfElements, width, height, stride);
13761376
}
13771377
else {
13781378
m_CtrlQueue.AttachBacking(res_id, ents, sgl->NumberOfElements);

DVServerKMD/viogpulite.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ typedef struct _CURRENT_MODE
5858
D3DKMDT_VIDPN_PRESENT_PATH_SCALING Scaling;
5959
UINT SrcModeWidth;
6060
UINT SrcModeHeight;
61+
UINT Stride;
6162
struct _CURRENT_MODE_FLAGS
6263
{
6364
UINT SourceNotVisible : 1;
@@ -151,7 +152,8 @@ class VioGpuAdapterLite :
151152
_In_ LONG SrcPitch,
152153
_In_ UINT SrcWidth,
153154
_In_ UINT SrcHeight,
154-
_In_ UINT ScreenNum);
155+
_In_ UINT ScreenNum,
156+
_In_ UINT Stride);
155157
VOID BlackOutScreen(CURRENT_MODE* pCurrentMod);
156158
BOOLEAN InterruptRoutine(_In_ ULONG MessageNumber);
157159
VOID DpcRoutine(void);
@@ -197,7 +199,7 @@ class VioGpuAdapterLite :
197199
void DestroyFrameBufferObj(UINT32 screen_num, BOOLEAN bReset);
198200
BOOLEAN CreateCursor(_In_ CONST DXGKARG_SETPOINTERSHAPE* pSetPointerShape, _In_ CONST CURRENT_MODE* pCurrentMode);
199201
void DestroyCursor(void);
200-
BOOLEAN GpuObjectAttach(UINT res_id, VioGpuObj* obj, ULONGLONG width, ULONGLONG height);
202+
BOOLEAN GpuObjectAttach(UINT res_id, VioGpuObj* obj, ULONGLONG width, ULONGLONG height, ULONGLONG stride);
201203
void static ThreadWork(_In_ PVOID Context);
202204
void ThreadWorkRoutine(void);
203205
void ConfigChanged(void);

DVServerUMD/DVEnabler/DVEnabler.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ int dvenabler_init()
8989
goto end;
9090
}
9191

92-
93-
if (dinfo.exit_dvenabler) {
94-
ERR("exit flag is set so exit dvenabler");
95-
break;
96-
}
97-
98-
9992
/* Step 1: Retrieve information about all possible display paths for all display devices */
10093
if (QueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &path_count, path_list.data(), &mode_count, mode_list.data(), nullptr) != ERROR_SUCCESS) {
10194
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
@@ -188,11 +181,6 @@ int dvenabler_init()
188181

189182
}
190183
WPP_CLEANUP();
191-
//Inform DVServerUmd About Initiation of DVenabler Cleanup. So that the UMD can exit
192-
status = SetEvent(hp_event);
193-
if (status == NULL) {
194-
ERR(" Set HPevent failed with error [%d]\n ", GetLastError());
195-
}
196184
CloseHandle(hp_event);
197185
CloseHandle(dve_event);
198186

DVServerUMD/DVEnabler/pch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ int dvenabler_init();
2323
struct disp_info {
2424
int disp_count;
2525
HANDLE mutex;
26-
BOOL exit_dvenabler;
2726
};
2827
int GetDisplayCount(disp_info* pdinfo);
2928
#endif //PCH_H

DVServerUMD/DVServer/DVServer.vcxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,8 @@
261261
</Inf>
262262
<PostBuildEvent>
263263
<Command>makecert -r -pe -ss PrivateCertStore -n CN=DVServer -eku 1.3.6.1.5.5.7.3.3 $(OutDir)DVServer.cer
264-
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServer /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServer\dvserver.cat
265264
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServer /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServer\DVServer.dll
265+
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServer /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServer\dvserver.cat
266266
certmgr -del -c -n "DVServer" -s PrivateCertStore</Command>
267267
</PostBuildEvent>
268268
<DriverSign>
@@ -292,8 +292,8 @@ certmgr -del -c -n "DVServer" -s PrivateCertStore</Command>
292292
</Inf>
293293
<PostBuildEvent>
294294
<Command>makecert -r -pe -ss PrivateCertStore -n CN=DVServer -eku 1.3.6.1.5.5.7.3.3 $(OutDir)DVServer.cer
295-
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServer /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServer\dvserver.cat
296295
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServer /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServer\DVServer.dll
296+
Signtool sign /v /fd sha256 /s PrivateCertStore /n DVServer /tr http://timestamp.digicert.com /td sha256 $(OutDir)DVServer\dvserver.cat
297297
certmgr -del -c -n "DVServer" -s PrivateCertStore</Command>
298298
</PostBuildEvent>
299299
<DriverSign>

0 commit comments

Comments
 (0)