Skip to content

Commit

Permalink
hwc: Map dirtyRect to layer destination before using.
Browse files Browse the repository at this point in the history
DirtyRect for a layer is generated w.r.t to its buffer
coordinates. It needs to be mapped for layer destination
(display) coordinates before using it to calculate the frame's
ROI.

Change-Id: Id86f495b2016da2cfd5aed4d86bff6d3035abf10
  • Loading branch information
Jeykumar Sankaran authored and Simon Wilson committed Jan 9, 2015
1 parent 514cb6b commit 5bbc98f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
10 changes: 8 additions & 2 deletions msm8226/libhwcomposer/hwc_mdpcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,17 @@ void MDPCompSplit::generateROI(hwc_context_t *ctx,
hwc_layer_1_t* layer = &list->hwLayers[index];
if ((mCachedFrame.hnd[index] != layer->handle) ||
isYuvBuffer((private_handle_t *)layer->handle)) {
hwc_rect_t updatingRect = layer->displayFrame;
hwc_rect_t dst = layer->displayFrame;
hwc_rect_t updatingRect = dst;

#ifdef QCOM_BSP
if(!needsScaling(layer) && !layer->transform)
updatingRect = layer->dirtyRect;
{
hwc_rect_t src = integerizeSourceCrop(layer->sourceCropf);
int x_off = dst.left - src.left;
int y_off = dst.top - src.top;
updatingRect = moveRect(layer->dirtyRect, x_off, y_off);
}
#endif

hwc_rect_t l_dst = getIntersection(l_frame, updatingRect);
Expand Down
15 changes: 15 additions & 0 deletions msm8226/libhwcomposer/hwc_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,21 @@ bool operator ==(const hwc_rect_t& lhs, const hwc_rect_t& rhs) {
return false;
}

hwc_rect_t moveRect(const hwc_rect_t& rect, const int& x_off, const int& y_off)
{
hwc_rect_t res;

if(!isValidRect(rect))
return (hwc_rect_t){0, 0, 0, 0};

res.left = rect.left + x_off;
res.top = rect.top + y_off;
res.right = rect.right + x_off;
res.bottom = rect.bottom + y_off;

return res;
}

/* computes the intersection of two rects */
hwc_rect_t getIntersection(const hwc_rect_t& rect1, const hwc_rect_t& rect2)
{
Expand Down
1 change: 1 addition & 0 deletions msm8226/libhwcomposer/hwc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ int getExtOrientation(hwc_context_t* ctx);
bool isValidRect(const hwc_rect_t& rect);
hwc_rect_t deductRect(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
bool isSameRect(const hwc_rect& rect1, const hwc_rect& rect2);
hwc_rect_t moveRect(const hwc_rect_t& rect, const int& x_off, const int& y_off);
hwc_rect_t getIntersection(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
hwc_rect_t getUnion(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
void optimizeLayerRects(const hwc_display_contents_1_t *list);
Expand Down

0 comments on commit 5bbc98f

Please sign in to comment.