Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
| diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
| index 6ca6f6b45f933d69aa3ca748ce2f5f0c9cd21bc7..1f6096c635780f9461af92c02f3261c9fa39201c 100644 |
| --- a/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
| +++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_atomic.cc |
| @@ -19,6 +19,35 @@ const char* kSrcXPropName = "SRC_X"; |
| const char* kSrcYPropName = "SRC_Y"; |
| const char* kSrcWPropName = "SRC_W"; |
| const char* kSrcHPropName = "SRC_H"; |
| +const char* kRotationPropName = "rotation"; |
| + |
| +const int kDrmRotate0 = 0; |
|
dnicoara
2017/04/11 13:51:06
Do you know if there's plans to have these in libd
Daniele Castagna
2017/04/11 20:21:05
I just asked Kristian and he agreed it should prob
|
| +const int kDrmRotate90 = 1; |
| +const int kDrmRotate180 = 4; |
| +const int kDrmRotate270 = 8; |
| +const int kDrmReflectX = 16; |
| +const int kDrmReflectY = 32; |
|
dnicoara
2017/04/11 13:51:06
nit: Could these be in hex or as bit shifts?
Daniele Castagna
2017/04/11 20:21:05
Re-used the drm_crtc defines. The bit shifts is no
|
| + |
| +uint32_t OverlayTransformToDrmRotationPropertyValue( |
| + gfx::OverlayTransform transform) { |
| + switch (transform) { |
| + case gfx::OVERLAY_TRANSFORM_NONE: |
| + return kDrmRotate0; |
| + case gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL: |
| + return kDrmReflectX; |
| + case gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL: |
| + return kDrmReflectY; |
| + case gfx::OVERLAY_TRANSFORM_ROTATE_90: |
| + return kDrmRotate90; |
| + case gfx::OVERLAY_TRANSFORM_ROTATE_180: |
| + return kDrmRotate180; |
| + case gfx::OVERLAY_TRANSFORM_ROTATE_270: |
| + return kDrmRotate270; |
| + default: |
| + NOTREACHED(); |
| + } |
| + return kDrmRotate0; |
| +} |
| } // namespace |
| @@ -51,11 +80,13 @@ HardwareDisplayPlaneAtomic::HardwareDisplayPlaneAtomic(uint32_t plane_id, |
| HardwareDisplayPlaneAtomic::~HardwareDisplayPlaneAtomic() { |
| } |
| -bool HardwareDisplayPlaneAtomic::SetPlaneData(drmModeAtomicReq* property_set, |
| - uint32_t crtc_id, |
| - uint32_t framebuffer, |
| - const gfx::Rect& crtc_rect, |
| - const gfx::Rect& src_rect) { |
| +bool HardwareDisplayPlaneAtomic::SetPlaneData( |
| + drmModeAtomicReq* property_set, |
| + uint32_t crtc_id, |
| + uint32_t framebuffer, |
| + const gfx::Rect& crtc_rect, |
| + const gfx::Rect& src_rect, |
| + const gfx::OverlayTransform transform) { |
| int plane_set_succeeded = |
| drmModeAtomicAddProperty(property_set, plane_id_, crtc_prop_.id, |
| crtc_id) && |
| @@ -76,7 +107,10 @@ bool HardwareDisplayPlaneAtomic::SetPlaneData(drmModeAtomicReq* property_set, |
| drmModeAtomicAddProperty(property_set, plane_id_, src_w_prop_.id, |
| src_rect.width()) && |
| drmModeAtomicAddProperty(property_set, plane_id_, src_h_prop_.id, |
| - src_rect.height()); |
| + src_rect.height()) && |
| + drmModeAtomicAddProperty( |
| + property_set, plane_id_, rotation_prop_.id, |
| + OverlayTransformToDrmRotationPropertyValue(transform)); |
| if (!plane_set_succeeded) { |
| PLOG(ERROR) << "Failed to set plane data"; |
| return false; |
| @@ -87,16 +121,18 @@ bool HardwareDisplayPlaneAtomic::SetPlaneData(drmModeAtomicReq* property_set, |
| bool HardwareDisplayPlaneAtomic::InitializeProperties( |
| DrmDevice* drm, |
| const ScopedDrmObjectPropertyPtr& plane_props) { |
| - bool props_init = crtc_prop_.Initialize(drm, kCrtcPropName, plane_props) && |
| - fb_prop_.Initialize(drm, kFbPropName, plane_props) && |
| - crtc_x_prop_.Initialize(drm, kCrtcXPropName, plane_props) && |
| - crtc_y_prop_.Initialize(drm, kCrtcYPropName, plane_props) && |
| - crtc_w_prop_.Initialize(drm, kCrtcWPropName, plane_props) && |
| - crtc_h_prop_.Initialize(drm, kCrtcHPropName, plane_props) && |
| - src_x_prop_.Initialize(drm, kSrcXPropName, plane_props) && |
| - src_y_prop_.Initialize(drm, kSrcYPropName, plane_props) && |
| - src_w_prop_.Initialize(drm, kSrcWPropName, plane_props) && |
| - src_h_prop_.Initialize(drm, kSrcHPropName, plane_props); |
| + bool props_init = |
| + crtc_prop_.Initialize(drm, kCrtcPropName, plane_props) && |
| + fb_prop_.Initialize(drm, kFbPropName, plane_props) && |
| + crtc_x_prop_.Initialize(drm, kCrtcXPropName, plane_props) && |
| + crtc_y_prop_.Initialize(drm, kCrtcYPropName, plane_props) && |
| + crtc_w_prop_.Initialize(drm, kCrtcWPropName, plane_props) && |
| + crtc_h_prop_.Initialize(drm, kCrtcHPropName, plane_props) && |
| + src_x_prop_.Initialize(drm, kSrcXPropName, plane_props) && |
| + src_y_prop_.Initialize(drm, kSrcYPropName, plane_props) && |
| + src_w_prop_.Initialize(drm, kSrcWPropName, plane_props) && |
| + src_h_prop_.Initialize(drm, kSrcHPropName, plane_props) && |
| + rotation_prop_.Initialize(drm, kRotationPropName, plane_props); |
| if (!props_init) { |
| LOG(ERROR) << "Unable to get plane properties."; |