drm_hwcomposer: Make Planner class fully static
clang-tidy suggested to make all methods of Planner static, since they don't use any instance members. This makes creation of Planner instances unnecessary, therefore remove all such cases. Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
This commit is contained in:
parent
fc014f5792
commit
753d107896
8 changed files with 10 additions and 36 deletions
|
|
@ -240,12 +240,6 @@ void DrmHwcTwo::HwcDisplay::ClearDisplay() {
|
|||
}
|
||||
|
||||
HWC2::Error DrmHwcTwo::HwcDisplay::Init(std::vector<DrmPlane *> *planes) {
|
||||
planner_ = Planner::CreateInstance(drm_);
|
||||
if (!planner_) {
|
||||
ALOGE("Failed to create planner instance for composition");
|
||||
return HWC2::Error::NoResources;
|
||||
}
|
||||
|
||||
int display = static_cast<int>(handle_);
|
||||
int ret = compositor_.Init(resource_manager_, display);
|
||||
if (ret) {
|
||||
|
|
@ -737,8 +731,7 @@ HWC2::Error DrmHwcTwo::HwcDisplay::CreateComposition(AtomicCommitArgs &a_args) {
|
|||
composition_layers.emplace_back(std::move(layer));
|
||||
}
|
||||
|
||||
auto composition = std::make_shared<DrmDisplayComposition>(crtc_,
|
||||
planner_.get());
|
||||
auto composition = std::make_shared<DrmDisplayComposition>(crtc_);
|
||||
|
||||
// TODO(nobody): Don't always assume geometry changed
|
||||
int ret = composition->SetLayers(composition_layers.data(),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <optional>
|
||||
|
||||
#include "compositor/DrmDisplayCompositor.h"
|
||||
#include "compositor/Planner.h"
|
||||
#include "drm/ResourceManager.h"
|
||||
#include "drm/VSyncWorker.h"
|
||||
#include "drmhwcomposer.h"
|
||||
|
|
@ -349,7 +348,6 @@ class DrmHwcTwo : public hwc2_device_t {
|
|||
ResourceManager *resource_manager_;
|
||||
DrmDevice *drm_;
|
||||
DrmDisplayCompositor compositor_;
|
||||
std::unique_ptr<Planner> planner_;
|
||||
|
||||
std::vector<DrmPlane *> primary_planes_;
|
||||
std::vector<DrmPlane *> overlay_planes_;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
DrmDisplayComposition::DrmDisplayComposition(DrmCrtc *crtc, Planner *planner)
|
||||
: crtc_(crtc), // Can be NULL if we haven't modeset yet
|
||||
planner_(planner) {
|
||||
DrmDisplayComposition::DrmDisplayComposition(DrmCrtc *crtc)
|
||||
: crtc_(crtc) // Can be NULL if we haven't modeset yet
|
||||
{
|
||||
}
|
||||
|
||||
int DrmDisplayComposition::SetLayers(DrmHwcLayer *layers, size_t num_layers) {
|
||||
|
|
@ -58,10 +58,10 @@ int DrmDisplayComposition::Plan(std::vector<DrmPlane *> *primary_planes,
|
|||
to_composite.emplace(std::make_pair(i, &layers_[i]));
|
||||
|
||||
int ret = 0;
|
||||
std::tie(ret,
|
||||
composition_planes_) = planner_->ProvisionPlanes(to_composite, crtc_,
|
||||
primary_planes,
|
||||
overlay_planes);
|
||||
std::tie(ret, composition_planes_) = Planner::ProvisionPlanes(to_composite,
|
||||
crtc_,
|
||||
primary_planes,
|
||||
overlay_planes);
|
||||
if (ret) {
|
||||
ALOGV("Planner failed provisioning planes ret=%d", ret);
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
namespace android {
|
||||
|
||||
class Importer;
|
||||
class Planner;
|
||||
|
||||
constexpr size_t kUndefinedSourceLayer = UINT16_MAX;
|
||||
|
||||
|
|
@ -59,7 +58,7 @@ class DrmCompositionPlane {
|
|||
class DrmDisplayComposition {
|
||||
public:
|
||||
DrmDisplayComposition(const DrmDisplayComposition &) = delete;
|
||||
DrmDisplayComposition(DrmCrtc *crtc, Planner *planner);
|
||||
explicit DrmDisplayComposition(DrmCrtc *crtc);
|
||||
~DrmDisplayComposition() = default;
|
||||
|
||||
int SetLayers(DrmHwcLayer *layers, size_t num_layers);
|
||||
|
|
@ -80,13 +79,8 @@ class DrmDisplayComposition {
|
|||
return crtc_;
|
||||
}
|
||||
|
||||
Planner *planner() const {
|
||||
return planner_;
|
||||
}
|
||||
|
||||
private:
|
||||
DrmCrtc *crtc_ = nullptr;
|
||||
Planner *planner_ = nullptr;
|
||||
|
||||
std::vector<DrmHwcLayer> layers_;
|
||||
std::vector<DrmCompositionPlane> composition_planes_;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ auto DrmDisplayCompositor::Init(ResourceManager *resource_manager, int display)
|
|||
ALOGE("Could not find drmdevice for display");
|
||||
return -EINVAL;
|
||||
}
|
||||
planner_ = Planner::CreateInstance(drm);
|
||||
|
||||
initialized_ = true;
|
||||
return 0;
|
||||
|
|
@ -64,7 +63,7 @@ DrmDisplayCompositor::CreateInitializedComposition() const {
|
|||
return std::unique_ptr<DrmDisplayComposition>();
|
||||
}
|
||||
|
||||
return std::make_unique<DrmDisplayComposition>(crtc, planner_.get());
|
||||
return std::make_unique<DrmDisplayComposition>(crtc);
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE (readability-function-cognitive-complexity): Fixme
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@
|
|||
#include <tuple>
|
||||
|
||||
#include "DrmDisplayComposition.h"
|
||||
#include "Planner.h"
|
||||
#include "drm/ResourceManager.h"
|
||||
#include "drm/VSyncWorker.h"
|
||||
#include "drmhwcomposer.h"
|
||||
|
|
@ -90,7 +89,6 @@ class DrmDisplayCompositor {
|
|||
}
|
||||
|
||||
ResourceManager *resource_manager_ = nullptr;
|
||||
std::unique_ptr<Planner> planner_;
|
||||
bool initialized_{};
|
||||
int display_ = -1;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,11 +25,6 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
std::unique_ptr<Planner> Planner::CreateInstance(DrmDevice * /*device*/) {
|
||||
std::unique_ptr<Planner> planner(new Planner);
|
||||
return planner;
|
||||
}
|
||||
|
||||
std::vector<DrmPlane *> Planner::GetUsablePlanes(
|
||||
DrmCrtc *crtc, std::vector<DrmPlane *> *primary_planes,
|
||||
std::vector<DrmPlane *> *overlay_planes) {
|
||||
|
|
|
|||
|
|
@ -72,9 +72,6 @@ class Planner {
|
|||
std::map<size_t, DrmHwcLayer *> &layers, std::vector<DrmPlane *> *planes);
|
||||
|
||||
public:
|
||||
// Creates a planner instance
|
||||
static std::unique_ptr<Planner> CreateInstance(DrmDevice *drm);
|
||||
|
||||
// Takes a stack of layers and provisions hardware planes for them. If the
|
||||
// entire stack can't fit in hardware, FIXME
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue