MR!3 patch

Submitted by Jon Stumpf on April 23, 2018, 11:24 p.m.

Details

Message ID CALQX8QTCN9YOnyM_sC-acsO2wXzvE-XTmQ86T=KoQne1e8k0zQ@mail.gmail.com
State New
Headers show
Series "MR!3 patch" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Jon Stumpf April 23, 2018, 11:24 p.m.
Here is the patch for Merge Request 3 (MR!3).  The WebIDE must have changed
the end-of-line sequence as I produced this with "git diff
--ignore-all-space".

- jss

Patch hide | download patch | download mbox

diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp
index 5fa9c9a..e73a4f9 100755
--- a/qxldod/QxlDod.cpp
+++ b/qxldod/QxlDod.cpp
@@ -189,7 +189,7 @@  NTSTATUS QxlDod::StartDevice(_In_  DXGK_START_INFO*   pDxgkStartInfo,
         return Status;
     }
 
-    Status = RegisterHWInfo(m_pHWDevice->GetId());
+    Status = RegisterHWInfo(m_pHWDevice->GetId(), m_DeviceInfo.SystemMemorySize);
     if (!NT_SUCCESS(Status))
     {
         QXL_LOG_ASSERTION1("RegisterHWInfo failed with status 0x%X\n",
@@ -1920,7 +1920,7 @@  NTSTATUS QxlDod::WriteHWInfoStr(_In_ HANDLE DevInstRegKeyHandle, _In_ PCWSTR psz
     return Status;
 }
 
-NTSTATUS QxlDod::RegisterHWInfo(_In_ ULONG Id)
+NTSTATUS QxlDod::RegisterHWInfo(_In_ ULONG Id, _In_ LARGE_INTEGER MemSize)
 {
     PAGED_CODE();
 
@@ -1965,9 +1965,17 @@  NTSTATUS QxlDod::RegisterHWInfo(_In_ ULONG Id)
     }
 
     // MemorySize is a ULONG, unlike the others which are all strings
+    //
+    // Microsoft documents the value as counting megabytes, but observation 
+    // suggests it counts bytes. For instance, to represent 512MB, set the 
+    // value to 0x20000000, not to 0x0200.
+    //
+    // A robust implementation would check that the size in bytes, given as 
+    // 64 bits, is not too big for representation as a DWORD!
+
     UNICODE_STRING ValueNameMemorySize;
     RtlInitUnicodeString(&ValueNameMemorySize, L"HardwareInformation.MemorySize");
-    DWORD MemorySize = 0; // BDD has no access to video memory
+    DWORD MemorySize = MemSize.LowPart;
     Status = ZwSetValueKey(DevInstRegKeyHandle,
                            &ValueNameMemorySize,
                            0,
diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h
index 695b83a..dc3c9fc 100755
--- a/qxldod/QxlDod.h
+++ b/qxldod/QxlDod.h
@@ -837,7 +837,7 @@  private:
     QXL_NON_PAGED D3DDDI_VIDEO_PRESENT_SOURCE_ID FindSourceForTarget(D3DDDI_VIDEO_PRESENT_TARGET_ID TargetId, BOOLEAN DefaultToZero);
     NTSTATUS IsVidPnSourceModeFieldsValid(CONST D3DKMDT_VIDPN_SOURCE_MODE* pSourceMode) const;
     NTSTATUS IsVidPnPathFieldsValid(CONST D3DKMDT_VIDPN_PRESENT_PATH* pPath) const;
-    NTSTATUS RegisterHWInfo(_In_ ULONG Id);
+    NTSTATUS RegisterHWInfo(_In_ ULONG Id, _In_ LARGE_INTEGER MemSize);
     QXL_NON_PAGED VOID VsyncTimerProc();
     static QXL_NON_PAGED VOID VsyncTimerProcGate(_In_ _KDPC *dpc, _In_ PVOID context, _In_ PVOID arg1, _In_ PVOID arg2);
     QXL_NON_PAGED VOID IndicateVSyncInterrupt();

Comments

> Here is the patch for Merge Request 3 (MR!3). The WebIDE must have changed
> the end-of-line sequence as I produced this with "git diff
> --ignore-all-space".

> - jss

Jon, can you provide patches in the form of git changes?
Instead of git diff you can use git format-patch.
Alternatively add some comment and email (I assume "Jon Stumpf" <jon.stumpf@gmail.com>)
you want to see in the git commit.

Frediano
Frediano,

I will this evening when I return home and after I read how to use "git
format-patch".

- jss


On Tue, Apr 24, 2018 at 7:00 AM, Frediano Ziglio <fziglio@redhat.com> wrote:

> > Here is the patch for Merge Request 3 (MR!3). The WebIDE must have
> changed
> > the end-of-line sequence as I produced this with "git diff
> > --ignore-all-space".
>
> > - jss
>
> Jon, can you provide patches in the form of git changes?
> Instead of git diff you can use git format-patch.
> Alternatively add some comment and email (I assume "Jon Stumpf" <
> jon.stumpf@gmail.com>)
> you want to see in the git commit.
>
> Frediano
>