[FREELDR][XBOXVMP] Retrieve screen resolution directly from NV2A GPU (#1962)
[reactos.git] / win32ss / drivers / miniport / xboxvmp / xboxvmp.h
1 /*
2 * PROJECT: ReactOS Xbox miniport video driver
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Simple framebuffer driver for NVIDIA NV2A XGPU
5 * COPYRIGHT: Copyright 2004 Ge van Geldorp
6 * Copyright 2004 Filip Navara
7 * Copyright 2019 Stanislav Motylkov (x86corez@gmail.com)
8 */
9
10 #pragma once
11
12 /* INCLUDES *******************************************************************/
13
14 /*
15 * FIXME: specify headers properly in the triangle brackets and rearrange them
16 * in a way so it would be simpler to add NDK and other headers for debugging.
17 */
18 #include "ntdef.h"
19 #define PAGE_SIZE 4096
20 #include "dderror.h"
21 #include "devioctl.h"
22 #include "miniport.h"
23 #include "video.h"
24
25 #define NV2A_VIDEO_MEMORY_SIZE (4 * 1024 * 1024)
26
27 #define NV2A_CONTROL_FRAMEBUFFER_ADDRESS_OFFSET 0x600800
28 #define NV2A_CRTC_REGISTER_INDEX 0x6013D4
29 #define NV2A_CRTC_REGISTER_VALUE 0x6013D5
30 #define NV2A_RAMDAC_FP_HVALID_END 0x680838
31 #define NV2A_RAMDAC_FP_VVALID_END 0x680818
32
33 typedef struct
34 {
35 PHYSICAL_ADDRESS PhysControlStart;
36 ULONG ControlLength;
37 PVOID VirtControlStart;
38 PHYSICAL_ADDRESS PhysFrameBufferStart;
39 } XBOXVMP_DEVICE_EXTENSION, *PXBOXVMP_DEVICE_EXTENSION;
40
41 VP_STATUS
42 NTAPI
43 XboxVmpFindAdapter(
44 IN PVOID HwDeviceExtension,
45 IN PVOID HwContext,
46 IN PWSTR ArgumentString,
47 IN OUT PVIDEO_PORT_CONFIG_INFO ConfigInfo,
48 OUT PUCHAR Again);
49
50 BOOLEAN
51 NTAPI
52 XboxVmpInitialize(
53 PVOID HwDeviceExtension);
54
55 BOOLEAN
56 NTAPI
57 XboxVmpStartIO(
58 PVOID HwDeviceExtension,
59 PVIDEO_REQUEST_PACKET RequestPacket);
60
61 BOOLEAN
62 NTAPI
63 XboxVmpResetHw(
64 PVOID DeviceExtension,
65 ULONG Columns,
66 ULONG Rows);
67
68 VP_STATUS
69 NTAPI
70 XboxVmpGetPowerState(
71 PVOID HwDeviceExtension,
72 ULONG HwId,
73 PVIDEO_POWER_MANAGEMENT VideoPowerControl);
74
75 VP_STATUS
76 NTAPI
77 XboxVmpSetPowerState(
78 PVOID HwDeviceExtension,
79 ULONG HwId,
80 PVIDEO_POWER_MANAGEMENT VideoPowerControl);
81
82 BOOLEAN
83 FASTCALL
84 XboxVmpSetCurrentMode(
85 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
86 PVIDEO_MODE RequestedMode,
87 PSTATUS_BLOCK StatusBlock);
88
89 BOOLEAN
90 FASTCALL
91 XboxVmpResetDevice(
92 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
93 PSTATUS_BLOCK StatusBlock);
94
95 BOOLEAN
96 FASTCALL
97 XboxVmpMapVideoMemory(
98 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
99 PVIDEO_MEMORY RequestedAddress,
100 PVIDEO_MEMORY_INFORMATION MapInformation,
101 PSTATUS_BLOCK StatusBlock);
102
103 BOOLEAN
104 FASTCALL
105 XboxVmpUnmapVideoMemory(
106 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
107 PVIDEO_MEMORY VideoMemory,
108 PSTATUS_BLOCK StatusBlock);
109
110 BOOLEAN
111 FASTCALL
112 XboxVmpQueryNumAvailModes(
113 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
114 PVIDEO_NUM_MODES Modes,
115 PSTATUS_BLOCK StatusBlock);
116
117 BOOLEAN
118 FASTCALL
119 XboxVmpQueryAvailModes(
120 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
121 PVIDEO_MODE_INFORMATION ReturnedModes,
122 PSTATUS_BLOCK StatusBlock);
123
124 BOOLEAN
125 FASTCALL
126 XboxVmpQueryCurrentMode(
127 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
128 PVIDEO_MODE_INFORMATION VideoModeInfo,
129 PSTATUS_BLOCK StatusBlock);
130
131 BOOLEAN
132 FASTCALL
133 XboxVmpSetColorRegisters(
134 PXBOXVMP_DEVICE_EXTENSION DeviceExtension,
135 PVIDEO_CLUT ColorLookUpTable,
136 PSTATUS_BLOCK StatusBlock);
137
138 /* EOF */