- Update to r53061
[reactos.git] / drivers / video / videoprt / resource.c
index 2ed6417..b83ca1f 100644 (file)
@@ -79,7 +79,7 @@ IntVideoPortMapMemory(
    IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension,
    IN PHYSICAL_ADDRESS IoAddress,
    IN ULONG NumberOfUchars,
-   IN UCHAR InIoSpace,
+   IN ULONG InIoSpace,
    IN HANDLE ProcessHandle,
    OUT VP_STATUS *Status)
 {
@@ -163,7 +163,7 @@ IntVideoPortMapMemory(
       if (Status)
          *Status = NO_ERROR;
 
-      return (PVOID)TranslatedAddress.u.LowPart;
+      return (PVOID)(ULONG_PTR)TranslatedAddress.u.LowPart;
    }
 
    /* user space */
@@ -271,7 +271,7 @@ IntVideoPortUnmapMemory(
    Status = ZwUnmapViewOfSection(NtCurrentProcess(), MappedAddress);
    if (!NT_SUCCESS(Status))
    {
-      WARN_(VIDEOPRT, "Warning: Mapping for address 0x%x not found!\n", (ULONG)MappedAddress);
+      WARN_(VIDEOPRT, "Warning: Mapping for address 0x%p not found!\n", MappedAddress);
    }
 }
 
@@ -760,7 +760,49 @@ VideoPortLockBuffer(
 }
 
 /*
- * @unimplemented
+ * @implemented
+ */
+
+BOOLEAN
+NTAPI
+VideoPortLockPages(
+    IN PVOID HwDeviceExtension,
+    IN OUT PVIDEO_REQUEST_PACKET pVrp,
+    IN PEVENT pUEvent,
+    IN PEVENT pDisplayEvent,
+    IN DMA_FLAGS DmaFlags)
+{
+    PVOID Buffer;
+
+    /* clear output buffer */
+    pVrp->OutputBuffer = NULL;
+
+    if (DmaFlags != VideoPortDmaInitOnly)
+    {
+        /* VideoPortKeepPagesLocked / VideoPortUnlockAfterDma is no-op */
+        return FALSE;
+    }
+
+    /* lock the buffer */
+    Buffer = VideoPortLockBuffer(HwDeviceExtension, pVrp->InputBuffer, pVrp->InputBufferLength, IoModifyAccess);
+
+    if (Buffer)
+    {
+        /* store result buffer & length */
+        pVrp->OutputBuffer = Buffer;
+        pVrp->OutputBufferLength = pVrp->InputBufferLength;
+
+        /* operation succeeded */
+        return TRUE;
+    }
+
+    /* operation failed */
+    return FALSE;
+}
+
+
+/*
+ * @implemented
  */
 
 VOID NTAPI