DrmHwcRect<int> display_frame;
DrmHwcRect<float> source_crop;
uint64_t rotation = 0;
+ uint64_t alpha = 0xFF;
switch (comp_plane.source_layer) {
case DrmCompositionPlane::kSourceNone:
break;
fb_id = layer.buffer->fb_id;
display_frame = layer.display_frame;
source_crop = layer.source_crop;
+ if (layer.blending == DrmHwcBlending::kPreMult)
+ alpha = layer.alpha;
switch (layer.transform) {
case DrmHwcTransform::kFlipH:
rotation = 1 << DRM_REFLECT_X;
break;
}
+ // TODO: Once we have atomic test, this should fall back to GL
+ if (alpha != 0xFF && plane->alpha_property().id() == 0) {
+ ALOGE("Alpha is not supported on plane %d", plane->id());
+ ret = -EINVAL;
+ break;
+ }
+
ret =
drmModePropertySetAdd(pset, plane->id(), plane->crtc_property().id(),
crtc->id()) ||
break;
}
}
+
+ if (plane->alpha_property().id()) {
+ ret = drmModePropertySetAdd(pset, plane->id(),
+ plane->alpha_property().id(), alpha);
+ if (ret) {
+ ALOGE("Failed to add alpha property %d to plane %d",
+ plane->alpha_property().id(), plane->id());
+ break;
+ }
+ }
}
out:
if (ret)
ALOGE("Could not get rotation property");
+ ret = drm_->GetPlaneProperty(*this, "alpha", &alpha_property_);
+ if (ret)
+ ALOGI("Could not get alpha property");
+
return 0;
}
const DrmProperty &DrmPlane::rotation_property() const {
return rotation_property_;
}
+
+const DrmProperty &DrmPlane::alpha_property() const {
+ return alpha_property_;
+}
}
const DrmProperty &src_w_property() const;
const DrmProperty &src_h_property() const;
const DrmProperty &rotation_property() const;
+ const DrmProperty &alpha_property() const;
private:
DrmPlane(const DrmPlane &);
DrmProperty src_w_property_;
DrmProperty src_h_property_;
DrmProperty rotation_property_;
+ DrmProperty alpha_property_;
};
}