Lines Matching refs:displayId
42 #define LOG_DISPLAY_ERROR(displayId, msg) \ argument
43 ALOGE("%s failed for display %s: %s", __FUNCTION__, to_string(displayId).c_str(), msg)
45 #define LOG_HWC_ERROR(what, error, displayId) \ argument
47 to_string(displayId).c_str(), to_string(error).c_str(), static_cast<int32_t>(error))
49 #define RETURN_IF_INVALID_DISPLAY(displayId, ...) \ argument
51 if (mDisplayData.count(displayId) == 0) { \
52 LOG_DISPLAY_ERROR(displayId, "Invalid display"); \
57 #define RETURN_IF_HWC_ERROR_FOR(what, error, displayId, ...) \ argument
60 LOG_HWC_ERROR(what, error, displayId); \
65 #define RETURN_IF_HWC_ERROR(error, displayId, ...) \ argument
66 RETURN_IF_HWC_ERROR_FOR(__FUNCTION__, error, displayId, __VA_ARGS__)
103 bool HWComposer::hasDisplayCapability(const std::optional<DisplayId>& displayId, in hasDisplayCapability() argument
105 if (!displayId) { in hasDisplayCapability()
112 RETURN_IF_INVALID_DISPLAY(*displayId, false); in hasDisplayCapability()
113 return mDisplayData.at(*displayId).hwcDisplay->getCapabilities().count(capability) > 0; in hasDisplayCapability()
145 if (const auto displayId = toPhysicalDisplayId(hwcDisplayId)) { in onHotplug() local
146 info = DisplayIdentificationInfo{*displayId, std::string()}; in onHotplug()
174 const auto displayId = toPhysicalDisplayId(hwcDisplayId); in onVsync() local
175 if (!displayId) { in onVsync()
180 RETURN_IF_INVALID_DISPLAY(*displayId, false); in onVsync()
182 auto& displayData = mDisplayData[*displayId]; in onVsync()
184 LOG_DISPLAY_ERROR(*displayId, "Invalid operation on virtual display"); in onVsync()
197 to_string(*displayId).c_str(), timestamp); in onVsync()
204 const auto tag = "HW_VSYNC_" + to_string(*displayId); in onVsync()
233 DisplayId displayId; in allocateVirtualDisplay() local
235 displayId = getVirtualDisplayId(mNextVirtualDisplayId++); in allocateVirtualDisplay()
237 displayId = *mFreeVirtualDisplayIds.begin(); in allocateVirtualDisplay()
238 mFreeVirtualDisplayIds.erase(displayId); in allocateVirtualDisplay()
241 auto& displayData = mDisplayData[displayId]; in allocateVirtualDisplay()
246 return displayId; in allocateVirtualDisplay()
249 HWC2::Layer* HWComposer::createLayer(DisplayId displayId) { in createLayer() argument
250 RETURN_IF_INVALID_DISPLAY(displayId, nullptr); in createLayer()
252 auto display = mDisplayData[displayId].hwcDisplay; in createLayer()
255 RETURN_IF_HWC_ERROR(error, displayId, nullptr); in createLayer()
259 void HWComposer::destroyLayer(DisplayId displayId, HWC2::Layer* layer) { in destroyLayer() argument
260 RETURN_IF_INVALID_DISPLAY(displayId); in destroyLayer()
262 auto display = mDisplayData[displayId].hwcDisplay; in destroyLayer()
264 RETURN_IF_HWC_ERROR(error, displayId); in destroyLayer()
267 nsecs_t HWComposer::getRefreshTimestamp(DisplayId displayId) const { in getRefreshTimestamp()
268 RETURN_IF_INVALID_DISPLAY(displayId, 0); in getRefreshTimestamp()
269 const auto& displayData = mDisplayData.at(displayId); in getRefreshTimestamp()
275 auto vsyncPeriod = getActiveConfig(displayId)->getVsyncPeriod(); in getRefreshTimestamp()
279 bool HWComposer::isConnected(DisplayId displayId) const { in isConnected()
280 RETURN_IF_INVALID_DISPLAY(displayId, false); in isConnected()
281 return mDisplayData.at(displayId).hwcDisplay->isConnected(); in isConnected()
285 DisplayId displayId) const { in getConfigs()
286 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getConfigs()
288 const auto& displayData = mDisplayData.at(displayId); in getConfigs()
299 DisplayId displayId) const { in getActiveConfig()
300 RETURN_IF_INVALID_DISPLAY(displayId, nullptr); in getActiveConfig()
303 auto error = mDisplayData.at(displayId).hwcDisplay->getActiveConfig(&config); in getActiveConfig()
305 LOG_DISPLAY_ERROR(displayId, "No active config"); in getActiveConfig()
309 RETURN_IF_HWC_ERROR(error, displayId, nullptr); in getActiveConfig()
312 LOG_DISPLAY_ERROR(displayId, "Unknown config"); in getActiveConfig()
319 int HWComposer::getActiveConfigIndex(DisplayId displayId) const { in getActiveConfigIndex()
320 RETURN_IF_INVALID_DISPLAY(displayId, -1); in getActiveConfigIndex()
323 auto error = mDisplayData.at(displayId).hwcDisplay->getActiveConfigIndex(&index); in getActiveConfigIndex()
325 LOG_DISPLAY_ERROR(displayId, "No active config"); in getActiveConfigIndex()
329 RETURN_IF_HWC_ERROR(error, displayId, -1); in getActiveConfigIndex()
332 LOG_DISPLAY_ERROR(displayId, "Unknown config"); in getActiveConfigIndex()
339 std::vector<ui::ColorMode> HWComposer::getColorModes(DisplayId displayId) const { in getColorModes()
340 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getColorModes()
343 auto error = mDisplayData.at(displayId).hwcDisplay->getColorModes(&modes); in getColorModes()
344 RETURN_IF_HWC_ERROR(error, displayId, {}); in getColorModes()
348 status_t HWComposer::setActiveColorMode(DisplayId displayId, ui::ColorMode mode, in setActiveColorMode() argument
350 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setActiveColorMode()
352 auto& displayData = mDisplayData[displayId]; in setActiveColorMode()
357 error, displayId, UNKNOWN_ERROR); in setActiveColorMode()
362 void HWComposer::setVsyncEnabled(DisplayId displayId, HWC2::Vsync enabled) { in setVsyncEnabled() argument
363 RETURN_IF_INVALID_DISPLAY(displayId); in setVsyncEnabled()
364 auto& displayData = mDisplayData[displayId]; in setVsyncEnabled()
367 LOG_DISPLAY_ERROR(displayId, "Invalid operation on virtual display"); in setVsyncEnabled()
382 RETURN_IF_HWC_ERROR(error, displayId); in setVsyncEnabled()
386 const auto tag = "HW_VSYNC_ON_" + to_string(displayId); in setVsyncEnabled()
390 status_t HWComposer::setClientTarget(DisplayId displayId, uint32_t slot, in setClientTarget() argument
393 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setClientTarget()
395 ALOGV("%s for display %s", __FUNCTION__, to_string(displayId).c_str()); in setClientTarget()
396 auto& hwcDisplay = mDisplayData[displayId].hwcDisplay; in setClientTarget()
398 RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setClientTarget()
402 status_t HWComposer::prepare(DisplayId displayId, const compositionengine::Output& output) { in prepare() argument
405 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in prepare()
407 auto& displayData = mDisplayData[displayId]; in prepare()
432 RETURN_IF_HWC_ERROR_FOR("presentOrValidate", error, displayId, UNKNOWN_ERROR); in prepare()
449 RETURN_IF_HWC_ERROR_FOR("validate", error, displayId, BAD_INDEX); in prepare()
455 RETURN_IF_HWC_ERROR_FOR("getChangedCompositionTypes", error, displayId, BAD_INDEX); in prepare()
462 RETURN_IF_HWC_ERROR_FOR("getRequests", error, displayId, BAD_INDEX); in prepare()
499 LOG_DISPLAY_ERROR(displayId, in prepare()
506 RETURN_IF_HWC_ERROR_FOR("acceptChanges", error, displayId, BAD_INDEX); in prepare()
511 bool HWComposer::hasDeviceComposition(const std::optional<DisplayId>& displayId) const { in hasDeviceComposition()
512 if (!displayId) { in hasDeviceComposition()
518 RETURN_IF_INVALID_DISPLAY(*displayId, false); in hasDeviceComposition()
519 return mDisplayData.at(*displayId).hasDeviceComposition; in hasDeviceComposition()
522 bool HWComposer::hasFlipClientTargetRequest(const std::optional<DisplayId>& displayId) const { in hasFlipClientTargetRequest()
523 if (!displayId) { in hasFlipClientTargetRequest()
529 RETURN_IF_INVALID_DISPLAY(*displayId, false); in hasFlipClientTargetRequest()
530 return ((static_cast<uint32_t>(mDisplayData.at(*displayId).displayRequests) & in hasFlipClientTargetRequest()
534 bool HWComposer::hasClientComposition(const std::optional<DisplayId>& displayId) const { in hasClientComposition()
535 if (!displayId) { in hasClientComposition()
541 RETURN_IF_INVALID_DISPLAY(*displayId, true); in hasClientComposition()
542 return mDisplayData.at(*displayId).hasClientComposition; in hasClientComposition()
545 sp<Fence> HWComposer::getPresentFence(DisplayId displayId) const { in getPresentFence()
546 RETURN_IF_INVALID_DISPLAY(displayId, Fence::NO_FENCE); in getPresentFence()
547 return mDisplayData.at(displayId).lastPresentFence; in getPresentFence()
550 sp<Fence> HWComposer::getLayerReleaseFence(DisplayId displayId, HWC2::Layer* layer) const { in getLayerReleaseFence() argument
551 RETURN_IF_INVALID_DISPLAY(displayId, Fence::NO_FENCE); in getLayerReleaseFence()
552 auto displayFences = mDisplayData.at(displayId).releaseFences; in getLayerReleaseFence()
560 status_t HWComposer::presentAndGetReleaseFences(DisplayId displayId) { in presentAndGetReleaseFences() argument
563 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in presentAndGetReleaseFences()
565 auto& displayData = mDisplayData[displayId]; in presentAndGetReleaseFences()
571 RETURN_IF_HWC_ERROR_FOR("flushCommands", error, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
572 RETURN_IF_HWC_ERROR_FOR("present", displayData.presentError, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
577 RETURN_IF_HWC_ERROR_FOR("present", error, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
581 RETURN_IF_HWC_ERROR_FOR("getReleaseFences", error, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
588 status_t HWComposer::setPowerMode(DisplayId displayId, int32_t intMode) { in setPowerMode() argument
589 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setPowerMode()
591 const auto& displayData = mDisplayData[displayId]; in setPowerMode()
593 LOG_DISPLAY_ERROR(displayId, "Invalid operation on virtual display"); in setPowerMode()
599 setVsyncEnabled(displayId, HWC2::Vsync::Disable); in setPowerMode()
611 error, displayId); in setPowerMode()
622 LOG_HWC_ERROR("supportsDoze", error, displayId); in setPowerMode()
632 error, displayId); in setPowerMode()
644 status_t HWComposer::setActiveConfig(DisplayId displayId, size_t configId) { in setActiveConfig() argument
645 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setActiveConfig()
647 auto& displayData = mDisplayData[displayId]; in setActiveConfig()
649 LOG_DISPLAY_ERROR(displayId, ("Invalid config " + std::to_string(configId)).c_str()); in setActiveConfig()
654 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setActiveConfig()
658 status_t HWComposer::setColorTransform(DisplayId displayId, const mat4& transform) { in setColorTransform() argument
659 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setColorTransform()
661 auto& displayData = mDisplayData[displayId]; in setColorTransform()
666 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setColorTransform()
670 void HWComposer::disconnectDisplay(DisplayId displayId) { in disconnectDisplay() argument
671 RETURN_IF_INVALID_DISPLAY(displayId); in disconnectDisplay()
672 auto& displayData = mDisplayData[displayId]; in disconnectDisplay()
677 mFreeVirtualDisplayIds.insert(displayId); in disconnectDisplay()
683 mDisplayData.erase(displayId); in disconnectDisplay()
695 status_t HWComposer::setOutputBuffer(DisplayId displayId, const sp<Fence>& acquireFence, in setOutputBuffer() argument
697 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setOutputBuffer()
698 const auto& displayData = mDisplayData[displayId]; in setOutputBuffer()
701 LOG_DISPLAY_ERROR(displayId, "Invalid operation on physical display"); in setOutputBuffer()
706 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setOutputBuffer()
710 void HWComposer::clearReleaseFences(DisplayId displayId) { in clearReleaseFences() argument
711 RETURN_IF_INVALID_DISPLAY(displayId); in clearReleaseFences()
712 mDisplayData[displayId].releaseFences.clear(); in clearReleaseFences()
715 status_t HWComposer::getHdrCapabilities(DisplayId displayId, HdrCapabilities* outCapabilities) { in getHdrCapabilities() argument
716 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getHdrCapabilities()
718 auto& hwcDisplay = mDisplayData[displayId].hwcDisplay; in getHdrCapabilities()
720 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in getHdrCapabilities()
724 int32_t HWComposer::getSupportedPerFrameMetadata(DisplayId displayId) const { in getSupportedPerFrameMetadata()
725 RETURN_IF_INVALID_DISPLAY(displayId, 0); in getSupportedPerFrameMetadata()
726 return mDisplayData.at(displayId).hwcDisplay->getSupportedPerFrameMetadata(); in getSupportedPerFrameMetadata()
729 std::vector<ui::RenderIntent> HWComposer::getRenderIntents(DisplayId displayId, in getRenderIntents() argument
731 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getRenderIntents()
734 auto error = mDisplayData.at(displayId).hwcDisplay->getRenderIntents(colorMode, &renderIntents); in getRenderIntents()
735 RETURN_IF_HWC_ERROR(error, displayId, {}); in getRenderIntents()
739 mat4 HWComposer::getDataspaceSaturationMatrix(DisplayId displayId, ui::Dataspace dataspace) { in getDataspaceSaturationMatrix() argument
740 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getDataspaceSaturationMatrix()
743 auto error = mDisplayData[displayId].hwcDisplay->getDataspaceSaturationMatrix(dataspace, in getDataspaceSaturationMatrix()
745 RETURN_IF_HWC_ERROR(error, displayId, {}); in getDataspaceSaturationMatrix()
749 status_t HWComposer::getDisplayedContentSamplingAttributes(DisplayId displayId, in getDisplayedContentSamplingAttributes() argument
753 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getDisplayedContentSamplingAttributes()
755 mDisplayData[displayId] in getDisplayedContentSamplingAttributes()
758 if (error == HWC2::Error::Unsupported) RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in getDisplayedContentSamplingAttributes()
759 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in getDisplayedContentSamplingAttributes()
763 status_t HWComposer::setDisplayContentSamplingEnabled(DisplayId displayId, bool enabled, in setDisplayContentSamplingEnabled() argument
765 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setDisplayContentSamplingEnabled()
767 mDisplayData[displayId].hwcDisplay->setDisplayContentSamplingEnabled(enabled, in setDisplayContentSamplingEnabled()
771 if (error == HWC2::Error::Unsupported) RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in setDisplayContentSamplingEnabled()
772 if (error == HWC2::Error::BadParameter) RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setDisplayContentSamplingEnabled()
773 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setDisplayContentSamplingEnabled()
777 status_t HWComposer::getDisplayedContentSample(DisplayId displayId, uint64_t maxFrames, in getDisplayedContentSample() argument
779 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getDisplayedContentSample()
781 mDisplayData[displayId].hwcDisplay->getDisplayedContentSample(maxFrames, timestamp, in getDisplayedContentSample()
783 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in getDisplayedContentSample()
787 status_t HWComposer::setDisplayBrightness(DisplayId displayId, float brightness) { in setDisplayBrightness() argument
788 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setDisplayBrightness()
789 const auto error = mDisplayData[displayId].hwcDisplay->setDisplayBrightness(brightness); in setDisplayBrightness()
791 RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in setDisplayBrightness()
794 RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setDisplayBrightness()
796 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setDisplayBrightness()
819 std::optional<hwc2_display_t> HWComposer::fromPhysicalDisplayId(DisplayId displayId) const { in fromPhysicalDisplayId()
820 if (const auto it = mDisplayData.find(displayId); in fromPhysicalDisplayId()