1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef ANDROID_DRM_PLANE_H_ 18 #define ANDROID_DRM_PLANE_H_ 19 20 #include <stdint.h> 21 #include <xf86drmMode.h> 22 23 #include <vector> 24 25 #include "DrmCrtc.h" 26 #include "DrmProperty.h" 27 28 namespace android { 29 30 class DrmDevice; 31 32 class DrmPlane { 33 public: 34 DrmPlane(DrmDevice *drm, drmModePlanePtr p); 35 DrmPlane(const DrmPlane &) = delete; 36 DrmPlane &operator=(const DrmPlane &) = delete; 37 38 int Init(); 39 40 uint32_t id() const; 41 42 bool GetCrtcSupported(const DrmCrtc &crtc) const; 43 44 uint32_t type() const; 45 46 bool IsFormatSupported(uint32_t format) const; 47 48 const DrmProperty &crtc_property() const; 49 const DrmProperty &fb_property() const; 50 const DrmProperty &crtc_x_property() const; 51 const DrmProperty &crtc_y_property() const; 52 const DrmProperty &crtc_w_property() const; 53 const DrmProperty &crtc_h_property() const; 54 const DrmProperty &src_x_property() const; 55 const DrmProperty &src_y_property() const; 56 const DrmProperty &src_w_property() const; 57 const DrmProperty &src_h_property() const; 58 const DrmProperty &zpos_property() const; 59 const DrmProperty &rotation_property() const; 60 const DrmProperty &alpha_property() const; 61 const DrmProperty &blend_property() const; 62 const DrmProperty &in_fence_fd_property() const; 63 64 private: 65 DrmDevice *drm_; 66 uint32_t id_; 67 68 uint32_t possible_crtc_mask_; 69 70 uint32_t type_; 71 72 std::vector<uint32_t> formats_; 73 74 DrmProperty crtc_property_; 75 DrmProperty fb_property_; 76 DrmProperty crtc_x_property_; 77 DrmProperty crtc_y_property_; 78 DrmProperty crtc_w_property_; 79 DrmProperty crtc_h_property_; 80 DrmProperty src_x_property_; 81 DrmProperty src_y_property_; 82 DrmProperty src_w_property_; 83 DrmProperty src_h_property_; 84 DrmProperty zpos_property_; 85 DrmProperty rotation_property_; 86 DrmProperty alpha_property_; 87 DrmProperty blend_property_; 88 DrmProperty in_fence_fd_property_; 89 }; 90 } // namespace android 91 92 #endif // ANDROID_DRM_PLANE_H_ 93