summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2016-05-11 16:57:26 -0400
committerSean Paul <seanpaul@chromium.org>2016-05-12 14:27:05 -0400
commitbbe39db91385424991ce86f333cc6c2ebe871a66 (patch)
tree1da9a135bf3132ab8cf7063346683d1f03bc4c95
parentca699be0bcc162c8748abb63cd4f7158733b1466 (diff)
downloaddrm_hwcomposer-bbe39db91385424991ce86f333cc6c2ebe871a66.tar.gz
drm_hwcomposer-bbe39db91385424991ce86f333cc6c2ebe871a66.tar.xz
drm_hwcomposer: Move DrmCompositionPlaneType into DrmCompositionPlane
Now that DrmCompositionPlane is classified, move the type into it as a subclass. BUG=b/28117135 TEST=Tested on ryu Signed-off-by: Sean Paul <seanpaul@chromium.org> Change-Id: I774f477e75b3a2e2916c5d98931730dac46d3877
-rw-r--r--drmdisplaycomposition.cpp20
-rw-r--r--drmdisplaycomposition.h27
-rw-r--r--drmdisplaycompositor.cpp14
3 files changed, 30 insertions, 31 deletions
diff --git a/drmdisplaycomposition.cpp b/drmdisplaycomposition.cpp
index 2af9d5a..3880a26 100644
--- a/drmdisplaycomposition.cpp
+++ b/drmdisplaycomposition.cpp
@@ -113,7 +113,7 @@ int DrmDisplayComposition::SetDisplayMode(const DrmMode &display_mode) {
}
int DrmDisplayComposition::AddPlaneDisable(DrmPlane *plane) {
- composition_planes_.emplace_back(DrmCompositionPlaneType::kDisable, plane,
+ composition_planes_.emplace_back(DrmCompositionPlane::Type::kDisable, plane,
crtc_);
return 0;
}
@@ -150,7 +150,7 @@ static DrmPlane *TakePlane(DrmCrtc *crtc,
}
void DrmDisplayComposition::EmplaceCompositionPlane(
- DrmCompositionPlaneType type, std::vector<DrmPlane *> *primary_planes,
+ DrmCompositionPlane::Type type, std::vector<DrmPlane *> *primary_planes,
std::vector<DrmPlane *> *overlay_planes) {
DrmPlane *plane = TakePlane(crtc_, primary_planes, overlay_planes);
if (plane == NULL) {
@@ -172,7 +172,7 @@ void DrmDisplayComposition::EmplaceCompositionPlane(
"remaining");
return;
}
- composition_planes_.emplace_back(DrmCompositionPlaneType::kLayer, plane,
+ composition_planes_.emplace_back(DrmCompositionPlane::Type::kLayer, plane,
crtc_, source_layer);
}
@@ -281,7 +281,7 @@ int DrmDisplayComposition::CreateAndAssignReleaseFences() {
}
for (const DrmCompositionPlane &plane : composition_planes_) {
- if (plane.type() == DrmCompositionPlaneType::kLayer) {
+ if (plane.type() == DrmCompositionPlane::Type::kLayer) {
for (auto i : plane.source_layers()) {
DrmHwcLayer *source_layer = &layers_[i];
comp_layers.emplace(source_layer);
@@ -459,7 +459,7 @@ int DrmDisplayComposition::Plan(SquashState *squash,
overlay_planes);
if (layers_remaining.size() > 0) {
- EmplaceCompositionPlane(DrmCompositionPlaneType::kPrecomp, primary_planes,
+ EmplaceCompositionPlane(DrmCompositionPlane::Type::kPrecomp, primary_planes,
overlay_planes);
SeparateLayers(layers_.data(), layers_remaining.data(),
layers_remaining.size(), protected_layers.data(),
@@ -468,7 +468,7 @@ int DrmDisplayComposition::Plan(SquashState *squash,
}
if (use_squash_framebuffer) {
- EmplaceCompositionPlane(DrmCompositionPlaneType::kSquash, primary_planes,
+ EmplaceCompositionPlane(DrmCompositionPlane::Type::kSquash, primary_planes,
overlay_planes);
}
@@ -638,16 +638,16 @@ void DrmDisplayComposition::Dump(std::ostringstream *out) const {
<< " plane=" << (comp_plane.plane() ? comp_plane.plane()->id() : -1)
<< " type=";
switch (comp_plane.type()) {
- case DrmCompositionPlaneType::kDisable:
+ case DrmCompositionPlane::Type::kDisable:
*out << "DISABLE";
break;
- case DrmCompositionPlaneType::kLayer:
+ case DrmCompositionPlane::Type::kLayer:
*out << "LAYER";
break;
- case DrmCompositionPlaneType::kPrecomp:
+ case DrmCompositionPlane::Type::kPrecomp:
*out << "PRECOMP";
break;
- case DrmCompositionPlaneType::kSquash:
+ case DrmCompositionPlane::Type::kSquash:
*out << "SQUASH";
break;
default:
diff --git a/drmdisplaycomposition.h b/drmdisplaycomposition.h
index 768ccfb..b2cfb9c 100644
--- a/drmdisplaycomposition.h
+++ b/drmdisplaycomposition.h
@@ -46,31 +46,30 @@ struct DrmCompositionRegion {
std::vector<size_t> source_layers;
};
-enum class DrmCompositionPlaneType : int32_t {
- kDisable,
- kLayer,
- kPrecomp,
- kSquash,
-};
-
class DrmCompositionPlane {
public:
+ enum class Type : int32_t {
+ kDisable,
+ kLayer,
+ kPrecomp,
+ kSquash,
+ };
+
DrmCompositionPlane() = default;
DrmCompositionPlane(DrmCompositionPlane &&rhs) = default;
DrmCompositionPlane &operator=(DrmCompositionPlane &&other) = default;
- DrmCompositionPlane(DrmCompositionPlaneType type, DrmPlane *plane,
- DrmCrtc *crtc)
+ DrmCompositionPlane(Type type, DrmPlane *plane, DrmCrtc *crtc)
: type_(type), plane_(plane), crtc_(crtc) {
}
- DrmCompositionPlane(DrmCompositionPlaneType type, DrmPlane *plane,
- DrmCrtc *crtc, size_t source_layer)
+ DrmCompositionPlane(Type type, DrmPlane *plane, DrmCrtc *crtc,
+ size_t source_layer)
: type_(type),
plane_(plane),
crtc_(crtc),
source_layers_(1, source_layer) {
}
- DrmCompositionPlaneType type() const {
+ Type type() const {
return type_;
}
@@ -94,7 +93,7 @@ class DrmCompositionPlane {
}
private:
- DrmCompositionPlaneType type_ = DrmCompositionPlaneType::kDisable;
+ Type type_ = Type::kDisable;
DrmPlane *plane_ = NULL;
DrmCrtc *crtc_ = NULL;
std::vector<size_t> source_layers_;
@@ -179,7 +178,7 @@ class DrmDisplayComposition {
int IncreaseTimelineToPoint(int point);
- void EmplaceCompositionPlane(DrmCompositionPlaneType type,
+ void EmplaceCompositionPlane(DrmCompositionPlane::Type type,
std::vector<DrmPlane *> *primary_planes,
std::vector<DrmPlane *> *overlay_planes);
void EmplaceCompositionPlane(size_t source_layer,
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index fc040dc..acd5436 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -172,7 +172,7 @@ void SquashState::Dump(std::ostringstream *out) const {
static bool UsesSquash(const std::vector<DrmCompositionPlane> &comp_planes) {
return std::any_of(comp_planes.begin(), comp_planes.end(),
[](const DrmCompositionPlane &plane) {
- return plane.type() == DrmCompositionPlaneType::kSquash;
+ return plane.type() == DrmCompositionPlane::Type::kSquash;
});
}
@@ -574,13 +574,13 @@ int DrmDisplayCompositor::PrepareFrame(DrmDisplayComposition *display_comp) {
for (DrmCompositionPlane &comp_plane : comp_planes) {
std::vector<size_t> &source_layers = comp_plane.source_layers();
switch (comp_plane.type()) {
- case DrmCompositionPlaneType::kSquash:
+ case DrmCompositionPlane::Type::kSquash:
if (source_layers.size())
ALOGE("Squash source_layers is expected to be empty (%zu/%d)",
source_layers[0], squash_layer_index);
source_layers.push_back(squash_layer_index);
break;
- case DrmCompositionPlaneType::kPrecomp:
+ case DrmCompositionPlane::Type::kPrecomp:
if (!do_pre_comp) {
ALOGE(
"Can not use pre composite framebuffer with no pre composite "
@@ -652,7 +652,7 @@ int DrmDisplayCompositor::CommitFrame(DrmDisplayComposition *display_comp,
uint64_t rotation = 0;
uint64_t alpha = 0xFF;
- if (comp_plane.type() != DrmCompositionPlaneType::kDisable) {
+ if (comp_plane.type() != DrmCompositionPlane::Type::kDisable) {
if (source_layers.size() > 1) {
ALOGE("Can't handle more than one source layer sz=%zu type=%d",
source_layers.size(), comp_plane.type());
@@ -1041,7 +1041,7 @@ int DrmDisplayCompositor::SquashFrame(DrmDisplayComposition *src,
// Make sure there is more than one layer to squash.
size_t src_planes_with_layer = std::count_if(
src_planes.begin(), src_planes.end(), [](DrmCompositionPlane &p) {
- return p.type() == DrmCompositionPlaneType::kLayer;
+ return p.type() == DrmCompositionPlane::Type::kLayer;
});
if (src_planes_with_layer <= 1)
return -EALREADY;
@@ -1065,7 +1065,7 @@ int DrmDisplayCompositor::SquashFrame(DrmDisplayComposition *src,
goto move_layers_back;
}
- if (comp_plane.type() == DrmCompositionPlaneType::kDisable)
+ if (comp_plane.type() == DrmCompositionPlane::Type::kDisable)
continue;
for (auto i : comp_plane.source_layers()) {
@@ -1114,7 +1114,7 @@ int DrmDisplayCompositor::SquashFrame(DrmDisplayComposition *src,
framebuffer_index_ = (framebuffer_index_ + 1) % DRM_DISPLAY_BUFFERS;
for (DrmCompositionPlane &plane : dst->composition_planes()) {
- if (plane.type() == DrmCompositionPlaneType::kPrecomp) {
+ if (plane.type() == DrmCompositionPlane::Type::kPrecomp) {
// Replace source_layers with the output of the precomposite
plane.source_layers().clear();
plane.source_layers().push_back(pre_comp_layer_index);