hwc: mdpcomp: Remove pipe estimation blocks
Pipe estimation was necessary when the unavailability from overlay
led to GPU fallback.
With the new design, hwc uses the next best strategy, so failure
to grab a pipe from overlay is ok.
Change-Id: Id20d2e6fd24aeb5af3ab84ec9dd8c52f6bbbef8b
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 4f6099e..7be2f78 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -1297,10 +1297,6 @@
return false;
}
- if(!arePipesAvailable(ctx, list)) {
- return false;
- }
-
double size = calcMDPBytesRead(ctx, list);
if(!bandwidthCheck(ctx, size)) {
ALOGD_IF(isDebug(), "%s: Exceeds bandwidth",__FUNCTION__);
@@ -1551,58 +1547,6 @@
&PipeLayerPair.rot);
}
-bool MDPCompNonSplit::arePipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list) {
- overlay::Overlay& ov = *ctx->mOverlay;
- int numPipesNeeded = mCurrentFrame.mdpCount;
- int availPipes = ov.availablePipes(mDpy, Overlay::MIXER_DEFAULT);
-
- //Reserve pipe for FB
- if(mCurrentFrame.fbCount)
- availPipes -= 1;
-
- if(numPipesNeeded > availPipes) {
- ALOGD_IF(isDebug(), "%s: Insufficient pipes, dpy %d needed %d, avail %d",
- __FUNCTION__, mDpy, numPipesNeeded, availPipes);
- return false;
- }
-
- if(not areVGPipesAvailable(ctx, list)) {
- return false;
- }
-
- return true;
-}
-
-bool MDPCompNonSplit::areVGPipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list) {
- overlay::Overlay& ov = *ctx->mOverlay;
- int pipesNeeded = 0;
- for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
- if(!mCurrentFrame.isFBComposed[i]) {
- hwc_layer_1_t* layer = &list->hwLayers[i];
- hwc_rect_t dst = layer->displayFrame;
- private_handle_t *hnd = (private_handle_t *)layer->handle;
- if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){
- pipesNeeded = pipesNeeded + 2;
- }
- else if(isYuvBuffer(hnd)) {
- pipesNeeded++;
- }
- }
- }
-
- int availableVGPipes = ov.availablePipes(mDpy, ovutils::OV_MDP_PIPE_VG);
- if(pipesNeeded > availableVGPipes) {
- ALOGD_IF(isDebug(), "%s: Insufficient VG pipes for video layers"
- "dpy %d needed %d, avail %d",
- __FUNCTION__, mDpy, pipesNeeded, availableVGPipes);
- return false;
- }
-
- return true;
-}
-
bool MDPCompNonSplit::allocLayerPipes(hwc_context_t *ctx,
hwc_display_contents_1_t* list) {
for(int index = 0; index < mCurrentFrame.layerCount; index++) {
@@ -1800,105 +1744,6 @@
}
}
-int MDPCompSplit::pipesNeeded(hwc_context_t *ctx,
- hwc_display_contents_1_t* list,
- int mixer) {
- int pipesNeeded = 0;
-
- const int lSplit = getLeftSplit(ctx, mDpy);
-
- for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
- if(!mCurrentFrame.isFBComposed[i]) {
- hwc_layer_1_t* layer = &list->hwLayers[i];
- hwc_rect_t dst = layer->displayFrame;
- if(mixer == Overlay::MIXER_LEFT && dst.left < lSplit) {
- pipesNeeded++;
- } else if(mixer == Overlay::MIXER_RIGHT && dst.right > lSplit) {
- pipesNeeded++;
- }
- }
- }
- return pipesNeeded;
-}
-
-bool MDPCompSplit::arePipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list) {
- overlay::Overlay& ov = *ctx->mOverlay;
- int totalPipesNeeded = 0;
-
- for(int i = 0; i < Overlay::MIXER_MAX; i++) {
- int numPipesNeeded = pipesNeeded(ctx, list, i);
- int availPipes = ov.availablePipes(mDpy, i);
-
- //Reserve pipe(s)for FB
- if(mCurrentFrame.fbCount)
- numPipesNeeded += 1;
-
- totalPipesNeeded += numPipesNeeded;
-
- //Per mixer check.
- if(numPipesNeeded > availPipes) {
- ALOGD_IF(isDebug(), "%s: Insufficient pipes for "
- "dpy %d mixer %d needed %d, avail %d",
- __FUNCTION__, mDpy, i, numPipesNeeded, availPipes);
- return false;
- }
- }
-
- //Per display check, since unused pipes can get counted twice.
- int totalPipesAvailable = ov.availablePipes(mDpy);
- if(totalPipesNeeded > totalPipesAvailable) {
- ALOGD_IF(isDebug(), "%s: Insufficient pipes for "
- "dpy %d needed %d, avail %d",
- __FUNCTION__, mDpy, totalPipesNeeded, totalPipesAvailable);
- return false;
- }
-
- if(not areVGPipesAvailable(ctx, list)) {
- return false;
- }
-
- return true;
-}
-
-bool MDPCompSplit::areVGPipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list) {
- overlay::Overlay& ov = *ctx->mOverlay;
- int pipesNeeded = 0;
- const int lSplit = getLeftSplit(ctx, mDpy);
- for(int i = 0; i < mCurrentFrame.layerCount; ++i) {
- if(!mCurrentFrame.isFBComposed[i]) {
- hwc_layer_1_t* layer = &list->hwLayers[i];
- hwc_rect_t dst = layer->displayFrame;
- private_handle_t *hnd = (private_handle_t *)layer->handle;
- if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){
- if((dst.left > lSplit)||(dst.right < lSplit)){
- pipesNeeded = pipesNeeded + 2;
- continue;
- }
- }
- if(isYuvBuffer(hnd)) {
- if(dst.left < lSplit) {
- pipesNeeded++;
- }
- if(dst.right > lSplit) {
- pipesNeeded++;
- }
- }
- }
- }
-
- int availableVGPipes = ov.availablePipes(mDpy, ovutils::OV_MDP_PIPE_VG);
- if(pipesNeeded > availableVGPipes) {
- ALOGD_IF(isDebug(), "%s: Insufficient VG pipes for video layers"
- "dpy %d needed %d, avail %d",
- __FUNCTION__, mDpy, pipesNeeded, availableVGPipes);
- return false;
- }
-
- return true;
-}
-
bool MDPCompSplit::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
MdpPipeInfoSplit& pipe_info,
ePipeType type) {
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 40a0cb5..f2a8eda 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -136,9 +136,6 @@
/* configures MPD pipes */
virtual int configure(hwc_context_t *ctx, hwc_layer_1_t *layer,
PipeLayerPair& pipeLayerPair) = 0;
- /* Checks for pipes needed versus pipes available */
- virtual bool arePipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list) = 0;
/* Increments mdpCount if 4k2k yuv layer split is enabled.
* updates framebuffer z order if fb lies above source-split layer */
virtual void adjustForSourceSplit(hwc_context_t *ctx,
@@ -268,14 +265,6 @@
virtual bool allocLayerPipes(hwc_context_t *ctx,
hwc_display_contents_1_t* list);
- /* Checks for pipes needed versus pipes available */
- virtual bool arePipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list);
-
- /* Checks for video pipes needed versus pipes available */
- virtual bool areVGPipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list);
-
/* Increments mdpCount if 4k2k yuv layer split is enabled.
* updates framebuffer z order if fb lies above source-split layer */
virtual void adjustForSourceSplit(hwc_context_t *ctx,
@@ -309,14 +298,6 @@
virtual bool allocLayerPipes(hwc_context_t *ctx,
hwc_display_contents_1_t* list);
- /* Checks for pipes needed versus pipes available */
- virtual bool arePipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list);
-
- /* Checks for video pipes needed versus pipes available */
- virtual bool areVGPipesAvailable(hwc_context_t *ctx,
- hwc_display_contents_1_t* list);
-
/* Increments mdpCount if 4k2k yuv layer split is enabled.
* updates framebuffer z order if fb lies above source-split layer */
virtual void adjustForSourceSplit(hwc_context_t *ctx,
@@ -325,9 +306,6 @@
/* configures 4kx2k yuv layer*/
virtual int configure4k2kYuv(hwc_context_t *ctx, hwc_layer_1_t *layer,
PipeLayerPair& PipeLayerPair);
-
- int pipesNeeded(hwc_context_t *ctx, hwc_display_contents_1_t* list,
- int mixer);
};
}; //namespace