diff --git a/backend/BackendManager.cpp b/backend/BackendManager.cpp index 46d9536..6c1dd27 100644 --- a/backend/BackendManager.cpp +++ b/backend/BackendManager.cpp @@ -18,7 +18,9 @@ #include "BackendManager.h" -#include "hwc/HwcDisplay.h" +#include "drm/DrmConnector.h" +#include "drm/DrmDevice.h" +#include "drm/DrmDisplayPipeline.h" #include "utils/log.h" #include "utils/properties.h" diff --git a/backend/BackendManager.h b/backend/BackendManager.h index f76d71e..12ec5b8 100644 --- a/backend/BackendManager.h +++ b/backend/BackendManager.h @@ -21,10 +21,11 @@ #include #include -#include "compositor/CompositionPlanner.h" - namespace android::drm_hwcomposer { +class DrmConnector; +struct DrmDisplayPipeline; + // BackendManager is a singleton that manages the registration of Backends and // finding a Backend which can be used to create a DrmDisplayPipeline for a // DrmConnector. diff --git a/backend/ClientBackend.cpp b/backend/ClientBackend.cpp index 7eaf769..ad98ebf 100644 --- a/backend/ClientBackend.cpp +++ b/backend/ClientBackend.cpp @@ -15,7 +15,7 @@ */ #include "backend/GenericBackend.h" -#include "compositor/GenericCompositionPlanner.h" +#include "compositor/CompositionPlanner.h" #include "hwc/HwcDisplay.h" namespace android::drm_hwcomposer { diff --git a/backend/GenericBackend.cpp b/backend/GenericBackend.cpp index 090d201..038c7cc 100644 --- a/backend/GenericBackend.cpp +++ b/backend/GenericBackend.cpp @@ -14,9 +14,12 @@ * limitations under the License. */ -#include "backend/GenericBackend.h" +#include "GenericBackend.h" +#include "backend/BackendManager.h" +#include "compositor/CompositionPlanner.h" #include "compositor/GenericCompositionPlanner.h" +#include "drm/DrmConnector.h" #include "drm/DrmDisplayPipeline.h" namespace android::drm_hwcomposer { diff --git a/backend/GenericBackend.h b/backend/GenericBackend.h index dd61a06..4126e54 100644 --- a/backend/GenericBackend.h +++ b/backend/GenericBackend.h @@ -21,6 +21,9 @@ namespace android::drm_hwcomposer { +class DrmConnector; +struct DrmDisplayPipeline; + // Implement the Backend interface on top of upstream drm uAPI. class GenericBackend : public BackendManager::Backend { public: diff --git a/bufferinfo/BufferInfoGetter.cpp b/bufferinfo/BufferInfoGetter.cpp index 1eb89c8..ab5222f 100644 --- a/bufferinfo/BufferInfoGetter.cpp +++ b/bufferinfo/BufferInfoGetter.cpp @@ -17,7 +17,6 @@ #define LOG_TAG "drmhwc" #include "BufferInfoGetter.h" -#include "BufferInfoMapperMetadata.h" #include #include @@ -27,8 +26,8 @@ #include +#include "bufferinfo/BufferInfoMapperMetadata.h" #include "utils/log.h" -#include "utils/properties.h" namespace android::drm_hwcomposer { diff --git a/bufferinfo/BufferInfoGetter.h b/bufferinfo/BufferInfoGetter.h index 169e43f..1d29e88 100644 --- a/bufferinfo/BufferInfoGetter.h +++ b/bufferinfo/BufferInfoGetter.h @@ -21,8 +21,7 @@ #include -#include "BufferInfo.h" -#include "drm/DrmDevice.h" +#include "utils/log.h" #ifndef DRM_FORMAT_INVALID #define DRM_FORMAT_INVALID 0 @@ -32,6 +31,8 @@ namespace android::drm_hwcomposer { using BufferUniqueId = uint64_t; +struct BufferInfo; + class BufferInfoGetter { public: virtual ~BufferInfoGetter() = default; diff --git a/bufferinfo/BufferInfoMapperMetadata.cpp b/bufferinfo/BufferInfoMapperMetadata.cpp index 0d11c5c..ebd2756 100644 --- a/bufferinfo/BufferInfoMapperMetadata.cpp +++ b/bufferinfo/BufferInfoMapperMetadata.cpp @@ -25,6 +25,8 @@ #include +#include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/bufferinfo/BufferInfoMapperMetadata.h b/bufferinfo/BufferInfoMapperMetadata.h index 168f267..369cbb9 100644 --- a/bufferinfo/BufferInfoMapperMetadata.h +++ b/bufferinfo/BufferInfoMapperMetadata.h @@ -20,6 +20,8 @@ namespace android::drm_hwcomposer { +struct BufferInfo; + class BufferInfoMapperMetadata : public BufferInfoGetter { public: using BufferInfoGetter::BufferInfoGetter; diff --git a/bufferinfo/legacy/BufferInfoImagination.cpp b/bufferinfo/legacy/BufferInfoImagination.cpp index dff560d..0a641ff 100644 --- a/bufferinfo/legacy/BufferInfoImagination.cpp +++ b/bufferinfo/legacy/BufferInfoImagination.cpp @@ -22,6 +22,8 @@ #include +#include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "img_gralloc1_public.h" #include "utils/log.h" diff --git a/bufferinfo/legacy/BufferInfoLibdrm.cpp b/bufferinfo/legacy/BufferInfoLibdrm.cpp index f9422e2..ccdc584 100644 --- a/bufferinfo/legacy/BufferInfoLibdrm.cpp +++ b/bufferinfo/legacy/BufferInfoLibdrm.cpp @@ -25,8 +25,9 @@ #include +#include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "utils/log.h" -#include "utils/properties.h" namespace android::drm_hwcomposer { diff --git a/bufferinfo/legacy/BufferInfoMaliHisi.cpp b/bufferinfo/legacy/BufferInfoMaliHisi.cpp index f6827f7..1f02cc8 100644 --- a/bufferinfo/legacy/BufferInfoMaliHisi.cpp +++ b/bufferinfo/legacy/BufferInfoMaliHisi.cpp @@ -23,8 +23,9 @@ #include +#include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "gralloc_priv.h" -#include "utils/log.h" #define MALI_ALIGN(value, base) (((value) + ((base)-1)) & ~((base)-1)) diff --git a/bufferinfo/legacy/BufferInfoMaliMediatek.cpp b/bufferinfo/legacy/BufferInfoMaliMediatek.cpp index 43f5e59..570fcf1 100644 --- a/bufferinfo/legacy/BufferInfoMaliMediatek.cpp +++ b/bufferinfo/legacy/BufferInfoMaliMediatek.cpp @@ -25,8 +25,9 @@ #include +#include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "gralloc_priv.h" -#include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/bufferinfo/legacy/BufferInfoMaliMeson.cpp b/bufferinfo/legacy/BufferInfoMaliMeson.cpp index 88558ac..eaaafb4 100644 --- a/bufferinfo/legacy/BufferInfoMaliMeson.cpp +++ b/bufferinfo/legacy/BufferInfoMaliMeson.cpp @@ -23,8 +23,9 @@ #include +#include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "gralloc_priv.h" -#include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/bufferinfo/legacy/BufferInfoMinigbm.cpp b/bufferinfo/legacy/BufferInfoMinigbm.cpp index 9f02041..ae94bfa 100644 --- a/bufferinfo/legacy/BufferInfoMinigbm.cpp +++ b/bufferinfo/legacy/BufferInfoMinigbm.cpp @@ -24,6 +24,8 @@ #include #include +#include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/compositor/CompositionPlanner.cpp b/compositor/CompositionPlanner.cpp index 3e00e27..83af852 100644 --- a/compositor/CompositionPlanner.cpp +++ b/compositor/CompositionPlanner.cpp @@ -16,6 +16,7 @@ #include "CompositionPlanner.h" +#include "compositor/LayerData.h" #include "hwc/HwcLayer.h" namespace android::drm_hwcomposer { diff --git a/compositor/CompositionPlanner.h b/compositor/CompositionPlanner.h index 021c9dc..0fb7cb6 100644 --- a/compositor/CompositionPlanner.h +++ b/compositor/CompositionPlanner.h @@ -21,13 +21,12 @@ #include #include -#include "compositor/LayerData.h" - namespace android::drm_hwcomposer { -struct LayerToPlaneJoiningPlan; +enum class CompositionType; class HwcDisplay; class HwcLayer; +struct LayerToPlaneJoiningPlan; // CompositionPlanner is responsible for determining the mapping between // HwcLayer and drm planes. This includes deciding which HwcLayers should be diff --git a/compositor/DisplayInfo.h b/compositor/DisplayInfo.h index a22a634..22d07d9 100644 --- a/compositor/DisplayInfo.h +++ b/compositor/DisplayInfo.h @@ -82,7 +82,7 @@ enum class Colorspace : int32_t { /** * Display panel orientation property values. */ -enum PanelOrientation { +enum class PanelOrientation { kModePanelOrientationNormal = 0, kModePanelOrientationBottomUp, kModePanelOrientationLeftUp, diff --git a/compositor/GenericCompositionPlanner.cpp b/compositor/GenericCompositionPlanner.cpp index 392e80b..eb6100a 100644 --- a/compositor/GenericCompositionPlanner.cpp +++ b/compositor/GenericCompositionPlanner.cpp @@ -20,11 +20,12 @@ #include #include -#include "backend/BackendManager.h" #include "compositor/FlatteningController.h" #include "compositor/LayerData.h" +#include "drm/DrmPlane.h" #include "hwc/HwcDisplay.h" #include "hwc/HwcLayer.h" +#include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/compositor/GenericCompositionPlanner.h b/compositor/GenericCompositionPlanner.h index d520e66..999a14f 100644 --- a/compositor/GenericCompositionPlanner.h +++ b/compositor/GenericCompositionPlanner.h @@ -16,11 +16,11 @@ #pragma once -#include "CompositionPlanner.h" +#include "compositor/CompositionPlanner.h" namespace android::drm_hwcomposer { -struct LayerToPlaneJoiningPlan; +enum class CompositionType; class HwcDisplay; class HwcLayer; diff --git a/compositor/LayerData.h b/compositor/LayerData.h index 05c898d..26cdcb1 100644 --- a/compositor/LayerData.h +++ b/compositor/LayerData.h @@ -23,7 +23,6 @@ #include #include "bufferinfo/BufferInfo.h" -#include "drm/DrmFbImporter.h" #include "utils/fd.h" namespace android::drm_hwcomposer { diff --git a/compositor/LayerToPlaneJoiningPlan.cpp b/compositor/LayerToPlaneJoiningPlan.cpp index 63f572d..e4f3473 100644 --- a/compositor/LayerToPlaneJoiningPlan.cpp +++ b/compositor/LayerToPlaneJoiningPlan.cpp @@ -18,9 +18,9 @@ #include "LayerToPlaneJoiningPlan.h" -#include "drm/DrmDevice.h" +#include "compositor/LayerData.h" +#include "drm/DrmDisplayPipeline.h" #include "drm/DrmPlane.h" -#include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/compositor/LayerToPlaneJoiningPlan.h b/compositor/LayerToPlaneJoiningPlan.h index dd3d8b7..20058b1 100644 --- a/compositor/LayerToPlaneJoiningPlan.h +++ b/compositor/LayerToPlaneJoiningPlan.h @@ -23,7 +23,10 @@ namespace android::drm_hwcomposer { -class DrmDevice; +class DrmPlane; +struct DrmDisplayPipeline; +template +class BindingOwner; struct LayerToPlaneJoiningPlan { struct LayerToPlaneJoining { diff --git a/drm/DrmAtomicStateManager.cpp b/drm/DrmAtomicStateManager.cpp index 2024c55..8510489 100644 --- a/drm/DrmAtomicStateManager.cpp +++ b/drm/DrmAtomicStateManager.cpp @@ -29,10 +29,16 @@ #include +#include "compositor/LayerData.h" +#include "compositor/LayerToPlaneJoiningPlan.h" +#include "drm/DrmConnector.h" #include "drm/DrmCrtc.h" #include "drm/DrmDevice.h" +#include "drm/DrmDisplayPipeline.h" +#include "drm/DrmFbImporter.h" #include "drm/DrmPlane.h" #include "drm/DrmUnique.h" +#include "utils/fd.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/drm/DrmAtomicStateManager.h b/drm/DrmAtomicStateManager.h index cdc3bda..668af1b 100644 --- a/drm/DrmAtomicStateManager.h +++ b/drm/DrmAtomicStateManager.h @@ -22,16 +22,30 @@ #include #include #include +#include + +#include -#include "compositor/DisplayInfo.h" #include "compositor/LayerData.h" -#include "compositor/LayerToPlaneJoiningPlan.h" -#include "drm/DrmPlane.h" -#include "drm/ResourceManager.h" -#include "drm/VSyncWorker.h" +#include "drm/DrmMode.h" +#include "utils/fd.h" namespace android::drm_hwcomposer { +template +class BindingOwner; + +class DrmFbIdHandle; +class DrmPlane; + +struct DrmDisplayPipeline; +struct LayerToPlaneJoiningPlan; + +enum class Colorspace; +enum class ContentProtection; +enum class ContentType; +enum class HdcpContentType; + struct AtomicCommitArgs { /* inputs. All fields are optional, but at least one has to be specified */ bool test_only = false; diff --git a/drm/DrmConnector.cpp b/drm/DrmConnector.cpp index 93ed7e5..590f76f 100644 --- a/drm/DrmConnector.cpp +++ b/drm/DrmConnector.cpp @@ -27,8 +27,13 @@ #include #include -#include "DrmDevice.h" #include "compositor/DisplayInfo.h" +#include "drm/DrmDevice.h" +#include "drm/DrmEncoder.h" +#include "drm/DrmMode.h" +#include "drm/DrmProperty.h" +#include "drm/DrmUnique.h" +#include "utils/log.h" #include "utils/properties.h" #ifndef DRM_MODE_CONNECTOR_SPI @@ -82,6 +87,13 @@ auto DrmConnector::CreateInstance(DrmDevice &dev, uint32_t connector_id, return c; } +DrmConnector::~DrmConnector() = default; + +DrmConnector::DrmConnector(DrmModeConnectorUnique connector, DrmDevice *drm, + uint32_t index) + : connector_(std::move(connector)), drm_(drm), index_in_res_array_(index) { +} + auto DrmConnector::Init()-> bool { if (!GetConnectorProperty("DPMS", &dpms_property_) || !GetConnectorProperty("CRTC_ID", &crtc_id_property_)) { @@ -196,6 +208,17 @@ auto DrmConnector::GetEdidBlob() -> DrmModePropertyBlobUnique { return MakeDrmModePropertyBlobUnique(*drm_->GetFd(), *blob_id); } +bool DrmConnector::SupportsEncoder(DrmEncoder &enc) const { + for (int i = 0; i < connector_->count_encoders; i++) { + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + if (connector_->encoders[i] == enc.GetId()) { + return true; + } + } + + return false; +} + bool DrmConnector::IsInternal() const { auto type = connector_->connector_type; return type == DRM_MODE_CONNECTOR_Unknown || diff --git a/drm/DrmConnector.h b/drm/DrmConnector.h index d9e6baf..bc9b580 100644 --- a/drm/DrmConnector.h +++ b/drm/DrmConnector.h @@ -22,15 +22,18 @@ #include #include -#include "DrmEncoder.h" -#include "DrmMode.h" -#include "DrmProperty.h" -#include "DrmUnique.h" -#include "compositor/DisplayInfo.h" +#include "drm/DrmDisplayPipeline.h" +#include "drm/DrmProperty.h" +#include "drm/DrmUnique.h" namespace android::drm_hwcomposer { class DrmDevice; +class DrmProperty; +class DrmMode; + +enum class Colorspace; +enum class PanelOrientation; class DrmConnector : public PipelineBindable { friend class FakeDrmConnector; @@ -42,7 +45,7 @@ class DrmConnector : public PipelineBindable { DrmConnector(const DrmProperty &) = delete; DrmConnector &operator=(const DrmProperty &) = delete; - virtual ~DrmConnector() = default; + virtual ~DrmConnector(); int UpdateEdidProperty(); auto GetEdidBlob() -> DrmModePropertyBlobUnique; @@ -63,16 +66,7 @@ class DrmConnector : public PipelineBindable { return connector_->encoder_id; } - auto SupportsEncoder(DrmEncoder &enc) const { - for (int i = 0; i < connector_->count_encoders; i++) { - // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (connector_->encoders[i] == enc.GetId()) { - return true; - } - } - - return false; - } + bool SupportsEncoder(DrmEncoder &enc) const; bool IsInternal() const; bool IsExternal() const; @@ -158,10 +152,8 @@ class DrmConnector : public PipelineBindable { auto GetPanelOrientation() -> std::optional; private: - DrmConnector(DrmModeConnectorUnique connector, DrmDevice *drm, uint32_t index) - : connector_(std::move(connector)), - drm_(drm), - index_in_res_array_(index) {}; + DrmConnector(DrmModeConnectorUnique connector, DrmDevice *drm, + uint32_t index); DrmModeConnectorUnique connector_; DrmDevice *const drm_; diff --git a/drm/DrmCrtc.cpp b/drm/DrmCrtc.cpp index f6584d7..38f310f 100644 --- a/drm/DrmCrtc.cpp +++ b/drm/DrmCrtc.cpp @@ -18,12 +18,14 @@ #include "DrmCrtc.h" -#include #include #include -#include "DrmDevice.h" +#include "drm/DrmDevice.h" +#include "drm/DrmProperty.h" +#include "drm/DrmUnique.h" +#include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/drm/DrmCrtc.h b/drm/DrmCrtc.h index 9d95766..ad55c0f 100644 --- a/drm/DrmCrtc.h +++ b/drm/DrmCrtc.h @@ -20,10 +20,9 @@ #include -#include "DrmDisplayPipeline.h" -#include "DrmMode.h" -#include "DrmProperty.h" -#include "DrmUnique.h" +#include "drm/DrmDisplayPipeline.h" +#include "drm/DrmProperty.h" +#include "drm/DrmUnique.h" namespace android::drm_hwcomposer { diff --git a/drm/DrmDevice.cpp b/drm/DrmDevice.cpp index 7c50945..b1a3c18 100644 --- a/drm/DrmDevice.cpp +++ b/drm/DrmDevice.cpp @@ -27,15 +27,22 @@ #include #include -#include "drm/DrmAtomicStateManager.h" +#include "bufferinfo/BufferInfo.h" #include "drm/DrmConnector.h" +#include "drm/DrmCrtc.h" +#include "drm/DrmEncoder.h" +#include "drm/DrmFbImporter.h" #include "drm/DrmPlane.h" +#include "drm/DrmProperty.h" +#include "drm/DrmUnique.h" #include "drm/ResourceManager.h" +#include "utils/fd.h" #include "utils/log.h" -#include "utils/properties.h" namespace android::drm_hwcomposer { +DrmDevice::~DrmDevice() = default; + auto DrmDevice::CreateInstance(std::string const &path, ResourceManager *res_man, uint32_t index) -> std::unique_ptr { @@ -194,6 +201,26 @@ auto DrmDevice::RegisterUserPropertyBlob(void *data, size_t length) const }); } +DrmCrtc *DrmDevice::FindCrtcById(uint32_t id) const { + for (const auto &crtc : crtcs_) { + if (crtc->GetId() == id) { + return crtc.get(); + } + }; + + return nullptr; +} + +DrmEncoder *DrmDevice::FindEncoderById(uint32_t id) const { + for (const auto &enc : encoders_) { + if (enc->GetId() == id) { + return enc.get(); + } + }; + + return nullptr; +} + int DrmDevice::GetProperty(uint32_t obj_id, uint32_t obj_type, const char *prop_name, DrmProperty *property) const { drmModeObjectPropertiesPtr props = nullptr; diff --git a/drm/DrmDevice.h b/drm/DrmDevice.h index 994c966..ca5a135 100644 --- a/drm/DrmDevice.h +++ b/drm/DrmDevice.h @@ -21,23 +21,25 @@ #include #include -#include "DrmConnector.h" -#include "DrmCrtc.h" -#include "DrmEncoder.h" -#include "bufferinfo/BufferInfo.h" +#include "drm/DrmUnique.h" #include "utils/fd.h" namespace android::drm_hwcomposer { +struct BufferInfo; +class DrmConnector; +class DrmCrtc; +class DrmEncoder; class DrmFbImporter; class DrmPlane; +class DrmProperty; class ResourceManager; class DrmDevice { friend class FakeDrmDevice; public: - ~DrmDevice() = default; + ~DrmDevice(); static auto CreateInstance(std::string const &path, ResourceManager *res_man, uint32_t index) -> std::unique_ptr; @@ -88,25 +90,9 @@ class DrmDevice { return *drm_fb_importer_; } - auto FindCrtcById(uint32_t id) const -> DrmCrtc * { - for (const auto &crtc : crtcs_) { - if (crtc->GetId() == id) { - return crtc.get(); - } - }; + DrmCrtc *FindCrtcById(uint32_t id) const; - return nullptr; - } - - auto FindEncoderById(uint32_t id) const -> DrmEncoder * { - for (const auto &enc : encoders_) { - if (enc->GetId() == id) { - return enc.get(); - } - }; - - return nullptr; - } + DrmEncoder *FindEncoderById(uint32_t id) const; int GetProperty(uint32_t obj_id, uint32_t obj_type, const char *prop_name, DrmProperty *property) const; diff --git a/drm/DrmDisplayPipeline.cpp b/drm/DrmDisplayPipeline.cpp index ee9dd3c..318d7d9 100644 --- a/drm/DrmDisplayPipeline.cpp +++ b/drm/DrmDisplayPipeline.cpp @@ -18,13 +18,13 @@ #include "DrmDisplayPipeline.h" -#include "DrmAtomicStateManager.h" -#include "DrmConnector.h" -#include "DrmCrtc.h" -#include "DrmDevice.h" -#include "DrmEncoder.h" -#include "DrmPlane.h" #include "compositor/CompositionPlanner.h" +#include "drm/DrmAtomicStateManager.h" +#include "drm/DrmConnector.h" +#include "drm/DrmCrtc.h" +#include "drm/DrmDevice.h" +#include "drm/DrmEncoder.h" +#include "drm/DrmPlane.h" #include "utils/log.h" #include "utils/properties.h" diff --git a/drm/DrmDisplayPipeline.h b/drm/DrmDisplayPipeline.h index 6cbacc0..c531689 100644 --- a/drm/DrmDisplayPipeline.h +++ b/drm/DrmDisplayPipeline.h @@ -22,12 +22,12 @@ namespace android::drm_hwcomposer { class CompositionPlanner; -class DrmConnector; -class DrmDevice; -class DrmPlane; -class DrmCrtc; -class DrmEncoder; class DrmAtomicStateManager; +class DrmConnector; +class DrmCrtc; +class DrmDevice; +class DrmEncoder; +class DrmPlane; struct DrmDisplayPipeline; diff --git a/drm/DrmDisplayPipelineTest.cpp b/drm/DrmDisplayPipelineTest.cpp index ac54984..66fb9e2 100644 --- a/drm/DrmDisplayPipelineTest.cpp +++ b/drm/DrmDisplayPipelineTest.cpp @@ -20,12 +20,12 @@ #include #include -#include "DrmConnector.h" -#include "DrmCrtc.h" -#include "DrmDevice.h" -#include "DrmDisplayPipeline.h" -#include "DrmEncoder.h" -#include "DrmPlane.h" +#include "drm/DrmConnector.h" +#include "drm/DrmCrtc.h" +#include "drm/DrmDevice.h" +#include "drm/DrmDisplayPipeline.h" +#include "drm/DrmEncoder.h" +#include "drm/DrmPlane.h" namespace android::drm_hwcomposer { diff --git a/drm/DrmEncoder.cpp b/drm/DrmEncoder.cpp index a4ecab3..d5576ac 100644 --- a/drm/DrmEncoder.cpp +++ b/drm/DrmEncoder.cpp @@ -22,7 +22,9 @@ #include -#include "DrmDevice.h" +#include "drm/DrmCrtc.h" +#include "drm/DrmDevice.h" +#include "drm/DrmUnique.h" #include "utils/log.h" namespace android::drm_hwcomposer { @@ -38,4 +40,12 @@ auto DrmEncoder::CreateInstance(DrmDevice &dev, uint32_t encoder_id, return std::unique_ptr(new DrmEncoder(std::move(e), index)); } +bool DrmEncoder::CanClone(DrmEncoder &encoder) { + return (enc_->possible_clones & (1 << encoder.GetIndexInResArray())) != 0; +} + +bool DrmEncoder::SupportsCrtc(DrmCrtc &crtc) { + return (enc_->possible_crtcs & (1 << crtc.GetIndexInResArray())) != 0; +} + } // namespace android::drm_hwcomposer diff --git a/drm/DrmEncoder.h b/drm/DrmEncoder.h index ee0c454..d102dff 100644 --- a/drm/DrmEncoder.h +++ b/drm/DrmEncoder.h @@ -22,11 +22,14 @@ #include #include -#include "DrmCrtc.h" -#include "DrmDisplayPipeline.h" +#include "drm/DrmDisplayPipeline.h" +#include "drm/DrmUnique.h" namespace android::drm_hwcomposer { +class DrmCrtc; +class DrmDevice; + class DrmEncoder : public PipelineBindable { friend class FakeDrmEncoder; @@ -47,13 +50,9 @@ class DrmEncoder : public PipelineBindable { return index_in_res_array_; } - auto CanClone(DrmEncoder &encoder) { - return (enc_->possible_clones & (1 << encoder.GetIndexInResArray())) != 0; - } + bool CanClone(DrmEncoder &encoder); - auto SupportsCrtc(DrmCrtc &crtc) { - return (enc_->possible_crtcs & (1 << crtc.GetIndexInResArray())) != 0; - } + bool SupportsCrtc(DrmCrtc &crtc); virtual uint32_t GetCurrentCrtcId() const { return enc_->crtc_id; diff --git a/drm/DrmFbImporter.cpp b/drm/DrmFbImporter.cpp index 53d3614..18df53d 100644 --- a/drm/DrmFbImporter.cpp +++ b/drm/DrmFbImporter.cpp @@ -29,8 +29,9 @@ #include #include +#include "bufferinfo/BufferInfo.h" +#include "drm/DrmDevice.h" #include "utils/log.h" -#include "utils/properties.h" namespace android::drm_hwcomposer { @@ -125,6 +126,9 @@ DrmFbIdHandle::~DrmFbIdHandle() { } } +DrmFbIdHandle::DrmFbIdHandle(DrmDevice &drm) : drm_fd_(drm.GetFd()) { +} + auto DrmFbImporter::GetOrCreateFbId(BufferInfo *bo) -> std::shared_ptr { /* TODO: Clean up DrmDevices and DrmFbImporter inter-dependency. diff --git a/drm/DrmFbImporter.h b/drm/DrmFbImporter.h index fd2f44b..3ef7373 100644 --- a/drm/DrmFbImporter.h +++ b/drm/DrmFbImporter.h @@ -23,7 +23,6 @@ #include #include "bufferinfo/BufferInfo.h" -#include "drm/DrmDevice.h" #include "utils/fd.h" #ifndef DRM_FORMAT_INVALID @@ -34,6 +33,8 @@ using GemHandle = uint32_t; namespace android::drm_hwcomposer { +class DrmDevice; + class DrmFbIdHandle { public: static auto CreateInstance(BufferInfo *bo, GemHandle first_gem_handle, @@ -50,7 +51,7 @@ class DrmFbIdHandle { } private: - explicit DrmFbIdHandle(DrmDevice &drm) : drm_fd_(drm.GetFd()) {}; + explicit DrmFbIdHandle(DrmDevice &drm); SharedFd drm_fd_; diff --git a/drm/DrmHwc.cpp b/drm/DrmHwc.cpp index 7cfd48c..b675148 100644 --- a/drm/DrmHwc.cpp +++ b/drm/DrmHwc.cpp @@ -24,6 +24,9 @@ #include #include +#include "drm/DrmConnector.h" +#include "drm/DrmDisplayPipeline.h" +#include "hwc/HwcDisplay.h" #include "stats/CompositionStats.h" #include "utils/log.h" #include "utils/properties.h" diff --git a/drm/DrmHwc.h b/drm/DrmHwc.h index 333a8f3..9fa0ffb 100644 --- a/drm/DrmHwc.h +++ b/drm/DrmHwc.h @@ -16,13 +16,14 @@ #pragma once -#include "drm/DrmDisplayPipeline.h" #include "drm/ResourceManager.h" #include "hwc/HwcDisplay.h" #include "stats/CompositionStats.h" namespace android::drm_hwcomposer { +struct DrmDisplayPipeline; + class DrmHwc : public PipelineToFrontendBindingInterface, public CompositionStatsProvider { public: diff --git a/drm/DrmMode.cpp b/drm/DrmMode.cpp index 7fbf192..6cdd1be 100644 --- a/drm/DrmMode.cpp +++ b/drm/DrmMode.cpp @@ -18,7 +18,8 @@ #include -#include "DrmDevice.h" +#include "drm/DrmDevice.h" +#include "drm/DrmUnique.h" namespace android::drm_hwcomposer { diff --git a/drm/DrmMode.h b/drm/DrmMode.h index 217aa56..e0516c0 100644 --- a/drm/DrmMode.h +++ b/drm/DrmMode.h @@ -22,7 +22,7 @@ #include #include -#include "DrmUnique.h" +#include "drm/DrmUnique.h" namespace android::drm_hwcomposer { diff --git a/drm/DrmPlane.cpp b/drm/DrmPlane.cpp index 5e4696b..45f55d3 100644 --- a/drm/DrmPlane.cpp +++ b/drm/DrmPlane.cpp @@ -23,9 +23,11 @@ #include #include -#include "DrmDevice.h" #include "bufferinfo/BufferInfoGetter.h" #include "compositor/LayerData.h" +#include "drm/DrmCrtc.h" +#include "drm/DrmDevice.h" +#include "drm/DrmFbImporter.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/drm/DrmPlane.h b/drm/DrmPlane.h index 16fbc22..2e65921 100644 --- a/drm/DrmPlane.h +++ b/drm/DrmPlane.h @@ -21,15 +21,22 @@ #include #include -#include "DrmCrtc.h" -#include "DrmProperty.h" -#include "compositor/LayerData.h" +#include "drm/DrmDisplayPipeline.h" +#include "drm/DrmProperty.h" +#include "drm/DrmUnique.h" namespace android::drm_hwcomposer { +class DrmCrtc; class DrmDevice; + +struct DstRectInfo; struct LayerData; +enum class BufferBlendMode; +enum class BufferColorSpace; +enum class BufferSampleRange; + // NOLINTNEXTLINE(readability-identifier-naming) struct drm_plane_size_hint_local { __u16 width; diff --git a/drm/DrmProperty.cpp b/drm/DrmProperty.cpp index c9df052..5db3477 100644 --- a/drm/DrmProperty.cpp +++ b/drm/DrmProperty.cpp @@ -26,7 +26,7 @@ #include #include -#include "DrmDevice.h" +#include "utils/fd.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/drm/ResourceManager.cpp b/drm/ResourceManager.cpp index d44e77e..58c1632 100644 --- a/drm/ResourceManager.cpp +++ b/drm/ResourceManager.cpp @@ -26,10 +26,10 @@ #include "backend/BackendManager.h" #include "bufferinfo/BufferInfoGetter.h" -#include "drm/DrmAtomicStateManager.h" +#include "drm/DrmConnector.h" #include "drm/DrmDevice.h" #include "drm/DrmDisplayPipeline.h" -#include "drm/DrmPlane.h" +#include "drm/UEventListener.h" #include "utils/log.h" #include "utils/properties.h" diff --git a/drm/ResourceManager.h b/drm/ResourceManager.h index 087d450..0a2dabd 100644 --- a/drm/ResourceManager.h +++ b/drm/ResourceManager.h @@ -17,18 +17,18 @@ #pragma once #include +#include #include #include -#include "DrmDevice.h" -#include "DrmDisplayPipeline.h" -#include "DrmFbImporter.h" -#include "DrmProperty.h" -#include "UEventListener.h" -#include "utils/properties.h" - namespace android::drm_hwcomposer { +enum class CtmHandling; +class DrmConnector; +class DrmDevice; +struct DrmDisplayPipeline; +class UEventListener; + class PipelineToFrontendBindingInterface { public: virtual ~PipelineToFrontendBindingInterface() = default; diff --git a/drm/UEventListener.cpp b/drm/UEventListener.cpp index 2b1421f..56770bc 100644 --- a/drm/UEventListener.cpp +++ b/drm/UEventListener.cpp @@ -20,6 +20,7 @@ #include +#include "utils/UEvent.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/drm/UEventListener.h b/drm/UEventListener.h index 44580cc..d22cd59 100644 --- a/drm/UEventListener.h +++ b/drm/UEventListener.h @@ -20,10 +20,10 @@ #include #include -#include "utils/UEvent.h" - namespace android::drm_hwcomposer { +class UEvent; + class UEventListener { public: ~UEventListener(); diff --git a/drm/VSyncWorker.cpp b/drm/VSyncWorker.cpp index 0646422..8c7324f 100644 --- a/drm/VSyncWorker.cpp +++ b/drm/VSyncWorker.cpp @@ -27,7 +27,11 @@ #include #include +#include "drm/DrmCrtc.h" +#include "drm/DrmDevice.h" +#include "drm/DrmDisplayPipeline.h" #include "drm/ResourceManager.h" +#include "utils/fd.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/drm/VSyncWorker.h b/drm/VSyncWorker.h index f59b7bf..9ab3480 100644 --- a/drm/VSyncWorker.h +++ b/drm/VSyncWorker.h @@ -24,10 +24,12 @@ #include -#include "DrmDevice.h" +#include "utils/fd.h" namespace android::drm_hwcomposer { +struct DrmDisplayPipeline; + class VSyncWorker { public: using VsyncTimestampCallback = std::function -#include "HwcDisplayConfigs.h" -#include "HwcLayer.h" #include "compositor/CompositionPlanner.h" #include "compositor/DisplayInfo.h" #include "compositor/LayerData.h" -#include "drm/DrmAtomicStateManager.h" -#include "drm/VSyncWorker.h" -#include "stats/CompositionStats.h" -#include "utils/EdidWrapper.h" +#include "hwc/HwcDisplayConfigs.h" +#include "hwc/HwcLayer.h" namespace aidl::android::hardware::graphics::common { enum class Hdr; @@ -38,13 +34,20 @@ using aidl::android::hardware::graphics::common::Hdr; namespace android::drm_hwcomposer { +class ChangedLayer; +class DrmHwc; +class EdidWrapper; +class FlatteningController; +class VSyncWorker; + +struct AtomicCommitArgs; +struct CompositionAttributes; +struct CompositionStats; +struct DrmDisplayPipeline; + using DisplayHandle = int64_t; using EdidWrapperUnique = std::unique_ptr; -class CompositionPlanner; -class DrmHwc; -class FlatteningController; - class FrontendDisplayBase { public: virtual ~FrontendDisplayBase() = default; diff --git a/hwc/HwcDisplayConfigs.cpp b/hwc/HwcDisplayConfigs.cpp index 23ab3e8..40b1e7c 100644 --- a/hwc/HwcDisplayConfigs.cpp +++ b/hwc/HwcDisplayConfigs.cpp @@ -21,8 +21,9 @@ #include #include -#include "compositor/DisplayInfo.h" #include "drm/DrmConnector.h" +#include "drm/DrmMode.h" +#include "utils/log.h" #include "utils/properties.h" constexpr uint32_t kSyncLen = 10; diff --git a/hwc/HwcLayer.cpp b/hwc/HwcLayer.cpp index f10ae06..67ae569 100644 --- a/hwc/HwcLayer.cpp +++ b/hwc/HwcLayer.cpp @@ -18,8 +18,10 @@ #include "HwcLayer.h" -#include "HwcDisplay.h" -#include "bufferinfo/BufferInfoGetter.h" +#include "drm/DrmDevice.h" +#include "drm/DrmDisplayPipeline.h" +#include "drm/DrmFbImporter.h" +#include "hwc/HwcDisplay.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/hwc/HwcLayer.h b/hwc/HwcLayer.h index 3ac6134..30ee46f 100644 --- a/hwc/HwcLayer.h +++ b/hwc/HwcLayer.h @@ -16,10 +16,10 @@ #pragma once +#include #include #include "bufferinfo/BufferInfo.h" -#include "bufferinfo/BufferInfoGetter.h" #include "compositor/LayerData.h" #include "utils/fd.h" diff --git a/hwc2_device/DrmHwcTwo.cpp b/hwc2_device/DrmHwcTwo.cpp index 311c2fe..bc86988 100644 --- a/hwc2_device/DrmHwcTwo.cpp +++ b/hwc2_device/DrmHwcTwo.cpp @@ -20,8 +20,8 @@ #include -#include "compositor/CompositionPlanner.h" -#include "utils/log.h" +#include "drm/DrmHwc.h" +#include "hwc/HwcDisplay.h" namespace android::drm_hwcomposer { diff --git a/hwc2_device/DrmHwcTwo.h b/hwc2_device/DrmHwcTwo.h index deb9deb..2ed5ac9 100644 --- a/hwc2_device/DrmHwcTwo.h +++ b/hwc2_device/DrmHwcTwo.h @@ -19,6 +19,7 @@ #include #include "drm/DrmHwc.h" +#include "hwc/HwcDisplay.h" namespace android::drm_hwcomposer { diff --git a/hwc2_device/hwc2_device.cpp b/hwc2_device/hwc2_device.cpp index dac8511..2f8b753 100644 --- a/hwc2_device/hwc2_device.cpp +++ b/hwc2_device/hwc2_device.cpp @@ -25,15 +25,17 @@ #include #include +#include +#include #include -#include "DrmHwcTwo.h" -#include "compositor/CompositionPlanner.h" +#include "bufferinfo/BufferInfoGetter.h" #include "compositor/DisplayInfo.h" -#include "hardware/hwcomposer2.h" +#include "hwc/HwcDisplay.h" #include "hwc/HwcLayer.h" -#include "system/graphics-base-v1.1.h" +#include "hwc2_device/DrmHwcTwo.h" #include "utils/log.h" +#include "utils/properties.h" namespace android::drm_hwcomposer { diff --git a/hwc3/CommandResultWriter.h b/hwc3/CommandResultWriter.h index 3c0ccd7..43999c4 100644 --- a/hwc3/CommandResultWriter.h +++ b/hwc3/CommandResultWriter.h @@ -17,17 +17,19 @@ #include #include +#include +#include +#include +#include +#include #include -#include "Utils.h" -#include "aidl/android/hardware/graphics/composer3/CommandError.h" -#include "aidl/android/hardware/graphics/composer3/CommandResultPayload.h" -#include "aidl/android/hardware/graphics/composer3/PresentFence.h" -#include "aidl/android/hardware/graphics/composer3/PresentOrValidate.h" -#include "aidl/android/hardware/graphics/composer3/ReleaseFences.h" - namespace aidl::android::hardware::graphics::composer3 { +namespace hwc3 { +enum class Error; +} // namespace hwc3 + struct DisplayChanges { std::optional composition_changes; std::optional display_request_changes; diff --git a/hwc3/Composer.cpp b/hwc3/Composer.cpp index 17e1ec8..1250ed3 100644 --- a/hwc3/Composer.cpp +++ b/hwc3/Composer.cpp @@ -19,12 +19,10 @@ #include "Composer.h" -#include #include #include "hwc3/ComposerClient.h" #include "hwc3/Utils.h" -#include "utils/log.h" #include "utils/properties.h" using ::android::drm_hwcomposer::Properties; diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp index 9c86501..5e6614f 100644 --- a/hwc3/ComposerClient.cpp +++ b/hwc3/ComposerClient.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -42,14 +41,19 @@ #include #include "bufferinfo/BufferInfo.h" +#include "bufferinfo/BufferInfoGetter.h" #include "compositor/DisplayInfo.h" #include "hwc/HwcDisplay.h" #include "hwc/HwcDisplayConfigs.h" #include "hwc/HwcLayer.h" +#include "hwc3/CommandResultWriter.h" #include "hwc3/DrmHwcThree.h" #include "hwc3/Utils.h" #include "stats/CompositionStatsAtomReporter.h" #include "stats/CompositionStatsPoller.h" +#include "utils/fd.h" +#include "utils/log.h" +#include "utils/properties.h" using ::android::drm_hwcomposer::BufferBlendMode; using ::android::drm_hwcomposer::BufferColorSpace; @@ -513,7 +517,7 @@ ComposerClient::~ComposerClient() { hwc_->DeinitDisplays(); hwc_.reset(); } - LOG(DEBUG) << "removed composer client"; + ALOGD("removed composer client"); } ndk::ScopedAStatus ComposerClient::createLayer(int64_t display_handle, @@ -1087,7 +1091,8 @@ ndk::ScopedAStatus ComposerClient::getDisplayPhysicalOrientation( *orientation = common::Transform::ROT_90; break; default: - ALOGE("Unknown panel orientation value: %d", drm_orientation); + ALOGE("Unknown panel orientation value: %d", + static_cast(drm_orientation)); return ToBinderStatus(hwc3::Error::kBadDisplay); } @@ -1566,7 +1571,7 @@ ndk::ScopedAStatus ComposerClient::startHdcpNegotiation( if (levels.connectedLevel != drm::HdcpLevel::HDCP_NONE && levels.connectedLevel != drm::HdcpLevel::HDCP_UNKNOWN) { ALOGI("Requested to start HDCP for connected level : %d", - levels.connectedLevel); + static_cast(levels.connectedLevel)); if (!display->StartHdcp(true)) { return ToBinderStatus(hwc3::Error::kUnsupported); } diff --git a/hwc3/ComposerClient.h b/hwc3/ComposerClient.h index a2ddf4b..9e598c4 100644 --- a/hwc3/ComposerClient.h +++ b/hwc3/ComposerClient.h @@ -18,12 +18,10 @@ #include -#include "aidl/android/hardware/graphics/composer3/BnComposerClient.h" -#include "aidl/android/hardware/graphics/composer3/LayerCommand.h" +#include +#include + #include "hwc/HwcLayer.h" -#include "hwc3/CommandResultWriter.h" -#include "hwc3/Utils.h" -#include "utils/Mutex.h" using AidlPixelFormat = aidl::android::hardware::graphics::common::PixelFormat; using AidlNativeHandle = aidl::android::hardware::common::NativeHandle; @@ -33,6 +31,14 @@ class CompositionStatsPoller; class HwcDisplay; } // namespace android::drm_hwcomposer +namespace aidl::android::hardware::graphics::composer3 { +class CommandResultWriter; + +namespace hwc3 { +enum class Error; +} // namespace hwc3 +} // namespace aidl::android::hardware::graphics::composer3 + namespace aidl::android::hardware::graphics::composer3::impl { using AidlColorMode = ColorMode; diff --git a/hwc3/DrmHwcThree.cpp b/hwc3/DrmHwcThree.cpp index 0f15f73..daee85b 100644 --- a/hwc3/DrmHwcThree.cpp +++ b/hwc3/DrmHwcThree.cpp @@ -20,9 +20,11 @@ #include -#include "Utils.h" -#include "aidl/android/hardware/graphics/common/Dataspace.h" -#include "aidl/android/hardware/graphics/common/DisplayHotplugEvent.h" +#include +#include + +#include "drm/DrmHwc.h" +#include "hwc/HwcDisplay.h" namespace aidl::android::hardware::graphics::composer3::impl { diff --git a/hwc3/Utils.h b/hwc3/Utils.h index fb90ad4..b3c0271 100644 --- a/hwc3/Utils.h +++ b/hwc3/Utils.h @@ -17,10 +17,11 @@ #pragma once #include -#include #include +#include "utils/log.h" + // NOLINTNEXTLINE #define DEBUG_FUNC() ALOGV("%s", __func__) diff --git a/hwc3/service.cpp b/hwc3/service.cpp index 4f69f1e..ac8cfb9 100644 --- a/hwc3/service.cpp +++ b/hwc3/service.cpp @@ -21,7 +21,7 @@ #include #include -#include "Composer.h" +#include "hwc3/Composer.h" #include "utils/log.h" using aidl::android::hardware::graphics::composer3::impl::Composer; diff --git a/stats/CompositionStats.cpp b/stats/CompositionStats.cpp index f83fa1a..acd5458 100644 --- a/stats/CompositionStats.cpp +++ b/stats/CompositionStats.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "stats/CompositionStats.h" +#include "CompositionStats.h" namespace android::drm_hwcomposer { diff --git a/stats/CompositionStatsAtomReporter.h b/stats/CompositionStatsAtomReporter.h index 40cd7c1..0954180 100644 --- a/stats/CompositionStatsAtomReporter.h +++ b/stats/CompositionStatsAtomReporter.h @@ -18,8 +18,8 @@ #include -#include "CompositionStats.h" #include "compositor/CompositionPlanner.h" +#include "stats/CompositionStats.h" namespace android::drm_hwcomposer { diff --git a/stats/CompositionStatsAtomReporterDesktop.cpp b/stats/CompositionStatsAtomReporterDesktop.cpp index 87ef9ae..690ea26 100644 --- a/stats/CompositionStatsAtomReporterDesktop.cpp +++ b/stats/CompositionStatsAtomReporterDesktop.cpp @@ -25,9 +25,9 @@ #include #include -#include "CompositionStats.h" #include "compositor/CompositionPlanner.h" #include "desktopatoms.h" +#include "stats/CompositionStats.h" #include "utils/log.h" using aidl::android::frameworks::stats::IStats; diff --git a/stats/CompositionStatsPoller.h b/stats/CompositionStatsPoller.h index e286089..a958d45 100644 --- a/stats/CompositionStatsPoller.h +++ b/stats/CompositionStatsPoller.h @@ -16,8 +16,6 @@ #pragma once -#include "stats/CompositionStats.h" - #include #include #include @@ -25,6 +23,8 @@ #include +#include "stats/CompositionStats.h" + namespace android::drm_hwcomposer { class CompositionStatsAtomReporter; diff --git a/utils/LibdisplayEdidWrapper.cpp b/utils/LibdisplayEdidWrapper.cpp index 6f1c87c..dcce413 100644 --- a/utils/LibdisplayEdidWrapper.cpp +++ b/utils/LibdisplayEdidWrapper.cpp @@ -18,9 +18,12 @@ #if HAS_LIBDISPLAY_INFO +#include "EdidWrapper.h" + #include -#include "utils/EdidWrapper.h" +#include "compositor/DisplayInfo.h" +#include "drm/DrmUnique.h" #include "utils/log.h" namespace android::drm_hwcomposer { diff --git a/utils/UEvent.h b/utils/UEvent.h index 102b867..dd25bb8 100644 --- a/utils/UEvent.h +++ b/utils/UEvent.h @@ -26,8 +26,8 @@ #include #include -#include "fd.h" -#include "log.h" +#include "utils/fd.h" +#include "utils/log.h" namespace android::drm_hwcomposer {