Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HDR & WCG patch 14] Added the implementation of HWC 2.3 API SetLayerColorTransform #15

Open
wants to merge 1 commit into
base: hdr_invest12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions os/android/iahwc2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,13 +937,8 @@ HWC2::Error IAHWC2::HwcDisplay::SetColorTransform(const float *matrix,
supported(__func__);
// TODO: Force client composition if we get this

if (hint != HAL_COLOR_TRANSFORM_IDENTITY &&
hint != HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX &&
hint != HAL_COLOR_TRANSFORM_VALUE_INVERSE &&
hint != HAL_COLOR_TRANSFORM_GRAYSCALE &&
hint != HAL_COLOR_TRANSFORM_CORRECT_PROTANOPIA &&
hint != HAL_COLOR_TRANSFORM_CORRECT_DEUTERANOPIA &&
hint != HAL_COLOR_TRANSFORM_CORRECT_TRITANOPIA)
if (!matrix || (hint < HAL_COLOR_TRANSFORM_IDENTITY ||
hint > HAL_COLOR_TRANSFORM_CORRECT_TRITANOPIA))
return HWC2::Error::BadParameter;

display_->SetColorTransform(matrix, (HWCColorTransform)hint);
Expand Down Expand Up @@ -1354,7 +1349,12 @@ HWC2::Error IAHWC2::Hwc2Layer::SetLayerZOrder(uint32_t order) {

HWC2::Error IAHWC2::Hwc2Layer::SetLayerColorTransform(const float *matrix) {
unsupported(__func__);
return HWC2::Error::None;

if (hwc_layer_.SetLayerColorTransform(matrix)) {
return HWC2::Error::None;
} else {
return HWC2::Error::Unsupported;
}
}

HWC2::Error IAHWC2::Hwc2Layer::SetLayerPerFrameMetadataBlobs(
Expand Down
6 changes: 6 additions & 0 deletions public/hwclayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ struct HwcLayer {
return true;
}

bool SetLayerColorTransform(const float *matrix) {
memcpy(layer_color_transform_, matrix, sizeof(layer_color_transform_));
return true;
}

const HwcRect<int>& GetDisplayFrame() const {
return display_frame_;
}
Expand Down Expand Up @@ -412,6 +417,7 @@ struct HwcLayer {
};

int32_t transform_ = 0;
float layer_color_transform_[16];
uint32_t source_crop_width_ = 0;
uint32_t source_crop_height_ = 0;
uint32_t display_frame_width_ = 0;
Expand Down