ReactOS 0.4.16-dev-2293-g4d8327b
sgpc.cpp File Reference
#include "driver.h"
Include dependency graph for sgpc.cpp:

Go to the source code of this file.

Functions

NTSTATUS NTAPI HDAGraphics_EvtIoTargetQueryRemove (WDFIOTARGET ioTarget)
 
void NTAPI HDAGraphics_EvtIoTargetRemoveCanceled (WDFIOTARGET ioTarget)
 
void NTAPI HDAGraphics_EvtIoTargetRemoveComplete (WDFIOTARGET ioTarget)
 
void HDAGraphicsPowerNotificationCallback (PVOID GraphicsDeviceHandle, DEVICE_POWER_STATE NewGrfxPowerState, BOOLEAN PreNotification, PVOID PrivateHandle)
 
void HDAGraphicsPowerRemovalNotificationCallback (PVOID GraphicsDeviceHandle, PVOID PrivateHandle)
 
void NTAPI Fdo_EnumerateCodec (PFDO_CONTEXT fdoCtx, UINT8 addr)
 
void NTAPI EjectGraphicsCodec (PFDO_CONTEXT fdoCtx)
 
void NTAPI EnumerateGraphicsCodec (PFDO_CONTEXT fdoCtx)
 
void HDAGraphicsPowerFStateNotificationCallback (PVOID GraphicsDeviceHandle, ULONG ComponentIndex, UINT NewFState, BOOLEAN PreNotification, PVOID PrivateHandle)
 
void HDAGraphicsPowerInitialComponentStateCallback (PVOID GraphicsDeviceHandle, PVOID PrivateHandle, ULONG ComponentIndex, BOOLEAN IsBlockingType, UINT InitialFState, GUID ComponentGuid, UINT PowerComponentMappingFlag)
 
void NTAPI HDAGraphicsPowerInterfaceAdd (WDFWORKITEM WorkItem)
 
NTSTATUS NTAPI HDAGraphicsPowerInterfaceCallback (PVOID NotificationStruct, PVOID Context)
 
void CheckHDAGraphicsRegistryKeys (PFDO_CONTEXT fdoCtx)
 

Function Documentation

◆ CheckHDAGraphicsRegistryKeys()

void CheckHDAGraphicsRegistryKeys ( PFDO_CONTEXT  fdoCtx)

Definition at line 313 of file sgpc.cpp.

313 {
315 WDFKEY driverKey;
316 status = WdfDeviceOpenRegistryKey(fdoCtx->WdfDevice, PLUGPLAY_REGKEY_DRIVER, READ_CONTROL, NULL, &driverKey);
317 if (!NT_SUCCESS(status)) {
318 return;
319 }
320
321 WDFKEY settingsKey;
322 DECLARE_CONST_UNICODE_STRING(DriverSettings, L"Settings");
323 DECLARE_CONST_UNICODE_STRING(GfxSharedCodecAddress, L"GfxSharedCodecAddress");
324 status = WdfRegistryOpenKey(driverKey, &DriverSettings, READ_CONTROL, NULL, &settingsKey);
325 if (!NT_SUCCESS(status)) {
326 goto closeDriverKey;
327 }
328
329 ULONG GfxCodecAddr;
330 status = WdfRegistryQueryULong(settingsKey, &GfxSharedCodecAddress, &GfxCodecAddr);
331 if (NT_SUCCESS(status)) {
332 fdoCtx->UseSGPCCodec = TRUE;
333 fdoCtx->GraphicsCodecAddress = GfxCodecAddr;
334 }
335
336 WdfRegistryClose(settingsKey);
337
338closeDriverKey:
339 WdfRegistryClose(driverKey);
340}
LONG NTSTATUS
Definition: precomp.h:26
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
#define READ_CONTROL
Definition: nt_native.h:58
WDFDEVICE WdfDevice
Definition: fdo.h:115
ULONG GraphicsCodecAddress
Definition: fdo.h:130
BOOLEAN UseSGPCCodec
Definition: fdo.h:131
Definition: ps.c:97
uint32_t ULONG
Definition: typedefs.h:59
#define PLUGPLAY_REGKEY_DRIVER
Definition: usbd.c:42
#define DECLARE_CONST_UNICODE_STRING(_variablename, _string)
Definition: wdfcore.h:161

