hwc: Add support for copybit(C2D) composition
- Add CopybitEngine to hwc_context
- draw the layer on the HWC_FRAMEBUFFER_TARGET using
copybit(c2d) if it qualifies for C2D composition.
- use fence returned from the copybit during c2d
composition
Change-Id: I052da015cd031f7abd6411d83d7944c335caeff7
diff --git a/libhwcomposer/hwc_uevents.cpp b/libhwcomposer/hwc_uevents.cpp
index 334df26..6b8f4e3 100644
--- a/libhwcomposer/hwc_uevents.cpp
+++ b/libhwcomposer/hwc_uevents.cpp
@@ -27,6 +27,8 @@
#include <stdlib.h>
#include "hwc_utils.h"
#include "hwc_fbupdate.h"
+#include "hwc_copybit.h"
+#include "comptype.h"
#include "external.h"
namespace qhwc {
@@ -38,6 +40,16 @@
int vsync = 0;
int64_t timestamp = 0;
const char *str = udata;
+ bool usecopybit = false;
+ int compositionType =
+ qdutils::QCCompositionType::getInstance().getCompositionType();
+
+ if (compositionType & (qdutils::COMPOSITION_TYPE_DYN |
+ qdutils::COMPOSITION_TYPE_MDP |
+ qdutils::COMPOSITION_TYPE_C2D)) {
+ usecopybit = true;
+
+ }
if(!strcasestr("change@/devices/virtual/switch/hdmi", str) &&
!strcasestr("change@/devices/virtual/switch/wfd", str)) {
@@ -72,6 +84,8 @@
ctx->mFBUpdate[HWC_DISPLAY_EXTERNAL] =
IFBUpdate::getObject(ctx->dpyAttr[HWC_DISPLAY_EXTERNAL].xres,
HWC_DISPLAY_EXTERNAL);
+ if(usecopybit)
+ ctx->mCopyBit[HWC_DISPLAY_EXTERNAL] = new CopyBit();
} else {
ctx->mExtDisplay->processUEventOffline(udata);
if(ctx->mFBUpdate[HWC_DISPLAY_EXTERNAL]) {
@@ -79,6 +93,11 @@
delete ctx->mFBUpdate[HWC_DISPLAY_EXTERNAL];
ctx->mFBUpdate[HWC_DISPLAY_EXTERNAL] = NULL;
}
+ if(ctx->mCopyBit[HWC_DISPLAY_EXTERNAL]){
+ Locker::Autolock _l(ctx->mExtSetLock);
+ delete ctx->mCopyBit[HWC_DISPLAY_EXTERNAL];
+ ctx->mCopyBit[HWC_DISPLAY_EXTERNAL] = NULL;
+ }
}
ALOGD("%s sending hotplug: connected = %d", __FUNCTION__, connected);
Locker::Autolock _l(ctx->mExtSetLock); //hwc comp could be on