One more step towards "frontend" isolation.
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
HWC2::Error DrmHwcTwo::HwcLayer::SetLayerTransform(int32_t transform) {
supported(__func__);
- transform_ = static_cast<HWC2::Transform>(transform);
+
+ uint32_t l_transform = 0;
+
+ // 270* and 180* cannot be combined with flips. More specifically, they
+ // already contain both horizontal and vertical flips, so those fields are
+ // redundant in this case. 90* rotation can be combined with either horizontal
+ // flip or vertical flip, so treat it differently
+ if (transform == HWC_TRANSFORM_ROT_270) {
+ l_transform = DrmHwcTransform::kRotate270;
+ } else if (transform == HWC_TRANSFORM_ROT_180) {
+ l_transform = DrmHwcTransform::kRotate180;
+ } else {
+ if (transform & HWC_TRANSFORM_FLIP_H)
+ l_transform |= DrmHwcTransform::kFlipH;
+ if (transform & HWC_TRANSFORM_FLIP_V)
+ l_transform |= DrmHwcTransform::kFlipV;
+ if (transform & HWC_TRANSFORM_ROT_90)
+ l_transform |= DrmHwcTransform::kRotate90;
+ }
+
+ transform_ = static_cast<DrmHwcTransform>(l_transform);
return HWC2::Error::None;
}
layer->alpha = lround(65535.0F * alpha_);
layer->blending = blending_;
layer->source_crop = source_crop_;
- layer->SetTransform(static_cast<int32_t>(transform_));
+ layer->transform = transform_;
layer->color_space = color_space_;
layer->sample_range = sample_range_;
}
int32_t cursor_x_;
int32_t cursor_y_;
hwc_color_t layer_color_;
- HWC2::Transform transform_ = HWC2::Transform::None;
+ DrmHwcTransform transform_ = DrmHwcTransform::kIdentity;
uint32_t z_order_ = 0;
DrmHwcBlending blending_ = DrmHwcBlending::kNone;
DrmHwcColorSpace color_space_ = DrmHwcColorSpace::kUndefined;
kLimitedRange,
};
-enum DrmHwcTransform {
+enum DrmHwcTransform : uint32_t {
kIdentity = 0,
kFlipH = 1 << 0,
kFlipV = 1 << 1,
std::shared_ptr<DrmFbIdHandle> FbIdHandle;
int gralloc_buffer_usage = 0;
- uint32_t transform;
+ DrmHwcTransform transform{};
DrmHwcBlending blending = DrmHwcBlending::kNone;
uint16_t alpha = 0xffff;
hwc_frect_t source_crop;
int ImportBuffer(DrmDevice *drmDevice);
- void SetTransform(int32_t sf_transform);
-
bool protected_usage() const {
return (gralloc_buffer_usage & GRALLOC_USAGE_PROTECTED) ==
GRALLOC_USAGE_PROTECTED;
return 0;
}
-void DrmHwcLayer::SetTransform(int32_t sf_transform) {
- transform = 0;
- // 270* and 180* cannot be combined with flips. More specifically, they
- // already contain both horizontal and vertical flips, so those fields are
- // redundant in this case. 90* rotation can be combined with either horizontal
- // flip or vertical flip, so treat it differently
- if (sf_transform == HWC_TRANSFORM_ROT_270) {
- transform = DrmHwcTransform::kRotate270;
- } else if (sf_transform == HWC_TRANSFORM_ROT_180) {
- transform = DrmHwcTransform::kRotate180;
- } else {
- if (sf_transform & HWC_TRANSFORM_FLIP_H)
- transform |= DrmHwcTransform::kFlipH;
- if (sf_transform & HWC_TRANSFORM_FLIP_V)
- transform |= DrmHwcTransform::kFlipV;
- if (sf_transform & HWC_TRANSFORM_ROT_90)
- transform |= DrmHwcTransform::kRotate90;
- }
-}
} // namespace android