Referenced by Fdo_Create().

◆ EjectGraphicsCodec()

void NTAPI EjectGraphicsCodec ( PFDO_CONTEXT  fdoCtx)

Definition at line 93 of file sgpc.cpp.

93 {
94 if (!fdoCtx->UseSGPCCodec) {
95 return;
96 }
97
98 if (!fdoCtx->codecs[fdoCtx->GraphicsCodecAddress])
99 return;
100
102
104 // Initialize the description with the information about the detected codec.
105 //
107 &description.Header,
108 sizeof(description)
109 );
110
111 description.FdoContext = fdoCtx;
112 RtlCopyMemory(&description.CodecIds, &fdoCtx->codecs[fdoCtx->GraphicsCodecAddress]->CodecIds, sizeof(description.CodecIds));
113
114 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
115 "Ejecting Gfx Codec\n");
116
117 WdfInterruptAcquireLock(fdoCtx->Interrupt);
118
119 WdfChildListUpdateChildDescriptionAsMissing(WdfFdoGetDefaultChildList(fdoCtx->WdfDevice), &description.Header);
120 //Don't null FdoContext to allow SGPC Audio driver to unregister callbacks / events and cleanup
121
122 WdfInterruptReleaseLock(fdoCtx->Interrupt);
123
124}
#define FALSE
Definition: types.h:117
#define SklHdAudBusPrint(dbglevel, fmt,...)
Definition: driver.h:111
BOOLEAN GraphicsCodecConnected
Definition: fdo.h:132
struct _PDO_DEVICE_DATA * codecs[HDA_MAX_CODECS]
Definition: fdo.h:150
WDFINTERRUPT Interrupt
Definition: fdo.h:124
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
FORCEINLINE VOID WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER_INIT(_Out_ PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Header, _In_ ULONG IdentificationDescriptionSize)
Definition: wdfchildlist.h:83
const char * description
Definition: directx.c:2497

Referenced by HDAGraphicsPowerFStateNotificationCallback().

◆ EnumerateGraphicsCodec()

void NTAPI EnumerateGraphicsCodec ( PFDO_CONTEXT  fdoCtx)

Definition at line 128 of file sgpc.cpp.

128 {
129 if (!fdoCtx->UseSGPCCodec) {
130 return;
131 }
132 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
133 "Enumerating Gfx Codec\n");
136}
unsigned char UINT8
Definition: actypes.h:128
void NTAPI Fdo_EnumerateCodec(PFDO_CONTEXT fdoCtx, UINT8 addr)
Definition: fdo.cpp:680

Referenced by HDAGraphicsPowerFStateNotificationCallback(), and HDAGraphicsPowerInitialComponentStateCallback().

◆ Fdo_EnumerateCodec()

void NTAPI Fdo_EnumerateCodec ( PFDO_CONTEXT  fdoCtx,
UINT8  addr 
)

Definition at line 680 of file fdo.cpp.

