ReactOS  0.4.15-dev-448-gd6c4411
xboxvmp.h File Reference
#include "ntdef.h"
#include "dderror.h"
#include "devioctl.h"
#include "miniport.h"
#include "ioaccess.h"
#include "video.h"
Include dependency graph for xboxvmp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  XBOXVMP_DEVICE_EXTENSION
 

Macros

#define PAGE_SIZE   4096
 
#define NV2A_VIDEO_MEMORY_SIZE   (4 * 1024 * 1024)
 
#define NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET   0x600800
 
#define NV2A_CRTC_REGISTER_INDEX   0x6013D4
 
#define NV2A_CRTC_REGISTER_VALUE   0x6013D5
 
#define NV2A_RAMDAC_FP_HVALID_END   0x680838
 
#define NV2A_RAMDAC_FP_VVALID_END   0x680818
 

Typedefs

typedef struct XBOXVMP_DEVICE_EXTENSIONPXBOXVMP_DEVICE_EXTENSION
 

Functions

VP_STATUS NTAPI XboxVmpFindAdapter (IN PVOID HwDeviceExtension, IN PVOID HwContext, IN PWSTR ArgumentString, IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo, OUT PUCHAR Again)
 
BOOLEAN NTAPI XboxVmpInitialize (PVOID HwDeviceExtension)
 
BOOLEAN NTAPI XboxVmpStartIO (PVOID HwDeviceExtension, PVIDEO_REQUEST_PACKET RequestPacket)
 
BOOLEAN NTAPI XboxVmpResetHw (PVOID DeviceExtension, ULONG Columns, ULONG Rows)
 
