This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 81
Hdcp 2.2 #471
Open
harishkrupo
wants to merge
2
commits into
intel:master
Choose a base branch
from
harishkrupo:hdcp
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hdcp 2.2 #471
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,22 +182,12 @@ bool DrmDisplay::ConnectDisplay(const drmModeModeInfo &mode_info, | |
GetDrmHDCPObjectProperty("Content Protection", connector, connector_props, | ||
&hdcp_id_prop_, &value); | ||
|
||
if (value >= 0) { | ||
switch (value) { | ||
case 0: | ||
current_protection_support_ = HWCContentProtection::kUnDesired; | ||
break; | ||
case 1: | ||
current_protection_support_ = HWCContentProtection::kDesired; | ||
break; | ||
default: | ||
break; | ||
} | ||
current_protection_support_ = static_cast<HWCContentProtection>(value); | ||
|
||
if (desired_protection_support_ == HWCContentProtection::kUnSupported) { | ||
desired_protection_support_ = current_protection_support_; | ||
} | ||
} | ||
GetDrmHDCPObjectProperty("CP_Content_Type", connector, connector_props, | ||
&hdcp_type_prop_, &value); | ||
|
||
current_content_type_ = static_cast<HWCContentType>(value); | ||
|
||
GetDrmHDCPObjectProperty("CP_SRM", connector, connector_props, | ||
&hdcp_srm_id_prop_, &value); | ||
|
@@ -213,7 +203,6 @@ bool DrmDisplay::ConnectDisplay(const drmModeModeInfo &mode_info, | |
ITRACE("DCIP3 support not available"); | ||
|
||
PhysicalDisplay::Connect(); | ||
SetHDCPState(desired_protection_support_, content_type_); | ||
|
||
drmModePropertyPtr broadcastrgb_props = | ||
drmModeGetProperty(gpu_fd_, broadcastrgb_id_); | ||
|
@@ -419,30 +408,81 @@ bool DrmDisplay::SetBroadcastRGB(const char *range_property) { | |
return true; | ||
} | ||
|
||
void DrmDisplay::SetHDCPState(HWCContentProtection state, | ||
bool DrmDisplay::CheckHDCPStatus() { | ||
int val = -1; | ||
uint32_t i; | ||
ScopedDrmObjectPropertyPtr cprops(drmModeObjectGetProperties( | ||
gpu_fd_, connector_, DRM_MODE_OBJECT_CONNECTOR)); | ||
for (i = 0; i < cprops->count_props; i++) { | ||
if (cprops->props[i] == hdcp_id_prop_) { | ||
val = cprops->prop_values[i]; | ||
break; | ||
} | ||
} | ||
|
||
if ((current_protection_support_ && val == HWCContentProtection::kEnabled) || | ||
(!current_protection_support_ && val == HWCContentProtection::kDesired)) | ||
return true; | ||
|
||
return false; | ||
} | ||
|
||
bool DrmDisplay::SetHDCPState(HWCContentProtection state, | ||
HWCContentType content_type) { | ||
desired_protection_support_ = state; | ||
content_type_ = content_type; | ||
if (desired_protection_support_ == current_protection_support_) | ||
return; | ||
desired_content_type_ = content_type; | ||
|
||
if (desired_protection_support_ == current_protection_support_ && | ||
desired_content_type_ == current_content_type_) | ||
return true; | ||
|
||
if (hdcp_id_prop_ <= 0) { | ||
ETRACE("Cannot set HDCP state as Connector property is not supported \n"); | ||
return; | ||
return false; | ||
} | ||
if ((hdcp_type_prop_ <= 0) && (desired_content_type_ == 1)) { | ||
ETRACE("Content type property unavailable. HDCP 2.2 cannot be enabled\n"); | ||
return false; | ||
} | ||
|
||
if (!(connection_state_ & kConnected)) { | ||
return; | ||
return false; | ||
} | ||
|
||
current_protection_support_ = desired_protection_support_; | ||
uint32_t value = 0; | ||
if (current_protection_support_ == kDesired) { | ||
value = 1; | ||
ScopedDrmAtomicReqPtr pset(drmModeAtomicAlloc()); | ||
int ret = drmModeAtomicAddProperty(pset.get(), connector_, hdcp_id_prop_, | ||
desired_protection_support_) < 0; | ||
if (current_protection_support_ && (hdcp_type_prop_ > 0)) | ||
ret = ret || | ||
drmModeAtomicAddProperty(pset.get(), connector_, hdcp_type_prop_, | ||
desired_content_type_) < 0; | ||
if (ret) { | ||
ETRACE("Unable to fill pset for HDCP\n"); | ||
return false; | ||
} | ||
ret = drmModeAtomicCommit(gpu_fd_, pset.get(), DRM_MODE_ATOMIC_ALLOW_MODESET, | ||
NULL); | ||
if (ret) { | ||
ETRACE("Failed to commit HDCP ret %d errno %d : %s\n", ret, errno, | ||
PRINTERROR()); | ||
return false; | ||
} | ||
|
||
drmModeConnectorSetProperty(gpu_fd_, connector_, hdcp_id_prop_, value); | ||
ETRACE("Ignored Content type. \n"); | ||
/* Wait for Enable should be 5.1 Sec * 3(kernel reattempt cnt) */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. possible to wait up to 15s blocking hwc service such long time seems not acceptable. I would suggest not blocking in hwc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, agreed. This should be done by the hdcp daemon. I had previously raised it as a concern. |
||
for (uint8_t i = 0; i < 160; i++) { | ||
if (CheckHDCPStatus()) { | ||
harishkrupo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
current_protection_support_ = desired_protection_support_; | ||
current_content_type_ = desired_content_type_; | ||
return true; | ||
} | ||
usleep(100 * 1000); | ||
} | ||
|
||
// HDCP failed to enable, mark it as undesired | ||
drmModeConnectorSetProperty(gpu_fd_, connector_, hdcp_id_prop_, | ||
HWCContentProtection::kUnDesired); | ||
|
||
return false; | ||
} | ||
|
||
void DrmDisplay::SetHDCPSRM(const int8_t *SRM, uint32_t SRMLength) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
when and how the status will change from kDesired to kEnabled? Is it possible in the sleep time frame it is already changed to kEnabled, you can not get the kDesired state.
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.
sorry, could you please explain more about the sleep time frame?
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.
I mean in the SetHDCPState() there is 'usleep(100 * 1000);' for every iteration. is it possible in this time frame, the state changes from kUnDisired->kDesired->kEnabled? for such case, your logic in Check state will not return true.