684{
685 UINT32 cmdTmpl = (addr << 28) | (AC_NODE_ROOT << 20) |
686 (AC_VERB_PARAMETERS << 8);
687 ULONG funcType = 0, vendorDevice, subsysId, revId, nodeCount;
688 if (!NT_SUCCESS(RunSingleHDACmd(fdoCtx, cmdTmpl | AC_PAR_VENDOR_ID, &vendorDevice))) {
689 return;
690 }
691 if (!NT_SUCCESS(RunSingleHDACmd(fdoCtx, cmdTmpl | AC_PAR_REV_ID, &revId))) {
692 return;
693 }
694 if (!NT_SUCCESS(RunSingleHDACmd(fdoCtx, cmdTmpl | AC_PAR_NODE_COUNT, &nodeCount))) {
695 return;
696 }
697
698 fdoCtx->numCodecs += 1;
699
700 UINT8 startID = (nodeCount >> 16) & 0xFF;
701 nodeCount = (nodeCount & 0x7FFF);
702
703 UINT16 mainFuncGrp = 0;
704 {
705 UINT16 nid = startID;
706 for (UINT32 i = 0; i < nodeCount; i++, nid++) {
707 UINT32 cmd = (addr << 28) | (nid << 20) |
709 if (!NT_SUCCESS(RunSingleHDACmd(fdoCtx, cmd, &funcType))) {
710 continue;
711 }
712 switch (funcType & 0xFF) {
715 mainFuncGrp = nid;
716 break;
717 }
718 }
719 }
720
721 UINT32 cmd = (addr << 28) | (mainFuncGrp << 20) |
723 RunSingleHDACmd(fdoCtx, cmd, &subsysId);
724
726 //
727 // Initialize the description with the information about the detected codec.
728 //
730 &description.Header,
731 sizeof(description)
732 );
733
734 description.FdoContext = fdoCtx;
735
736 description.CodecIds.CtlrDevId = fdoCtx->devId;
737 description.CodecIds.CtlrVenId = fdoCtx->venId;
738
739 description.CodecIds.CodecAddress = addr;
740 if (fdoCtx->UseSGPCCodec && addr == fdoCtx->GraphicsCodecAddress)
741 description.CodecIds.IsGraphicsCodec = TRUE;
742 else
743 description.CodecIds.IsGraphicsCodec = FALSE;
744
745 description.CodecIds.FunctionGroupStartNode = startID;
746
747 description.CodecIds.IsDSP = FALSE;
748
749 description.CodecIds.FuncId = funcType & 0xFF;
750 description.CodecIds.VenId = (vendorDevice >> 16) & 0xFFFF;
751 description.CodecIds.DevId = vendorDevice & 0xFFFF;
752 description.CodecIds.SubsysId = subsysId;
753 description.CodecIds.RevId = (revId >> 8) & 0xFFFF;
754
755 //
756 // Call the framework to add this child to the childlist. This call
757 // will internaly call our DescriptionCompare callback to check
758 // whether this device is a new device or existing device. If
759 // it's a new device, the framework will call DescriptionDuplicate to create
760 // a copy of this description in nonpaged pool.
761 // The actual creation of the child device will happen when the framework
762 // receives QUERY_DEVICE_RELATION request from the PNP manager in
763 // response to InvalidateDeviceRelations call made as part of adding
764 // a new child.
765 //
766 WdfChildListAddOrUpdateChildDescriptionAsPresent(
767 WdfFdoGetDefaultChildList(fdoCtx->WdfDevice), &description.Header,
768 NULL); // AddressDescription
769}
unsigned short UINT16
Definition: actypes.h:129
GLenum const GLvoid * addr
Definition: glext.h:9621
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define AC_NODE_ROOT
Definition: hda_verbs.h:4
#define AC_VERB_GET_SUBSYSTEM_ID
Definition: hda_verbs.h:45
#define AC_PAR_NODE_COUNT
Definition: hda_verbs.h:106
#define AC_PAR_VENDOR_ID
Definition: hda_verbs.h:103
#define AC_PAR_FUNCTION_TYPE
Definition: hda_verbs.h:107
#define AC_PAR_REV_ID
Definition: hda_verbs.h:105
@ AC_GRP_AUDIO_FUNCTION
Definition: hda_verbs.h:10
@ AC_GRP_MODEM_FUNCTION
Definition: hda_verbs.h:11
#define AC_VERB_PARAMETERS
Definition: hda_verbs.h:21
NTSTATUS RunSingleHDACmd(PFDO_CONTEXT fdoCtx, ULONG val, ULONG *res)
NOTIFYICONDATA nid
Definition: magnifier.c:44
USHORT numCodecs
Definition: fdo.h:161
UINT16 venId
Definition: fdo.h:117
UINT16 devId
Definition: fdo.h:118
Definition: ftp_var.h:139
uint32_t UINT32
Definition: typedefs.h:59

Referenced by EnumerateGraphicsCodec(), and Fdo_EvtDeviceSelfManagedIoInit().

◆ HDAGraphics_EvtIoTargetQueryRemove()

