drm_hwcomposer: Replace uint32t with OutputType
Add OutputType enum to DisplayInfo and use throughout. Change-Id: If90deb5b19e7f61b7d74b9016221f35d09986678
This commit is contained in:
parent
f67a9eaae5
commit
8a7f263bb0
5 changed files with 52 additions and 10 deletions
|
|
@ -176,15 +176,15 @@ const HwcDisplayConfig *HwcDisplay::GetNextConfig() const {
|
|||
return GetCurrentConfig();
|
||||
}
|
||||
|
||||
void HwcDisplay::SetOutputType(uint32_t hdr_output_type) {
|
||||
void HwcDisplay::SetOutputType(OutputType hdr_output_type) {
|
||||
switch (hdr_output_type) {
|
||||
case 3: { // HDR10
|
||||
case OutputType::kHdr10: {
|
||||
SetHdrOutputMetadata(ui::Hdr::HDR10);
|
||||
min_bpc_ = 8;
|
||||
colorspace_ = Colorspace::kBt2020Rgb;
|
||||
break;
|
||||
}
|
||||
case 1: { // SYSTEM
|
||||
case OutputType::kSystem: {
|
||||
std::vector<ui::Hdr> hdr_types;
|
||||
GetEdid()->GetSupportedHdrTypes(hdr_types);
|
||||
if (!hdr_types.empty()) {
|
||||
|
|
@ -195,9 +195,9 @@ void HwcDisplay::SetOutputType(uint32_t hdr_output_type) {
|
|||
}
|
||||
[[fallthrough]];
|
||||
}
|
||||
case 0: // INVALID
|
||||
case OutputType::kInvalid:
|
||||
[[fallthrough]];
|
||||
case 2: // SDR
|
||||
case OutputType::kSdr:
|
||||
[[fallthrough]];
|
||||
default:
|
||||
hdr_metadata_.reset();
|
||||
|
|
@ -406,6 +406,9 @@ auto HwcDisplay::PresentStagedComposition(
|
|||
|
||||
out_present_fence = a_args.out_fence;
|
||||
|
||||
// Reset the hdr output metadata blobs so we don't apply it repeatedly.
|
||||
hdr_metadata_.reset();
|
||||
|
||||
++frame_no_;
|
||||
|
||||
if (!out_present_fence) {
|
||||
|
|
@ -690,6 +693,13 @@ void HwcDisplay::GetHdrCapabilities(std::vector<ui::Hdr> *types,
|
|||
if (IsInHeadlessMode())
|
||||
return;
|
||||
|
||||
// Return HDR caps only when we have the ability to set HDR
|
||||
DrmDisplayPipeline &pipeline = GetPipe();
|
||||
if (pipeline.connector == nullptr || pipeline.connector->Get() == nullptr ||
|
||||
!pipeline.connector->Get()->GetHdrOutputMetadataProperty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetEdid()->GetHdrCapabilities(*types, max_luminance, max_average_luminance,
|
||||
min_luminance);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ class HwcDisplay {
|
|||
bool Init();
|
||||
|
||||
void SetHdrOutputMetadata(ui::Hdr hdrType);
|
||||
void SetOutputType(uint32_t hdr_output_type);
|
||||
void SetOutputType(OutputType hdr_output_type);
|
||||
|
||||
auto GetEdid() -> EdidWrapperUnique & {
|
||||
return GetPipe().connector->Get()->GetParsedEdid();
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
#include "compositor/DisplayInfo.h"
|
||||
#include "drm/DrmConnector.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/properties.h"
|
||||
|
|
@ -147,7 +148,7 @@ bool HwcDisplayConfigs::Update(DrmConnector &connector) {
|
|||
.group_id = group_found,
|
||||
.mode = mode,
|
||||
.disabled = disabled,
|
||||
.output_type = 1, // OutputType::SYSTEM
|
||||
.output_type = OutputType::kSystem,
|
||||
};
|
||||
|
||||
/* Chwck if the mode is preferred */
|
||||
|
|
|
|||
|
|
@ -26,12 +26,22 @@ using ConfigId = int32_t;
|
|||
|
||||
class DrmConnector;
|
||||
|
||||
/**
|
||||
* Display panel colorspace property values.
|
||||
*/
|
||||
enum class OutputType : uint32_t {
|
||||
kInvalid,
|
||||
kSystem,
|
||||
kSdr,
|
||||
kHdr10,
|
||||
};
|
||||
|
||||
struct HwcDisplayConfig {
|
||||
ConfigId id{};
|
||||
uint32_t group_id{};
|
||||
DrmMode mode{};
|
||||
bool disabled{};
|
||||
uint32_t output_type{};
|
||||
OutputType output_type{};
|
||||
|
||||
bool IsInterlaced() const {
|
||||
return (mode.GetRawMode().flags & DRM_MODE_FLAG_INTERLACE) != 0;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ using ::android::IRect;
|
|||
using ::android::LayerTransform;
|
||||
using ::android::SrcRectInfo;
|
||||
|
||||
using HwcOutputType = ::android::OutputType;
|
||||
#if __ANDROID_API__ >= 36
|
||||
using AidlOutputType = aidl::android::hardware::graphics::composer3::OutputType;
|
||||
#endif
|
||||
|
||||
namespace aidl::android::hardware::graphics::composer3::impl {
|
||||
namespace {
|
||||
|
||||
|
|
@ -266,6 +271,23 @@ class DisplayConfiguration {
|
|||
|
||||
#endif
|
||||
|
||||
#if __ANDROID_API__ >= 36
|
||||
AidlOutputType OutputTypeToAidl(const HwcOutputType output_type) {
|
||||
switch (output_type) {
|
||||
case HwcOutputType::kSystem:
|
||||
return AidlOutputType::SYSTEM;
|
||||
case HwcOutputType::kSdr:
|
||||
return AidlOutputType::SDR;
|
||||
case HwcOutputType::kHdr10:
|
||||
return AidlOutputType::HDR10;
|
||||
case HwcOutputType::kInvalid:
|
||||
[[fallthrough]];
|
||||
default:
|
||||
return AidlOutputType::INVALID;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
DisplayConfiguration HwcDisplayConfigToAidlConfiguration(
|
||||
int32_t width, int32_t height, const HwcDisplayConfig& config) {
|
||||
DisplayConfiguration aidl_configuration =
|
||||
|
|
@ -276,8 +298,7 @@ DisplayConfiguration HwcDisplayConfigToAidlConfiguration(
|
|||
.vsyncPeriod = config.mode.GetVSyncPeriodNs()};
|
||||
|
||||
#if __ANDROID_API__ >= 36
|
||||
aidl_configuration.hdrOutputType = static_cast<OutputType>(
|
||||
config.output_type);
|
||||
aidl_configuration.hdrOutputType = OutputTypeToAidl(config.output_type);
|
||||
#endif
|
||||
|
||||
if (width > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue