hwc: Update to new API
* Updates HWC to use the Jellybean MR1 API
* Remove qcom_ui which was using parts of the old API
Change-Id: I663363547b193d2318aae88f2256a9baed1e3d4b
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index db6597d..c132f16 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -61,7 +61,7 @@
/*
* Save callback functions registered to HWC
*/
-static void hwc_registerProcs(struct hwc_composer_device* dev,
+static void hwc_registerProcs(struct hwc_composer_device_1* dev,
hwc_procs_t const* procs)
{
hwc_context_t* ctx = (hwc_context_t*)(dev);
@@ -72,7 +72,8 @@
ctx->device.reserved_proc[0] = (void*)procs;
}
-static int hwc_prepare(hwc_composer_device_t *dev, hwc_layer_list_t* list)
+static int hwc_prepare(hwc_composer_device_1 *dev, size_t numDisplays,
+ hwc_display_contents_1_t** displays)
{
hwc_context_t* ctx = (hwc_context_t*)(dev);
ctx->overlayInUse = false;
@@ -81,40 +82,46 @@
ctx->qbuf->unlockAllPrevious();
return 0;
- if (LIKELY(list)) {
- //reset for this draw round
- VideoOverlay::reset();
- ExtOnly::reset();
+ for (uint32_t i = 0; i <numDisplays; i++) {
+ hwc_display_contents_1_t* list = displays[i];
+ ctx->dpys[i] = list->dpy;
+ //XXX: Actually handle the multiple displays
+ if (LIKELY(list)) {
+ //reset for this draw round
+ VideoOverlay::reset();
+ ExtOnly::reset();
- getLayerStats(ctx, list);
- if(VideoOverlay::prepare(ctx, list)) {
- ctx->overlayInUse = true;
- //Nothing here
- } else if(ExtOnly::prepare(ctx, list)) {
- ctx->overlayInUse = true;
- } else if(UIMirrorOverlay::prepare(ctx, list)) {
- ctx->overlayInUse = true;
- } else if(MDPComp::configure(dev, list)) {
- ctx->overlayInUse = true;
- } else if (0) {
- //Other features
- ctx->overlayInUse = true;
- } else { // Else set this flag to false, otherwise video cases
- // fail in non-overlay targets.
- ctx->overlayInUse = false;
+ getLayerStats(ctx, list);
+ if(VideoOverlay::prepare(ctx, list)) {
+ ctx->overlayInUse = true;
+ //Nothing here
+ } else if(ExtOnly::prepare(ctx, list)) {
+ ctx->overlayInUse = true;
+ } else if(UIMirrorOverlay::prepare(ctx, list)) {
+ ctx->overlayInUse = true;
+ } else if(MDPComp::configure(dev, list)) {
+ ctx->overlayInUse = true;
+ } else if (0) {
+ //Other features
+ ctx->overlayInUse = true;
+ } else { // Else set this flag to false, otherwise video cases
+ // fail in non-overlay targets.
+ ctx->overlayInUse = false;
+ }
}
}
return 0;
}
-static int hwc_eventControl(struct hwc_composer_device* dev,
+static int hwc_eventControl(struct hwc_composer_device_1* dev, int dpy,
int event, int enabled)
{
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
private_module_t* m = reinterpret_cast<private_module_t*>(
ctx->mFbDev->common.module);
+ //XXX: Handle dpy
switch(event) {
case HWC_EVENT_VSYNC:
if(ioctl(m->framebuffer->fd, MSMFB_OVERLAY_VSYNC_CTRL, &enabled) < 0)
@@ -130,7 +137,18 @@
return ret;
}
-static int hwc_query(struct hwc_composer_device* dev,
+static int hwc_blank(struct hwc_composer_device_1* dev, int dpy, int blank)
+{
+ //XXX: Handle based on dpy
+ if(blank) {
+ hwc_context_t* ctx = (hwc_context_t*)(dev);
+ ctx->mOverlay->setState(ovutils::OV_CLOSED);
+ ctx->qbuf->unlockAllPrevious();
+ }
+ return 0;
+}
+
+static int hwc_query(struct hwc_composer_device_1* dev,
int param, int* value)
{
hwc_context_t* ctx = (hwc_context_t*)(dev);
@@ -153,29 +171,32 @@
}
-static int hwc_set(hwc_composer_device_t *dev,
- hwc_display_t dpy,
- hwc_surface_t sur,
- hwc_layer_list_t* list)
+static int hwc_set(hwc_composer_device_1 *dev,
+ size_t numDisplays,
+ hwc_display_contents_1_t** displays)
{
int ret = 0;
hwc_context_t* ctx = (hwc_context_t*)(dev);
- if (LIKELY(list)) {
- VideoOverlay::draw(ctx, list);
- ExtOnly::draw(ctx, list);
- MDPComp::draw(ctx, list);
- EGLBoolean sucess = eglSwapBuffers((EGLDisplay)dpy, (EGLSurface)sur);
- UIMirrorOverlay::draw(ctx);
- if(ctx->mExtDisplay->getExternalDisplay())
- ctx->mExtDisplay->commit();
- } else {
- ctx->mOverlay->setState(ovutils::OV_CLOSED);
- ctx->qbuf->unlockAllPrevious();
+ for (uint32_t i = 0; i <numDisplays; i++) {
+ hwc_display_contents_1_t* list = displays[i];
+ //XXX: Actually handle the multiple displays
+ if (LIKELY(list)) {
+ VideoOverlay::draw(ctx, list);
+ ExtOnly::draw(ctx, list);
+ MDPComp::draw(ctx, list);
+ EGLBoolean success = eglSwapBuffers((EGLDisplay)list->dpy,
+ (EGLSurface)list->sur);
+ UIMirrorOverlay::draw(ctx);
+ if(ctx->mExtDisplay->getExternalDisplay())
+ ctx->mExtDisplay->commit();
+ } else {
+ ctx->mOverlay->setState(ovutils::OV_CLOSED);
+ ctx->qbuf->unlockAllPrevious();
+ }
+
+ if(!ctx->overlayInUse)
+ ctx->mOverlay->setState(ovutils::OV_CLOSED);
}
-
- if(!ctx->overlayInUse)
- ctx->mOverlay->setState(ovutils::OV_CLOSED);
-
return ret;
}
@@ -205,13 +226,14 @@
initContext(dev);
//Setup HWC methods
- hwc_methods_t *methods;
- methods = (hwc_methods_t *)malloc(sizeof(*methods));
+ hwc_methods_1_t *methods;
+ methods = (hwc_methods_1_t *) malloc(sizeof(*methods));
memset(methods, 0, sizeof(*methods));
methods->eventControl = hwc_eventControl;
+ methods->blank = hwc_blank;
dev->device.common.tag = HARDWARE_DEVICE_TAG;
- dev->device.common.version = HWC_DEVICE_API_VERSION_0_3;
+ dev->device.common.version = HWC_DEVICE_API_VERSION_1_0;
dev->device.common.module = const_cast<hw_module_t*>(module);
dev->device.common.close = hwc_device_close;
dev->device.prepare = hwc_prepare;
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index f14d00f..05b9997 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -113,7 +113,7 @@
return true;
}
-bool CopyBit::canUseCopybitForRGB(hwc_context_t *ctx, hwc_layer_list_t *list) {
+bool CopyBit::canUseCopybitForRGB(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
int compositionType =
qdutils::QCCompositionType::getInstance().getCompositionType();
@@ -154,7 +154,7 @@
return false;
}
-unsigned int CopyBit::getRGBRenderingArea(const hwc_layer_list_t *list) {
+unsigned int CopyBit::getRGBRenderingArea(const hwc_display_contents_1_t *list) {
//Calculates total rendering area for RGB layers
unsigned int renderArea = 0;
unsigned int w=0, h=0;
@@ -170,7 +170,7 @@
return renderArea;
}
-bool CopyBit::prepare(hwc_context_t *ctx, hwc_layer_list_t *list) {
+bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
int compositionType =
qdutils::QCCompositionType::getInstance().getCompositionType();
@@ -209,7 +209,7 @@
return true;
}
-bool CopyBit::draw(hwc_context_t *ctx, hwc_layer_list_t *list, EGLDisplay dpy,
+bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list, EGLDisplay dpy,
EGLSurface sur){
// draw layers marked for COPYBIT
int retVal = true;
@@ -228,7 +228,7 @@
return true;
}
-int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_t *layer,
+int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
EGLDisplay dpy,
EGLSurface surface,
functype_eglGetRenderBufferANDROID& LINK_eglGetRenderBufferANDROID,
@@ -459,7 +459,7 @@
return err;
}
-void CopyBit::getLayerResolution(const hwc_layer_t* layer,
+void CopyBit::getLayerResolution(const hwc_layer_1_t* layer,
unsigned int& width, unsigned int& height)
{
hwc_rect_t displayFrame = layer->displayFrame;
@@ -468,7 +468,7 @@
height = displayFrame.bottom - displayFrame.top;
}
-bool CopyBit::validateParams(hwc_context_t *ctx, const hwc_layer_list_t *list) {
+bool CopyBit::validateParams(hwc_context_t *ctx, const hwc_display_contents_1_t *list) {
//Validate parameters
if (!ctx) {
ALOGE("%s:Invalid HWC context", __FUNCTION__);
diff --git a/libhwcomposer/hwc_copybit.h b/libhwcomposer/hwc_copybit.h
index 8390968..ae82b6c 100644
--- a/libhwcomposer/hwc_copybit.h
+++ b/libhwcomposer/hwc_copybit.h
@@ -39,28 +39,28 @@
class CopyBit {
public:
//Sets up members and prepares copybit if conditions are met
- static bool prepare(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list);
//Draws layer if the layer is set for copybit in prepare
- static bool draw(hwc_context_t *ctx, hwc_layer_list_t *list, EGLDisplay dpy,
+ static bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list, EGLDisplay dpy,
EGLSurface sur);
//Receives data from hwc
static void setStats(int yuvCount, int yuvLayerIndex, bool isYuvLayerSkip);
static void updateEglHandles(void*);
- static int drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_t *layer,
+ static int drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
EGLDisplay dpy, EGLSurface surface,
functype_eglGetRenderBufferANDROID& LINK_eglGetRenderBufferANDROID,
functype_eglGetCurrentSurface LINK_eglGetCurrentSurface);
static bool canUseCopybitForYUV (hwc_context_t *ctx);
static bool canUseCopybitForRGB (hwc_context_t *ctx,
- hwc_layer_list_t *list);
+ hwc_display_contents_1_t *list);
static bool validateParams (hwc_context_t *ctx,
- const hwc_layer_list_t *list);
+ const hwc_display_contents_1_t *list);
static void closeEglLib();
static void openEglLibAndGethandle();
private:
//Marks layer flags if this feature is used
- static void markFlags(hwc_layer_t *layer);
+ static void markFlags(hwc_layer_1_t *layer);
//returns yuv count
static int getYuvCount();
@@ -78,9 +78,9 @@
static functype_eglGetRenderBufferANDROID LINK_eglGetRenderBufferANDROID;
static functype_eglGetCurrentSurface LINK_eglGetCurrentSurface;
- static unsigned int getRGBRenderingArea (const hwc_layer_list_t *list);
+ static unsigned int getRGBRenderingArea (const hwc_display_contents_1_t *list);
- static void getLayerResolution(const hwc_layer_t* layer,
+ static void getLayerResolution(const hwc_layer_1_t* layer,
unsigned int &width, unsigned int& height);
};
diff --git a/libhwcomposer/hwc_extonly.cpp b/libhwcomposer/hwc_extonly.cpp
index 6793760..ab50972 100644
--- a/libhwcomposer/hwc_extonly.cpp
+++ b/libhwcomposer/hwc_extonly.cpp
@@ -31,7 +31,7 @@
bool ExtOnly::sIsModeOn = false;
//Cache stats, figure out the state, config overlay
-bool ExtOnly::prepare(hwc_context_t *ctx, hwc_layer_list_t *list) {
+bool ExtOnly::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
sIsModeOn = false;
if(!ctx->mMDP.hasOverlay) {
ALOGD_IF(EXTONLY_DEBUG,"%s, this hw doesnt support overlay",
@@ -44,7 +44,7 @@
chooseState(ctx);
//if the state chosen above is CLOSED, skip this block.
if(sState != ovutils::OV_CLOSED) {
- hwc_layer_t *extLayer = &list->hwLayers[sExtIndex];
+ hwc_layer_1_t *extLayer = &list->hwLayers[sExtIndex];
if(configure(ctx, extLayer)) {
markFlags(extLayer);
sIsModeOn = true;
@@ -75,7 +75,7 @@
ovutils::getStateString(sState));
}
-void ExtOnly::markFlags(hwc_layer_t *layer) {
+void ExtOnly::markFlags(hwc_layer_1_t *layer) {
switch(sState) {
case ovutils::OV_DUAL_DISP:
layer->compositionType = HWC_OVERLAY;
@@ -85,7 +85,7 @@
}
}
-bool ExtOnly::configure(hwc_context_t *ctx, hwc_layer_t *layer) {
+bool ExtOnly::configure(hwc_context_t *ctx, hwc_layer_1_t *layer) {
overlay::Overlay& ov = *(ctx->mOverlay);
ov.setState(sState);
@@ -121,7 +121,7 @@
return true;
}
-bool ExtOnly::draw(hwc_context_t *ctx, hwc_layer_list_t *list)
+bool ExtOnly::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list)
{
if(!sIsModeOn || sExtIndex == -1) {
return true;
diff --git a/libhwcomposer/hwc_extonly.h b/libhwcomposer/hwc_extonly.h
index 26d5fb9..dccd065 100644
--- a/libhwcomposer/hwc_extonly.h
+++ b/libhwcomposer/hwc_extonly.h
@@ -28,9 +28,9 @@
class ExtOnly {
public:
//Sets up members and prepares overlay if conditions are met
- static bool prepare(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list);
//Draws layer if this feature is on
- static bool draw(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
//Receives data from hwc
static void setStats(int extCount, int extIndex, bool isExtBlock);
//resets values
@@ -39,9 +39,9 @@
//Choose an appropriate overlay state based on conditions
static void chooseState(hwc_context_t *ctx);
//Configures overlay
- static bool configure(hwc_context_t *ctx, hwc_layer_t *layer);
+ static bool configure(hwc_context_t *ctx, hwc_layer_1_t *layer);
//Marks layer flags if this feature is used
- static void markFlags(hwc_layer_t *layer);
+ static void markFlags(hwc_layer_1_t *layer);
//returns ext-only count
static int getExtCount();
diff --git a/libhwcomposer/hwc_mdpcomp.cpp b/libhwcomposer/hwc_mdpcomp.cpp
index 135d651..787ba9b 100644
--- a/libhwcomposer/hwc_mdpcomp.cpp
+++ b/libhwcomposer/hwc_mdpcomp.cpp
@@ -125,7 +125,7 @@
proc->invalidate(proc);
}
-void MDPComp::reset( hwc_context_t *ctx, hwc_layer_list_t* list ) {
+void MDPComp::reset( hwc_context_t *ctx, hwc_display_contents_1_t* list ) {
sCurrentFrame.count = 0;
free(sCurrentFrame.pipe_layer);
sCurrentFrame.pipe_layer = NULL;
@@ -145,13 +145,13 @@
}
}
-void MDPComp::setLayerIndex(hwc_layer_t* layer, const int pipe_index)
+void MDPComp::setLayerIndex(hwc_layer_1_t* layer, const int pipe_index)
{
layer->flags &= ~HWC_MDPCOMP_INDEX_MASK;
layer->flags |= pipe_index << MDPCOMP_INDEX_OFFSET;
}
-int MDPComp::getLayerIndex(hwc_layer_t* layer)
+int MDPComp::getLayerIndex(hwc_layer_1_t* layer)
{
int byp_index = -1;
@@ -162,7 +162,7 @@
}
return byp_index;
}
-void MDPComp::print_info(hwc_layer_t* layer)
+void MDPComp::print_info(hwc_layer_1_t* layer)
{
hwc_rect_t sourceCrop = layer->sourceCrop;
hwc_rect_t displayFrame = layer->displayFrame;
@@ -185,7 +185,7 @@
/*
* Configures pipe(s) for MDP composition
*/
-int MDPComp::prepare(hwc_context_t *ctx, hwc_layer_t *layer,
+int MDPComp::prepare(hwc_context_t *ctx, hwc_layer_1_t *layer,
mdp_pipe_info& mdp_info) {
int nPipeIndex = mdp_info.index;
@@ -333,8 +333,8 @@
* 5. Overlay in use
*/
-bool MDPComp::is_doable(hwc_composer_device_t *dev,
- const hwc_layer_list_t* list) {
+bool MDPComp::is_doable(hwc_composer_device_1_t *dev,
+ const hwc_display_contents_1_t* list) {
hwc_context_t* ctx = (hwc_context_t*)(dev);
if(!ctx) {
@@ -370,13 +370,13 @@
return true;
}
-void MDPComp::setMDPCompLayerFlags(hwc_layer_list_t* list) {
+void MDPComp::setMDPCompLayerFlags(hwc_display_contents_1_t* list) {
for(int index = 0 ; index < sCurrentFrame.count; index++ )
{
int layer_index = sCurrentFrame.pipe_layer[index].layer_index;
if(layer_index >= 0) {
- hwc_layer_t* layer = &(list->hwLayers[layer_index]);
+ hwc_layer_1_t* layer = &(list->hwLayers[layer_index]);
layer->flags |= HWC_MDPCOMP;
layer->compositionType = HWC_OVERLAY;
@@ -385,7 +385,7 @@
}
}
-void MDPComp::get_layer_info(hwc_layer_t* layer, int& flags) {
+void MDPComp::get_layer_info(hwc_layer_1_t* layer, int& flags) {
private_handle_t* hnd = (private_handle_t*)layer->handle;
@@ -410,7 +410,7 @@
}
}
-int MDPComp::mark_layers(hwc_layer_list_t* list, layer_mdp_info* layer_info,
+int MDPComp::mark_layers(hwc_display_contents_1_t* list, layer_mdp_info* layer_info,
frame_info& current_frame) {
int layer_count = list->numHwLayers;
@@ -424,7 +424,7 @@
//Parse layers from higher z-order
for(int index = layer_count - 1 ; index >= 0; index-- ) {
- hwc_layer_t* layer = &list->hwLayers[index];
+ hwc_layer_1_t* layer = &list->hwLayers[index];
int layer_prop = 0;
get_layer_info(layer, layer_prop);
@@ -476,7 +476,7 @@
}
}
-bool MDPComp::alloc_layer_pipes(hwc_layer_list_t* list,
+bool MDPComp::alloc_layer_pipes(hwc_display_contents_1_t* list,
layer_mdp_info* layer_info, frame_info& current_frame) {
int layer_count = list->numHwLayers;
@@ -490,7 +490,7 @@
layer_count, mdp_count, fallback_count);
for(int index = 0 ; index < layer_count ; index++ ) {
- hwc_layer_t* layer = &list->hwLayers[index];
+ hwc_layer_1_t* layer = &list->hwLayers[index];
if(layer_info[index].can_use_mdp) {
pipe_layer_pair& info = current_frame.pipe_layer[frame_pipe_count];
@@ -518,7 +518,7 @@
}
//returns array of layers and their allocated pipes
-bool MDPComp::parse_and_allocate(hwc_context_t* ctx, hwc_layer_list_t* list,
+bool MDPComp::parse_and_allocate(hwc_context_t* ctx, hwc_display_contents_1_t* list,
frame_info& current_frame ) {
int layer_count = list->numHwLayers;
@@ -584,7 +584,7 @@
}
#endif
-bool MDPComp::setup(hwc_context_t* ctx, hwc_layer_list_t* list) {
+bool MDPComp::setup(hwc_context_t* ctx, hwc_display_contents_1_t* list) {
int nPipeIndex, vsync_wait, isFG;
int numHwLayers = list->numHwLayers;
@@ -632,7 +632,7 @@
for (int index = 0 ; index < current_frame.count; index++) {
int layer_index = current_frame.pipe_layer[index].layer_index;
- hwc_layer_t* layer = &list->hwLayers[layer_index];
+ hwc_layer_1_t* layer = &list->hwLayers[layer_index];
mdp_pipe_info& cur_pipe = current_frame.pipe_layer[index].pipe_index;
if( prepare(ctx, layer, cur_pipe) != 0 ) {
@@ -647,7 +647,7 @@
return true;
}
-void MDPComp::unsetMDPCompLayerFlags(hwc_context_t* ctx, hwc_layer_list_t* list)
+void MDPComp::unsetMDPCompLayerFlags(hwc_context_t* ctx, hwc_display_contents_1_t* list)
{
if (!list)
return;
@@ -660,7 +660,7 @@
}
}
-int MDPComp::draw(hwc_context_t *ctx, hwc_layer_list_t* list) {
+int MDPComp::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
if(!isEnabled()) {
ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled",__FUNCTION__);
@@ -676,7 +676,7 @@
for(unsigned int i = 0; i < list->numHwLayers; i++ )
{
- hwc_layer_t *layer = &list->hwLayers[i];
+ hwc_layer_1_t *layer = &list->hwLayers[i];
if(!(layer->flags & HWC_MDPCOMP)) {
ALOGD_IF(isDebug(), "%s: Layer Not flagged for MDP comp",
@@ -789,7 +789,7 @@
return true;
}
-bool MDPComp::configure(hwc_composer_device_t *dev, hwc_layer_list_t* list) {
+bool MDPComp::configure(hwc_composer_device_1_t *dev, hwc_display_contents_1_t* list) {
if(!isEnabled()) {
ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__);
diff --git a/libhwcomposer/hwc_mdpcomp.h b/libhwcomposer/hwc_mdpcomp.h
index 199204c..5cb2476 100644
--- a/libhwcomposer/hwc_mdpcomp.h
+++ b/libhwcomposer/hwc_mdpcomp.h
@@ -154,10 +154,10 @@
static bool deinit();
/*sets up mdp comp for the current frame */
- static bool configure(hwc_composer_device_t *ctx, hwc_layer_list_t* list);
+ static bool configure(hwc_composer_device_1_t *ctx, hwc_display_contents_1_t* list);
/* draw */
- static int draw(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static int draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
/* store frame stats */
static void setStats(int skipCt) { sSkipCount = skipCt;};
@@ -165,40 +165,40 @@
private:
/* get/set pipe index associated with overlay layers */
- static void setLayerIndex(hwc_layer_t* layer, const int pipe_index);
- static int getLayerIndex(hwc_layer_t* layer);
+ static void setLayerIndex(hwc_layer_1_t* layer, const int pipe_index);
+ static int getLayerIndex(hwc_layer_1_t* layer);
/* set/reset flags for MDPComp */
- static void setMDPCompLayerFlags(hwc_layer_list_t* list);
+ static void setMDPCompLayerFlags(hwc_display_contents_1_t* list);
static void unsetMDPCompLayerFlags(hwc_context_t* ctx,
- hwc_layer_list_t* list);
+ hwc_display_contents_1_t* list);
- static void print_info(hwc_layer_t* layer);
+ static void print_info(hwc_layer_1_t* layer);
/* configure's overlay pipes for the frame */
- static int prepare(hwc_context_t *ctx, hwc_layer_t *layer,
+ static int prepare(hwc_context_t *ctx, hwc_layer_1_t *layer,
mdp_pipe_info& mdp_info);
/* checks for conditions where mdpcomp is not possible */
- static bool is_doable(hwc_composer_device_t *dev,
- const hwc_layer_list_t* list);
+ static bool is_doable(hwc_composer_device_1_t *dev,
+ const hwc_display_contents_1_t* list);
- static bool setup(hwc_context_t* ctx, hwc_layer_list_t* list);
+ static bool setup(hwc_context_t* ctx, hwc_display_contents_1_t* list);
/* parses layer for properties affecting mdp comp */
- static void get_layer_info(hwc_layer_t* layer, int& flags);
+ static void get_layer_info(hwc_layer_1_t* layer, int& flags);
/* iterates through layer list to choose candidate to use overlay */
- static int mark_layers(hwc_layer_list_t* list, layer_mdp_info* layer_info,
+ static int mark_layers(hwc_display_contents_1_t* list, layer_mdp_info* layer_info,
frame_info& current_frame);
- static bool parse_and_allocate(hwc_context_t* ctx, hwc_layer_list_t* list,
+ static bool parse_and_allocate(hwc_context_t* ctx, hwc_display_contents_1_t* list,
frame_info& current_frame );
/* clears layer info struct */
static void reset_layer_mdp_info(layer_mdp_info* layer_mdp_info,int count);
/* allocates pipes to selected candidates */
- static bool alloc_layer_pipes(hwc_layer_list_t* list,
+ static bool alloc_layer_pipes(hwc_display_contents_1_t* list,
layer_mdp_info* layer_info,
frame_info& current_frame);
/* updates variable pipe mode for the current frame */
@@ -209,7 +209,7 @@
static void set_state(State state) { sMDPCompState = state; };
/* reset state */
- static void reset( hwc_context_t *ctx, hwc_layer_list_t* list );
+ static void reset( hwc_context_t *ctx, hwc_display_contents_1_t* list );
/* Is feature enabled */
static bool isEnabled() { return sMaxLayers ? true : false; };
diff --git a/libhwcomposer/hwc_uevents.cpp b/libhwcomposer/hwc_uevents.cpp
index 1953c8a..e7ab629 100644
--- a/libhwcomposer/hwc_uevents.cpp
+++ b/libhwcomposer/hwc_uevents.cpp
@@ -59,7 +59,8 @@
while(*str) {
if (!strncmp(str, "VSYNC=", strlen("VSYNC="))) {
timestamp = strtoull(str + strlen("VSYNC="), NULL, 0);
- proc->vsync(proc, 0, timestamp);
+ //XXX: Handle vsync from multiple displays
+ proc->vsync(proc, (int)ctx->dpys[0], timestamp);
}
str += strlen(str) + 1;
if(str - udata >= len)
diff --git a/libhwcomposer/hwc_uimirror.cpp b/libhwcomposer/hwc_uimirror.cpp
index d2b766d..019b1ec 100644
--- a/libhwcomposer/hwc_uimirror.cpp
+++ b/libhwcomposer/hwc_uimirror.cpp
@@ -30,7 +30,7 @@
// Function to get the primary device orientation
// Loops thru the hardware layers and returns the orientation of the max.
// number of layers
-int getDeviceOrientation(hwc_context_t* ctx, hwc_layer_list_t *list) {
+int getDeviceOrientation(hwc_context_t* ctx, hwc_display_contents_1_t *list) {
int orientation = list->hwLayers[0].transform;
if(!ctx) {
ALOGE("In %s: ctx is NULL!!", __FUNCTION__);
@@ -57,7 +57,7 @@
//Prepare the overlay for the UI mirroring
-bool UIMirrorOverlay::prepare(hwc_context_t *ctx, hwc_layer_list_t *list) {
+bool UIMirrorOverlay::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
sState = ovutils::OV_CLOSED;
sIsUiMirroringOn = false;
@@ -75,7 +75,7 @@
}
// Configure
-bool UIMirrorOverlay::configure(hwc_context_t *ctx, hwc_layer_list_t *list)
+bool UIMirrorOverlay::configure(hwc_context_t *ctx, hwc_display_contents_1_t *list)
{
if (LIKELY(ctx->mOverlay)) {
overlay::Overlay& ov = *(ctx->mOverlay);
diff --git a/libhwcomposer/hwc_uimirror.h b/libhwcomposer/hwc_uimirror.h
index 98f7896..da03c5f 100644
--- a/libhwcomposer/hwc_uimirror.h
+++ b/libhwcomposer/hwc_uimirror.h
@@ -30,12 +30,12 @@
class UIMirrorOverlay {
public:
// Sets up members and prepares overlay if conditions are met
- static bool prepare(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list);
// Draws layer if this feature is on
static bool draw(hwc_context_t *ctx);
private:
//Configures overlay
- static bool configure(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static bool configure(hwc_context_t *ctx, hwc_display_contents_1_t *list);
//The chosen overlay state.
static ovutils::eOverlayState sState;
//Flags if this feature is on.
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 8bc8bfc..a2ba499 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+#include <EGL/egl.h>
#include <overlay.h>
#include "hwc_utils.h"
#include "mdp_version.h"
@@ -46,6 +47,7 @@
ctx->mMDP.panel = qdutils::MDPVersion::getInstance().getPanelType();
ctx->mCopybitEngine = CopybitEngine::getInstance();
ctx->mExtDisplay = new ExternalDisplay(ctx);
+ memset(ctx->dpys,(int)EGL_NO_DISPLAY, MAX_NUM_DISPLAYS);
MDPComp::init(ctx);
init_uevent_thread(ctx);
@@ -82,11 +84,11 @@
}
- free(const_cast<hwc_methods_t *>(ctx->device.methods));
+ free(const_cast<hwc_methods_1_t *>(ctx->device.methods));
}
-void dumpLayer(hwc_layer_t const* l)
+void dumpLayer(hwc_layer_1_t const* l)
{
ALOGD("\ttype=%d, flags=%08x, handle=%p, tr=%02x, blend=%04x, {%d,%d,%d,%d}"
", {%d,%d,%d,%d}",
@@ -101,7 +103,7 @@
l->displayFrame.bottom);
}
-void getLayerStats(hwc_context_t *ctx, const hwc_layer_list_t *list)
+void getLayerStats(hwc_context_t *ctx, const hwc_display_contents_1_t *list)
{
//Video specific stats
int yuvCount = 0;
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 71c1f73..84309ac 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -18,6 +18,7 @@
#ifndef HWC_UTILS_H
#define HWC_UTILS_H
+#define HWC_REMOVE_DEPRECATED_VERSIONS 1
#include <hardware/hwcomposer.h>
#include <gralloc_priv.h>
@@ -25,6 +26,7 @@
#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
#define UNLIKELY( exp ) (__builtin_expect( (exp) != 0, false ))
#define FINAL_TRANSFORM_MASK 0x000F
+#define MAX_NUM_DISPLAYS 4 //Yes, this is ambitious
//Fwrd decls
struct hwc_context_t;
@@ -67,8 +69,8 @@
// -----------------------------------------------------------------------------
// Utility functions - implemented in hwc_utils.cpp
-void dumpLayer(hwc_layer_t const* l);
-void getLayerStats(hwc_context_t *ctx, const hwc_layer_list_t *list);
+void dumpLayer(hwc_layer_1_t const* l);
+void getLayerStats(hwc_context_t *ctx, const hwc_display_contents_1_t *list);
void initContext(hwc_context_t *ctx);
void closeContext(hwc_context_t *ctx);
//Crops source buffer against destination and FB boundaries
@@ -76,7 +78,7 @@
const int fbWidth, const int fbHeight);
// Inline utility functions
-static inline bool isSkipLayer(const hwc_layer_t* l) {
+static inline bool isSkipLayer(const hwc_layer_1_t* l) {
return (UNLIKELY(l && (l->flags & HWC_SKIP_LAYER)));
}
@@ -108,7 +110,7 @@
// Initialize uevent thread
void init_uevent_thread(hwc_context_t* ctx);
-inline void getLayerResolution(const hwc_layer_t* layer,
+inline void getLayerResolution(const hwc_layer_1_t* layer,
int& width, int& height)
{
hwc_rect_t displayFrame = layer->displayFrame;
@@ -121,9 +123,10 @@
// HWC context
// This structure contains overall state
struct hwc_context_t {
- hwc_composer_device_t device;
+ hwc_composer_device_1_t device;
int numHwLayers;
int overlayInUse;
+ hwc_display_t dpys[MAX_NUM_DISPLAYS];
//Framebuffer device
framebuffer_device_t *mFbDev;
diff --git a/libhwcomposer/hwc_video.cpp b/libhwcomposer/hwc_video.cpp
index 4e7bc5f..38ac695 100644
--- a/libhwcomposer/hwc_video.cpp
+++ b/libhwcomposer/hwc_video.cpp
@@ -34,7 +34,7 @@
bool VideoOverlay::sIsModeOn = false;
//Cache stats, figure out the state, config overlay
-bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_layer_list_t *list) {
+bool VideoOverlay::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list) {
sIsModeOn = false;
if(!ctx->mMDP.hasOverlay) {
ALOGD_IF(VIDEO_DEBUG,"%s, this hw doesnt support overlay", __FUNCTION__);
@@ -46,8 +46,8 @@
chooseState(ctx);
//if the state chosen above is CLOSED, skip this block.
if(sState != ovutils::OV_CLOSED) {
- hwc_layer_t *yuvLayer = &list->hwLayers[sYuvLayerIndex];
- hwc_layer_t *ccLayer = NULL;
+ hwc_layer_1_t *yuvLayer = &list->hwLayers[sYuvLayerIndex];
+ hwc_layer_1_t *ccLayer = NULL;
if(sCCLayerIndex != -1)
ccLayer = &list->hwLayers[sCCLayerIndex];
@@ -90,7 +90,7 @@
ovutils::getStateString(sState));
}
-void VideoOverlay::markFlags(hwc_layer_t *layer) {
+void VideoOverlay::markFlags(hwc_layer_1_t *layer) {
switch(sState) {
case ovutils::OV_2D_VIDEO_ON_PANEL:
case ovutils::OV_2D_VIDEO_ON_PANEL_TV:
@@ -105,7 +105,7 @@
}
/* Helpers */
-bool configPrimVid(hwc_context_t *ctx, hwc_layer_t *layer) {
+bool configPrimVid(hwc_context_t *ctx, hwc_layer_1_t *layer) {
overlay::Overlay& ov = *(ctx->mOverlay);
private_handle_t *hnd = (private_handle_t *)layer->handle;
ovutils::Whf info(hnd->width, hnd->height, hnd->format, hnd->size);
@@ -183,7 +183,7 @@
return true;
}
-bool configExtVid(hwc_context_t *ctx, hwc_layer_t *layer) {
+bool configExtVid(hwc_context_t *ctx, hwc_layer_1_t *layer) {
overlay::Overlay& ov = *(ctx->mOverlay);
private_handle_t *hnd = (private_handle_t *)layer->handle;
ovutils::Whf info(hnd->width, hnd->height, hnd->format, hnd->size);
@@ -236,7 +236,7 @@
return true;
}
-bool configExtCC(hwc_context_t *ctx, hwc_layer_t *layer) {
+bool configExtCC(hwc_context_t *ctx, hwc_layer_1_t *layer) {
if(layer == NULL)
return true;
@@ -276,8 +276,8 @@
return true;
}
-bool VideoOverlay::configure(hwc_context_t *ctx, hwc_layer_t *yuvLayer,
- hwc_layer_t *ccLayer) {
+bool VideoOverlay::configure(hwc_context_t *ctx, hwc_layer_1_t *yuvLayer,
+ hwc_layer_1_t *ccLayer) {
bool ret = true;
if (LIKELY(ctx->mOverlay)) {
@@ -307,7 +307,7 @@
return ret;
}
-bool VideoOverlay::draw(hwc_context_t *ctx, hwc_layer_list_t *list)
+bool VideoOverlay::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list)
{
if(!sIsModeOn || sYuvLayerIndex == -1) {
return true;
diff --git a/libhwcomposer/hwc_video.h b/libhwcomposer/hwc_video.h
index 62a32a9..40a7c14 100644
--- a/libhwcomposer/hwc_video.h
+++ b/libhwcomposer/hwc_video.h
@@ -26,9 +26,9 @@
class VideoOverlay {
public:
//Sets up members and prepares overlay if conditions are met
- static bool prepare(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static bool prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list);
//Draws layer if this feature is on
- static bool draw(hwc_context_t *ctx, hwc_layer_list_t *list);
+ static bool draw(hwc_context_t *ctx, hwc_display_contents_1_t *list);
//Receives data from hwc
static void setStats(int yuvCount, int yuvLayerIndex, bool isYuvLayerSkip,
int ccLayerIndex);
@@ -38,10 +38,10 @@
//Choose an appropriate overlay state based on conditions
static void chooseState(hwc_context_t *ctx);
//Configures overlay for video prim and ext
- static bool configure(hwc_context_t *ctx, hwc_layer_t *yuvlayer,
- hwc_layer_t *ccLayer);
+ static bool configure(hwc_context_t *ctx, hwc_layer_1_t *yuvlayer,
+ hwc_layer_1_t *ccLayer);
//Marks layer flags if this feature is used
- static void markFlags(hwc_layer_t *layer);
+ static void markFlags(hwc_layer_1_t *layer);
//returns yuv count
static int getYuvCount();