RSScreen color management method implementation

Signed-off-by: w00607952 <wangyiyuan4@huawei.com>
Change-Id: Idb64e3123e76cb6e2cedca806cf9037d7cdc541a
This commit is contained in:
w00607952 2022-02-14 17:18:57 +08:00
parent 5bdc421a71
commit babd36da5d
4 changed files with 72 additions and 13 deletions

View File

@ -367,33 +367,87 @@ int32_t RSScreen::GetScreenBacklight() const
int32_t RSScreen::GetScreenSupportedColorGamuts(std::vector<ScreenColorGamut> &mode) const
{
// Stub, waiting for HDIScreen interfaces
mode.clear();
mode.push_back(COLOR_GAMUT_SRGB);
return StatusCode::SUCCESS;
if (isVirtual_) {
mode.clear();
mode = supportedColorGamuts_;
return StatusCode::SUCCESS;
}
std::vector<ColorGamut> hdiMode;
int32_t result = hdiScreen_->GetScreenSupportedColorGamuts(hdiMode);
if (result == DispErrCode::DISPLAY_SUCCESS) {
mode.clear();
for (auto m : hdiMode) {
mode.push_back(static_cast<ScreenColorGamut>(m));
}
return StatusCode::SUCCESS;
}
return StatusCode::HDI_ERROR;
}
int32_t RSScreen::GetScreenColorGamut(ScreenColorGamut &mode) const
{
// Stub, waiting for HDIScreen interfaces
mode = COLOR_GAMUT_SRGB;
return StatusCode::SUCCESS;
if (isVirtual_) {
mode = supportedColorGamuts_[currentGamutIdx_];
return StatusCode::SUCCESS;
}
ColorGamut hdiMode;
int32_t result = hdiScreen_->GetScreenColorGamut(hdiMode);
if (result == DispErrCode::DISPLAY_SUCCESS) {
mode = static_cast<ScreenColorGamut>(hdiMode);
return StatusCode::SUCCESS;
}
return StatusCode::HDI_ERROR;
}
int32_t RSScreen::SetScreenColorGamut(int32_t modeIdx)
{
return StatusCode::SUCCESS;
if (isVirtual_) {
if (modeIdx >= supportedColorGamuts_.size()) {
return StatusCode::INVALID_ARGUMENTS;
}
currentGamutIdx_ = modeIdx;
return StatusCode::SUCCESS;
}
std::vector<ColorGamut> hdiMode;
if (hdiScreen_->GetScreenSupportedColorGamuts(hdiMode) != DispErrCode::DISPLAY_SUCCESS) {
return StatusCode::HDI_ERROR;
}
if (modeIdx >= hdiMode.size()) {
return StatusCode::INVALID_ARGUMENTS;
}
int32_t result = hdiScreen_->SetScreenColorGamut(hdiMode[modeIdx]);
if (result == DispErrCode::DISPLAY_SUCCESS) {
return StatusCode::SUCCESS;
}
return StatusCode::HDI_ERROR;
}
int32_t RSScreen::SetScreenGamutMap(ScreenGamutMap mode)
{
return StatusCode::SUCCESS;
if (isVirtual_) {
currentGamutMap_ = mode;
return StatusCode::SUCCESS;
}
int32_t result = hdiScreen_->SetScreenGamutMap(static_cast<GamutMap>(mode));
if (result == DispErrCode::DISPLAY_SUCCESS) {
return StatusCode::SUCCESS;
}
return StatusCode::HDI_ERROR;
}
int32_t RSScreen::GetScreenGamutMap(ScreenGamutMap &mode) const
{
mode = GAMUT_MAP_CONSTANT;
return StatusCode::SUCCESS;
if (isVirtual_) {
mode = currentGamutMap_;
return StatusCode::SUCCESS;
}
GamutMap hdiMode;
int32_t result = hdiScreen_->GetScreenGamutMap(hdiMode);
if (result == DispErrCode::DISPLAY_SUCCESS) {
mode = static_cast<ScreenGamutMap>(hdiMode);
return StatusCode::SUCCESS;
}
return StatusCode::HDI_ERROR;
}
bool RSScreen::SetRotation(ScreenRotation rotation)

View File

@ -150,6 +150,10 @@ private:
DisplayCapability capability_;
sptr<Surface> producerSurface_; // has value if the screen is virtual
DispPowerStatus powerStatus_;
std::vector<ScreenColorGamut> supportedColorGamuts_ = { COLOR_GAMUT_SRGB }; // valid if the screen is virtual
int32_t currentGamutIdx_ = 0; // valid if the screen is virtual
ScreenGamutMap currentGamutMap_ = GAMUT_MAP_CONSTANT; // valid if the screen is virtual
};
} // namespace impl
} // namespace Rosen

View File

@ -108,8 +108,9 @@ typedef enum : uint32_t {
RS_CONNECTION_ERROR,
SURFACE_NOT_UNIQUE,
RENDER_SERVICE_NULL,
INVALID_AUGMENTS,
INVALID_ARGUMENTS,
WRITE_PARCEL_ERR,
HDI_ERROR,
} StatusCode;
// get the underlying type of an enum value.

View File

@ -176,7 +176,7 @@ int32_t RSRenderServiceConnectionProxy::SetVirtualScreenSurface(ScreenId id, spt
{
if (surface == nullptr) {
ROSEN_LOGE("RSRenderServiceConnectionProxy::SetVirtualScreenSurface: Send surface is nullptr!");
return INVALID_AUGMENTS;
return INVALID_ARGUMENTS;
}
MessageParcel data;