drm_hwcomposer: Remove HWC2 SetContentType
Add a new function to set the HDMI content type, and call this from the frontend. Change-Id: I338a00b7a142c6d2e2c3a727e8e7df7d24c1594d Signed-off-by: Drew Davenport <ddavenport@google.com>
This commit is contained in:
parent
ea508da8c0
commit
2d71839c8a
6 changed files with 30 additions and 19 deletions
|
|
@ -72,6 +72,11 @@ enum PanelOrientation {
|
|||
kModePanelOrientationRightUp
|
||||
};
|
||||
|
||||
/*
|
||||
* Content type to be used for HDMI infoframes.
|
||||
*/
|
||||
enum class ContentType { kNoData, kGraphics, kPhoto, kCinema, kGame };
|
||||
|
||||
struct QueuedConfigTiming {
|
||||
// In order for the new config to be applied, the client must send a new frame
|
||||
// at this time.
|
||||
|
|
|
|||
|
|
@ -151,7 +151,8 @@ auto DrmAtomicStateManager::CommitFrame(AtomicCommitArgs &args) -> int {
|
|||
|
||||
if (args.content_type && connector->GetContentTypeProperty()) {
|
||||
if (!connector->GetContentTypeProperty().AtomicSet(*pset,
|
||||
*args.content_type))
|
||||
static_cast<uint64_t>(
|
||||
*args.content_type)))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ struct AtomicCommitArgs {
|
|||
std::shared_ptr<DrmKmsPlan> composition;
|
||||
std::shared_ptr<drm_color_ctm> color_matrix;
|
||||
std::optional<Colorspace> colorspace;
|
||||
std::optional<int32_t> content_type;
|
||||
std::optional<ContentType> content_type;
|
||||
std::shared_ptr<hdr_output_metadata> hdr_metadata;
|
||||
|
||||
std::shared_ptr<DrmFbIdHandle> writeback_fb;
|
||||
|
|
|
|||
|
|
@ -1278,17 +1278,6 @@ HWC2::Error HwcDisplay::SetActiveConfigWithConstraints(
|
|||
return HWC2::Error::None;
|
||||
}
|
||||
|
||||
HWC2::Error HwcDisplay::SetContentType(int32_t contentType) {
|
||||
/* Maps exactly to the content_type DRM connector property:
|
||||
* https://elixir.bootlin.com/linux/v6.11/source/include/uapi/drm/drm_mode.h#L107
|
||||
*/
|
||||
if (contentType < HWC2_CONTENT_TYPE_NONE || contentType > HWC2_CONTENT_TYPE_GAME)
|
||||
return HWC2::Error::BadParameter;
|
||||
|
||||
content_type_ = contentType;
|
||||
|
||||
return HWC2::Error::None;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ > 27
|
||||
|
|
|
|||
|
|
@ -124,6 +124,10 @@ class HwcDisplay {
|
|||
// Get the port id that this display is plugged into.
|
||||
auto GetPort() -> uint8_t;
|
||||
|
||||
auto SetContentType(ContentType content_type) {
|
||||
content_type_ = content_type;
|
||||
}
|
||||
|
||||
auto GetFrontendPrivateData() -> std::shared_ptr<FrontendDisplayBase> {
|
||||
return frontend_private_data_;
|
||||
}
|
||||
|
|
@ -155,8 +159,6 @@ class HwcDisplay {
|
|||
hwc2_config_t config,
|
||||
hwc_vsync_period_change_constraints_t *vsyncPeriodChangeConstraints,
|
||||
hwc_vsync_period_change_timeline_t *outTimeline);
|
||||
|
||||
HWC2::Error SetContentType(int32_t contentType);
|
||||
#endif
|
||||
HWC2::Error GetDisplayVsyncPeriod(uint32_t *outVsyncPeriod);
|
||||
|
||||
|
|
@ -287,7 +289,7 @@ class HwcDisplay {
|
|||
std::shared_ptr<drm_color_ctm> identity_color_matrix_;
|
||||
android_color_transform_t color_transform_hint_{};
|
||||
bool ctm_has_offset_ = false;
|
||||
int32_t content_type_{};
|
||||
ContentType content_type_ = ContentType::kNoData;
|
||||
Colorspace colorspace_{};
|
||||
std::shared_ptr<hdr_output_metadata> hdr_metadata_;
|
||||
|
||||
|
|
|
|||
|
|
@ -611,6 +611,22 @@ static int32_t GetSupportedContentTypes(
|
|||
*out_num_supported_content_types = 0;
|
||||
return static_cast<int32_t>(HWC2::Error::None);
|
||||
}
|
||||
|
||||
static int32_t SetContentType(hwc2_device_t *device, hwc2_display_t display,
|
||||
int32_t content_type) {
|
||||
ALOGV("SetContentType");
|
||||
LOCK_COMPOSER(device);
|
||||
GET_DISPLAY(display);
|
||||
|
||||
if (content_type < HWC2_CONTENT_TYPE_NONE ||
|
||||
content_type > HWC2_CONTENT_TYPE_GAME) {
|
||||
return static_cast<int32_t>(HWC2::Error::BadParameter);
|
||||
}
|
||||
|
||||
idisplay->SetContentType(static_cast<ContentType>(content_type));
|
||||
|
||||
return static_cast<int32_t>(HWC2::Error::None);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Layer functions */
|
||||
|
|
@ -973,9 +989,7 @@ static hwc2_function_pointer_t HookDevGetFunction(struct hwc2_device * /*dev*/,
|
|||
case HWC2::FunctionDescriptor::GetSupportedContentTypes:
|
||||
return (hwc2_function_pointer_t)GetSupportedContentTypes;
|
||||
case HWC2::FunctionDescriptor::SetContentType:
|
||||
return ToHook<HWC2_PFN_SET_CONTENT_TYPE>(
|
||||
DisplayHook<decltype(&HwcDisplay::SetContentType),
|
||||
&HwcDisplay::SetContentType, int32_t>);
|
||||
return (hwc2_function_pointer_t)SetContentType;
|
||||
#endif
|
||||
// Layer functions
|
||||
case HWC2::FunctionDescriptor::SetCursorPosition:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue