1 /*
2  * Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
3  * Not a Contribution.
4  *
5  * Copyright 2015 The Android Open Source Project
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef __HWC_DISPLAY_H__
21 #define __HWC_DISPLAY_H__
22 
23 #include <QService.h>
24 #include <android/hardware/graphics/common/1.1/types.h>
25 #include <core/core_interface.h>
26 #include <hardware/hwcomposer.h>
27 #include <private/color_params.h>
28 #include <qdMetaData.h>
29 #include <sys/stat.h>
30 #include <map>
31 #include <queue>
32 #include <set>
33 #include <string>
34 #include <utility>
35 #include <vector>
36 
37 #include "hwc_buffer_allocator.h"
38 #include "hwc_callbacks.h"
39 #include "hwc_layers.h"
40 #include "histogram_collector.h"
41 
42 using android::hardware::graphics::common::V1_1::ColorMode;
43 using android::hardware::graphics::common::V1_1::Dataspace;
44 using android::hardware::graphics::common::V1_1::RenderIntent;
45 
46 namespace sdm {
47 
48 class BlitEngine;
49 class HWCToneMapper;
50 constexpr uint32_t kColorTransformMatrixCount = 16;
51 
52 // Subclasses set this to their type. This has to be different from DisplayType.
53 // This is to avoid RTTI and dynamic_cast
54 enum DisplayClass {
55   DISPLAY_CLASS_PRIMARY,
56   DISPLAY_CLASS_EXTERNAL,
57   DISPLAY_CLASS_VIRTUAL,
58   DISPLAY_CLASS_NULL
59 };
60 
61 class HWCColorMatrix {
62  public:
HWCColorMatrix(const string & values)63   HWCColorMatrix(const string &values) : key_values_(values){};
64   virtual ~HWCColorMatrix() = default;
65   virtual HWC2::Error SetEnabled(bool enabled);
GetEnabled()66   bool GetEnabled() const { return enabled_; }
67   // Apply effect to input matrix
68   virtual void ApplyToMatrix(double *in) = 0;
69   bool ParseFloatValueByCommas(const string &values, uint32_t length,
70                                std::vector<float> &elements) const;
71 
72  protected:
73   bool enabled_ = false;
74   const string key_values_;
75 };
76 
77 class WhiteCompensation : public HWCColorMatrix {
78  public:
WhiteCompensation(const string & values)79   WhiteCompensation(const string &values) : HWCColorMatrix(values){};
GetCompensatedRed()80   int GetCompensatedRed() const { return compensated_red_; }
GetCompensatedGreen()81   int GetCompensatedGreen() const { return compensated_green_; }
GetCompensatedBlue()82   int GetCompensatedBlue() const { return compensated_blue_; }
83   HWC2::Error SetEnabled(bool enabled) override;
84   /*
85    * Transform matrix is 4 x 4
86    *  |r.r   r.g   r.b  0|
87    *  |g.r   g.g   g.b  0|
88    *  |b.r   b.g   b.b  0|
89    *  |T.r   T.g   T.b  1|
90    *   R_out = R_in * r.r + G_in * g.r + B_in * b.r + Tr
91    *   G_out = R_in * r.g + G_in * g.g + B_in * b.g + Tg
92    *   B_out = R_in * r.b + G_in * g.b + B_in * b.b + Tb
93    *
94    * Cr, Cg, Cb for white point compensation
95    *  |r.r*Cr   r.g*Cg   r.b*Cb  0|
96    *  |g.r*Cr   g.g*Cg   g.b*Cb  0|
97    *  |b.r*Cr   b.g*Cg   b.b*Cb  0|
98    *  |T.r*Cr   T.g*Cg   T.b*Cb  1|
99    *   R_out = R_in * r.r * Cr + G_in * g.r * Cr + B_in * b.r * Cr + Tr * Cr
100    *   G_out = R_in * r.g * Cg + G_in * g.g * Cg + B_in * b.g * Cg + Tg * Cg
101    *   B_out = R_in * r.b * Cb + G_in * g.b * Cb + B_in * b.b * Cb + Tb * Cb
102    */
103   void ApplyToMatrix(double *in) override;
104 
105  private:
106   static constexpr int kCompensatedMaxRGB = 255;
107   static constexpr int kCompensatedMinRGB = 230;
108   static constexpr int kNumOfCompensationData = 3;
109   int compensated_red_ = kCompensatedMaxRGB;
110   int compensated_green_ = kCompensatedMaxRGB;
111   int compensated_blue_ = kCompensatedMaxRGB;
112 
113   double compensated_red_ratio_ = 1.0;
114   double compensated_green_ratio_ = 1.0;
115   double compensated_blue_ratio_ = 1.0;
116 
117   static constexpr int kCoefficientElements = 9;
118   float white_compensated_Coefficients_[kCoefficientElements] = {0.0, 1.0, 0.0, 0.0, 1.0,
119                                                                  0.0, 0.0, 1.0, 0.0};
120   bool ConfigCoefficients();
121   bool ParseWhitePointCalibrationData();
CheckCompensatedRGB(int value)122   inline static constexpr bool CheckCompensatedRGB(int value) {
123     return ((value >= kCompensatedMinRGB) && (value <= kCompensatedMaxRGB));
124   }
125   void CalculateRGBRatio();
126 };
127 
128 class SaturationCompensation : public HWCColorMatrix {
129  public:
SaturationCompensation(const string & values)130   SaturationCompensation(const string &values) : HWCColorMatrix(values){};
131   HWC2::Error SetEnabled(bool enabled) override;
132   /*  Saturated matrix is 4 x 4
133    *  | s0   s1   s2   s3|
134    *  | s4   s5   s6   s7|
135    *  | s8   s9   s10  s11|
136    *  | s12  s13  s14  s15|
137    * Transform matrix is 4 x 4
138    *  |a0   a1   a2   a3|
139    *  |a4   a5   a6   a7|
140    *  |a8   a9   a10  a11|
141    *  |a12  a13  a14  a15|
142    *
143    *  Saturated matrix[] X Transform matrix[]
144    */
145   void ApplyToMatrix(double *in) override;
146 
147  private:
148   static constexpr int kSaturationParameters = 9;
149   static constexpr int kNumOfRows = 4;
150   static constexpr int kColumnsPerRow = 4;
151   static_assert(kNumOfRows * kColumnsPerRow == kColorTransformMatrixCount,
152                 "Rows x Columns should be equal to matrix count");
153   float saturated_matrix_[kColorTransformMatrixCount] = {1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0,
154                                                          0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0};
155   bool ConfigSaturationParameter();
156 };
157 
158 class HWCColorMode {
159  public:
160   explicit HWCColorMode(DisplayInterface *display_intf);
~HWCColorMode()161   ~HWCColorMode() {}
162   HWC2::Error Init();
163   HWC2::Error DeInit();
164   void Dump(std::ostringstream* os);
165   uint32_t GetColorModeCount();
166   uint32_t GetRenderIntentCount(ColorMode mode);
167   HWC2::Error GetColorModes(uint32_t *out_num_modes, ColorMode *out_modes);
168   HWC2::Error GetRenderIntents(ColorMode mode, uint32_t *out_num_intents, RenderIntent *out_modes);
169   HWC2::Error SetColorModeWithRenderIntent(ColorMode mode, RenderIntent intent);
170   HWC2::Error SetColorModeById(int32_t color_mode_id);
171   HWC2::Error SetColorTransform(const float *matrix, android_color_transform_t hint);
172   HWC2::Error RestoreColorTransform();
173   PrimariesTransfer  GetWorkingColorSpace();
GetCurrentColorMode()174   ColorMode GetCurrentColorMode() { return current_color_mode_; }
175   HWC2::Error SetWhiteCompensation(bool enabled);
176 
177  private:
178   void PopulateColorModes();
179   void FindRenderIntent(const ColorMode &mode, const std::string &mode_string);
180   template <class T>
CopyColorTransformMatrix(const T * input_matrix,double * output_matrix)181   void CopyColorTransformMatrix(const T *input_matrix, double *output_matrix) {
182     for (uint32_t i = 0; i < kColorTransformMatrixCount; i++) {
183       output_matrix[i] = static_cast<double>(input_matrix[i]);
184     }
185   }
186   HWC2::Error ApplyDefaultColorMode();
187 
188   DisplayInterface *display_intf_ = NULL;
189 
190   ColorMode current_color_mode_ = ColorMode::NATIVE;
191   RenderIntent current_render_intent_ = RenderIntent::COLORIMETRIC;
192   typedef std::map<RenderIntent, std::string> RenderIntentMap;
193   // Initialize supported mode/render intent combination
194   std::map<ColorMode, RenderIntentMap> color_mode_map_ = {};
195   double color_matrix_[kColorTransformMatrixCount] = { 1.0, 0.0, 0.0, 0.0, \
196                                                        0.0, 1.0, 0.0, 0.0, \
197                                                        0.0, 0.0, 1.0, 0.0, \
198                                                        0.0, 0.0, 0.0, 1.0 };
199   void InitColorCompensation();
200   std::unique_ptr<WhiteCompensation> adaptive_white_;
201   std::unique_ptr<SaturationCompensation> adaptive_saturation_;
202   double compensated_color_matrix_[kColorTransformMatrixCount] = { 1.0, 0.0, 0.0, 0.0, \
203                                                                    0.0, 1.0, 0.0, 0.0, \
204                                                                    0.0, 0.0, 1.0, 0.0, \
205                                                                    0.0, 0.0, 0.0, 1.0 };
HasWhiteCompensation()206   bool HasWhiteCompensation() { return (adaptive_white_ && adaptive_white_->GetEnabled()); }
HasSaturationCompensation()207   bool HasSaturationCompensation() {
208     return (adaptive_saturation_ && adaptive_saturation_->GetEnabled());
209   }
210 
211   const double *PickTransferMatrix();
212 };
213 
214 class HWCDisplay : public DisplayEventHandler {
215  public:
216   enum DisplayStatus {
217     kDisplayStatusInvalid = -1,
218     kDisplayStatusOffline,
219     kDisplayStatusOnline,
220     kDisplayStatusPause,
221     kDisplayStatusResume,
222   };
223 
224   enum DisplayValidateState {
225     kNormalValidate,
226     kInternalValidate,
227     kSkipValidate,
228   };
229 
~HWCDisplay()230   virtual ~HWCDisplay() {}
231   virtual int Init();
232   virtual int Deinit();
233 
234   // Framebuffer configurations
235   virtual void SetIdleTimeoutMs(uint32_t timeout_ms);
236   virtual HWC2::Error SetFrameDumpConfig(uint32_t count, uint32_t bit_mask_layer_type,
237                                          int32_t format, bool post_processed);
238   virtual DisplayError SetMaxMixerStages(uint32_t max_mixer_stages);
ControlPartialUpdate(bool enable,uint32_t * pending)239   virtual DisplayError ControlPartialUpdate(bool enable, uint32_t *pending) {
240     return kErrorNotSupported;
241   }
242   virtual HWC2::PowerMode GetLastPowerMode();
243   virtual int SetFrameBufferResolution(uint32_t x_pixels, uint32_t y_pixels);
244   virtual void GetFrameBufferResolution(uint32_t *x_pixels, uint32_t *y_pixels);
245   virtual int SetDisplayStatus(DisplayStatus display_status);
246   virtual int OnMinHdcpEncryptionLevelChange(uint32_t min_enc_level);
247   virtual int Perform(uint32_t operation, ...);
248   virtual void SetSecureDisplay(bool secure_display_active);
249   virtual DisplayError SetMixerResolution(uint32_t width, uint32_t height);
250   virtual DisplayError GetMixerResolution(uint32_t *width, uint32_t *height);
251   virtual void GetPanelResolution(uint32_t *width, uint32_t *height);
252   virtual std::string Dump();
TeardownConcurrentWriteback(void)253   virtual DisplayError TeardownConcurrentWriteback(void) {
254     return kErrorNotSupported;
255   }
256 
257   // Captures frame output in the buffer specified by output_buffer_info. The API is
258   // non-blocking and the client is expected to check operation status later on.
259   // Returns -1 if the input is invalid.
FrameCaptureAsync(const BufferInfo & output_buffer_info,bool post_processed)260   virtual int FrameCaptureAsync(const BufferInfo &output_buffer_info, bool post_processed) {
261     return -1;
262   }
263   // Client gets release fence of the frame capture, requested with FrameCaptureAsync().
264   // True : Frame capture configured and client gets release fence.
265   // False: Frame capture is not valid and has not been configured.
GetFrameCaptureFence(int32_t * release_fence)266   virtual bool GetFrameCaptureFence(int32_t *release_fence) { return false; }
267 
SetDetailEnhancerConfig(const DisplayDetailEnhancerData & de_data)268   virtual DisplayError SetDetailEnhancerConfig(const DisplayDetailEnhancerData &de_data) {
269     return kErrorNotSupported;
270   }
SetReadbackBuffer(const native_handle_t * buffer,int32_t acquire_fence,bool post_processed_output)271   virtual HWC2::Error SetReadbackBuffer(const native_handle_t *buffer, int32_t acquire_fence,
272                                         bool post_processed_output) {
273     return HWC2::Error::Unsupported;
274   }
GetReadbackBufferFence(int32_t * release_fence)275   virtual HWC2::Error GetReadbackBufferFence(int32_t *release_fence) {
276     return HWC2::Error::Unsupported;
277   }
278 
279   // Display Configurations
280   virtual int SetActiveDisplayConfig(uint32_t config);
281   virtual int GetActiveDisplayConfig(uint32_t *config);
282   virtual int GetDisplayConfigCount(uint32_t *count);
283   virtual int GetDisplayAttributesForConfig(int config,
284                                             DisplayConfigVariableInfo *display_attributes);
SetState(bool connected)285   virtual int SetState(bool connected) {
286     return kErrorNotSupported;
287   }
Flush()288   virtual DisplayError Flush() {
289     return kErrorNotSupported;
290   }
291 
292   int SetPanelBrightness(int level);
293   int GetPanelBrightness(int *level);
294   int ToggleScreenUpdates(bool enable);
295   int ColorSVCRequestRoute(const PPDisplayAPIPayload &in_payload, PPDisplayAPIPayload *out_payload,
296                            PPPendingParams *pending_action);
297   void SolidFillPrepare();
298   void SolidFillCommit();
299   DisplayClass GetDisplayClass();
300   int GetVisibleDisplayRect(hwc_rect_t *rect);
301   void BuildLayerStack(void);
302   void BuildSolidFillStack(void);
303   HWCLayer *GetHWCLayer(hwc2_layer_t layer_id);
ResetValidation()304   void ResetValidation() { validated_ = false; }
GetGeometryChanges()305   uint32_t GetGeometryChanges() { return geometry_changes_; }
306   bool CanSkipValidate();
HasClientComposition()307   bool HasClientComposition() { return has_client_composition_; }
IsSkipValidateState()308   bool IsSkipValidateState() { return (validate_state_ == kSkipValidate); }
IsInternalValidateState()309   bool IsInternalValidateState() { return (validated_ && (validate_state_ == kInternalValidate)); }
SetValidationState(DisplayValidateState state)310   void SetValidationState(DisplayValidateState state) { validate_state_ = state; }
GetCurrentColorMode()311   ColorMode GetCurrentColorMode() { return current_color_mode_; }
312 
313   // HWC2 APIs
314   virtual HWC2::Error AcceptDisplayChanges(void);
315   virtual HWC2::Error GetActiveConfig(hwc2_config_t *out_config);
316   virtual HWC2::Error SetActiveConfig(hwc2_config_t config);
317   virtual HWC2::Error SetClientTarget(buffer_handle_t target, int32_t acquire_fence,
318                                       int32_t dataspace, hwc_region_t damage);
SetColorMode(ColorMode mode)319   virtual HWC2::Error SetColorMode(ColorMode mode) { return HWC2::Error::Unsupported; }
SetWhiteCompensation(bool enabled)320   virtual HWC2::Error SetWhiteCompensation(bool enabled) { return HWC2::Error::Unsupported; }
SetColorModeWithRenderIntent(ColorMode mode,RenderIntent intent)321   virtual HWC2::Error SetColorModeWithRenderIntent(ColorMode mode, RenderIntent intent) {
322     return HWC2::Error::Unsupported;
323   }
SetColorModeById(int32_t color_mode_id)324   virtual HWC2::Error SetColorModeById(int32_t color_mode_id) {
325     return HWC2::Error::Unsupported;
326   }
RestoreColorTransform()327   virtual HWC2::Error RestoreColorTransform() {
328     return HWC2::Error::Unsupported;
329   }
SetColorTransform(const float * matrix,android_color_transform_t hint)330   virtual HWC2::Error SetColorTransform(const float *matrix, android_color_transform_t hint) {
331     return HWC2::Error::Unsupported;
332   }
HandleColorModeTransform(android_color_mode_t mode,android_color_transform_t hint,const double * matrix)333   virtual HWC2::Error HandleColorModeTransform(android_color_mode_t mode,
334                                                android_color_transform_t hint,
335                                                const double *matrix) {
336     return HWC2::Error::Unsupported;
337   }
338   virtual HWC2::Error GetDisplayConfigs(uint32_t *out_num_configs, hwc2_config_t *out_configs);
339   virtual HWC2::Error GetDisplayAttribute(hwc2_config_t config, HWC2::Attribute attribute,
340                                           int32_t *out_value);
341   virtual HWC2::Error GetClientTargetSupport(uint32_t width, uint32_t height, int32_t format,
342                                              int32_t dataspace);
343   virtual HWC2::Error GetColorModes(uint32_t *outNumModes, ColorMode *outModes);
344   virtual HWC2::Error GetRenderIntents(ColorMode mode, uint32_t *out_num_intents,
345                                        RenderIntent *out_intents);
346   virtual HWC2::Error GetChangedCompositionTypes(uint32_t *out_num_elements,
347                                                  hwc2_layer_t *out_layers, int32_t *out_types);
348   virtual HWC2::Error GetDisplayRequests(int32_t *out_display_requests, uint32_t *out_num_elements,
349                                          hwc2_layer_t *out_layers, int32_t *out_layer_requests);
350   virtual HWC2::Error GetDisplayName(uint32_t *out_size, char *out_name);
351   virtual HWC2::Error GetDisplayType(int32_t *out_type);
352   virtual HWC2::Error SetCursorPosition(hwc2_layer_t layer, int x, int y);
353   virtual HWC2::Error SetVsyncEnabled(HWC2::Vsync enabled);
354   virtual HWC2::Error SetPowerMode(HWC2::PowerMode mode);
355   virtual HWC2::Error CreateLayer(hwc2_layer_t *out_layer_id);
356   virtual HWC2::Error DestroyLayer(hwc2_layer_t layer_id);
357   virtual HWC2::Error SetLayerZOrder(hwc2_layer_t layer_id, uint32_t z);
358   virtual HWC2::Error Validate(uint32_t *out_num_types, uint32_t *out_num_requests) = 0;
359   virtual HWC2::Error GetReleaseFences(uint32_t *out_num_elements, hwc2_layer_t *out_layers,
360                                        int32_t *out_fences);
361   virtual HWC2::Error Present(int32_t *out_retire_fence) = 0;
362   virtual HWC2::Error GetHdrCapabilities(uint32_t *out_num_types, int32_t* out_types,
363                                          float* out_max_luminance,
364                                          float* out_max_average_luminance,
365                                          float* out_min_luminance);
366   virtual HWC2::Error GetPerFrameMetadataKeys(uint32_t *out_num_keys,
367                                               PerFrameMetadataKey *out_keys);
SetDisplayAnimating(bool animating)368   virtual HWC2::Error SetDisplayAnimating(bool animating) {
369     animating_ = animating;
370     validated_ = false;
371     return HWC2::Error::None;
372   }
373   virtual HWC2::Error GetValidateDisplayOutput(uint32_t *out_num_types, uint32_t *out_num_requests);
ControlIdlePowerCollapse(bool enable,bool synchronous)374   virtual HWC2::Error ControlIdlePowerCollapse(bool enable, bool synchronous) {
375     return HWC2::Error::Unsupported;
376   }
377 
378   virtual HWC2::Error SetDisplayedContentSamplingEnabledVndService(bool enabled);
379   virtual HWC2::Error SetDisplayedContentSamplingEnabled(int32_t enabled, uint8_t component_mask, uint64_t max_frames);
380   virtual HWC2::Error GetDisplayedContentSamplingAttributes(int32_t* format,
381                                                             int32_t* dataspace,
382                                                             uint8_t* supported_components);
383   virtual HWC2::Error GetDisplayedContentSample(uint64_t max_frames,
384                                                 uint64_t timestamp,
385                                                 uint64_t* numFrames,
386                                                 int32_t samples_size[NUM_HISTOGRAM_COLOR_COMPONENTS],
387                                                 uint64_t* samples[NUM_HISTOGRAM_COLOR_COMPONENTS]);
388 
389  protected:
390   // Maximum number of layers supported by display manager.
391   static const uint32_t kMaxLayerCount = 32;
392   HWCDisplay(CoreInterface *core_intf, HWCCallbacks *callbacks, DisplayType type, hwc2_display_t id,
393              bool needs_blit, qService::QService *qservice, DisplayClass display_class,
394              BufferAllocator *buffer_allocator);
395 
396   // DisplayEventHandler methods
397   virtual DisplayError VSync(const DisplayEventVSync &vsync);
398   virtual DisplayError Refresh();
399   virtual DisplayError CECMessage(char *message);
400   virtual DisplayError HandleEvent(DisplayEvent event);
401   virtual void DumpOutputBuffer(const BufferInfo &buffer_info, void *base, int fence);
402   virtual HWC2::Error PrepareLayerStack(uint32_t *out_num_types, uint32_t *out_num_requests);
403   virtual HWC2::Error CommitLayerStack(void);
404   virtual HWC2::Error PostCommitLayerStack(int32_t *out_retire_fence);
DisablePartialUpdateOneFrame()405   virtual DisplayError DisablePartialUpdateOneFrame() {
406     return kErrorNotSupported;
407   }
408   LayerBufferFormat GetSDMFormat(const int32_t &source, const int flags);
409   const char *GetDisplayString();
410   void MarkLayersForGPUBypass(void);
411   void MarkLayersForClientComposition(void);
412   virtual void ApplyScanAdjustment(hwc_rect_t *display_frame);
413   uint32_t GetUpdatingLayersCount(void);
414   bool IsLayerUpdating(HWCLayer *layer);
415   uint32_t SanitizeRefreshRate(uint32_t req_refresh_rate);
GetUnderScanConfig()416   virtual void GetUnderScanConfig() { }
417 
418   enum {
419     INPUT_LAYER_DUMP,
420     OUTPUT_LAYER_DUMP,
421   };
422 
423   bool validated_ = false;
424   bool layer_stack_invalid_ = true;
425   CoreInterface *core_intf_ = nullptr;
426   HWCCallbacks *callbacks_  = nullptr;
427   HWCBufferAllocator *buffer_allocator_ = NULL;
428   DisplayType type_;
429   hwc2_display_t id_;
430   bool needs_blit_ = false;
431   DisplayInterface *display_intf_ = NULL;
432   LayerStack layer_stack_;
433   HWCLayer *client_target_ = nullptr;                   // Also known as framebuffer target
434   std::map<hwc2_layer_t, HWCLayer *> layer_map_;        // Look up by Id - TODO
435   std::multiset<HWCLayer *, SortLayersByZ> layer_set_;  // Maintain a set sorted by Z
436   std::map<hwc2_layer_t, HWC2::Composition> layer_changes_;
437   std::map<hwc2_layer_t, HWC2::LayerRequest> layer_requests_;
438   bool flush_on_error_ = false;
439   bool flush_ = false;
440   uint32_t dump_frame_count_ = 0;
441   uint32_t dump_frame_index_ = 0;
442   bool dump_input_layers_ = false;
443   HWC2::PowerMode last_power_mode_;
444   bool swap_interval_zero_ = false;
445   bool display_paused_ = false;
446   uint32_t min_refresh_rate_ = 0;
447   uint32_t max_refresh_rate_ = 0;
448   uint32_t current_refresh_rate_ = 0;
449   bool use_metadata_refresh_rate_ = false;
450   uint32_t metadata_refresh_rate_ = 0;
451   uint32_t force_refresh_rate_ = 0;
452   bool boot_animation_completed_ = false;
453   bool shutdown_pending_ = false;
454   bool use_blit_comp_ = false;
455   bool secure_display_active_ = false;
456   bool skip_prepare_ = false;
457   bool solid_fill_enable_ = false;
458   Layer *solid_fill_layer_ = NULL;
459   LayerRect solid_fill_rect_ = {};
460   LayerSolidFill solid_fill_color_ = {};
461   LayerRect display_rect_;
462   bool color_tranform_failed_ = false;
463   HWCColorMode *color_mode_ = NULL;
464   HWCToneMapper *tone_mapper_ = nullptr;
465   uint32_t num_configs_ = 0;
466   int disable_hdr_handling_ = 0;  // disables HDR handling.
467   uint32_t display_config_ = 0;
468   bool config_pending_ = false;
469   bool pending_commit_ = false;
470   ColorMode current_color_mode_ = ColorMode::NATIVE;
471   ColorPrimaries working_primaries_ = ColorPrimaries_BT709_5;
472   GammaTransfer working_transfer_ = Transfer_sRGB;
473   float hdr_largest_layer_px_ = 0.0f;
474 
475  private:
476   void DumpInputBuffers(void);
477   void UpdateRefreshRate();
478   bool CanSkipSdmPrepare(uint32_t *num_types, uint32_t *num_requests);
479 
480   qService::QService *qservice_ = NULL;
481   DisplayClass display_class_;
482   uint32_t geometry_changes_ = GeometryChanges::kNone;
483   bool animating_ = false;
484   bool has_client_composition_ = false;
485   DisplayValidateState validate_state_ = kNormalValidate;
486   bool partial_update_enabled_ = false;
487 };
488 
Perform(uint32_t operation,...)489 inline int HWCDisplay::Perform(uint32_t operation, ...) {
490   return 0;
491 }
492 
493 }  // namespace sdm
494 
495 #endif  // __HWC_DISPLAY_H__
496