Create DrmDisplayPipeline through BackendManager
Additionally, move the creation of the Backend into BackendManager so that it the Backend is created along with the DrmDisplayPipeline Change-Id: I24dc19cadb324429f229fe7751b60b70ab512265
This commit is contained in:
parent
043be2b9e3
commit
0f5244ef78
4 changed files with 28 additions and 15 deletions
|
|
@ -43,9 +43,21 @@ int BackendManager::RegisterBackend(const std::string &name,
|
|||
return 0;
|
||||
}
|
||||
|
||||
std::unique_ptr<DrmDisplayPipeline> BackendManager::CreatePipelineForConnector(
|
||||
DrmConnector &connector) {
|
||||
auto pipeline = DrmDisplayPipeline::CreatePipeline(connector);
|
||||
if (pipeline) {
|
||||
pipeline->backend = CreateBackendForConnector(connector);
|
||||
}
|
||||
if (!pipeline || !pipeline->backend) {
|
||||
return nullptr;
|
||||
}
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
std::unique_ptr<Backend> BackendManager::CreateBackendForConnector(
|
||||
const DrmConnector *connector) {
|
||||
auto driver_name(connector->GetDev().GetName());
|
||||
const DrmConnector &connector) {
|
||||
auto driver_name(connector.GetDev().GetName());
|
||||
std::string backend_name = Properties::GetBackendOverride();
|
||||
if (backend_name.empty()) {
|
||||
backend_name = driver_name;
|
||||
|
|
@ -54,14 +66,13 @@ std::unique_ptr<Backend> BackendManager::CreateBackendForConnector(
|
|||
auto backend = GetBackendByName(backend_name);
|
||||
if (backend == nullptr) {
|
||||
ALOGE("Failed to create backend '%s' for '%s' and driver '%s'",
|
||||
backend_name.c_str(), connector->GetName().c_str(),
|
||||
backend_name.c_str(), connector.GetName().c_str(),
|
||||
driver_name.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ALOGI("Backend '%s' for '%s' and driver '%s' was successfully created",
|
||||
backend_name.c_str(), connector->GetName().c_str(),
|
||||
driver_name.c_str());
|
||||
backend_name.c_str(), connector.GetName().c_str(), driver_name.c_str());
|
||||
|
||||
return backend;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,14 @@ class BackendManager {
|
|||
static BackendManager &GetInstance();
|
||||
int RegisterBackend(const std::string &name,
|
||||
BackendConstructorT backend_constructor);
|
||||
std::unique_ptr<Backend> CreateBackendForConnector(
|
||||
const DrmConnector *connector);
|
||||
|
||||
std::unique_ptr<DrmDisplayPipeline> CreatePipelineForConnector(
|
||||
DrmConnector &connector);
|
||||
|
||||
private:
|
||||
std::unique_ptr<Backend> CreateBackendForConnector(
|
||||
const DrmConnector &connector);
|
||||
|
||||
std::unique_ptr<Backend> GetBackendByName(std::string &name);
|
||||
|
||||
BackendManager() = default;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include "backend/BackendManager.h"
|
||||
#include "stats/CompositionStats.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/properties.h"
|
||||
|
|
@ -129,8 +128,6 @@ bool DrmHwc::BindDisplay(std::shared_ptr<DrmDisplayPipeline> pipeline) {
|
|||
pipeline->connector->Get()->GetName().c_str(), (int)disp_handle,
|
||||
disp_handle == kPrimaryDisplay ? " (Primary)" : "");
|
||||
|
||||
pipeline->backend = BackendManager::GetInstance().CreateBackendForConnector(
|
||||
pipeline->connector->Get());
|
||||
displays_[disp_handle]->SetPipeline(pipeline);
|
||||
display_handles_[pipeline] = disp_handle;
|
||||
|
||||
|
|
@ -185,9 +182,6 @@ std::optional<DisplayHandle> DrmHwc::CreateVirtualDisplay(uint32_t width,
|
|||
/* is_virtual */ true, this);
|
||||
|
||||
disp->SetVirtualDisplayResolution(width, height);
|
||||
virtual_pipeline->backend = BackendManager::GetInstance()
|
||||
.CreateBackendForConnector(
|
||||
virtual_pipeline->connector->Get());
|
||||
disp->SetPipeline(virtual_pipeline);
|
||||
displays_[new_display_handle] = std::move(disp);
|
||||
return new_display_handle;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
#include <ctime>
|
||||
#include <sstream>
|
||||
|
||||
#include "backend/BackendManager.h"
|
||||
#include "bufferinfo/BufferInfoGetter.h"
|
||||
#include "drm/DrmAtomicStateManager.h"
|
||||
#include "drm/DrmDevice.h"
|
||||
|
|
@ -147,8 +148,11 @@ void ResourceManager::UpdateFrontendDisplays() {
|
|||
|
||||
if (connected) {
|
||||
std::shared_ptr<DrmDisplayPipeline>
|
||||
pipeline = DrmDisplayPipeline::CreatePipeline(*conn);
|
||||
|
||||
pipeline = BackendManager::GetInstance().CreatePipelineForConnector(
|
||||
*conn);
|
||||
ALOGE_IF(pipeline == nullptr,
|
||||
"Failed to create pipeline for connector %s",
|
||||
conn->GetName().c_str());
|
||||
if (pipeline) {
|
||||
frontend_interface_->BindDisplay(pipeline);
|
||||
attached_pipelines_[conn] = std::move(pipeline);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue