-
Notifications
You must be signed in to change notification settings - Fork 5k
Handling KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE on avscamera DMFT #1325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ng behavior on camera DMFT.
} | ||
done: | ||
return hr; | ||
return S_OK; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If source device return failed on the following, hr won't hold S_OK here. I would assume if source device returned failed, but the DMFT itself supports the KsEvent, it should reply OK.
&& (pEvent->Id == KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE)) | ||
{ | ||
|
||
m_hSelectedProfileKSEvent = nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FALSE, | ||
DUPLICATE_SAME_ACCESS) == false) | ||
{ | ||
return E_INVALIDARG; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (pProperty->Id == KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE) | ||
{ | ||
DMFTCHECKHR_GOTO(ProfilePropertyHandler(pProperty, ulPropertyLength, pvPropertyData, ulDataLength, pulBytesReturned), done); | ||
goto done; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: only use goto for error case
} | ||
if (m_isProfileDDISupportedInBaseDriver.value_or(true)) | ||
{ | ||
m_hSelectedProfileKSEventSentToDriver = CreateEventExW( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UNREFERENCED_PARAMETER(ulPropertyLength); | ||
HRESULT hr = S_OK; | ||
|
||
if (pProperty->Flags & KSPROPERTY_TYPE_SET) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check size
// Deref on the connected outpins to break reference loop | ||
(VOID)pInPin->ShutdownPin(); | ||
} | ||
return ShutdownEventGenerator(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to handle canceling event and outstanding controls in shutdown
<ClCompile> | ||
<PreprocessorDefinitions>%(PreprocessorDefinitions);UNICODE;MF_WPP;SECURITY_WIN32;MFT_UNIQUE_METHOD_NAMES;MF_DEVICEMFT_ALLOW_MFT0_LOAD</PreprocessorDefinitions> | ||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories);..\..\common;..\common</AdditionalIncludeDirectories> | ||
<LanguageStandard>stdcpp17</LanguageStandard> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
SetEvent(m_hSelectedProfileKSEvent); | ||
m_hSelectedProfileKSEvent = nullptr; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait should not block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using MFPutWaitingWorkItem to signal the m_hSelectedProfileKSEvent (using m_hSelectedProfileKSEventSentToDriver as the event handle to the API in question). This doesn't afford you the ability to use a timeout, but the spec requires drivers to signal the event both in the case of success or if the operation can't complete.
|
||
/// PDMFT only cares about ExtendedCameraControls, all others | ||
/// are just blindly forwarded to the upstream DMFTs. | ||
if (!IsEqualCLSID(pProperty->Set, KSPROPERTYSETID_ExtendedCameraControl)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PWCHAR m_SymbolicLink; | ||
HANDLE m_hSelectedProfileKSEvent; | ||
HANDLE m_hSelectedProfileKSEventSentToDriver; | ||
std::optional<bool> m_isProfileDDISupportedInBaseDriver; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
interface IDirect3DDeviceManager9; | ||
|
||
constexpr int kMAX_WAIT_TIME_DRIVER_PROFILE_KSEVENT = 3000;// ms, amount of time to wait for the profile DDI KsEvent sent to the driver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO: required to avoid bug OS bug 36971659 in extended property handling that introduces a 16 bytes cookie | ||
typedef struct | ||
{ | ||
//byte cookieBuffer[16]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove commented out code
DMFTCHECKHR_GOTO(pAttributes->SetUINT32( MF_SA_D3D_AWARE, TRUE ), done); | ||
DMFTCHECKHR_GOTO(pAttributes->SetString( MFT_ENUM_HARDWARE_URL_Attribute, L"SampleMultiPinMft" ),done); | ||
m_spAttributes = pAttributes; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: remove
pvPropertyData, | ||
ulDataLength, | ||
pulBytesReturned),done); | ||
if (pProperty->Id == KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (pProperty->Id == KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE)
This is incorrect. You're only checking against the Id. The combination should always be Set + Id to determine the control.
In this particular case, you're going to intercept any control whose Id is 34 regardless of whether that Id belongs to the KSPROPERTYSETID_ExtendedCameraControl or not. I think what you meant to do here is to intercept and call ProfilePropertyHandler only if the Set == KSPROPERTYSETID_ExtendedCameraControl && Id == KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent poinnt!!
|
||
m_selectedProfileId.Type = pProfile->ProfileId; | ||
m_selectedProfileId.Index = pProfile->Index; | ||
m_selectedProfileId.Unused = pProfile->Reserved; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This information is never forwarded to the driver so the SentToDriver event will never signal.
In avscamera DMFT, its KsEvent and KsProperty functions handle KSPROPERTY_CAMERACONTROL_EXTENDED_PROFILE property to allow DMFT to behave appropriately in response of various camera streaming profile selected.