NTSTATUS NTAPI HDAGraphics_EvtIoTargetQueryRemove ( WDFIOTARGET  ioTarget)

Definition at line 5 of file sgpc.cpp.

7 {
8 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
9 "Device Removal Notification\n");
10
11 WdfIoTargetCloseForQueryRemove(ioTarget);
12 return STATUS_SUCCESS;
13}
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by HDAGraphicsPowerInterfaceAdd().

◆ HDAGraphics_EvtIoTargetRemoveCanceled()

void NTAPI HDAGraphics_EvtIoTargetRemoveCanceled ( WDFIOTARGET  ioTarget)

Definition at line 17 of file sgpc.cpp.

19 {
22 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
23 "Device Removal Cancel\n");
24
26
27 status = WdfIoTargetOpen(ioTarget, &openParams);
28
29 if (!NT_SUCCESS(status)) {
30 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
31 "WdfIoTargetOpen failed 0x%x\n", status);
32 WdfObjectDelete(ioTarget);
33 return;
34 }
35}
WDF_IO_TARGET_OPEN_PARAMS openParams
FORCEINLINE VOID WDF_IO_TARGET_OPEN_PARAMS_INIT_REOPEN(_Out_ PWDF_IO_TARGET_OPEN_PARAMS Params)
Definition: wdfiotarget.h:340

Referenced by HDAGraphicsPowerInterfaceAdd().

◆ HDAGraphics_EvtIoTargetRemoveComplete()

void NTAPI HDAGraphics_EvtIoTargetRemoveComplete ( WDFIOTARGET  ioTarget)

Definition at line 39 of file sgpc.cpp.

41 {
42 PFDO_CONTEXT fdoCtx;
43 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
44 "Device Removal Complete\n");
45
46 PGRAPHICSIOTARGET_CONTEXT ioTargetContext;
47 ioTargetContext = GraphicsIoTarget_GetContext(ioTarget);
48
49 fdoCtx = ioTargetContext->FdoContext;
50
52 WdfCollectionRemove(fdoCtx->GraphicsDevicesCollection, ioTarget);
53 WdfWaitLockRelease(fdoCtx->GraphicsDevicesCollectionWaitLock);
54
55 WdfObjectDelete(ioTarget);
56}
WDFWAITLOCK GraphicsDevicesCollectionWaitLock
Definition: fdo.h:128
WDFCOLLECTION GraphicsDevicesCollection
Definition: fdo.h:129
struct _FDO_CONTEXT * FdoContext
Definition: fdo.h:108
_Must_inspect_result_ FORCEINLINE NTSTATUS WdfWaitLockAcquire(_In_ _Requires_lock_not_held_(_Curr_) WDFWAITLOCK Lock, _In_opt_ PLONGLONG Timeout)
Definition: wdfsync.h:173

Referenced by HDAGraphicsPowerInterfaceAdd().

◆ HDAGraphicsPowerFStateNotificationCallback()

void HDAGraphicsPowerFStateNotificationCallback ( PVOID  GraphicsDeviceHandle,
ULONG  ComponentIndex,
UINT  NewFState,
BOOLEAN  PreNotification,
PVOID  PrivateHandle 
)

Definition at line 138 of file sgpc.cpp.

144 {
145 PFDO_CONTEXT fdoCtx = (PFDO_CONTEXT)PrivateHandle;
146 UNREFERENCED_PARAMETER(GraphicsDeviceHandle);
147 UNREFERENCED_PARAMETER(ComponentIndex);
148 if (NewFState) {
149 if (PreNotification) {
150 EjectGraphicsCodec(fdoCtx);
151 }
152 else {
153
154 }
155 }
156 else {
157 if (PreNotification) {
158
159 }
160 else {
162 }
163 }
164}
struct _FDO_CONTEXT * PFDO_CONTEXT
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
void NTAPI EnumerateGraphicsCodec(PFDO_CONTEXT fdoCtx)
Definition: sgpc.cpp:128
void NTAPI EjectGraphicsCodec(PFDO_CONTEXT fdoCtx)
Definition: sgpc.cpp:93

