summaryrefslogtreecommitdiff
authorStark Li <stark.li@amlogic.com>2017-02-23 10:35:53 (GMT)
committer Stark Li <stark.li@amlogic.com>2017-03-03 06:28:14 (GMT)
commit0bdb136ad905d4a7c0586fdf82f2eca5440a44ec (patch)
tree1ca087395f11f1d710372dc9c06f8cd24eed5fe2
parentf71f6c3b23ca91745aef93a0bb242362f070a298 (diff)
downloadhwcomposer-0bdb136ad905d4a7c0586fdf82f2eca5440a44ec.zip
hwcomposer-0bdb136ad905d4a7c0586fdf82f2eca5440a44ec.tar.gz
hwcomposer-0bdb136ad905d4a7c0586fdf82f2eca5440a44ec.tar.bz2
PD#139798: for android.leanbackjank.cts.CtsDeviceLeanback#testScrollingByTimer
Change-Id: Ifb1ab48ffd8bffdfb557e4f194fc47e714813e99
Diffstat
-rw-r--r--hwc2/common/composers/GE2DComposer.cpp28
-rw-r--r--hwc2/common/composers/GE2DComposer.h2
-rw-r--r--hwc2/common/devices/PhysicalDevice.cpp77
-rw-r--r--hwc2/include/IDisplayDevice.h10
-rw-r--r--hwc2/include/PhysicalDevice.h1
-rw-r--r--hwc2/platforms/Android.mk1
6 files changed, 74 insertions, 45 deletions
diff --git a/hwc2/common/composers/GE2DComposer.cpp b/hwc2/common/composers/GE2DComposer.cpp
index 2928194..bbe2f41 100644
--- a/hwc2/common/composers/GE2DComposer.cpp
+++ b/hwc2/common/composers/GE2DComposer.cpp
@@ -56,9 +56,9 @@ int32_t GE2DComposer::allocBuffer(private_module_t* module, size_t size, int32_t
int32_t ion_flags = 0;
int32_t lock_state = 0;
- if (usage & GRALLOC_USAGE_AML_DMA_BUFFER)
+ if (usage & GRALLOC_USAGE_HW_COMPOSER)
{
- ret = ion_alloc(module->ion_client, size, 0, ION_HEAP_CARVEOUT_MASK,
+ ret = ion_alloc(module->ion_client, size, 0, 1<<ION_HEAP_TYPE_CHUNK,
ion_flags, &ion_hnd);
}
@@ -168,7 +168,7 @@ bool GE2DComposer::initialize(framebuffer_info_t* fbInfo)
mNumBuffers = fbInfo->fbSize / mSingleFbSize;
if (!mGe2dBufHnd) {
- int32_t usage = GRALLOC_USAGE_AML_DMA_BUFFER;
+ int32_t usage = GRALLOC_USAGE_HW_COMPOSER;
int32_t ret = allocBuffer(mFbInfo->grallocModule, mFbInfo->fbSize, usage, &mGe2dBufHnd);
if (ret < 0) {
ETRACE("allocBuffer failed!");
@@ -477,11 +477,11 @@ void GE2DComposer::dumpLayers(
void GE2DComposer::runGE2DProcess(int32_t slot, Vector< LayerState* > &hwcLayersState)
{
bool sameSize = false;
- hwc_frect_t sourceCrop[GE2D_COMPOSE_MAX_LAYERS];
- const LayerState* layer[GE2D_COMPOSE_MAX_LAYERS] = { NULL, NULL, NULL };
- private_handle_t const* hnd[GE2D_COMPOSE_MAX_LAYERS] = { NULL, NULL, NULL };
+ hwc_frect_t sourceCrop[HWC2_MAX_LAYERS];
+ const LayerState* layer[HWC2_MAX_LAYERS] = { NULL };
+ private_handle_t const* hnd[HWC2_MAX_LAYERS] = { NULL };
uint32_t layerNum = hwcLayersState.size();
- hwc_rect_t displayFrame[GE2D_COMPOSE_MAX_LAYERS];
+ hwc_rect_t displayFrame[HWC2_MAX_LAYERS];
for (int32_t i=0; i<layerNum; i++) {
layer[i] = hwcLayersState.itemAt(i);
@@ -497,7 +497,7 @@ void GE2DComposer::runGE2DProcess(int32_t slot, Vector< LayerState* > &hwcLayers
bool debugSameSize = Utils::checkBoolProp("sys.sf.debug.ss");
// TODO:2 same size layers case.
- if (!debugSameSize && layerNum > GE2D_COMPOSE_ONE_LAYER) {
+ if (!debugSameSize && layerNum > HWC2_ONE_LAYER) {
if (Utils::compareRect(sourceCrop[0], sourceCrop[1])
&& Utils::compareRect(sourceCrop[0], displayFrame[0])
&& Utils::compareRect(sourceCrop[1], displayFrame[1])) {
@@ -508,15 +508,15 @@ void GE2DComposer::runGE2DProcess(int32_t slot, Vector< LayerState* > &hwcLayers
}
}
- if ((layerNum == GE2D_COMPOSE_TWO_LAYERS && !hnd[1])
- || (layerNum == GE2D_COMPOSE_MAX_LAYERS && (!hnd[1] || !hnd[2]))) {
+ if ((layerNum == HWC2_TWO_LAYERS && !hnd[1])
+ || (layerNum == HWC2_MAX_LAYERS && (!hnd[1] || !hnd[2]))) {
ETRACE("%d layers compose, hnd should not be null", layerNum);
return;
}
mSrcBufferInfo->offset = 0;
if (sameSize) {
- for (int32_t i=0; i<GE2D_COMPOSE_TWO_LAYERS; i++) {
+ for (int32_t i=0; i<HWC2_TWO_LAYERS; i++) {
mSrcBufferInfo->src_info[i].offset = 0;
mSrcBufferInfo->src_info[i].shared_fd = hnd[i]->share_fd;
mSrcBufferInfo->src_info[i].format = hnd[i]->format;
@@ -555,13 +555,13 @@ void GE2DComposer::runGE2DProcess(int32_t slot, Vector< LayerState* > &hwcLayers
tracer();
}
- if (layerNum == GE2D_COMPOSE_TWO_LAYERS) return;
+ if (layerNum == HWC2_TWO_LAYERS) return;
}
int32_t beginWith = 0;
if (sameSize) {
- if (layerNum == GE2D_COMPOSE_THREE_LAYERS) {
- beginWith = GE2D_COMPOSE_THREE_LAYERS -1;
+ if (layerNum == HWC2_THREE_LAYERS) {
+ beginWith = HWC2_THREE_LAYERS -1;
}
}
diff --git a/hwc2/common/composers/GE2DComposer.h b/hwc2/common/composers/GE2DComposer.h
index 7ef6cf7..22d2f35 100644
--- a/hwc2/common/composers/GE2DComposer.h
+++ b/hwc2/common/composers/GE2DComposer.h
@@ -74,7 +74,7 @@ public:
mVideoLayerId(0),
mClearBuffer(false),
mLayersState() {
- mLayersState.setCapacity(GE2D_COMPOSE_MAX_LAYERS);
+ mLayersState.setCapacity(HWC2_MAX_LAYERS);
mLayersState.clear();
}
diff --git a/hwc2/common/devices/PhysicalDevice.cpp b/hwc2/common/devices/PhysicalDevice.cpp
index 8ce0491..1380f2f 100644
--- a/hwc2/common/devices/PhysicalDevice.cpp
+++ b/hwc2/common/devices/PhysicalDevice.cpp
@@ -54,6 +54,7 @@ PhysicalDevice::PhysicalDevice(hwc2_display_t id, Hwcomposer& hwc, DeviceControl
mVideoOverlayLayerId(0),
mGE2DClearVideoRegionCount(0),
mGE2DComposeFrameCount(0),
+ mDirectComposeFrameCount(0),
mInitialized(false)
{
CTRACE();
@@ -89,7 +90,7 @@ PhysicalDevice::PhysicalDevice(hwc2_display_t id, Hwcomposer& hwc, DeviceControl
mHwcGlesLayers.clear();
mHwcLayers.clear();
- mGE2DRenderSortedLayerIds.setCapacity(GE2D_COMPOSE_MAX_LAYERS);
+ mGE2DRenderSortedLayerIds.setCapacity(HWC2_MAX_LAYERS);
mGE2DRenderSortedLayerIds.clear();
mHwcCurReleaseFences = mHwcPriorReleaseFences = NULL;
@@ -598,15 +599,16 @@ void PhysicalDevice::directCompose(framebuffer_info_t * fbInfo) {
DTRACE("Hit only one non video overlay layer, handle: %08" PRIxPTR ", fence: %d",
intptr_t(mClientTargetHnd), mTargetAcquireFence);
- hwc_rect_t displayframe = layer->getDisplayFrame();
+ /* hwc_rect_t displayframe = layer->getDisplayFrame();
fbInfo->info.xoffset = displayframe.left;
- fbInfo->info.yoffset = displayframe.top;
+ fbInfo->info.yoffset = displayframe.top; */
return;
}
ETRACE("Didn't find direct compose layer!");
}
+#ifdef ENABLE_AML_GE2D_COMPOSER
void PhysicalDevice::ge2dCompose(framebuffer_info_t * fbInfo, bool hasVideoOverlay) {
if (mGE2DRenderSortedLayerIds.size() > 0) {
DTRACE("GE2D compose mFbSlot: %d", mFbSlot);
@@ -635,6 +637,7 @@ void PhysicalDevice::ge2dCompose(framebuffer_info_t * fbInfo, bool hasVideoOverl
ETRACE("Didn't find ge2d compose layers!");
}
+#endif
int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence, bool hasVideoOverlay) {
HwcLayer* layer = NULL;
@@ -680,9 +683,12 @@ int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence, bool hasVideoOv
}*/
} else if (mRenderMode == DIRECT_COMPOSE_MODE) { // if only one layer exists, let hwc do her work.
directCompose(&fbInfo);
- } else if (mRenderMode == GE2D_COMPOSE_MODE) {
+ }
+#ifdef ENABLE_AML_GE2D_COMPOSER
+ else if (mRenderMode == GE2D_COMPOSE_MODE) {
ge2dCompose(&fbInfo, hasVideoOverlay);
}
+#endif
fbInfo.renderMode = mRenderMode;
if (hasVideoOverlay && mHwcLayers.size() == 1) {
@@ -731,7 +737,7 @@ int32_t PhysicalDevice::postFramebuffer(int32_t* outRetireFence, bool hasVideoOv
if (mRenderMode == GE2D_COMPOSE_MODE) {
mComposer->mergeRetireFence(mFbSlot, HwcFenceControl::dupFence(mPriorFrameRetireFence));
} else {
- if (mGE2DComposeFrameCount != 0) {
+ if (mComposer && mGE2DComposeFrameCount != 0) {
mComposer->removeRetireFence(mFbSlot);
}
@@ -911,10 +917,10 @@ bool PhysicalDevice::layersStateCheck(int32_t renderMode,
KeyedVector<hwc2_layer_t, HwcLayer*> & composeLayers) {
bool ret = false;
uint32_t layerNum = composeLayers.size();
- hwc_frect_t sourceCrop[GE2D_COMPOSE_MAX_LAYERS];
- HwcLayer* layer[GE2D_COMPOSE_MAX_LAYERS] = { NULL, NULL, NULL };
- private_handle_t const* hnd[GE2D_COMPOSE_MAX_LAYERS] = { NULL, NULL, NULL };
- hwc_rect_t displayFrame[GE2D_COMPOSE_MAX_LAYERS];
+ hwc_frect_t sourceCrop[HWC2_MAX_LAYERS];
+ HwcLayer* layer[HWC2_MAX_LAYERS] = { NULL };
+ private_handle_t const* hnd[HWC2_MAX_LAYERS] = { NULL };
+ hwc_rect_t displayFrame[HWC2_MAX_LAYERS];
for (int32_t i=0; i<layerNum; i++) {
layer[i] = composeLayers.valueAt(i);
@@ -951,7 +957,9 @@ bool PhysicalDevice::layersStateCheck(int32_t renderMode,
DTRACE("direct compose can not process!");
return false;
}
- }else if (renderMode == GE2D_COMPOSE_MODE) {
+ }
+#ifdef ENABLE_AML_GE2D_COMPOSER
+ else if (renderMode == GE2D_COMPOSE_MODE) {
bool yuv420Sp = false;
for (int32_t i=0; i<layerNum; i++) {
switch (hnd[i]->format) {
@@ -984,7 +992,7 @@ bool PhysicalDevice::layersStateCheck(int32_t renderMode,
}
}
#if 0
- if (yuv420Sp && GE2D_COMPOSE_TWO_LAYERS == layerNum) {
+ if (yuv420Sp && HWC2_TWO_LAYERS == layerNum) {
if (Utils::compareRect(sourceCrop[0], sourceCrop[1])
&& Utils::compareRect(sourceCrop[0], displayFrame[0])
&& Utils::compareRect(sourceCrop[1], displayFrame[1])) {
@@ -994,6 +1002,7 @@ bool PhysicalDevice::layersStateCheck(int32_t renderMode,
}
#endif
}
+#endif
return ret;
}
@@ -1014,20 +1023,25 @@ int32_t PhysicalDevice::composersFilter(
KeyedVector<hwc2_layer_t, HwcLayer*> & composeLayers) {
// direct Composer.
- if (composeLayers.size() == GE2D_COMPOSE_ONE_LAYER) {
+ if (composeLayers.size() == HWC2_ONE_LAYER) {
// if only one layer exists, do direct framebuffer composer.
bool directCompose = layersStateCheck(DIRECT_COMPOSE_MODE, composeLayers);
if (directCompose) {
- hwc2_layer_t layerGlesLayerId = composeLayers.keyAt(0);
- composeLayers.clear();
- mDirectRenderLayerId = layerGlesLayerId;
- return DIRECT_COMPOSE_MODE;
+ if (mDirectComposeFrameCount >= 3) {
+ hwc2_layer_t layerGlesLayerId = composeLayers.keyAt(0);
+ composeLayers.clear();
+ mDirectRenderLayerId = layerGlesLayerId;
+ return DIRECT_COMPOSE_MODE;
+ }
+ mDirectComposeFrameCount++;
+ return GLES_COMPOSE_MODE;
}
}
+#ifdef ENABLE_AML_GE2D_COMPOSER
// if direct composer can't work, try this.
- if (composeLayers.size() > GE2D_COMPOSE_NO_LAYER
- && composeLayers.size() < GE2D_COMPOSE_MAX_LAYERS) {
+ if (composeLayers.size() > HWC2_NO_LAYER
+ && composeLayers.size() < HWC2_MAX_LAYERS) {
bool ge2dCompose = layersStateCheck(GE2D_COMPOSE_MODE, composeLayers);
if (!ge2dCompose) return GLES_COMPOSE_MODE;
mGE2DRenderSortedLayerIds.clear();
@@ -1067,6 +1081,7 @@ int32_t PhysicalDevice::composersFilter(
composeLayers.clear();
return GE2D_COMPOSE_MODE;
}
+#endif
return GLES_COMPOSE_MODE;
}
@@ -1089,6 +1104,7 @@ int32_t PhysicalDevice::validateDisplay(uint32_t* outNumTypes,
HwcLayer* layer = NULL;
bool istvp = false;
bool glesCompose = false;
+ bool zeroLayer = false;
mRenderMode = GLES_COMPOSE_MODE;
mVideoOverlayLayerId = 0;
@@ -1104,11 +1120,11 @@ int32_t PhysicalDevice::validateDisplay(uint32_t* outNumTypes,
reinterpret_cast<private_handle_t const*>(layer->getBufferHandle());
if (hnd) {
// continous buffer.
- if (!(hnd->flags & private_handle_t::PRIV_FLAGS_CONTINUOUS_BUF)) {
- DTRACE("continous buffer flag is not set!");
+ if (!(hnd->flags & private_handle_t::PRIV_FLAGS_CONTINUOUS_BUF
+ || hnd->flags & private_handle_t::PRIV_FLAGS_VIDEO_OVERLAY)) {
+ DTRACE("continous buffer flag is not set, bufhnd: 0x%" PRIxPTR "", intptr_t(layer->getBufferHandle()));
mIsContinuousBuf = false;
}
-
#ifdef GRALLOC_ENABLE_SECURE_LAYER
// secure or protected layer.
if (!mSecure && (hnd->flags & private_handle_t::PRIV_FLAGS_SECURE_PROTECTED)) {
@@ -1120,14 +1136,14 @@ int32_t PhysicalDevice::validateDisplay(uint32_t* outNumTypes,
continue;
}
#endif
- if (hnd && layer->getCompositionType() == HWC2_COMPOSITION_DEVICE) {
+ if (layer->getCompositionType() == HWC2_COMPOSITION_DEVICE) {
// video overlay.
if (hnd->flags & private_handle_t::PRIV_FLAGS_VIDEO_OMX) {
set_omx_pts((char*)hnd->base, &Amvideo_Handle);
istvp = true;
}
if (hnd->flags & private_handle_t::PRIV_FLAGS_VIDEO_OVERLAY) {
- ETRACE("PRIV_FLAGS_VIDEO_OVERLAY!!!!");
+ DTRACE("PRIV_FLAGS_VIDEO_OVERLAY!!!!");
mVideoOverlayLayerId = layerId;
mHwcLayersChangeRequest.add(layerId, layer);
continue;
@@ -1178,12 +1194,19 @@ int32_t PhysicalDevice::validateDisplay(uint32_t* outNumTypes,
noDevComp = true;
#endif
+ if (mHwcLayers.size() == 0) {
+ zeroLayer = true;
+ mIsContinuousBuf = false;
+ }
+
// dumpLayers(mHwcLayers);
if (mIsContinuousBuf && !glesCompose && !noDevComp) {
mRenderMode = composersFilter(mHwcGlesLayers);
+ } else {
+ mDirectComposeFrameCount = 0;
}
- if (mHwcLayers.size() == 0 && mComposer) {
+ if (mComposer && zeroLayer) {
clearFramebuffer();
}
@@ -1205,7 +1228,11 @@ int32_t PhysicalDevice::validateDisplay(uint32_t* outNumTypes,
}
// mark the validate function is called.(???)
- mIsValidated = true;
+ if (zeroLayer) {
+ mIsValidated = false;
+ } else {
+ mIsValidated = true;
+ }
if (mHwcLayersChangeType.size() > 0) {
DTRACE("there are %d layer types has changed.", mHwcLayersChangeType.size());
diff --git a/hwc2/include/IDisplayDevice.h b/hwc2/include/IDisplayDevice.h
index 5de0000..7395b4a 100644
--- a/hwc2/include/IDisplayDevice.h
+++ b/hwc2/include/IDisplayDevice.h
@@ -36,11 +36,11 @@ enum {
};
enum {
- GE2D_COMPOSE_NO_LAYER = 0,
- GE2D_COMPOSE_ONE_LAYER = 1,
- GE2D_COMPOSE_TWO_LAYERS = 2,
- GE2D_COMPOSE_THREE_LAYERS = 3,
- GE2D_COMPOSE_MAX_LAYERS = GE2D_COMPOSE_THREE_LAYERS,
+ HWC2_NO_LAYER = 0,
+ HWC2_ONE_LAYER = 1,
+ HWC2_TWO_LAYERS = 2,
+ HWC2_THREE_LAYERS = 3,
+ HWC2_MAX_LAYERS = HWC2_THREE_LAYERS,
};
diff --git a/hwc2/include/PhysicalDevice.h b/hwc2/include/PhysicalDevice.h
index 9657c0a..8478abc 100644
--- a/hwc2/include/PhysicalDevice.h
+++ b/hwc2/include/PhysicalDevice.h
@@ -215,6 +215,7 @@ private:
hwc_region_t mClientTargetDamageRegion;
int32_t mTargetAcquireFence;
int32_t mGE2DComposeFrameCount;
+ int32_t mDirectComposeFrameCount;
int32_t mPriorFrameRetireFence;
int32_t mRenderMode;
bool mIsValidated;
diff --git a/hwc2/platforms/Android.mk b/hwc2/platforms/Android.mk
index 23eb276..079f7ac 100644
--- a/hwc2/platforms/Android.mk
+++ b/hwc2/platforms/Android.mk
@@ -92,6 +92,7 @@ LOCAL_C_INCLUDES += system/core/libion/include/ \
ifeq ($(TARGET_APP_LAYER_USE_CONTINUOUS_BUFFER),true)
LOCAL_CFLAGS += -DUSE_CONTINOUS_BUFFER_COMPOSER
+# LOCAL_CFLAGS += -DENABLE_AML_GE2D_COMPOSER
endif
ifeq ($(TARGET_SUPPORT_SECURE_LAYER),true)