• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "rs_screen.h"
17 
18 #include <cinttypes>
19 
20 #include "platform/common/rs_log.h"
21 #include "string_utils.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 using namespace HiviewDFX;
26 
27 namespace impl {
RSScreen(ScreenId id,bool isVirtual,std::shared_ptr<HdiOutput> output,sptr<Surface> surface)28 RSScreen::RSScreen(ScreenId id,
29     bool isVirtual,
30     std::shared_ptr<HdiOutput> output,
31     sptr<Surface> surface)
32     : id_(id),
33       isVirtual_(isVirtual),
34       hdiOutput_(std::move(output)),
35       producerSurface_(std::move(surface))
36 {
37     if (!IsVirtual()) {
38         name_ = "Screen_" + std::to_string(id_);
39         PhysicalScreenInit();
40     }
41 }
42 
RSScreen(const VirtualScreenConfigs & configs)43 RSScreen::RSScreen(const VirtualScreenConfigs &configs)
44     : id_(configs.id),
45       mirrorId_(configs.mirrorId),
46       name_(configs.name),
47       width_(configs.width),
48       height_(configs.height),
49       isVirtual_(true),
50       producerSurface_(configs.surface),
51       screenType_(RSScreenType::VIRTUAL_TYPE_SCREEN)
52 {
53 }
54 
~RSScreen()55 RSScreen::~RSScreen() noexcept
56 {
57 }
58 
PhysicalScreenInit()59 void RSScreen::PhysicalScreenInit() noexcept
60 {
61     hdiScreen_ = HdiScreen::CreateHdiScreen(ScreenPhysicalId(id_));
62     if (hdiScreen_ == nullptr) {
63         RS_LOGE("RSScreen %s: RSScreen(id %" PRIu64 ") failed to CreateHdiScreens.",
64             __func__, id_);
65         return;
66     }
67 
68     hdiScreen_->Init();
69     if (hdiScreen_->GetScreenSupportedModes(supportedModes_) < 0) {
70         RS_LOGE("RSScreen %s: RSScreen(id %" PRIu64 ") failed to GetScreenSupportedModes.",
71             __func__, id_);
72     }
73     if (hdiScreen_->GetScreenCapability(capability_) < 0) {
74         RS_LOGE("RSScreen %s: RSScreen(id %" PRIu64 ") failed to GetScreenCapability.",
75             __func__, id_);
76     }
77     if (hdiScreen_->GetHDRCapabilityInfos(hdrCapability_) < 0) {
78         RS_LOGE("RSScreen %s: RSScreen(id %" PRIu64 ") failed to GetHDRCapabilityInfos.",
79             __func__, id_);
80     }
81     auto status = DispPowerStatus::POWER_STATUS_ON;
82     if (hdiScreen_->SetScreenPowerStatus(status) < 0) {
83         RS_LOGE("RSScreen %s: RSScreen(id %" PRIu64 ") failed to SetScreenPowerStatus.",
84             __func__, id_);
85     }
86     auto activeMode = GetActiveMode();
87     if (activeMode) {
88         width_ = activeMode->width;
89         height_ = activeMode->height;
90     }
91     if (hdiScreen_->GetScreenPowerStatus(powerStatus_) < 0) {
92         powerStatus_ = static_cast<DispPowerStatus>(INVALID_POWER_STATUS);
93     }
94     if (capability_.type == InterfaceType::DISP_INTF_MIPI) {
95         screenType_ = RSScreenType::BUILT_IN_TYPE_SCREEN;
96     } else {
97         screenType_ = RSScreenType::EXTERNAL_TYPE_SCREEN;
98     }
99 }
100 
Id() const101 ScreenId RSScreen::Id() const
102 {
103     return id_;
104 }
105 
MirrorId() const106 ScreenId RSScreen::MirrorId() const
107 {
108     return mirrorId_;
109 }
110 
SetMirror(ScreenId mirrorId)111 void RSScreen::SetMirror(ScreenId mirrorId)
112 {
113     mirrorId_ = mirrorId;
114 }
115 
Name() const116 const std::string& RSScreen::Name() const
117 {
118     return name_;
119 }
120 
Width() const121 uint32_t RSScreen::Width() const
122 {
123     return width_;
124 }
125 
Height() const126 uint32_t RSScreen::Height() const
127 {
128     return height_;
129 }
130 
IsEnable() const131 bool RSScreen::IsEnable() const
132 {
133     if (id_ == INVALID_SCREEN_ID) {
134         return false;
135     }
136 
137     if (!hdiOutput_ && !producerSurface_) {
138         return false;
139     }
140 
141     // [PLANNING]: maybe need more information to judge whether this screen is enable.
142     return true;
143 }
144 
IsVirtual() const145 bool RSScreen::IsVirtual() const
146 {
147     return isVirtual_;
148 }
149 
SetActiveMode(uint32_t modeId)150 void RSScreen::SetActiveMode(uint32_t modeId)
151 {
152     if (IsVirtual()) {
153         RS_LOGW("RSScreen %s: virtual screen not support SetActiveMode.", __func__);
154         return;
155     }
156 
157     if (modeId >= supportedModes_.size()) {
158         RS_LOGE("RSScreen %s: set fails because the index is out of bounds.", __func__);
159         return;
160     }
161     int32_t selectModeId = supportedModes_[modeId].id;
162     if (hdiScreen_->SetScreenMode(static_cast<uint32_t>(selectModeId)) < 0) {
163         RS_LOGE("RSScreen %s: Hdi SetScreenMode fails.", __func__);
164         return;
165     }
166     auto activeMode = GetActiveMode();
167     if (activeMode) {
168         width_ = activeMode->width;
169         height_ = activeMode->height;
170     }
171 }
172 
SetResolution(uint32_t width,uint32_t height)173 void RSScreen::SetResolution(uint32_t width, uint32_t height)
174 {
175     if (!IsVirtual()) {
176         RS_LOGW("RSScreen %s: physical screen not support SetResolution.", __func__);
177         return;
178     }
179     width_ = static_cast<int32_t>(width);
180     height_ = static_cast<int32_t>(height);
181 }
182 
GetActiveModePosByModeId(int32_t modeId) const183 int32_t RSScreen::GetActiveModePosByModeId(int32_t modeId) const
184 {
185     decltype(supportedModes_.size()) modeIndex = 0;
186     for (; modeIndex < supportedModes_.size(); ++modeIndex) {
187         if (supportedModes_[modeIndex].id == modeId) {
188             return static_cast<int32_t>(modeIndex);
189         }
190     }
191     return -1;
192 }
193 
SetPowerStatus(uint32_t powerStatus)194 void RSScreen::SetPowerStatus(uint32_t powerStatus)
195 {
196     if (IsVirtual()) {
197         RS_LOGW("RSScreen %s: virtual screen not support SetPowerStatus.", __func__);
198         return;
199     }
200 
201     RS_LOGD("RSScreen %s SetPowerStatus, status is %u", __func__, powerStatus);
202     if (hdiScreen_->SetScreenPowerStatus(static_cast<DispPowerStatus>(powerStatus)) < 0) {
203         return;
204     }
205 
206     if (powerStatus == DispPowerStatus::POWER_STATUS_ON) {
207         RS_LOGD("RSScreen %s Enable hardware vsync", __func__);
208         if (hdiScreen_->SetScreenVsyncEnabled(true) != GRAPHIC_DISPLAY_SUCCESS) {
209             RS_LOGE("RSScreen %s SetScreenVsyncEnabled failed", __func__);
210         }
211     }
212 }
213 
GetActiveMode() const214 std::optional<DisplayModeInfo> RSScreen::GetActiveMode() const
215 {
216     if (IsVirtual()) {
217         RS_LOGW("RSScreen %s: virtual screen not support GetActiveMode.", __func__);
218         return {};
219     }
220 
221     uint32_t modeId = 0;
222 
223     if (hdiScreen_ == nullptr) {
224         RS_LOGE("RSScreen %s: RSScreen(id %" PRIu64 ") hdiScreen is null.",
225             __func__, id_);
226         return {};
227     }
228 
229     if (hdiScreen_->GetScreenMode(modeId) < 0) {
230         RS_LOGE("RSScreen %s: RSScreen(id %" PRIu64 ") GetScreenMode failed.",
231             __func__, id_);
232         return {};
233     }
234 
235     auto iter = std::find_if(supportedModes_.cbegin(), supportedModes_.cend(),
236         [modeId](const auto &mode) { return static_cast<uint32_t>(mode.id) == modeId; });
237     if (iter == supportedModes_.cend()) {
238         return {};
239     }
240 
241     return *iter;
242 }
243 
GetSupportedModes() const244 const std::vector<DisplayModeInfo>& RSScreen::GetSupportedModes() const
245 {
246     return supportedModes_;
247 }
248 
GetCapability() const249 const DisplayCapability& RSScreen::GetCapability() const
250 {
251     return capability_;
252 }
253 
GetPowerStatus() const254 uint32_t RSScreen::GetPowerStatus() const
255 {
256     if (IsVirtual()) {
257         RS_LOGW("RSScreen %s: virtual screen not support GetPowerStatus.", __func__);
258         return ScreenPowerStatus::INVALID_POWER_STATUS;
259     }
260 
261     DispPowerStatus status;
262     if (hdiScreen_->GetScreenPowerStatus(status) < 0) {
263         return INVALID_POWER_STATUS;
264     }
265     return static_cast<uint32_t>(status);
266 }
267 
GetOutput() const268 std::shared_ptr<HdiOutput> RSScreen::GetOutput() const
269 {
270     return hdiOutput_;
271 }
272 
GetProducerSurface() const273 sptr<Surface> RSScreen::GetProducerSurface() const
274 {
275     return producerSurface_;
276 }
277 
SetProducerSurface(sptr<Surface> producerSurface)278 void RSScreen::SetProducerSurface(sptr<Surface> producerSurface)
279 {
280     producerSurface_ = producerSurface;
281 }
282 
ModeInfoDump(std::string & dumpString)283 void RSScreen::ModeInfoDump(std::string& dumpString)
284 {
285     decltype(supportedModes_.size()) modeIndex = 0;
286     for (; modeIndex < supportedModes_.size(); ++modeIndex) {
287         AppendFormat(dumpString, "  supportedMode[%d]: %dx%d, refreshrate=%d\n",
288                      modeIndex, supportedModes_[modeIndex].width,
289                      supportedModes_[modeIndex].height, supportedModes_[modeIndex].freshRate);
290     }
291     std::optional<DisplayModeInfo> activeMode = GetActiveMode();
292     if (activeMode) {
293         AppendFormat(dumpString, "  activeMode: %dx%d, refreshrate=%d\n",
294             activeMode->width, activeMode->height, activeMode->freshRate);
295     }
296 }
297 
CapabilityTypeDump(InterfaceType capabilityType,std::string & dumpString)298 void RSScreen::CapabilityTypeDump(InterfaceType capabilityType, std::string& dumpString)
299 {
300     dumpString += "type=";
301     switch (capability_.type) {
302         case DISP_INTF_HDMI: {
303             dumpString += "DISP_INTF_HDMI, ";
304             break;
305         }
306         case DISP_INTF_LCD: {
307             dumpString += "DISP_INTF_LCD, ";
308             break;
309         }
310         case DISP_INTF_BT1120: {
311             dumpString += "DISP_INTF_BT1120, ";
312             break;
313         }
314         case DISP_INTF_BT656: {
315             dumpString += "DISP_INTF_BT656, ";
316             break;
317         }
318         default:
319             dumpString += "INVILID_DISP_INTF, ";
320             break;
321     }
322 }
323 
CapabilityDump(std::string & dumpString)324 void RSScreen::CapabilityDump(std::string& dumpString)
325 {
326     AppendFormat(dumpString, "  capability: name=%s, phywidth=%d, phyheight=%d,"
327                  "supportlayers=%d, virtualDispCount=%d, propCount=%d, ",
328                  capability_.name, capability_.phyWidth, capability_.phyHeight,
329                  capability_.supportLayers, capability_.virtualDispCount, capability_.propertyCount);
330     CapabilityTypeDump(capability_.type, dumpString);
331     dumpString += "supportWriteBack=";
332     dumpString += (capability_.supportWriteBack) ? "true" : "false";
333     dumpString += "\n";
334     PropDump(dumpString);
335 }
336 
PropDump(std::string & dumpString)337 void RSScreen::PropDump(std::string& dumpString)
338 {
339     decltype(capability_.propertyCount) propIndex = 0;
340     for (; propIndex < capability_.propertyCount; ++propIndex) {
341         AppendFormat(dumpString, "prop[%u]: name=%s, propid=%d, value=%d\n",
342                      propIndex, capability_.props[propIndex].name, capability_.props[propIndex].propId,
343                      capability_.props[propIndex].value);
344     }
345 }
346 
PowerStatusDump(std::string & dumpString)347 void RSScreen::PowerStatusDump(std::string& dumpString)
348 {
349     dumpString += "powerstatus=";
350     switch (powerStatus_) {
351         case POWER_STATUS_ON: {
352             dumpString += "POWER_STATUS_ON";
353             break;
354         }
355         case POWER_STATUS_STANDBY: {
356             dumpString += "POWER_STATUS_STANDBY";
357             break;
358         }
359         case POWER_STATUS_SUSPEND: {
360             dumpString += "POWER_STATUS_SUSPEND";
361             break;
362         }
363         case POWER_STATUS_OFF: {
364             dumpString += "POWER_STATUS_OFF";
365             break;
366         }
367         case POWER_STATUS_BUTT: {
368             dumpString += "POWER_STATUS_BUTT";
369             break;
370         }
371         default: {
372             dumpString += "INVALID_POWER_STATUS";
373             break;
374         }
375     }
376 }
377 
378 
DisplayDump(int32_t screenIndex,std::string & dumpString)379 void RSScreen::DisplayDump(int32_t screenIndex, std::string& dumpString)
380 {
381     dumpString += "-- ScreenInfo\n";
382     if (IsVirtual()) {
383         dumpString += "screen[" + std::to_string(screenIndex) + "]: ";
384         dumpString += "id=";
385         dumpString += (id_ == INVALID_SCREEN_ID) ? "INVALID_SCREEN_ID" : std::to_string(id_);
386         dumpString += ", ";
387         dumpString += "mirrorId=";
388         dumpString += (mirrorId_ == INVALID_SCREEN_ID) ? "INVALID_SCREEN_ID" : std::to_string(mirrorId_);
389         dumpString += ", ";
390         AppendFormat(dumpString, "%dx%d, isvirtual=true\n", width_, height_);
391     } else {
392         dumpString += "screen[" + std::to_string(screenIndex) + "]: ";
393         dumpString += "id=";
394         dumpString += (id_ == INVALID_SCREEN_ID) ? "INVALID_SCREEN_ID" : std::to_string(id_);
395         dumpString += ", ";
396         PowerStatusDump(dumpString);
397         dumpString += ", ";
398         dumpString += "backlight=" + std::to_string(GetScreenBacklight());
399         dumpString += ", ";
400         ScreenTypeDump(dumpString);
401         dumpString += "\n";
402         ModeInfoDump(dumpString);
403         CapabilityDump(dumpString);
404     }
405 }
406 
ScreenTypeDump(std::string & dumpString)407 void RSScreen::ScreenTypeDump(std::string& dumpString)
408 {
409     dumpString += "screenType=";
410     switch (screenType_) {
411         case RSScreenType::BUILT_IN_TYPE_SCREEN: {
412             dumpString += "BUILT_IN_TYPE";
413             break;
414         }
415         case RSScreenType::EXTERNAL_TYPE_SCREEN: {
416             dumpString += "EXTERNAL_TYPE";
417             break;
418         }
419         case RSScreenType::VIRTUAL_TYPE_SCREEN: {
420             dumpString += "VIRTUAL_TYPE";
421             break;
422         }
423         default: {
424             dumpString += "UNKNOWN_TYPE";
425             break;
426         }
427     }
428 }
429 
SurfaceDump(int32_t screenIndex,std::string & dumpString)430 void RSScreen::SurfaceDump(int32_t screenIndex, std::string& dumpString)
431 {
432     if (hdiOutput_ == nullptr) {
433         RS_LOGW("RSScreen %s: hdiOutput_ is nullptr.", __func__);
434         return;
435     }
436     hdiOutput_->Dump(dumpString);
437 }
438 
FpsDump(int32_t screenIndex,std::string & dumpString,std::string & arg)439 void RSScreen::FpsDump(int32_t screenIndex, std::string& dumpString, std::string& arg)
440 {
441     if (hdiOutput_ == nullptr) {
442         RS_LOGW("RSScreen %s: hdiOutput_ is nullptr.", __func__);
443         return;
444     }
445     hdiOutput_->DumpFps(dumpString, arg);
446 }
447 
ClearFpsDump(int32_t screenIndex,std::string & dumpString,std::string & arg)448 void RSScreen::ClearFpsDump(int32_t screenIndex, std::string& dumpString, std::string& arg)
449 {
450     if (hdiOutput_ == nullptr) {
451         RS_LOGW("RSScreen %s: hdiOutput_ is nullptr.", __func__);
452         return;
453     }
454     hdiOutput_->ClearFpsDump(dumpString, arg);
455 }
456 
SetScreenBacklight(uint32_t level)457 void RSScreen::SetScreenBacklight(uint32_t level)
458 {
459     if (IsVirtual()) {
460         RS_LOGW("RSScreen %s: virtual screen not support SetScreenBacklight.", __func__);
461         return;
462     }
463     if (hdiScreen_->SetScreenBacklight(level) < 0) {
464         return;
465     }
466 }
467 
GetScreenBacklight() const468 int32_t RSScreen::GetScreenBacklight() const
469 {
470     if (IsVirtual()) {
471         RS_LOGW("RSScreen %s: virtual screen not support GetScreenBacklight.", __func__);
472         return INVALID_BACKLIGHT_VALUE;
473     }
474     uint32_t level = 0;
475     if (hdiScreen_->GetScreenBacklight(level) < 0) {
476         return INVALID_BACKLIGHT_VALUE;
477     }
478     return static_cast<int32_t>(level);
479 }
480 
GetScreenSupportedColorGamuts(std::vector<ScreenColorGamut> & mode) const481 int32_t RSScreen::GetScreenSupportedColorGamuts(std::vector<ScreenColorGamut> &mode) const
482 {
483     if (IsVirtual()) {
484         mode.clear();
485         mode = supportedVirtualColorGamuts_;
486         return StatusCode::SUCCESS;
487     }
488     std::vector<GraphicColorGamut> hdiMode;
489     int32_t result = hdiScreen_->GetScreenSupportedColorGamuts(hdiMode);
490     if (result == GraphicDispErrCode::GRAPHIC_DISPLAY_SUCCESS) {
491         mode.clear();
492         std::transform(hdiMode.begin(), hdiMode.end(), std::back_inserter(mode),
493             [](GraphicColorGamut m) { return static_cast<ScreenColorGamut>(m); });
494         return StatusCode::SUCCESS;
495     }
496     return StatusCode::HDI_ERROR;
497 }
498 
GetScreenSupportedMetaDataKeys(std::vector<ScreenHDRMetadataKey> & keys) const499 int32_t RSScreen::GetScreenSupportedMetaDataKeys(std::vector<ScreenHDRMetadataKey> &keys) const
500 {
501     if (IsVirtual()) {
502         RS_LOGW("RSScreen %s: virtual screen not support GetScreenSupportedMetaDataKeys.", __func__);
503         return INVALID_BACKLIGHT_VALUE;
504     }
505 
506     // ScreenHDRMetadataKey now is mock data.
507     keys.push_back(ScreenHDRMetadataKey::MATAKEY_RED_PRIMARY_X);
508     keys.push_back(ScreenHDRMetadataKey::MATAKEY_RED_PRIMARY_Y);
509     keys.push_back(ScreenHDRMetadataKey::MATAKEY_GREEN_PRIMARY_X);
510     keys.push_back(ScreenHDRMetadataKey::MATAKEY_GREEN_PRIMARY_Y);
511     keys.push_back(ScreenHDRMetadataKey::MATAKEY_BLUE_PRIMARY_X);
512     keys.push_back(ScreenHDRMetadataKey::MATAKEY_BLUE_PRIMARY_Y);
513     keys.push_back(ScreenHDRMetadataKey::MATAKEY_WHITE_PRIMARY_X);
514     keys.push_back(ScreenHDRMetadataKey::MATAKEY_WHITE_PRIMARY_Y);
515     keys.push_back(ScreenHDRMetadataKey::MATAKEY_MAX_LUMINANCE);
516     keys.push_back(ScreenHDRMetadataKey::MATAKEY_MIN_LUMINANCE);
517     keys.push_back(ScreenHDRMetadataKey::MATAKEY_MAX_CONTENT_LIGHT_LEVEL);
518     keys.push_back(ScreenHDRMetadataKey::MATAKEY_MAX_FRAME_AVERAGE_LIGHT_LEVEL);
519     keys.push_back(ScreenHDRMetadataKey::MATAKEY_HDR10_PLUS);
520     keys.push_back(ScreenHDRMetadataKey::MATAKEY_HDR_VIVID);
521     return StatusCode::SUCCESS;
522 }
523 
GetScreenColorGamut(ScreenColorGamut & mode) const524 int32_t RSScreen::GetScreenColorGamut(ScreenColorGamut &mode) const
525 {
526     if (IsVirtual()) {
527         mode = supportedVirtualColorGamuts_[currentVirtualColorGamutIdx_];
528         return StatusCode::SUCCESS;
529     }
530     GraphicColorGamut hdiMode;
531     int32_t result = hdiScreen_->GetScreenColorGamut(hdiMode);
532     if (result == GraphicDispErrCode::GRAPHIC_DISPLAY_SUCCESS) {
533         mode = static_cast<ScreenColorGamut>(hdiMode);
534         return StatusCode::SUCCESS;
535     }
536     return StatusCode::HDI_ERROR;
537 }
538 
SetScreenColorGamut(int32_t modeIdx)539 int32_t RSScreen::SetScreenColorGamut(int32_t modeIdx)
540 {
541     if (IsVirtual()) {
542         if (modeIdx >= static_cast<int32_t>(supportedVirtualColorGamuts_.size())) {
543             return StatusCode::INVALID_ARGUMENTS;
544         }
545         currentVirtualColorGamutIdx_ = modeIdx;
546         return StatusCode::SUCCESS;
547     }
548     std::vector<GraphicColorGamut> hdiMode;
549     if (hdiScreen_->GetScreenSupportedColorGamuts(hdiMode) != GraphicDispErrCode::GRAPHIC_DISPLAY_SUCCESS) {
550         return StatusCode::HDI_ERROR;
551     }
552     if (modeIdx >= static_cast<int32_t>(hdiMode.size())) {
553         return StatusCode::INVALID_ARGUMENTS;
554     }
555     int32_t result = hdiScreen_->SetScreenColorGamut(hdiMode[modeIdx]);
556     if (result == GraphicDispErrCode::GRAPHIC_DISPLAY_SUCCESS) {
557         return StatusCode::SUCCESS;
558     }
559     return StatusCode::HDI_ERROR;
560 }
561 
SetScreenGamutMap(ScreenGamutMap mode)562 int32_t RSScreen::SetScreenGamutMap(ScreenGamutMap mode)
563 {
564     if (IsVirtual()) {
565         currentVirtualGamutMap_ = mode;
566         return StatusCode::SUCCESS;
567     }
568     int32_t result = hdiScreen_->SetScreenGamutMap(static_cast<GamutMap>(mode));
569     if (result == GraphicDispErrCode::GRAPHIC_DISPLAY_SUCCESS) {
570         return StatusCode::SUCCESS;
571     }
572     return StatusCode::HDI_ERROR;
573 }
574 
GetScreenGamutMap(ScreenGamutMap & mode) const575 int32_t RSScreen::GetScreenGamutMap(ScreenGamutMap &mode) const
576 {
577     if (IsVirtual()) {
578         mode = currentVirtualGamutMap_;
579         return StatusCode::SUCCESS;
580     }
581     GamutMap hdiMode;
582     int32_t result = hdiScreen_->GetScreenGamutMap(hdiMode);
583     if (result == GraphicDispErrCode::GRAPHIC_DISPLAY_SUCCESS) {
584         mode = static_cast<ScreenGamutMap>(hdiMode);
585         return StatusCode::SUCCESS;
586     }
587     return StatusCode::HDI_ERROR;
588 }
589 
GetHDRCapability()590 const HDRCapability& RSScreen::GetHDRCapability()
591 {
592     hdrCapability_.maxLum = 1000; // maxLum now is mock data
593     return hdrCapability_;
594 }
595 
GetScreenType() const596 const RSScreenType& RSScreen::GetScreenType() const
597 {
598     return screenType_;
599 }
600 
SetScreenSkipFrameInterval(uint32_t skipFrameInterval)601 void RSScreen::SetScreenSkipFrameInterval(uint32_t skipFrameInterval)
602 {
603     skipFrameInterval_ = skipFrameInterval;
604 }
605 
GetScreenSkipFrameInterval() const606 uint32_t RSScreen::GetScreenSkipFrameInterval() const
607 {
608     return skipFrameInterval_;
609 }
610 
SetScreenVsyncEnabled(bool enabled) const611 void RSScreen::SetScreenVsyncEnabled(bool enabled) const
612 {
613     if (IsVirtual()) {
614         return;
615     }
616     if (hdiScreen_ != nullptr) {
617         hdiScreen_->SetScreenVsyncEnabled(enabled);
618     }
619 }
620 } // namespace impl
621 } // namespace Rosen
622 } // namespace OHOS
623