Referenced by HDAGraphicsPowerInterfaceAdd().

◆ HDAGraphicsPowerInitialComponentStateCallback()

void HDAGraphicsPowerInitialComponentStateCallback ( PVOID  GraphicsDeviceHandle,
PVOID  PrivateHandle,
ULONG  ComponentIndex,
BOOLEAN  IsBlockingType,
UINT  InitialFState,
GUID  ComponentGuid,
UINT  PowerComponentMappingFlag 
)

Definition at line 166 of file sgpc.cpp.

174 {
175 UNREFERENCED_PARAMETER(GraphicsDeviceHandle);
176 UNREFERENCED_PARAMETER(ComponentIndex);
177 UNREFERENCED_PARAMETER(IsBlockingType);
178 UNREFERENCED_PARAMETER(ComponentGuid);
179 PFDO_CONTEXT fdoCtx = (PFDO_CONTEXT)PrivateHandle;
180 if (PowerComponentMappingFlag) {
181 }
182 else {
183 if (InitialFState) {
184 } else {
186 }
187 }
188}

Referenced by HDAGraphicsPowerInterfaceAdd().

◆ HDAGraphicsPowerInterfaceAdd()

void NTAPI HDAGraphicsPowerInterfaceAdd ( WDFWORKITEM  WorkItem)

Definition at line 192 of file sgpc.cpp.