VP_STATUS NTAPI XboxVmpGetPowerState (PVOID HwDeviceExtension, ULONG HwId, PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
VP_STATUS NTAPI XboxVmpSetPowerState (PVOID HwDeviceExtension, ULONG HwId, PVIDEO_POWER_MANAGEMENT VideoPowerControl)
 
BOOLEAN FASTCALL XboxVmpSetCurrentMode (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpResetDevice (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpMapVideoMemory (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY RequestedAddress, PVIDEO_MEMORY_INFORMATION MapInformation, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpUnmapVideoMemory (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY VideoMemory, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpQueryNumAvailModes (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_NUM_MODES Modes, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpQueryAvailModes (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION ReturnedModes, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpQueryCurrentMode (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoModeInfo, PSTATUS_BLOCK StatusBlock)
 
BOOLEAN FASTCALL XboxVmpSetColorRegisters (PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_CLUT ColorLookUpTable, PSTATUS_BLOCK StatusBlock)
 

Macro Definition Documentation

◆ NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET

#define NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET   0x600800

Definition at line 28 of file xboxvmp.h.

◆ NV2A_CRTC_REGISTER_INDEX

#define NV2A_CRTC_REGISTER_INDEX   0x6013D4

Definition at line 29 of file xboxvmp.h.

◆ NV2A_CRTC_REGISTER_VALUE

#define NV2A_CRTC_REGISTER_VALUE   0x6013D5

Definition at line 30 of file xboxvmp.h.

◆ NV2A_RAMDAC_FP_HVALID_END

#define NV2A_RAMDAC_FP_HVALID_END   0x680838

Definition at line 31 of file xboxvmp.h.

◆ NV2A_RAMDAC_FP_VVALID_END

#define NV2A_RAMDAC_FP_VVALID_END   0x680818

Definition at line 32 of file xboxvmp.h.

◆ NV2A_VIDEO_MEMORY_SIZE

#define NV2A_VIDEO_MEMORY_SIZE   (4 * 1024 * 1024)

Definition at line 26 of file xboxvmp.h.

◆ PAGE_SIZE

#define PAGE_SIZE   4096

Definition at line 19 of file xboxvmp.h.

Typedef Documentation

◆ PXBOXVMP_DEVICE_EXTENSION

Function Documentation

◆ XboxVmpFindAdapter()

VP_STATUS NTAPI XboxVmpFindAdapter ( IN PVOID  HwDeviceExtension,
IN PVOID  HwContext,
IN PWSTR  ArgumentString,
IN OUT PVIDEO_PORT_CONFIG_INFO  ConfigInfo,
OUT PUCHAR  Again 
)

Definition at line 54 of file xboxvmp.c.

60 {
61  PXBOXVMP_DEVICE_EXTENSION XboxVmpDeviceExtension;
62  VIDEO_ACCESS_RANGE AccessRanges[3];
64  USHORT VendorId = 0x10DE; /* NVIDIA Corporation */
65  USHORT DeviceId = 0x02A0; /* NV2A XGPU */
66 
67  TRACE_(IHVVIDEO, "XboxVmpFindAdapter\n");
68 
69  XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension;
70 
71  Status = VideoPortGetAccessRanges(HwDeviceExtension, 0, NULL, 3, AccessRanges,
72  &VendorId, &DeviceId, NULL);
73 
74  if (Status == NO_ERROR)
75  {
76  XboxVmpDeviceExtension->PhysControlStart = AccessRanges[0].RangeStart;
77  XboxVmpDeviceExtension->ControlLength = AccessRanges[0].RangeLength;
78  XboxVmpDeviceExtension->PhysFrameBufferStart = AccessRanges[1].RangeStart;
79  }
80 
81  return Status;
82 }
PHYSICAL_ADDRESS PhysControlStart
Definition: xboxvmp.h:36
#define NO_ERROR
Definition: dderror.h:5
smooth NULL
Definition: ftsmooth.c:416
PHYSICAL_ADDRESS PhysFrameBufferStart
Definition: xboxvmp.h:39
#define TRACE_(x)
Definition: compat.h:66
Status
Definition: gdiplustypes.h:24
unsigned short USHORT
Definition: pedump.c:61
VPAPI VP_STATUS NTAPI VideoPortGetAccessRanges(IN PVOID HwDeviceExtension, IN ULONG NumRequestedResources, IN PIO_RESOURCE_DESCRIPTOR RequestedResources OPTIONAL, IN ULONG NumAccessRanges, OUT PVIDEO_ACCESS_RANGE AccessRanges, IN PVOID VendorId, IN PVOID DeviceId, OUT PULONG Slot)
struct XBOXVMP_DEVICE_EXTENSION * PXBOXVMP_DEVICE_EXTENSION
LONG VP_STATUS
Definition: video.h:153
ULONG RangeLength
Definition: video.h:216
PHYSICAL_ADDRESS RangeStart
Definition: video.h:215

Referenced by DriverEntry().

◆ XboxVmpGetPowerState()

VP_STATUS NTAPI XboxVmpGetPowerState ( PVOID  HwDeviceExtension,
ULONG  HwId,
PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 305 of file xboxvmp.c.

309 {
310  ERR_(IHVVIDEO, "XboxVmpGetPowerState is not supported\n");
311 
312  return ERROR_INVALID_FUNCTION;
313 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define ERR_(ch,...)
Definition: debug.h:156

Referenced by DriverEntry().

◆ XboxVmpInitialize()

BOOLEAN NTAPI XboxVmpInitialize ( PVOID  HwDeviceExtension)

Definition at line 93 of file xboxvmp.c.

95 {
96  PXBOXVMP_DEVICE_EXTENSION XboxVmpDeviceExtension;
97  ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
98  ULONG Length;
99 
100  TRACE_(IHVVIDEO, "XboxVmpInitialize\n");
101 
102  XboxVmpDeviceExtension = (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension;
103 
104  Length = XboxVmpDeviceExtension->ControlLength;
105  XboxVmpDeviceExtension->VirtControlStart = NULL;
106 
107  if (VideoPortMapMemory(HwDeviceExtension,
108  XboxVmpDeviceExtension->PhysControlStart,
109  &Length,
110  &inIoSpace,
111  &XboxVmpDeviceExtension->VirtControlStart) != NO_ERROR)
112  {
113  ERR_(IHVVIDEO, "Failed to map control memory\n");
114  return FALSE;
115  }
116 
117  INFO_(IHVVIDEO, "Mapped 0x%x bytes of control mem at 0x%x to virt addr 0x%x\n",
118  XboxVmpDeviceExtension->ControlLength,
119  XboxVmpDeviceExtension->PhysControlStart.u.LowPart,
120  XboxVmpDeviceExtension->VirtControlStart);
121 
122  return TRUE;
123 }
#define TRUE
Definition: types.h:120
#define INFO_(ch,...)
Definition: debug.h:159
#define ERR_(ch,...)
Definition: debug.h:156
PHYSICAL_ADDRESS PhysControlStart
Definition: xboxvmp.h:36
#define NO_ERROR
Definition: dderror.h:5
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:66
VPAPI VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN OUT PULONG Length, IN PULONG InIoSpace, IN OUT PVOID *VirtualAddress)
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
struct XBOXVMP_DEVICE_EXTENSION * PXBOXVMP_DEVICE_EXTENSION
unsigned int ULONG
Definition: retypes.h:1
#define VIDEO_MEMORY_SPACE_MEMORY
Definition: video.h:132
struct _LARGE_INTEGER::@2245 u

Referenced by DriverEntry().

◆ XboxVmpMapVideoMemory()

BOOLEAN FASTCALL XboxVmpMapVideoMemory ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MEMORY  RequestedAddress,
PVIDEO_MEMORY_INFORMATION  MapInformation,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 384 of file xboxvmp.c.

389 {
391  ULONG inIoSpace = VIDEO_MEMORY_SPACE_MEMORY;
392 
393  StatusBlock->Information = sizeof(VIDEO_MEMORY_INFORMATION);
394 
395  /* Reuse framebuffer that was set up by firmware */
397  /* Framebuffer address offset value is coming from the GPU within
398  * memory mapped I/O address space, so we're comparing only low
399  * 28 bits of the address within actual RAM address space */
400  FrameBuffer.QuadPart &= 0x0FFFFFFF;
401  if (FrameBuffer.QuadPart != 0x3C00000 && FrameBuffer.QuadPart != 0x7C00000)
402  {
403  /* Check framebuffer address (high 4 MB of either 64 or 128 MB RAM) */
404  WARN_(IHVVIDEO, "Non-standard framebuffer address 0x%p\n", FrameBuffer.QuadPart);
405  }
406  /* Verify that framebuffer address is page-aligned */
407  ASSERT(FrameBuffer.QuadPart % PAGE_SIZE == 0);
408 
409  /* Return the address back to GPU memory mapped I/O */
410  FrameBuffer.QuadPart += DeviceExtension->PhysFrameBufferStart.QuadPart;
411  MapInformation->VideoRamBase = RequestedAddress->RequestedVirtualAddress;
412  /* FIXME: obtain fb size from firmware somehow (Cromwell reserves high 4 MB of RAM) */
413  MapInformation->VideoRamLength = NV2A_VIDEO_MEMORY_SIZE;
414 
416  DeviceExtension,
417  FrameBuffer,
418  &MapInformation->VideoRamLength,
419  &inIoSpace,
420  &MapInformation->VideoRamBase);
421 
422  MapInformation->FrameBufferBase = MapInformation->VideoRamBase;
423  MapInformation->FrameBufferLength = MapInformation->VideoRamLength;
424 
425  /* Tell the nVidia controller about the framebuffer */
427 
428  INFO_(IHVVIDEO, "Mapped 0x%x bytes of phys mem at 0x%lx to virt addr 0x%p\n",
429  MapInformation->VideoRamLength, FrameBuffer.u.LowPart, MapInformation->VideoRamBase);
430 
431  return TRUE;
432 }
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
#define TRUE
Definition: types.h:120
#define INFO_(ch,...)
Definition: debug.h:159
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:274
NTKERNELAPI ULONG NTAPI READ_REGISTER_ULONG(IN PULONG Register)
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET
Definition: nv2a.h:18
PHYSICAL_ADDRESS PhysFrameBufferStart
Definition: xboxvmp.h:39
VPAPI VP_STATUS NTAPI VideoPortMapMemory(IN PVOID HwDeviceExtension, IN PHYSICAL_ADDRESS PhysicalAddress, IN OUT PULONG Length, IN PULONG InIoSpace, IN OUT PVOID *VirtualAddress)
struct _VIDEO_MEMORY_INFORMATION VIDEO_MEMORY_INFORMATION
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
PVOID FrameBuffer
Definition: xboxvideo.c:27
#define NV2A_VIDEO_MEMORY_SIZE
Definition: nv2a.h:16
#define PAGE_SIZE
Definition: env_spec_w32.h:49
unsigned int ULONG
Definition: retypes.h:1
#define VIDEO_MEMORY_SPACE_MEMORY
Definition: video.h:132
#define WARN_(ch,...)
Definition: debug.h:157
ULONG_PTR Information
Definition: video.h:326
LONGLONG QuadPart
Definition: typedefs.h:113

Referenced by XboxVmpStartIO().

◆ XboxVmpQueryAvailModes()

BOOLEAN FASTCALL XboxVmpQueryAvailModes ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE_INFORMATION  ReturnedModes,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 485 of file xboxvmp.c.

489 {
490  return XboxVmpQueryCurrentMode(DeviceExtension, VideoMode, StatusBlock);
491 }
BOOLEAN FASTCALL XboxVmpQueryCurrentMode(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:532

Referenced by XboxVmpStartIO().

◆ XboxVmpQueryCurrentMode()

BOOLEAN FASTCALL XboxVmpQueryCurrentMode ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE_INFORMATION  VideoModeInfo,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 532 of file xboxvmp.c.

536 {
538 
539  VideoMode->Length = sizeof(VIDEO_MODE_INFORMATION);
540  VideoMode->ModeIndex = 0;
541 
542  VideoMode->VisScreenWidth = READ_REGISTER_ULONG((ULONG_PTR)DeviceExtension->VirtControlStart + NV2A_RAMDAC_FP_HVALID_END) + 1;
543  VideoMode->VisScreenHeight = READ_REGISTER_ULONG((ULONG_PTR)DeviceExtension->VirtControlStart + NV2A_RAMDAC_FP_VVALID_END) + 1;
544 
545  if (VideoMode->VisScreenWidth <= 1 || VideoMode->VisScreenHeight <= 1)
546  {
547  ERR_(IHVVIDEO, "Cannot obtain current screen resolution!\n");
548  return FALSE;
549  }
550 
551  BytesPerPixel = NvGetBytesPerPixel(DeviceExtension, VideoMode->VisScreenWidth);
552  ASSERT(BytesPerPixel >= 1 && BytesPerPixel <= 4);
553 
554  VideoMode->ScreenStride = VideoMode->VisScreenWidth * BytesPerPixel;
555  VideoMode->NumberOfPlanes = 1;
556  VideoMode->BitsPerPlane = BytesPerPixel * 8;
557  VideoMode->Frequency = 1;
558  VideoMode->XMillimeter = 0; /* FIXME */
559  VideoMode->YMillimeter = 0; /* FIXME */
560  if (BytesPerPixel >= 3)
561  {
562  VideoMode->NumberRedBits = 8;
563  VideoMode->NumberGreenBits = 8;
564  VideoMode->NumberBlueBits = 8;
565  VideoMode->RedMask = 0xFF0000;
566  VideoMode->GreenMask = 0x00FF00;
567  VideoMode->BlueMask = 0x0000FF;
568  }
569  else
570  {
571  /* FIXME: not implemented */
572  WARN_(IHVVIDEO, "BytesPerPixel %d - not implemented\n", BytesPerPixel);
573  }
574  VideoMode->VideoMemoryBitmapWidth = VideoMode->VisScreenWidth;
575  VideoMode->VideoMemoryBitmapHeight = VideoMode->VisScreenHeight;
576  VideoMode->AttributeFlags = VIDEO_MODE_GRAPHICS | VIDEO_MODE_COLOR |
578  VideoMode->DriverSpecificAttributeFlags = 0;
579 
580  StatusBlock->Information = sizeof(VIDEO_MODE_INFORMATION);
581 
582  /* Verify that screen fits framebuffer size */
583  if (VideoMode->VisScreenWidth * VideoMode->VisScreenHeight * (VideoMode->BitsPerPlane / 8) > NV2A_VIDEO_MEMORY_SIZE)
584  {
585  ERR_(IHVVIDEO, "Current screen resolution exceeds video memory bounds!\n");
586  return FALSE;
587  }
588 
589  return TRUE;
590 }
#define TRUE
Definition: types.h:120
static ULONG BytesPerPixel
Definition: xboxvideo.c:31
#define ERR_(ch,...)
Definition: debug.h:156
NTKERNELAPI ULONG NTAPI READ_REGISTER_ULONG(IN PULONG Register)
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define VIDEO_MODE_NO_OFF_SCREEN
Definition: ntddvdeo.h:298
#define NV2A_RAMDAC_FP_VVALID_END
Definition: machxbox.h:49
UCHAR NvGetBytesPerPixel(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, ULONG ScreenWidth)
Definition: xboxvmp.c:503
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned char UCHAR
Definition: xmlstorage.h:181
#define NV2A_VIDEO_MEMORY_SIZE
Definition: nv2a.h:16
#define VIDEO_MODE_COLOR
Definition: ntddvdeo.h:293
#define NV2A_RAMDAC_FP_HVALID_END
Definition: machxbox.h:48
struct _VIDEO_MODE_INFORMATION VIDEO_MODE_INFORMATION
#define WARN_(ch,...)
Definition: debug.h:157
ULONG_PTR Information
Definition: video.h:326
#define VIDEO_MODE_GRAPHICS
Definition: ntddvdeo.h:294

Referenced by XboxVmpQueryAvailModes(), and XboxVmpStartIO().

◆ XboxVmpQueryNumAvailModes()

BOOLEAN FASTCALL XboxVmpQueryNumAvailModes ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_NUM_MODES  Modes,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 466 of file xboxvmp.c.

470 {
471  Modes->NumModes = 1;
472  Modes->ModeInformationLength = sizeof(VIDEO_MODE_INFORMATION);
473  StatusBlock->Information = sizeof(VIDEO_NUM_MODES);
474  return TRUE;
475 }
#define TRUE
Definition: types.h:120
struct _VIDEO_NUM_MODES VIDEO_NUM_MODES
static const VBE_MODE Modes[VBE_MODE_COUNT]
Definition: vbe.c:189
struct _VIDEO_MODE_INFORMATION VIDEO_MODE_INFORMATION
ULONG_PTR Information
Definition: video.h:326

Referenced by XboxVmpStartIO().

◆ XboxVmpResetDevice()

BOOLEAN FASTCALL XboxVmpResetDevice ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 366 of file xboxvmp.c.

369 {
370  /* There is nothing to be done here */
371 
372  return TRUE;
373 }
#define TRUE
Definition: types.h:120

Referenced by XboxVmpResetHw(), and XboxVmpStartIO().

◆ XboxVmpResetHw()

BOOLEAN NTAPI XboxVmpResetHw ( PVOID  DeviceExtension,
ULONG  Columns,
ULONG  Rows 
)

Definition at line 282 of file xboxvmp.c.

286 {
287  TRACE_(IHVVIDEO, "XboxVmpResetHw\n");
288 
289  if (!XboxVmpResetDevice((PXBOXVMP_DEVICE_EXTENSION)DeviceExtension, NULL))
290  {
291  return FALSE;
292  }
293 
294  return TRUE;
295 }
#define TRUE
Definition: types.h:120
BOOLEAN FASTCALL XboxVmpResetDevice(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:366
smooth NULL
Definition: ftsmooth.c:416
#define TRACE_(x)
Definition: compat.h:66

Referenced by DriverEntry().

◆ XboxVmpSetColorRegisters()

BOOLEAN FASTCALL XboxVmpSetColorRegisters ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_CLUT  ColorLookUpTable,
PSTATUS_BLOCK  StatusBlock 
)

◆ XboxVmpSetCurrentMode()

BOOLEAN FASTCALL XboxVmpSetCurrentMode ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MODE  RequestedMode,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 341 of file xboxvmp.c.

345 {
346  if (RequestedMode->RequestedMode != 0)
347  {
348  return FALSE;
349  }
350 
351  /* Nothing to do, really. We only support a single mode and we're already
352  * in that mode
353  */
354  return TRUE;
355 }
#define TRUE
Definition: types.h:120
ULONG RequestedMode
Definition: ntddvdeo.h:289

Referenced by XboxVmpStartIO().

◆ XboxVmpSetPowerState()

VP_STATUS NTAPI XboxVmpSetPowerState ( PVOID  HwDeviceExtension,
ULONG  HwId,
PVIDEO_POWER_MANAGEMENT  VideoPowerControl 
)

Definition at line 323 of file xboxvmp.c.

327 {
328  ERR_(IHVVIDEO, "XboxVmpSetPowerState not supported\n");
329 
330  return ERROR_INVALID_FUNCTION;
331 }
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define ERR_(ch,...)
Definition: debug.h:156

Referenced by DriverEntry().

◆ XboxVmpStartIO()

BOOLEAN NTAPI XboxVmpStartIO ( PVOID  HwDeviceExtension,
PVIDEO_REQUEST_PACKET  RequestPacket 
)

Definition at line 133 of file xboxvmp.c.

136 {
137  BOOLEAN Result;
138 
139  RequestPacket->StatusBlock->Status = ERROR_INVALID_PARAMETER;
140 
141  switch (RequestPacket->IoControlCode)
142  {
144  {
145  TRACE_(IHVVIDEO, "XboxVmpStartIO IOCTL_VIDEO_SET_CURRENT_MODE\n");
146 
147  if (RequestPacket->InputBufferLength < sizeof(VIDEO_MODE))
148  {
149  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
150  return TRUE;
151  }
152 
154  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
155  (PVIDEO_MODE)RequestPacket->InputBuffer,
156  RequestPacket->StatusBlock);
157  break;
158  }
159 
161  {
162  TRACE_(IHVVIDEO, "XboxVmpStartIO IOCTL_VIDEO_RESET_DEVICE\n");
163 
165  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
166  RequestPacket->StatusBlock);
167  break;
168  }
169 
171  {
172  TRACE_(IHVVIDEO, "XboxVmpStartIO IOCTL_VIDEO_MAP_VIDEO_MEMORY\n");
173 
174  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MEMORY_INFORMATION) ||
175  RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
176  {
177  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
178  return TRUE;
179  }
180 
182  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
183  (PVIDEO_MEMORY)RequestPacket->InputBuffer,
184  (PVIDEO_MEMORY_INFORMATION)RequestPacket->OutputBuffer,
185  RequestPacket->StatusBlock);
186  break;
187  }
188 
190  {
191  TRACE_(IHVVIDEO, "XboxVmpStartIO IOCTL_VIDEO_UNMAP_VIDEO_MEMORY\n");
192 
193  if (RequestPacket->InputBufferLength < sizeof(VIDEO_MEMORY))
194  {
195  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
196  return TRUE;
197  }
198 
200  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
201  (PVIDEO_MEMORY)RequestPacket->InputBuffer,
202  RequestPacket->StatusBlock);
203  break;
204  }
205 
207  {
208  TRACE_(IHVVIDEO, "XboxVmpStartIO IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES\n");
209 
210  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_NUM_MODES))
211  {
212  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
213  return TRUE;
214  }
215 
217  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
218  (PVIDEO_NUM_MODES)RequestPacket->OutputBuffer,
219  RequestPacket->StatusBlock);
220  break;
221  }
222 
224  {
225  TRACE_(IHVVIDEO, "XboxVmpStartIO IOCTL_VIDEO_QUERY_AVAIL_MODES\n");
226 
227  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
228  {
229  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
230  return TRUE;
231  }
232 
234  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
235  (PVIDEO_MODE_INFORMATION)RequestPacket->OutputBuffer,
236  RequestPacket->StatusBlock);
237  break;
238  }
239 
241  {
242  TRACE_(IHVVIDEO, "XboxVmpStartIO IOCTL_VIDEO_QUERY_CURRENT_MODE\n");
243 
244  if (RequestPacket->OutputBufferLength < sizeof(VIDEO_MODE_INFORMATION))
245  {
246  RequestPacket->StatusBlock->Status = ERROR_INSUFFICIENT_BUFFER;
247  return TRUE;
248  }
249 
251  (PXBOXVMP_DEVICE_EXTENSION)HwDeviceExtension,
252  (PVIDEO_MODE_INFORMATION)RequestPacket->OutputBuffer,
253  RequestPacket->StatusBlock);
254  break;
255  }
256 
257  default:
258  {
259  WARN_(IHVVIDEO, "XboxVmpStartIO 0x%x not implemented\n", RequestPacket->IoControlCode);
260 
261  RequestPacket->StatusBlock->Status = ERROR_INVALID_FUNCTION;
262  return FALSE;
263  }
264  }
265 
266  if (Result)
267  {
268  RequestPacket->StatusBlock->Status = NO_ERROR;
269  }
270 
271  return TRUE;
272 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
BOOLEAN FASTCALL XboxVmpQueryCurrentMode(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:532
#define ERROR_INVALID_FUNCTION
Definition: dderror.h:6
#define IOCTL_VIDEO_RESET_DEVICE
Definition: ntddvdeo.h:137
#define IOCTL_VIDEO_MAP_VIDEO_MEMORY
Definition: ntddvdeo.h:104
BOOLEAN FASTCALL XboxVmpSetCurrentMode(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE RequestedMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:341
ULONG InputBufferLength
Definition: video.h:333
#define NO_ERROR
Definition: dderror.h:5
BOOLEAN FASTCALL XboxVmpResetDevice(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:366
#define IOCTL_VIDEO_QUERY_CURRENT_MODE
Definition: ntddvdeo.h:113
#define IOCTL_VIDEO_SET_CURRENT_MODE
Definition: ntddvdeo.h:152
BOOLEAN FASTCALL XboxVmpQueryAvailModes(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MODE_INFORMATION VideoMode, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:485
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
ULONG OutputBufferLength
Definition: video.h:335
#define IOCTL_VIDEO_UNMAP_VIDEO_MEMORY
Definition: ntddvdeo.h:179
#define TRACE_(x)
Definition: compat.h:66
VP_STATUS Status
Definition: video.h:323
#define IOCTL_VIDEO_QUERY_NUM_AVAIL_MODES
Definition: ntddvdeo.h:122
#define IOCTL_VIDEO_QUERY_AVAIL_MODES
Definition: ntddvdeo.h:107
BOOLEAN FASTCALL XboxVmpQueryNumAvailModes(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_NUM_MODES Modes, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:466
PSTATUS_BLOCK StatusBlock
Definition: video.h:331
BOOLEAN FASTCALL XboxVmpMapVideoMemory(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY RequestedAddress, PVIDEO_MEMORY_INFORMATION MapInformation, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:384
BOOLEAN FASTCALL XboxVmpUnmapVideoMemory(PXBOXVMP_DEVICE_EXTENSION DeviceExtension, PVIDEO_MEMORY VideoMemory, PSTATUS_BLOCK StatusBlock)
Definition: xboxvmp.c:443
#define WARN_(ch,...)
Definition: debug.h:157
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by DriverEntry().

◆ XboxVmpUnmapVideoMemory()

BOOLEAN FASTCALL XboxVmpUnmapVideoMemory ( PXBOXVMP_DEVICE_EXTENSION  DeviceExtension,
PVIDEO_MEMORY  VideoMemory,
PSTATUS_BLOCK  StatusBlock 
)

Definition at line 443 of file xboxvmp.c.

447 {
449  DeviceExtension,
450  VideoMemory->RequestedVirtualAddress,
451  NULL);
452 
453  return TRUE;
454 }
#define TRUE
Definition: types.h:120
PVOID RequestedVirtualAddress
Definition: ntddvdeo.h:274
smooth NULL
Definition: ftsmooth.c:416
VPAPI VP_STATUS NTAPI VideoPortUnmapMemory(IN PVOID HwDeviceExtension, IN OUT PVOID VirtualAddress, IN HANDLE ProcessHandle)

Referenced by XboxVmpStartIO().