Skip to content

Commit

Permalink
hwc_display: Guard Dolby Vision support
Browse files Browse the repository at this point in the history
To enable Dolby Vision support in hwc, add the following to your
BoardConfig.mk or BoardConfigCommon.mk

SOONG_CONFIG_NAMESPACES += dolby_vision
SOONG_CONFIG_dolby_vision += enabled
SOONG_CONFIG_dolby_vision_enabled := true

Change-Id: Ic512456847d84a1f5af64ed9fb8c38d7de4e8970
  • Loading branch information
jjpprrrr authored and 33bca committed Aug 22, 2023
1 parent a1411d2 commit b409502
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
21 changes: 20 additions & 1 deletion composer/Android.bp
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
composer_srcs = ["*.cpp"]

soong_config_module_type {
name: "dolby_vision_cc_defaults",
module_type: "cc_defaults",
config_namespace: "dolby_vision",
bool_variables: ["enabled"],
properties: ["cflags"],
}

dolby_vision_cc_defaults {
name: "dolby_vision_defaults",
soong_config_variables: {
enabled: {
cflags: [
"-DTARGET_SUPPORTS_DOLBY_VISION",
],
},
},
}

cc_binary {

name: "vendor.qti.hardware.display.composer-service",
defaults: ["qtidisplay_defaults"],
defaults: ["qtidisplay_defaults", "dolby_vision_defaults"],
sanitize: {
integer_overflow: true,
},
Expand Down
15 changes: 15 additions & 0 deletions composer/hwc_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1774,18 +1774,33 @@ HWC2::Error HWCDisplay::GetHdrCapabilities(uint32_t *out_num_types, int32_t *out

uint32_t num_types = 0;
if (fixed_info.hdr_plus_supported) {
#ifdef TARGET_SUPPORTS_DOLBY_VISION
num_types = UINT32(Hdr::HDR10_PLUS);
} else {
num_types = UINT32(Hdr::HLG);
}

// We support DOLBY_VISION, HDR10, HLG and HDR10_PLUS.
#else
num_types = UINT32(Hdr::HDR10_PLUS) - 1;
} else {
num_types = UINT32(Hdr::HLG) - 1;
}

// We support HDR10, HLG and HDR10_PLUS.
#endif /* TARGET_SUPPORTS_DOLBY_VISION */
if (out_types == nullptr) {
*out_num_types = num_types;
} else {
uint32_t max_out_types = std::min(*out_num_types, num_types);
int32_t type = static_cast<int32_t>(Hdr::DOLBY_VISION);
for (int32_t i = 0; i < max_out_types; i++) {
#ifndef TARGET_SUPPORTS_DOLBY_VISION
while (type == static_cast<int32_t>(Hdr::DOLBY_VISION) /* Skip list */) {
// Skip the type
type++;
}
#endif /* TARGET_SUPPORTS_DOLBY_VISION */
if (type > (num_types + 1)) {
break;
}
Expand Down

0 comments on commit b409502

Please sign in to comment.