192 {
193 PGRAPHICSWORKITEM_CONTEXT workItemContext = GraphicsWorkitem_GetContext(WorkItem);
194 PFDO_CONTEXT fdoCtx = workItemContext->FdoContext;
195 PUNICODE_STRING graphicsDeviceSymlink = &workItemContext->GPUDeviceSymlink;
196
197 WDF_OBJECT_ATTRIBUTES attributes;
199
200 WDFIOTARGET ioTarget;
202 PGRAPHICSIOTARGET_CONTEXT ioTargetContext;
203
204 NTSTATUS status = WdfIoTargetCreate(fdoCtx->WdfDevice, &attributes, &ioTarget);
205 if (!NT_SUCCESS(status)) {
206 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
207 "WdfIoTargetCreate failed 0x%x\n", status);
208 goto exit;
209 }
210
211 ioTargetContext = GraphicsIoTarget_GetContext(ioTarget);
212 ioTargetContext->FdoContext = fdoCtx;
213
215 &openParams,
216 graphicsDeviceSymlink,
222
223 status = WdfIoTargetOpen(ioTarget, &openParams);
224
225 if (!NT_SUCCESS(status)) {
226 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
227 "WdfIoTargetOpen failed with status 0x%x\n", status);
228 WdfObjectDelete(ioTarget);
229 goto exit;
230 }
231
233 WdfCollectionAdd(fdoCtx->GraphicsDevicesCollection, ioTarget);
234 WdfWaitLockRelease(fdoCtx->GraphicsDevicesCollectionWaitLock);
235
236 DXGK_GRAPHICSPOWER_REGISTER_INPUT graphicsPowerRegisterInput;
237 graphicsPowerRegisterInput = { 0 };
238 graphicsPowerRegisterInput.Version = DXGK_GRAPHICSPOWER_VERSION;
239 graphicsPowerRegisterInput.PrivateHandle = fdoCtx;
240 graphicsPowerRegisterInput.PowerNotificationCb = HDAGraphicsPowerNotificationCallback;
241 graphicsPowerRegisterInput.RemovalNotificationCb = HDAGraphicsPowerRemovalNotificationCallback;
242 graphicsPowerRegisterInput.FStateNotificationCb = HDAGraphicsPowerFStateNotificationCallback;
243 graphicsPowerRegisterInput.InitialComponentStateCb = HDAGraphicsPowerInitialComponentStateCallback;
244
245 WDF_MEMORY_DESCRIPTOR inputDescriptor;
246 WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&inputDescriptor, &graphicsPowerRegisterInput, sizeof(graphicsPowerRegisterInput));
247
248 WDF_MEMORY_DESCRIPTOR outputDescriptor;
249 WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(&outputDescriptor, &ioTargetContext->graphicsPowerRegisterOutput, sizeof(ioTargetContext->graphicsPowerRegisterOutput));
250
251 status = WdfIoTargetSendInternalIoctlSynchronously(ioTarget,
253 IOCTL_INTERNAL_GRAPHICSPOWER_REGISTER,
254 &inputDescriptor, &outputDescriptor, NULL, NULL);
255 if (!NT_SUCCESS(status)) {
256 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
257 "IOCTL_INTERNAL_GRAPHICSPOWER_REGISTER failed with status 0x%x\n", status);
258 goto exit;
259 }
260
261exit:
262 WdfObjectDelete(WorkItem);
263}
#define FILE_SHARE_READ
Definition: compat.h:136
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define STANDARD_RIGHTS_ALL
Definition: nt_native.h:69
#define exit(n)
Definition: config.h:202
void NTAPI HDAGraphics_EvtIoTargetRemoveComplete(WDFIOTARGET ioTarget)
Definition: sgpc.cpp:39
void HDAGraphicsPowerFStateNotificationCallback(PVOID GraphicsDeviceHandle, ULONG ComponentIndex, UINT NewFState, BOOLEAN PreNotification, PVOID PrivateHandle)
Definition: sgpc.cpp:138
void NTAPI HDAGraphics_EvtIoTargetRemoveCanceled(WDFIOTARGET ioTarget)
Definition: sgpc.cpp:17
void HDAGraphicsPowerRemovalNotificationCallback(PVOID GraphicsDeviceHandle, PVOID PrivateHandle)
Definition: sgpc.cpp:74
void HDAGraphicsPowerInitialComponentStateCallback(PVOID GraphicsDeviceHandle, PVOID PrivateHandle, ULONG ComponentIndex, BOOLEAN IsBlockingType, UINT InitialFState, GUID ComponentGuid, UINT PowerComponentMappingFlag)
Definition: sgpc.cpp:166
void HDAGraphicsPowerNotificationCallback(PVOID GraphicsDeviceHandle, DEVICE_POWER_STATE NewGrfxPowerState, BOOLEAN PreNotification, PVOID PrivateHandle)
Definition: sgpc.cpp:59
NTSTATUS NTAPI HDAGraphics_EvtIoTargetQueryRemove(WDFIOTARGET ioTarget)
Definition: sgpc.cpp:5
DXGK_GRAPHICSPOWER_REGISTER_OUTPUT graphicsPowerRegisterOutput
Definition: fdo.h:109
UNICODE_STRING GPUDeviceSymlink
Definition: fdo.h:102
struct _FDO_CONTEXT * FdoContext
Definition: fdo.h:101
PFN_WDF_IO_TARGET_QUERY_REMOVE EvtIoTargetQueryRemove
Definition: wdfiotarget.h:140
PFN_WDF_IO_TARGET_REMOVE_CANCELED EvtIoTargetRemoveCanceled
Definition: wdfiotarget.h:146
PFN_WDF_IO_TARGET_REMOVE_COMPLETE EvtIoTargetRemoveComplete
Definition: wdfiotarget.h:152
FORCEINLINE VOID WDF_IO_TARGET_OPEN_PARAMS_INIT_OPEN_BY_NAME(_Out_ PWDF_IO_TARGET_OPEN_PARAMS Params, _In_ PCUNICODE_STRING TargetDeviceName, _In_ ACCESS_MASK DesiredAccess)
Definition: wdfiotarget.h:323
FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_BUFFER(_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ PVOID Buffer, _In_ ULONG BufferLength)
Definition: wdfmemory.h:102
#define WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:170
#define WDF_NO_HANDLE
Definition: wdftypes.h:107
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:115

Referenced by HDAGraphicsPowerInterfaceCallback().

◆ HDAGraphicsPowerInterfaceCallback()

NTSTATUS NTAPI HDAGraphicsPowerInterfaceCallback ( PVOID  NotificationStruct,
PVOID  Context 
)

Definition at line 267 of file sgpc.cpp.

