summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Paul <seanpaul@google.com>2015-11-24 18:13:42 (GMT)
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-11-24 18:13:42 (GMT)
commitd0cff784a82bbb63047420da20fef7d3739715bd (patch)
treecd137f3346f61c2a2480e55a2aa1d8625bede1f4
parent0c7da1e236c3a31a5bc171aac4d5f2a1033f10e1 (diff)
parentb1008373244ff109cadb8b5d443e95d98d034124 (diff)
downloaddrm_hwcomposer-d0cff784a82bbb63047420da20fef7d3739715bd.tar.gz
drm_hwcomposer-d0cff784a82bbb63047420da20fef7d3739715bd.tar.xz
Merge "drm_hwcomposer: Skip layers which aren't on-screen" into mnc-dr-dev
-rw-r--r--hwcomposer.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/hwcomposer.cpp b/hwcomposer.cpp
index c6f636b..3d39f6e 100644
--- a/hwcomposer.cpp
+++ b/hwcomposer.cpp
@@ -328,14 +328,16 @@ static int hwc_prepare(hwc_composer_device_1_t *dev, size_t num_displays,
continue;
bool use_framebuffer_target = false;
+ DrmMode mode;
if (i == HWC_DISPLAY_VIRTUAL) {
use_framebuffer_target = true;
} else {
- DrmCrtc *crtc = ctx->drm.GetCrtcForDisplay(i);
- if (!crtc) {
- ALOGE("No crtc for display %d", i);
+ DrmConnector *c = ctx->drm.GetConnectorForDisplay(i);
+ if (!c) {
+ ALOGE("Failed to get DrmConnector for display %d", i);
return -ENODEV;
}
+ mode = c->active_mode();
}
// Since we can't composite HWC_SKIP_LAYERs by ourselves, we'll let SF
@@ -358,6 +360,16 @@ static int hwc_prepare(hwc_composer_device_1_t *dev, size_t num_displays,
hwc_layer_1_t *layer = &display_contents[i]->hwLayers[j];
if (!use_framebuffer_target && !hwc_skip_layer(skip_layer_indices, j)) {
+ // If the layer is off the screen, don't earmark it for an overlay.
+ // We'll leave it as-is, which effectively just drops it from the frame
+ const hwc_rect_t *frame = &layer->displayFrame;
+ if ((frame->right - frame->left) <= 0 ||
+ (frame->bottom - frame->top) <= 0 ||
+ frame->right <= 0 || frame->bottom <= 0 ||
+ frame->left >= (int)mode.h_display() ||
+ frame->top >= (int)mode.v_display())
+ continue;
+
if (layer->compositionType == HWC_FRAMEBUFFER)
layer->compositionType = HWC_OVERLAY;
} else {