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_CRTC_H_ 18 #define ANDROID_DRM_CRTC_H_ 19 20 #include <stdint.h> 21 #include <xf86drmMode.h> 22 23 #include <array> 24 25 #include "drmmode.h" 26 #include "drmproperty.h" 27 28 namespace android { 29 30 class DrmDevice; 31 32 class DrmCrtc { 33 public: 34 DrmCrtc(DrmDevice *drm, drmModeCrtcPtr c, unsigned pipe); 35 DrmCrtc(const DrmCrtc &) = delete; 36 DrmCrtc &operator=(const DrmCrtc &) = delete; 37 38 int Init(); 39 40 uint32_t id() const; 41 unsigned pipe() const; 42 43 const std::vector<int>& displays() const; 44 bool has_display(const int display) const; 45 void set_display(int display); 46 47 bool can_bind(int display) const; 48 49 const DrmProperty &active_property() const; 50 const DrmProperty &mode_property() const; 51 const DrmProperty &out_fence_ptr_property() const; 52 const DrmProperty &cgc_lut_property() const; 53 const DrmProperty &cgc_lut_fd_property() const; 54 const DrmProperty °amma_lut_property() const; 55 const DrmProperty °amma_lut_size_property() const; 56 const DrmProperty &gamma_lut_property() const; 57 const DrmProperty &gamma_lut_size_property() const; 58 const DrmProperty &linear_matrix_property() const; 59 const DrmProperty &gamma_matrix_property() const; 60 const DrmProperty &partial_region_property() const; 61 const DrmProperty &force_bpc_property() const; 62 const DrmProperty &disp_dither_property() const; 63 const DrmProperty &cgc_dither_property() const; 64 DrmProperty &adjusted_vblank_property(); 65 const DrmProperty &ppc_property() const; 66 const DrmProperty &max_disp_freq_property() const; 67 const DrmProperty &dqe_enabled_property() const; 68 const DrmProperty &color_mode_property() const; 69 const DrmProperty &expected_present_time_property() const; 70 const DrmProperty &rcd_plane_id_property() const; 71 72 /* Histogram Properties */ 73 const DrmProperty &histogram_roi_property() const; 74 const DrmProperty &histogram_weights_property() const; 75 const DrmProperty &histogram_threshold_property() const; 76 const DrmProperty &histogram_position_property() const; 77 78 /* Histogram Properties:: multi channel */ 79 const DrmProperty &histogram_channel_property(uint8_t channelId) const; 80 properties()81 const std::vector<DrmProperty *> &properties() const { 82 return properties_; 83 } 84 85 private: 86 DrmDevice *drm_; 87 88 uint32_t id_; 89 unsigned pipe_; 90 std::vector<int> displays_; 91 92 DrmMode mode_; 93 94 DrmProperty active_property_; 95 DrmProperty mode_property_; 96 DrmProperty out_fence_ptr_property_; 97 DrmProperty cgc_lut_property_; 98 DrmProperty cgc_lut_fd_property_; 99 DrmProperty degamma_lut_property_; 100 DrmProperty degamma_lut_size_property_; 101 DrmProperty gamma_lut_property_; 102 DrmProperty gamma_lut_size_property_; 103 DrmProperty linear_matrix_property_; 104 DrmProperty gamma_matrix_property_; 105 DrmProperty partial_region_property_; 106 DrmProperty force_bpc_property_; 107 DrmProperty disp_dither_property_; 108 DrmProperty cgc_dither_property_; 109 DrmProperty adjusted_vblank_property_; 110 DrmProperty ppc_property_; 111 DrmProperty max_disp_freq_property_; 112 DrmProperty dqe_enabled_property_; 113 DrmProperty color_mode_property_; 114 DrmProperty expected_present_time_property_; 115 DrmProperty rcd_plane_id_property_; 116 117 /* Histogram Properties */ 118 DrmProperty histogram_roi_property_; 119 DrmProperty histogram_weights_property_; 120 DrmProperty histogram_threshold_property_; 121 DrmProperty histogram_position_property_; 122 123 /* Histogram Properties :: multichannel support */ 124 // TODO: b/295786065 - Get available channels from crtc property. 125 static const uint8_t histogram_channels_max = 4; 126 std::array<DrmProperty, histogram_channels_max> histogram_channel_property_; 127 128 /* all properties */ 129 std::vector<DrmProperty *> properties_; 130 }; 131 132 } // namespace android 133 134 #endif // ANDROID_DRM_CRTC_H_ 135