270 {
273 PDEVICE_INTERFACE_CHANGE_NOTIFICATION devNotificationStruct = (PDEVICE_INTERFACE_CHANGE_NOTIFICATION)NotificationStruct;
274
275 if (!IsEqualGUID(devNotificationStruct->InterfaceClassGuid, GUID_DEVINTERFACE_GRAPHICSPOWER)) {
277 }
278
279 if (IsEqualGUID(devNotificationStruct->Event, GUID_DEVICE_INTERFACE_ARRIVAL)) {
280 SklHdAudBusPrint(DEBUG_LEVEL_INFO, DBG_INIT,
281 "Graphics Arrival Notification!\n");
282
283 status = RtlUnicodeStringValidate(devNotificationStruct->SymbolicLinkName);
284 if (!NT_SUCCESS(status)) {
285 return status;
286 }
287
288 WDF_WORKITEM_CONFIG workItemConfig;
290
291 WDF_OBJECT_ATTRIBUTES attributes;
292 WDFWORKITEM workItem;
293
294 WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
296 &attributes,
298 );
299 attributes.ParentObject = fdoCtx->WdfDevice;
300
301 WdfWorkItemCreate(&workItemConfig, &attributes, &workItem);
302
303 PGRAPHICSWORKITEM_CONTEXT workItemContext = GraphicsWorkitem_GetContext(workItem);
304 workItemContext->FdoContext = fdoCtx;
305 workItemContext->GPUDeviceSymlink = *devNotificationStruct->SymbolicLinkName;
306
307 WdfWorkItemEnqueue(workItem);
308 }
309
310 return status;
311}
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
const GUID GUID_DEVICE_INTERFACE_ARRIVAL
Definition: deviface.c:14
NTSTRSAFEAPI RtlUnicodeStringValidate(PCUNICODE_STRING SourceString)
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
void NTAPI HDAGraphicsPowerInterfaceAdd(WDFWORKITEM WorkItem)
Definition: sgpc.cpp:192
WDFOBJECT ParentObject
Definition: wdfobject.h:130
FORCEINLINE VOID WDF_OBJECT_ATTRIBUTES_INIT(_Out_ PWDF_OBJECT_ATTRIBUTES Attributes)
Definition: wdfobject.h:147
#define WDF_OBJECT_ATTRIBUTES_SET_CONTEXT_TYPE(_attributes, _contexttype)
Definition: wdfobject.h:157
FORCEINLINE VOID WDF_WORKITEM_CONFIG_INIT(_Out_ PWDF_WORKITEM_CONFIG Config, _In_ PFN_WDF_WORKITEM EvtWorkItemFunc)
Definition: wdfworkitem.h:85
struct _DEVICE_INTERFACE_CHANGE_NOTIFICATION * PDEVICE_INTERFACE_CHANGE_NOTIFICATION

Referenced by Fdo_EvtDeviceSelfManagedIoInit().

◆ HDAGraphicsPowerNotificationCallback()

void HDAGraphicsPowerNotificationCallback ( PVOID  GraphicsDeviceHandle,
DEVICE_POWER_STATE  NewGrfxPowerState,
BOOLEAN  PreNotification,
PVOID  PrivateHandle 
)

Definition at line 59 of file sgpc.cpp.

64 {
65 PFDO_CONTEXT fdoCtx = (PFDO_CONTEXT)PrivateHandle;
66 UNREFERENCED_PARAMETER(GraphicsDeviceHandle);
67 UNREFERENCED_PARAMETER(NewGrfxPowerState);
68 UNREFERENCED_PARAMETER(PreNotification);
70 //No-Op
71}

Referenced by HDAGraphicsPowerInterfaceAdd().

◆ HDAGraphicsPowerRemovalNotificationCallback()

void HDAGraphicsPowerRemovalNotificationCallback ( PVOID  GraphicsDeviceHandle,
PVOID  PrivateHandle 
)

Definition at line 74 of file sgpc.cpp.

77 {
78 PFDO_CONTEXT fdoCtx = (PFDO_CONTEXT)PrivateHandle;
79 UNREFERENCED_PARAMETER(GraphicsDeviceHandle);
81 //No-Op
82}

Referenced by HDAGraphicsPowerInterfaceAdd().