VideoPortMapMemory

VP_STATUS VideoPortMapMemory(

    PVOID HwDeviceExtension,
   PHYSICAL_ADDRESS PhysicalAddress,
   PULONG Length,
   PULONG InIoSpace,
   PVOID *VirtualAddress
  );

VideoPortMapMemory remaps a bus-relative physical range of video memory into the corresponding display driver’s virtual address space in response to a VRP with the IoControlCode member set to IOCTL_VIDEO_MAP_VIDEO_MEMORY.

Parameters

HwDeviceExtension

Points to the miniport driver’s device extension.

PhysicalAddress

Specifies the bus-relative base address of the range to be mapped.

Length

Points to a variable specifying the number of bytes of device memory to be mapped. VideoPortMapMemory returns the actual size of the memory mapped, which can be rounded to a system-determined alignment boundary, in this parameter. However, the miniport and display drivers cannot access memory outside the range delimited by the input value at Length.

InIoSpace

Points to a variable indicating whether the range is in I/O space or memory space. TRUE indicates I/O space.

VirtualAddress

Points to a variable that specifies a process handle, which usually should be set to zero. Such a handle can also be a value passed in a VRP by the corresponding display driver. Zero specifies that the port driver should map the logical memory range at any location in the address space of the current process. On return from a successful call, VideoPortMapMemory resets the variable to the base virtual address to which it has mapped the given PhysicalAddress.

Return Value

VideoPortMapMemory returns NO_ERROR if the given logical range was successfully mapped to a user-space virtual range. Otherwise, it can return ERROR_INVALID_PARAMETER.

Comments

VideoPortMapMemory runs in kernel mode within the same context as the user-mode thread that initiated the call.

VideoPortMapMemory should be used by miniport drivers to manage video adapters that allow the video frame buffer to be completely mapped at all times. That is, miniport drivers for adapters that are not restricted to using Banks to map a slice at a time can use the more efficient VideoPortMapMemory.

Callers of VideoPortMapMemory are running at IRQL = PASSIVE_LEVEL.

See Also

IOCTL_VIDEO_MAP_VIDEO_MEMORY, VIDEO_REQUEST_PACKET, VideoPortUnmapMemory