Lines Matching refs:displayId
47 #define LOG_DISPLAY_ERROR(displayId, msg) \ argument
48 ALOGE("%s failed for display %s: %s", __FUNCTION__, to_string(displayId).c_str(), msg)
50 #define LOG_HWC_ERROR(what, error, displayId) \ argument
52 to_string(displayId).c_str(), to_string(error).c_str(), static_cast<int32_t>(error))
54 #define RETURN_IF_INVALID_DISPLAY(displayId, ...) \ argument
56 if (mDisplayData.count(displayId) == 0) { \
57 LOG_DISPLAY_ERROR(displayId, "Invalid display"); \
62 #define RETURN_IF_HWC_ERROR_FOR(what, error, displayId, ...) \ argument
65 LOG_HWC_ERROR(what, error, displayId); \
70 #define RETURN_IF_HWC_ERROR(error, displayId, ...) \ argument
71 RETURN_IF_HWC_ERROR_FOR(__FUNCTION__, error, displayId, __VA_ARGS__)
189 bool HWComposer::hasDisplayCapability(DisplayId displayId, in hasDisplayCapability() argument
191 RETURN_IF_INVALID_DISPLAY(displayId, false); in hasDisplayCapability()
192 return mDisplayData.at(displayId).hwcDisplay->getCapabilities().count(capability) > 0; in hasDisplayCapability()
208 const auto displayId = toPhysicalDisplayId(hwcDisplayId); in onVsync() local
209 if (!displayId) { in onVsync()
214 RETURN_IF_INVALID_DISPLAY(*displayId, false); in onVsync()
216 auto& displayData = mDisplayData[*displayId]; in onVsync()
218 LOG_DISPLAY_ERROR(*displayId, "Invalid operation on virtual display"); in onVsync()
231 to_string(*displayId).c_str(), timestamp); in onVsync()
238 const auto tag = "HW_VSYNC_" + to_string(*displayId); in onVsync()
271 DisplayId displayId; in allocateVirtualDisplay() local
273 displayId = getVirtualDisplayId(mNextVirtualDisplayId++); in allocateVirtualDisplay()
275 displayId = *mFreeVirtualDisplayIds.begin(); in allocateVirtualDisplay()
276 mFreeVirtualDisplayIds.erase(displayId); in allocateVirtualDisplay()
279 auto& displayData = mDisplayData[displayId]; in allocateVirtualDisplay()
284 return displayId; in allocateVirtualDisplay()
287 void HWComposer::allocatePhysicalDisplay(hal::HWDisplayId hwcDisplayId, DisplayId displayId) { in allocatePhysicalDisplay() argument
294 auto& displayData = mDisplayData[displayId]; in allocatePhysicalDisplay()
300 mPhysicalDisplayIdMap[hwcDisplayId] = displayId; in allocatePhysicalDisplay()
303 HWC2::Layer* HWComposer::createLayer(DisplayId displayId) { in createLayer() argument
304 RETURN_IF_INVALID_DISPLAY(displayId, nullptr); in createLayer()
307 auto error = mDisplayData[displayId].hwcDisplay->createLayer(&layer); in createLayer()
308 RETURN_IF_HWC_ERROR(error, displayId, nullptr); in createLayer()
312 void HWComposer::destroyLayer(DisplayId displayId, HWC2::Layer* layer) { in destroyLayer() argument
313 RETURN_IF_INVALID_DISPLAY(displayId); in destroyLayer()
315 auto error = mDisplayData[displayId].hwcDisplay->destroyLayer(layer); in destroyLayer()
316 RETURN_IF_HWC_ERROR(error, displayId); in destroyLayer()
319 nsecs_t HWComposer::getRefreshTimestamp(DisplayId displayId) const { in getRefreshTimestamp()
320 RETURN_IF_INVALID_DISPLAY(displayId, 0); in getRefreshTimestamp()
321 const auto& displayData = mDisplayData.at(displayId); in getRefreshTimestamp()
327 auto vsyncPeriodNanos = getDisplayVsyncPeriod(displayId); in getRefreshTimestamp()
331 bool HWComposer::isConnected(DisplayId displayId) const { in isConnected()
332 RETURN_IF_INVALID_DISPLAY(displayId, false); in isConnected()
333 return mDisplayData.at(displayId).hwcDisplay->isConnected(); in isConnected()
337 DisplayId displayId) const { in getConfigs()
338 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getConfigs()
340 const auto& displayData = mDisplayData.at(displayId); in getConfigs()
351 DisplayId displayId) const { in getActiveConfig()
352 RETURN_IF_INVALID_DISPLAY(displayId, nullptr); in getActiveConfig()
355 auto error = mDisplayData.at(displayId).hwcDisplay->getActiveConfig(&config); in getActiveConfig()
357 LOG_DISPLAY_ERROR(displayId, "No active config"); in getActiveConfig()
361 RETURN_IF_HWC_ERROR(error, displayId, nullptr); in getActiveConfig()
364 LOG_DISPLAY_ERROR(displayId, "Unknown config"); in getActiveConfig()
373 DisplayConnectionType HWComposer::getDisplayConnectionType(DisplayId displayId) const { in getDisplayConnectionType()
374 RETURN_IF_INVALID_DISPLAY(displayId, DisplayConnectionType::Internal); in getDisplayConnectionType()
375 const auto& hwcDisplay = mDisplayData.at(displayId).hwcDisplay; in getDisplayConnectionType()
384 RETURN_IF_HWC_ERROR(error, displayId, FALLBACK_TYPE); in getDisplayConnectionType()
388 bool HWComposer::isVsyncPeriodSwitchSupported(DisplayId displayId) const { in isVsyncPeriodSwitchSupported()
389 RETURN_IF_INVALID_DISPLAY(displayId, false); in isVsyncPeriodSwitchSupported()
390 return mDisplayData.at(displayId).hwcDisplay->isVsyncPeriodSwitchSupported(); in isVsyncPeriodSwitchSupported()
393 nsecs_t HWComposer::getDisplayVsyncPeriod(DisplayId displayId) const { in getDisplayVsyncPeriod()
394 RETURN_IF_INVALID_DISPLAY(displayId, 0); in getDisplayVsyncPeriod()
397 auto error = mDisplayData.at(displayId).hwcDisplay->getDisplayVsyncPeriod(&vsyncPeriodNanos); in getDisplayVsyncPeriod()
398 RETURN_IF_HWC_ERROR(error, displayId, 0); in getDisplayVsyncPeriod()
402 int HWComposer::getActiveConfigIndex(DisplayId displayId) const { in getActiveConfigIndex()
403 RETURN_IF_INVALID_DISPLAY(displayId, -1); in getActiveConfigIndex()
406 auto error = mDisplayData.at(displayId).hwcDisplay->getActiveConfigIndex(&index); in getActiveConfigIndex()
408 LOG_DISPLAY_ERROR(displayId, "No active config"); in getActiveConfigIndex()
412 RETURN_IF_HWC_ERROR(error, displayId, -1); in getActiveConfigIndex()
415 LOG_DISPLAY_ERROR(displayId, "Unknown config"); in getActiveConfigIndex()
422 std::vector<ui::ColorMode> HWComposer::getColorModes(DisplayId displayId) const { in getColorModes()
423 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getColorModes()
426 auto error = mDisplayData.at(displayId).hwcDisplay->getColorModes(&modes); in getColorModes()
427 RETURN_IF_HWC_ERROR(error, displayId, {}); in getColorModes()
431 status_t HWComposer::setActiveColorMode(DisplayId displayId, ui::ColorMode mode, in setActiveColorMode() argument
433 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setActiveColorMode()
435 auto& displayData = mDisplayData[displayId]; in setActiveColorMode()
440 error, displayId, UNKNOWN_ERROR); in setActiveColorMode()
445 void HWComposer::setVsyncEnabled(DisplayId displayId, hal::Vsync enabled) { in setVsyncEnabled() argument
446 RETURN_IF_INVALID_DISPLAY(displayId); in setVsyncEnabled()
447 auto& displayData = mDisplayData[displayId]; in setVsyncEnabled()
450 LOG_DISPLAY_ERROR(displayId, "Invalid operation on virtual display"); in setVsyncEnabled()
465 RETURN_IF_HWC_ERROR(error, displayId); in setVsyncEnabled()
469 const auto tag = "HW_VSYNC_ON_" + to_string(displayId); in setVsyncEnabled()
473 status_t HWComposer::setClientTarget(DisplayId displayId, uint32_t slot, in setClientTarget() argument
476 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setClientTarget()
478 ALOGV("%s for display %s", __FUNCTION__, to_string(displayId).c_str()); in setClientTarget()
479 auto& hwcDisplay = mDisplayData[displayId].hwcDisplay; in setClientTarget()
481 RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setClientTarget()
486 DisplayId displayId, bool frameUsesClientComposition, in getDeviceCompositionChanges() argument
490 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getDeviceCompositionChanges()
492 auto& displayData = mDisplayData[displayId]; in getDeviceCompositionChanges()
513 RETURN_IF_HWC_ERROR_FOR("presentOrValidate", error, displayId, UNKNOWN_ERROR); in getDeviceCompositionChanges()
530 RETURN_IF_HWC_ERROR_FOR("validate", error, displayId, BAD_INDEX); in getDeviceCompositionChanges()
536 RETURN_IF_HWC_ERROR_FOR("getChangedCompositionTypes", error, displayId, BAD_INDEX); in getDeviceCompositionChanges()
542 RETURN_IF_HWC_ERROR_FOR("getRequests", error, displayId, BAD_INDEX); in getDeviceCompositionChanges()
551 RETURN_IF_HWC_ERROR_FOR("acceptChanges", error, displayId, BAD_INDEX); in getDeviceCompositionChanges()
556 sp<Fence> HWComposer::getPresentFence(DisplayId displayId) const { in getPresentFence()
557 RETURN_IF_INVALID_DISPLAY(displayId, Fence::NO_FENCE); in getPresentFence()
558 return mDisplayData.at(displayId).lastPresentFence; in getPresentFence()
561 sp<Fence> HWComposer::getLayerReleaseFence(DisplayId displayId, HWC2::Layer* layer) const { in getLayerReleaseFence() argument
562 RETURN_IF_INVALID_DISPLAY(displayId, Fence::NO_FENCE); in getLayerReleaseFence()
563 const auto& displayFences = mDisplayData.at(displayId).releaseFences; in getLayerReleaseFence()
572 status_t HWComposer::presentAndGetReleaseFences(DisplayId displayId) { in presentAndGetReleaseFences() argument
575 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in presentAndGetReleaseFences()
577 auto& displayData = mDisplayData[displayId]; in presentAndGetReleaseFences()
583 RETURN_IF_HWC_ERROR_FOR("executeCommands", error, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
584 RETURN_IF_HWC_ERROR_FOR("present", displayData.presentError, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
589 RETURN_IF_HWC_ERROR_FOR("present", error, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
593 RETURN_IF_HWC_ERROR_FOR("getReleaseFences", error, displayId, UNKNOWN_ERROR); in presentAndGetReleaseFences()
600 status_t HWComposer::setPowerMode(DisplayId displayId, hal::PowerMode mode) { in setPowerMode() argument
601 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setPowerMode()
603 const auto& displayData = mDisplayData[displayId]; in setPowerMode()
605 LOG_DISPLAY_ERROR(displayId, "Invalid operation on virtual display"); in setPowerMode()
610 setVsyncEnabled(displayId, hal::Vsync::DISABLE); in setPowerMode()
622 displayId); in setPowerMode()
633 LOG_HWC_ERROR("supportsDoze", error, displayId); in setPowerMode()
643 displayId); in setPowerMode()
656 DisplayId displayId, size_t configId, const hal::VsyncPeriodChangeConstraints& constraints, in setActiveConfigWithConstraints() argument
658 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setActiveConfigWithConstraints()
660 auto& displayData = mDisplayData[displayId]; in setActiveConfigWithConstraints()
662 LOG_DISPLAY_ERROR(displayId, ("Invalid config " + std::to_string(configId)).c_str()); in setActiveConfigWithConstraints()
669 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setActiveConfigWithConstraints()
673 status_t HWComposer::setColorTransform(DisplayId displayId, const mat4& transform) { in setColorTransform() argument
674 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setColorTransform()
676 auto& displayData = mDisplayData[displayId]; in setColorTransform()
682 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setColorTransform()
686 void HWComposer::disconnectDisplay(DisplayId displayId) { in disconnectDisplay() argument
687 RETURN_IF_INVALID_DISPLAY(displayId); in disconnectDisplay()
688 auto& displayData = mDisplayData[displayId]; in disconnectDisplay()
693 mFreeVirtualDisplayIds.insert(displayId); in disconnectDisplay()
706 mDisplayData.erase(displayId); in disconnectDisplay()
709 status_t HWComposer::setOutputBuffer(DisplayId displayId, const sp<Fence>& acquireFence, in setOutputBuffer() argument
711 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setOutputBuffer()
712 const auto& displayData = mDisplayData[displayId]; in setOutputBuffer()
715 LOG_DISPLAY_ERROR(displayId, "Invalid operation on physical display"); in setOutputBuffer()
720 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setOutputBuffer()
724 void HWComposer::clearReleaseFences(DisplayId displayId) { in clearReleaseFences() argument
725 RETURN_IF_INVALID_DISPLAY(displayId); in clearReleaseFences()
726 mDisplayData[displayId].releaseFences.clear(); in clearReleaseFences()
729 status_t HWComposer::getHdrCapabilities(DisplayId displayId, HdrCapabilities* outCapabilities) { in getHdrCapabilities() argument
730 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getHdrCapabilities()
732 auto& hwcDisplay = mDisplayData[displayId].hwcDisplay; in getHdrCapabilities()
734 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in getHdrCapabilities()
738 int32_t HWComposer::getSupportedPerFrameMetadata(DisplayId displayId) const { in getSupportedPerFrameMetadata()
739 RETURN_IF_INVALID_DISPLAY(displayId, 0); in getSupportedPerFrameMetadata()
740 return mDisplayData.at(displayId).hwcDisplay->getSupportedPerFrameMetadata(); in getSupportedPerFrameMetadata()
743 std::vector<ui::RenderIntent> HWComposer::getRenderIntents(DisplayId displayId, in getRenderIntents() argument
745 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getRenderIntents()
748 auto error = mDisplayData.at(displayId).hwcDisplay->getRenderIntents(colorMode, &renderIntents); in getRenderIntents()
749 RETURN_IF_HWC_ERROR(error, displayId, {}); in getRenderIntents()
753 mat4 HWComposer::getDataspaceSaturationMatrix(DisplayId displayId, ui::Dataspace dataspace) { in getDataspaceSaturationMatrix() argument
754 RETURN_IF_INVALID_DISPLAY(displayId, {}); in getDataspaceSaturationMatrix()
757 auto error = mDisplayData[displayId].hwcDisplay->getDataspaceSaturationMatrix(dataspace, in getDataspaceSaturationMatrix()
759 RETURN_IF_HWC_ERROR(error, displayId, {}); in getDataspaceSaturationMatrix()
763 status_t HWComposer::getDisplayedContentSamplingAttributes(DisplayId displayId, in getDisplayedContentSamplingAttributes() argument
767 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getDisplayedContentSamplingAttributes()
769 mDisplayData[displayId] in getDisplayedContentSamplingAttributes()
772 if (error == hal::Error::UNSUPPORTED) RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in getDisplayedContentSamplingAttributes()
773 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in getDisplayedContentSamplingAttributes()
777 status_t HWComposer::setDisplayContentSamplingEnabled(DisplayId displayId, bool enabled, in setDisplayContentSamplingEnabled() argument
779 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setDisplayContentSamplingEnabled()
781 mDisplayData[displayId].hwcDisplay->setDisplayContentSamplingEnabled(enabled, in setDisplayContentSamplingEnabled()
785 if (error == hal::Error::UNSUPPORTED) RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in setDisplayContentSamplingEnabled()
786 if (error == hal::Error::BAD_PARAMETER) RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setDisplayContentSamplingEnabled()
787 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setDisplayContentSamplingEnabled()
791 status_t HWComposer::getDisplayedContentSample(DisplayId displayId, uint64_t maxFrames, in getDisplayedContentSample() argument
793 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getDisplayedContentSample()
795 mDisplayData[displayId].hwcDisplay->getDisplayedContentSample(maxFrames, timestamp, in getDisplayedContentSample()
797 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in getDisplayedContentSample()
801 std::future<status_t> HWComposer::setDisplayBrightness(DisplayId displayId, float brightness) { in setDisplayBrightness() argument
802 RETURN_IF_INVALID_DISPLAY(displayId, promise::yield<status_t>(BAD_INDEX)); in setDisplayBrightness()
803 auto& display = mDisplayData[displayId].hwcDisplay; in setDisplayBrightness()
806 .then([displayId](hal::Error error) -> status_t { in setDisplayBrightness()
808 RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in setDisplayBrightness()
811 RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setDisplayBrightness()
813 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setDisplayBrightness()
822 status_t HWComposer::setAutoLowLatencyMode(DisplayId displayId, bool on) { in setAutoLowLatencyMode() argument
823 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setAutoLowLatencyMode()
824 const auto error = mDisplayData[displayId].hwcDisplay->setAutoLowLatencyMode(on); in setAutoLowLatencyMode()
826 RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in setAutoLowLatencyMode()
829 RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setAutoLowLatencyMode()
831 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setAutoLowLatencyMode()
836 DisplayId displayId, std::vector<hal::ContentType>* outSupportedContentTypes) { in getSupportedContentTypes() argument
837 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in getSupportedContentTypes()
839 mDisplayData[displayId].hwcDisplay->getSupportedContentTypes(outSupportedContentTypes); in getSupportedContentTypes()
841 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in getSupportedContentTypes()
846 status_t HWComposer::setContentType(DisplayId displayId, hal::ContentType contentType) { in setContentType() argument
847 RETURN_IF_INVALID_DISPLAY(displayId, BAD_INDEX); in setContentType()
848 const auto error = mDisplayData[displayId].hwcDisplay->setContentType(contentType); in setContentType()
850 RETURN_IF_HWC_ERROR(error, displayId, INVALID_OPERATION); in setContentType()
853 RETURN_IF_HWC_ERROR(error, displayId, BAD_VALUE); in setContentType()
855 RETURN_IF_HWC_ERROR(error, displayId, UNKNOWN_ERROR); in setContentType()
876 std::optional<hal::HWDisplayId> HWComposer::fromPhysicalDisplayId(DisplayId displayId) const { in fromPhysicalDisplayId()
877 if (const auto it = mDisplayData.find(displayId); in fromPhysicalDisplayId()
908 if (const auto displayId = toPhysicalDisplayId(hwcDisplayId)) { in onHotplugConnect() local
909 info = DisplayIdentificationInfo{.id = *displayId, in onHotplugConnect()
955 const auto displayId = toPhysicalDisplayId(hwcDisplayId); in onHotplugDisconnect() local
956 if (!displayId) { in onHotplugDisconnect()
963 if (isConnected(*displayId)) { in onHotplugDisconnect()
964 mDisplayData[*displayId].hwcDisplay->setConnected(false); in onHotplugDisconnect()
970 return DisplayIdentificationInfo{.id = *displayId, in onHotplugDisconnect()