display : change wormhole calculation for swap rect
In case of swap rect use case ,wormhole rect will be same as dirty rect (if has any blending) Change-Id: Id2ee34d860207c440a033010460723fe964f7074
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
#include "comptype.h"
|
#include "comptype.h"
|
||||||
#include "gr.h"
|
#include "gr.h"
|
||||||
#include "cb_utils.h"
|
#include "cb_utils.h"
|
||||||
|
#include "cb_swap_rect.h"
|
||||||
using namespace qdutils;
|
using namespace qdutils;
|
||||||
namespace qhwc {
|
namespace qhwc {
|
||||||
|
|
||||||
@@ -303,6 +303,9 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
|
|||||||
ALOGD_IF(DEBUG_COPYBIT, "%s: Not Marked for copybit", __FUNCTION__);
|
ALOGD_IF(DEBUG_COPYBIT, "%s: Not Marked for copybit", __FUNCTION__);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if(layer->flags & HWC_SKIP_HWC_COMPOSITION){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
if (list->hwLayers[i].acquireFenceFd != -1
|
if (list->hwLayers[i].acquireFenceFd != -1
|
||||||
&& ctx->mMDP.version >= qdutils::MDP_V4_0) {
|
&& ctx->mMDP.version >= qdutils::MDP_V4_0) {
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ LOCAL_COPY_HEADERS := display_config.h mdp_version.h
|
|||||||
LOCAL_SRC_FILES := profiler.cpp mdp_version.cpp \
|
LOCAL_SRC_FILES := profiler.cpp mdp_version.cpp \
|
||||||
idle_invalidator.cpp \
|
idle_invalidator.cpp \
|
||||||
comptype.cpp qd_utils.cpp \
|
comptype.cpp qd_utils.cpp \
|
||||||
cb_utils.cpp display_config.cpp
|
cb_utils.cpp display_config.cpp \
|
||||||
|
cb_swap_rect.cpp
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|||||||
46
libqdutils/cb_swap_rect.cpp
Normal file
46
libqdutils/cb_swap_rect.cpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014, The Linux Foundation. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation or the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cb_swap_rect.h"
|
||||||
|
|
||||||
|
ANDROID_SINGLETON_STATIC_INSTANCE(qdutils::cb_swap_rect);
|
||||||
|
|
||||||
|
namespace qdutils {
|
||||||
|
|
||||||
|
cb_swap_rect:: cb_swap_rect(){
|
||||||
|
swap_rect_feature_on = false ;
|
||||||
|
}
|
||||||
|
void cb_swap_rect::setSwapRectFeature_on( bool value){
|
||||||
|
swap_rect_feature_on = value ;
|
||||||
|
}
|
||||||
|
bool cb_swap_rect::checkSwapRectFeature_on(){
|
||||||
|
return swap_rect_feature_on;
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
51
libqdutils/cb_swap_rect.h
Normal file
51
libqdutils/cb_swap_rect.h
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* * modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
* * Redistributions of source code must retain the above copyrigh
|
||||||
|
* notice, this list of conditions and the following disclaimer
|
||||||
|
* * Redistributions in binary form must reproduce the above
|
||||||
|
* copyright notice, this list of conditions and the following
|
||||||
|
* disclaimer in the documentation and/or other materials provided
|
||||||
|
* with the distribution.
|
||||||
|
* * Neither the name of The Linux Foundation nor the names of its
|
||||||
|
* contributors may be used to endorse or promote products derived
|
||||||
|
* from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||||
|
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||||
|
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CB_SWAP_RECT
|
||||||
|
#define CB_SWAP_RECT
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <utils/Singleton.h>
|
||||||
|
#include <cutils/log.h>
|
||||||
|
|
||||||
|
using namespace android;
|
||||||
|
namespace qdutils {
|
||||||
|
enum {
|
||||||
|
HWC_SKIP_HWC_COMPOSITION = 0x00040000,
|
||||||
|
};
|
||||||
|
|
||||||
|
class cb_swap_rect : public Singleton <cb_swap_rect>
|
||||||
|
{
|
||||||
|
bool swap_rect_feature_on;
|
||||||
|
public :
|
||||||
|
cb_swap_rect();
|
||||||
|
void setSwapRectFeature_on( bool value);
|
||||||
|
bool checkSwapRectFeature_on();
|
||||||
|
};
|
||||||
|
} // namespace qdutils
|
||||||
|
#endif
|
||||||
@@ -26,9 +26,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cb_utils.h"
|
#include "cb_utils.h"
|
||||||
|
#include "cb_swap_rect.h"
|
||||||
/* get union of two rects into 3rd rect */
|
/* get union of two rects into 3rd rect */
|
||||||
void getUnion(hwc_rect_t& rect1,hwc_rect_t& rect2, hwc_rect_t& irect) {
|
void getUnion(hwc_rect_t& rect1,hwc_rect_t& rect2, hwc_rect_t& irect) {
|
||||||
|
|
||||||
irect.left = min(rect1.left, rect2.left);
|
irect.left = min(rect1.left, rect2.left);
|
||||||
irect.top = min(rect1.top, rect2.top);
|
irect.top = min(rect1.top, rect2.top);
|
||||||
irect.right = max(rect1.right, rect2.right);
|
irect.right = max(rect1.right, rect2.right);
|
||||||
@@ -44,11 +45,23 @@ int CBUtils::getuiClearRegion(hwc_display_contents_1_t* list,
|
|||||||
|
|
||||||
uint32_t last = list->numHwLayers - 1;
|
uint32_t last = list->numHwLayers - 1;
|
||||||
hwc_rect_t fbFrame = list->hwLayers[last].displayFrame;
|
hwc_rect_t fbFrame = list->hwLayers[last].displayFrame;
|
||||||
|
|
||||||
Rect fbFrameRect(fbFrame.left,fbFrame.top,fbFrame.right,fbFrame.bottom);
|
Rect fbFrameRect(fbFrame.left,fbFrame.top,fbFrame.right,fbFrame.bottom);
|
||||||
Region wormholeRegion(fbFrameRect);
|
Region wormholeRegion(fbFrameRect);
|
||||||
|
|
||||||
for (uint32_t i = 0 ; i < last; i++) {
|
if(cb_swap_rect::getInstance().checkSwapRectFeature_on() == true){
|
||||||
|
wormholeRegion.set(0,0);
|
||||||
|
for(uint32_t i = 0 ; i < last; i++) {
|
||||||
|
if((list->hwLayers[i].blending == HWC_BLENDING_NONE) ||
|
||||||
|
!(layerProp[i].mFlags & HWC_COPYBIT) ||
|
||||||
|
(list->hwLayers[i].flags & HWC_SKIP_HWC_COMPOSITION))
|
||||||
|
continue ;
|
||||||
|
hwc_rect_t displayFrame = list->hwLayers[i].displayFrame;
|
||||||
|
Rect tmpRect(displayFrame.left,displayFrame.top,
|
||||||
|
displayFrame.right,displayFrame.bottom);
|
||||||
|
wormholeRegion.set(tmpRect);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for (uint32_t i = 0 ; i < last; i++) {
|
||||||
// need to take care only in per pixel blending.
|
// need to take care only in per pixel blending.
|
||||||
// Restrict calculation only for copybit layers.
|
// Restrict calculation only for copybit layers.
|
||||||
if((list->hwLayers[i].blending != HWC_BLENDING_NONE) ||
|
if((list->hwLayers[i].blending != HWC_BLENDING_NONE) ||
|
||||||
@@ -59,21 +72,27 @@ int CBUtils::getuiClearRegion(hwc_display_contents_1_t* list,
|
|||||||
displayFrame.bottom);
|
displayFrame.bottom);
|
||||||
Region tmpRegion(tmpRect);
|
Region tmpRegion(tmpRect);
|
||||||
wormholeRegion.subtractSelf(wormholeRegion.intersect(tmpRegion));
|
wormholeRegion.subtractSelf(wormholeRegion.intersect(tmpRegion));
|
||||||
}
|
}
|
||||||
if (wormholeRegion.isEmpty()) {
|
}
|
||||||
|
if(wormholeRegion.isEmpty()){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//TO DO :- 1. remove union and call clear for each rect.
|
//TO DO :- 1. remove union and call clear for each rect.
|
||||||
// :- 2. support swap ract feature.
|
Region::const_iterator it = wormholeRegion.begin();
|
||||||
Region::const_iterator it = wormholeRegion.begin();
|
Region::const_iterator const end = wormholeRegion.end();
|
||||||
Region::const_iterator const end = wormholeRegion.end();
|
while (it != end) {
|
||||||
while (it != end) {
|
const Rect& r = *it++;
|
||||||
const Rect& r = *it++;
|
hwc_rect_t tmpWormRect = {r.left,r.top,r.right,r.bottom};
|
||||||
hwc_rect_t tmpWormRect = {r.left,r.top,r.right,r.bottom};
|
int dst_w = clearWormholeRect.right - clearWormholeRect.left;
|
||||||
getUnion(clearWormholeRect, tmpWormRect, clearWormholeRect);
|
int dst_h = clearWormholeRect.bottom - clearWormholeRect.top;
|
||||||
|
|
||||||
}
|
if (!(dst_w || dst_h))
|
||||||
return 1;
|
clearWormholeRect = tmpWormRect;
|
||||||
|
else
|
||||||
|
getUnion(clearWormholeRect, tmpWormRect, clearWormholeRect);
|
||||||
|
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}//namespace qdutils
|
}//namespace qdutils
|
||||||
|
|||||||
Reference in New Issue
Block a user