hwc: resolve compiler warnings

- remove unused variables.
- fix incorrect castings.

Change-Id: I7661edb4539a3ffc7d4aedbb9f633bc5ba1dc149
This commit is contained in:
Arun Kumar K.R
2014-01-21 23:08:28 -08:00
parent a6fe50e686
commit 2aa44c66fa
14 changed files with 55 additions and 80 deletions

View File

@@ -105,9 +105,8 @@ static void hwc_registerProcs(struct hwc_composer_device_1* dev,
//Helper //Helper
static void reset(hwc_context_t *ctx, int numDisplays, static void reset(hwc_context_t *ctx, int numDisplays,
hwc_display_contents_1_t** displays) { hwc_display_contents_1_t** displays) {
ctx->numActiveDisplays = 0; ctx->numActiveDisplays = 0;
for(int i = 0; i < HWC_NUM_DISPLAY_TYPES; i++) { for(int i = 0; i < numDisplays; i++) {
hwc_display_contents_1_t *list = displays[i]; hwc_display_contents_1_t *list = displays[i];
// XXX:SurfaceFlinger no longer guarantees that this // XXX:SurfaceFlinger no longer guarantees that this
// value is reset on every prepare. However, for the layer // value is reset on every prepare. However, for the layer
@@ -660,7 +659,7 @@ int hwc_getDisplayConfigs(struct hwc_composer_device_1* dev, int disp,
} }
int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp, int hwc_getDisplayAttributes(struct hwc_composer_device_1* dev, int disp,
uint32_t config, const uint32_t* attributes, int32_t* values) { uint32_t /*config*/, const uint32_t* attributes, int32_t* values) {
hwc_context_t* ctx = (hwc_context_t*)(dev); hwc_context_t* ctx = (hwc_context_t*)(dev);
disp = getDpyforExternalDisplay(ctx, disp); disp = getDpyforExternalDisplay(ctx, disp);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@@ -270,12 +270,12 @@ bool AssertiveDisplay::draw(hwc_context_t *ctx, int fd, uint32_t offset) {
return true; return true;
} }
int AssertiveDisplay::getDstFd(hwc_context_t *ctx) const { int AssertiveDisplay::getDstFd() const {
overlay::Writeback *wb = overlay::Writeback::getInstance(); overlay::Writeback *wb = overlay::Writeback::getInstance();
return wb->getDstFd(); return wb->getDstFd();
} }
uint32_t AssertiveDisplay::getDstOffset(hwc_context_t *ctx) const { uint32_t AssertiveDisplay::getDstOffset() const {
overlay::Writeback *wb = overlay::Writeback::getInstance(); overlay::Writeback *wb = overlay::Writeback::getInstance();
return wb->getOffset(); return wb->getOffset();
} }

View File

@@ -51,8 +51,8 @@ public:
} }
bool isDoable() const { return mDoable; } bool isDoable() const { return mDoable; }
bool isModeOn() const { return (mWbFd >= 0); } bool isModeOn() const { return (mWbFd >= 0); }
int getDstFd(hwc_context_t *ctx) const; int getDstFd() const;
uint32_t getDstOffset(hwc_context_t *ctx) const; uint32_t getDstOffset() const;
private: private:
//State of feature turned on and off //State of feature turned on and off

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2010 The Android Open Source Project * Copyright (C) 2010 The Android Open Source Project
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved.
* *
* Not a Contribution. * Not a Contribution.
* *
@@ -162,8 +162,6 @@ bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
bool useCopybitForYUV = canUseCopybitForYUV(ctx); bool useCopybitForYUV = canUseCopybitForYUV(ctx);
bool useCopybitForRGB = canUseCopybitForRGB(ctx, list, dpy); bool useCopybitForRGB = canUseCopybitForRGB(ctx, list, dpy);
LayerProp *layerProp = ctx->layerProp[dpy]; LayerProp *layerProp = ctx->layerProp[dpy];
size_t fbLayerIndex = ctx->listStats[dpy].fbLayerIndex;
hwc_layer_1_t *fbLayer = &list->hwLayers[fbLayerIndex];
// Following are MDP3 limitations for which we // Following are MDP3 limitations for which we
// need to fallback to GPU composition: // need to fallback to GPU composition:
@@ -326,7 +324,7 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
list->hwLayers[i].acquireFenceFd = -1; list->hwLayers[i].acquireFenceFd = -1;
} }
retVal = drawLayerUsingCopybit(ctx, &(list->hwLayers[i]), retVal = drawLayerUsingCopybit(ctx, &(list->hwLayers[i]),
renderBuffer, dpy, !i); renderBuffer, !i);
copybitLayerCount++; copybitLayerCount++;
if(retVal < 0) { if(retVal < 0) {
ALOGE("%s : drawLayerUsingCopybit failed", __FUNCTION__); ALOGE("%s : drawLayerUsingCopybit failed", __FUNCTION__);
@@ -347,7 +345,7 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_display_contents_1_t *list,
} }
int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer, int CopyBit::drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
private_handle_t *renderBuffer, int dpy, bool isFG) private_handle_t *renderBuffer, bool isFG)
{ {
hwc_context_t* ctx = (hwc_context_t*)(dev); hwc_context_t* ctx = (hwc_context_t*)(dev);
int err = 0, acquireFd; int err = 0, acquireFd;

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2010 The Android Open Source Project * Copyright (C) 2010 The Android Open Source Project
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved.
* *
* Not a Contribution, Apache license notifications and license are retained * Not a Contribution, Apache license notifications and license are retained
* for attribution purposes only. * for attribution purposes only.
@@ -54,7 +54,7 @@ private:
struct copybit_device_t *mEngine; struct copybit_device_t *mEngine;
// Helper functions for copybit composition // Helper functions for copybit composition
int drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer, int drawLayerUsingCopybit(hwc_context_t *dev, hwc_layer_1_t *layer,
private_handle_t *renderBuffer, int dpy, bool isFG); private_handle_t *renderBuffer, bool isFG);
int fillColorUsingCopybit(hwc_layer_1_t *layer, int fillColorUsingCopybit(hwc_layer_1_t *layer,
private_handle_t *renderBuffer); private_handle_t *renderBuffer);
bool canUseCopybitForYUV (hwc_context_t *ctx); bool canUseCopybitForYUV (hwc_context_t *ctx);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2013, Linux Foundation. All rights reserved. * Copyright (c) 2012-2014, Linux Foundation. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are * modification, are permitted provided that the following conditions are
@@ -38,6 +38,9 @@
#include <comptype.h> #include <comptype.h>
#include <SkBitmap.h> #include <SkBitmap.h>
#include <SkImageEncoder.h> #include <SkImageEncoder.h>
#ifdef STDC_FORMAT_MACROS
#include <inttypes.h>
#endif
namespace qhwc { namespace qhwc {
@@ -308,7 +311,7 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
char dumpFilename[PATH_MAX]; char dumpFilename[PATH_MAX];
SkBitmap *tempSkBmp = new SkBitmap(); SkBitmap *tempSkBmp = new SkBitmap();
SkBitmap::Config tempSkBmpConfig = SkBitmap::kNo_Config; SkBitmap::Config tempSkBmpConfig = SkBitmap::kNo_Config;
sprintf(dumpFilename, "%s/sfdump%03d.layer%d.%s.png", mDumpDirPng, sprintf(dumpFilename, "%s/sfdump%03d.layer%zu.%s.png", mDumpDirPng,
mDumpCntrPng, layerIndex, mDisplayName); mDumpCntrPng, layerIndex, mDisplayName);
switch (hnd->format) { switch (hnd->format) {
@@ -344,7 +347,7 @@ void HwcDebug::dumpLayer(size_t layerIndex, hwc_layer_1_t hwLayers[])
if (needDumpRaw && hnd->base) { if (needDumpRaw && hnd->base) {
char dumpFilename[PATH_MAX]; char dumpFilename[PATH_MAX];
bool bResult = false; bool bResult = false;
sprintf(dumpFilename, "%s/sfdump%03d.layer%d.%dx%d.%s.%s.raw", sprintf(dumpFilename, "%s/sfdump%03d.layer%zu.%dx%d.%s.%s.raw",
mDumpDirRaw, mDumpCntrRaw, mDumpDirRaw, mDumpCntrRaw,
layerIndex, getWidth(hnd), getHeight(hnd), layerIndex, getWidth(hnd), getHeight(hnd),
pixFormatStr, mDisplayName); pixFormatStr, mDisplayName);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved.
* Not a Contribution, Apache license notifications and license are retained * Not a Contribution, Apache license notifications and license are retained
* for attribution purposes only. * for attribution purposes only.
* *
@@ -300,7 +300,6 @@ bool MDPComp::isSupportedForMDPComp(hwc_context_t *ctx, hwc_layer_1_t* layer) {
} }
bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) { bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) {
const int dpy = HWC_DISPLAY_PRIMARY;
private_handle_t *hnd = (private_handle_t *)layer->handle; private_handle_t *hnd = (private_handle_t *)layer->handle;
if(!hnd) { if(!hnd) {
@@ -316,9 +315,6 @@ bool MDPComp::isValidDimension(hwc_context_t *ctx, hwc_layer_1_t *layer) {
if(!isSecureBuffer(hnd) && isNonIntegralSourceCrop(layer->sourceCropf)) if(!isSecureBuffer(hnd) && isNonIntegralSourceCrop(layer->sourceCropf))
return false; return false;
int hw_w = ctx->dpyAttr[mDpy].xres;
int hw_h = ctx->dpyAttr[mDpy].yres;
hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf);
hwc_rect_t dst = layer->displayFrame; hwc_rect_t dst = layer->displayFrame;
int crop_w = crop.right - crop.left; int crop_w = crop.right - crop.left;
@@ -407,7 +403,6 @@ ovutils::eDest MDPComp::getMdpPipe(hwc_context_t *ctx, ePipeType type,
bool MDPComp::isFrameDoable(hwc_context_t *ctx) { bool MDPComp::isFrameDoable(hwc_context_t *ctx) {
bool ret = true; bool ret = true;
const int numAppLayers = ctx->listStats[mDpy].numAppLayers;
if(!isEnabled()) { if(!isEnabled()) {
ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__); ALOGD_IF(isDebug(),"%s: MDP Comp. not enabled.", __FUNCTION__);
@@ -458,7 +453,6 @@ bool MDPComp::validateAndApplyROI(hwc_context_t *ctx,
hwc_rect_t dstRect = layer->displayFrame; hwc_rect_t dstRect = layer->displayFrame;
hwc_rect_t srcRect = integerizeSourceCrop(layer->sourceCropf); hwc_rect_t srcRect = integerizeSourceCrop(layer->sourceCropf);
int transform = layer->transform;
hwc_rect_t res = getIntersection(visibleRect, dstRect); hwc_rect_t res = getIntersection(visibleRect, dstRect);
@@ -515,7 +509,6 @@ void MDPComp::generateROI(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
hwc_rect_t dstRect = list->hwLayers[index].displayFrame; hwc_rect_t dstRect = list->hwLayers[index].displayFrame;
hwc_rect_t srcRect = integerizeSourceCrop( hwc_rect_t srcRect = integerizeSourceCrop(
list->hwLayers[index].sourceCropf); list->hwLayers[index].sourceCropf);
int transform = list->hwLayers[index].transform;
/* Intersect against display boundaries */ /* Intersect against display boundaries */
roi = getUnion(roi, dstRect); roi = getUnion(roi, dstRect);
@@ -729,7 +722,7 @@ bool MDPComp::cacheBasedComp(hwc_context_t *ctx,
bool MDPComp::loadBasedCompPreferGPU(hwc_context_t *ctx, bool MDPComp::loadBasedCompPreferGPU(hwc_context_t *ctx,
hwc_display_contents_1_t* list) { hwc_display_contents_1_t* list) {
if(not isLoadBasedCompDoable(ctx, list)) { if(not isLoadBasedCompDoable(ctx)) {
return false; return false;
} }
@@ -840,7 +833,7 @@ bool MDPComp::loadBasedCompPreferGPU(hwc_context_t *ctx,
bool MDPComp::loadBasedCompPreferMDP(hwc_context_t *ctx, bool MDPComp::loadBasedCompPreferMDP(hwc_context_t *ctx,
hwc_display_contents_1_t* list) { hwc_display_contents_1_t* list) {
if(not isLoadBasedCompDoable(ctx, list)) { if(not isLoadBasedCompDoable(ctx)) {
return false; return false;
} }
@@ -919,8 +912,7 @@ bool MDPComp::loadBasedCompPreferMDP(hwc_context_t *ctx,
return true; return true;
} }
bool MDPComp::isLoadBasedCompDoable(hwc_context_t *ctx, bool MDPComp::isLoadBasedCompDoable(hwc_context_t *ctx) {
hwc_display_contents_1_t* list) {
if(mDpy or isSecurePresent(ctx, mDpy) or if(mDpy or isSecurePresent(ctx, mDpy) or
isYuvPresent(ctx, mDpy)) { isYuvPresent(ctx, mDpy)) {
return false; return false;
@@ -1174,7 +1166,6 @@ void MDPComp::updateLayerCache(hwc_context_t* ctx,
int fbCount = 0; int fbCount = 0;
for(int i = 0; i < numAppLayers; i++) { for(int i = 0; i < numAppLayers; i++) {
hwc_layer_1_t* layer = &list->hwLayers[i];
if (mCachedFrame.hnd[i] == list->hwLayers[i].handle) { if (mCachedFrame.hnd[i] == list->hwLayers[i].handle) {
if(!mCurrentFrame.drop[i]) if(!mCurrentFrame.drop[i])
fbCount++; fbCount++;
@@ -1484,12 +1475,9 @@ int MDPComp::prepare(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
return ret; return ret;
} }
bool MDPComp::allocSplitVGPipesfor4k2k(hwc_context_t *ctx, bool MDPComp::allocSplitVGPipesfor4k2k(hwc_context_t *ctx, int index) {
hwc_display_contents_1_t* list, int index) {
bool bRet = true; bool bRet = true;
hwc_layer_1_t* layer = &list->hwLayers[index];
private_handle_t *hnd = (private_handle_t *)layer->handle;
int mdpIndex = mCurrentFrame.layerToMDP[index]; int mdpIndex = mCurrentFrame.layerToMDP[index];
PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex]; PipeLayerPair& info = mCurrentFrame.mdpToLayer[mdpIndex];
info.pipeInfo = new MdpYUVPipeInfo; info.pipeInfo = new MdpYUVPipeInfo;
@@ -1514,10 +1502,10 @@ bool MDPComp::allocSplitVGPipesfor4k2k(hwc_context_t *ctx,
} }
return bRet; return bRet;
} }
//=============MDPCompNonSplit=================================================== //=============MDPCompNonSplit==================================================
void MDPCompNonSplit::adjustForSourceSplit(hwc_context_t *ctx, void MDPCompNonSplit::adjustForSourceSplit(hwc_context_t *ctx,
hwc_display_contents_1_t* list){ hwc_display_contents_1_t*) {
//As we split 4kx2k yuv layer and program to 2 VG pipes //As we split 4kx2k yuv layer and program to 2 VG pipes
//(if available) increase mdpcount accordingly //(if available) increase mdpcount accordingly
mCurrentFrame.mdpCount += ctx->listStats[mDpy].yuv4k2kCount; mCurrentFrame.mdpCount += ctx->listStats[mDpy].yuv4k2kCount;
@@ -1618,7 +1606,7 @@ bool MDPCompNonSplit::allocLayerPipes(hwc_context_t *ctx,
hwc_layer_1_t* layer = &list->hwLayers[index]; hwc_layer_1_t* layer = &list->hwLayers[index];
private_handle_t *hnd = (private_handle_t *)layer->handle; private_handle_t *hnd = (private_handle_t *)layer->handle;
if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){ if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){
if(allocSplitVGPipesfor4k2k(ctx, list, index)){ if(allocSplitVGPipesfor4k2k(ctx, index)){
continue; continue;
} }
} }
@@ -1810,7 +1798,6 @@ int MDPCompSplit::pipesNeeded(hwc_context_t *ctx,
hwc_display_contents_1_t* list, hwc_display_contents_1_t* list,
int mixer) { int mixer) {
int pipesNeeded = 0; int pipesNeeded = 0;
const int xres = ctx->dpyAttr[mDpy].xres;
const int lSplit = getLeftSplit(ctx, mDpy); const int lSplit = getLeftSplit(ctx, mDpy);
@@ -1909,7 +1896,6 @@ bool MDPCompSplit::areVGPipesAvailable(hwc_context_t *ctx,
bool MDPCompSplit::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer, bool MDPCompSplit::acquireMDPPipes(hwc_context_t *ctx, hwc_layer_1_t* layer,
MdpPipeInfoSplit& pipe_info, MdpPipeInfoSplit& pipe_info,
ePipeType type) { ePipeType type) {
const int xres = ctx->dpyAttr[mDpy].xres;
const int lSplit = getLeftSplit(ctx, mDpy); const int lSplit = getLeftSplit(ctx, mDpy);
hwc_rect_t dst = layer->displayFrame; hwc_rect_t dst = layer->displayFrame;
@@ -1943,7 +1929,7 @@ bool MDPCompSplit::allocLayerPipes(hwc_context_t *ctx,
const int lSplit = getLeftSplit(ctx, mDpy); const int lSplit = getLeftSplit(ctx, mDpy);
if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){ if(is4kx2kYuvBuffer(hnd) && sEnable4k2kYUVSplit){
if((dst.left > lSplit)||(dst.right < lSplit)){ if((dst.left > lSplit)||(dst.right < lSplit)){
if(allocSplitVGPipesfor4k2k(ctx, list, index)){ if(allocSplitVGPipesfor4k2k(ctx, index)){
continue; continue;
} }
} }
@@ -2104,8 +2090,8 @@ bool MDPCompSplit::draw(hwc_context_t *ctx, hwc_display_contents_1_t* list) {
if(ctx->mAD->isModeOn()) { if(ctx->mAD->isModeOn()) {
if(ctx->mAD->draw(ctx, fd, offset)) { if(ctx->mAD->draw(ctx, fd, offset)) {
fd = ctx->mAD->getDstFd(ctx); fd = ctx->mAD->getDstFd();
offset = ctx->mAD->getDstOffset(ctx); offset = ctx->mAD->getDstOffset();
} }
} }

View File

@@ -172,8 +172,7 @@ protected:
bool loadBasedCompPreferMDP(hwc_context_t *ctx, bool loadBasedCompPreferMDP(hwc_context_t *ctx,
hwc_display_contents_1_t* list); hwc_display_contents_1_t* list);
/* Checks if its worth doing load based partial comp */ /* Checks if its worth doing load based partial comp */
bool isLoadBasedCompDoable(hwc_context_t *ctx, bool isLoadBasedCompDoable(hwc_context_t *ctx);
hwc_display_contents_1_t* list);
/* checks for conditions where only video can be bypassed */ /* checks for conditions where only video can be bypassed */
bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list); bool tryVideoOnly(hwc_context_t *ctx, hwc_display_contents_1_t* list);
bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list, bool videoOnlyComp(hwc_context_t *ctx, hwc_display_contents_1_t* list,
@@ -246,8 +245,7 @@ protected:
struct LayerCache mCachedFrame; struct LayerCache mCachedFrame;
//Enable 4kx2k yuv layer split //Enable 4kx2k yuv layer split
static bool sEnable4k2kYUVSplit; static bool sEnable4k2kYUVSplit;
bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, bool allocSplitVGPipesfor4k2k(hwc_context_t *ctx, int index);
hwc_display_contents_1_t* list, int index);
}; };
class MDPCompNonSplit : public MDPComp { class MDPCompNonSplit : public MDPComp {

View File

@@ -130,8 +130,9 @@ static void getDisplayAttributes(hwc_context_t* ctx, const Parcel* inParcel,
//XXX: Need to check what to return for HDMI //XXX: Need to check what to return for HDMI
outParcel->writeInt32(ctx->mMDP.panel); outParcel->writeInt32(ctx->mMDP.panel);
} }
static void setHSIC(hwc_context_t* ctx, const Parcel* inParcel) { static void setHSIC(const Parcel* inParcel) {
int dpy = inParcel->readInt32(); int dpy = inParcel->readInt32();
ALOGD_IF(0, "In %s: dpy = %d", __FUNCTION__, dpy);
HSICData_t hsic_data; HSICData_t hsic_data;
hsic_data.hue = inParcel->readInt32(); hsic_data.hue = inParcel->readInt32();
hsic_data.saturation = inParcel->readFloat(); hsic_data.saturation = inParcel->readFloat();
@@ -191,7 +192,6 @@ status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel,
return vpuCommand(mHwcContext, command, inParcel, outParcel); return vpuCommand(mHwcContext, command, inParcel, outParcel);
} }
#endif #endif
switch(command) { switch(command) {
case IQService::SECURING: case IQService::SECURING:
securing(mHwcContext, inParcel->readInt32()); securing(mHwcContext, inParcel->readInt32());
@@ -219,7 +219,7 @@ status_t QClient::notifyCallback(uint32_t command, const Parcel* inParcel,
getDisplayAttributes(mHwcContext, inParcel, outParcel); getDisplayAttributes(mHwcContext, inParcel, outParcel);
break; break;
case IQService::SET_HSIC_DATA: case IQService::SET_HSIC_DATA:
setHSIC(mHwcContext, inParcel); setHSIC(inParcel);
case IQService::PAUSE_WFD: case IQService::PAUSE_WFD:
pauseWFD(mHwcContext, inParcel->readInt32()); pauseWFD(mHwcContext, inParcel->readInt32());
break; break;

View File

@@ -494,7 +494,6 @@ void getAspectRatioPosition(hwc_context_t* ctx, int dpy, int extOrientation,
getAspectRatioPosition(width, height, width, height, r); getAspectRatioPosition(width, height, width, height, r);
xPos = r.left; xPos = r.left;
yPos = r.top; yPos = r.top;
float tempWidth = r.right - r.left;
float tempHeight = r.bottom - r.top; float tempHeight = r.bottom - r.top;
yRatio = yPos/height; yRatio = yPos/height;
wRatio = outPos.w/width; wRatio = outPos.w/width;
@@ -799,7 +798,7 @@ void setListStats(hwc_context_t *ctx,
ctx->dpyAttr[dpy].mActionSafePresent = isActionSafePresent(ctx, dpy); ctx->dpyAttr[dpy].mActionSafePresent = isActionSafePresent(ctx, dpy);
trimList(ctx, list, dpy); trimList(ctx, list, dpy);
optimizeLayerRects(ctx, list, dpy); optimizeLayerRects(list);
for (size_t i = 0; i < (size_t)ctx->listStats[dpy].numAppLayers; i++) { for (size_t i = 0; i < (size_t)ctx->listStats[dpy].numAppLayers; i++) {
hwc_layer_1_t const* layer = &list->hwLayers[i]; hwc_layer_1_t const* layer = &list->hwLayers[i];
@@ -1009,8 +1008,6 @@ void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
const int& sci_t = scissor.top; const int& sci_t = scissor.top;
const int& sci_r = scissor.right; const int& sci_r = scissor.right;
const int& sci_b = scissor.bottom; const int& sci_b = scissor.bottom;
int sci_w = abs(sci_r - sci_l);
int sci_h = abs(sci_b - sci_t);
double leftCutRatio = 0.0, rightCutRatio = 0.0, topCutRatio = 0.0, double leftCutRatio = 0.0, rightCutRatio = 0.0, topCutRatio = 0.0,
bottomCutRatio = 0.0; bottomCutRatio = 0.0;
@@ -1117,14 +1114,12 @@ hwc_rect_t deductRect(const hwc_rect_t& rect1, const hwc_rect_t& rect2) {
return res; return res;
} }
void optimizeLayerRects(hwc_context_t *ctx, void optimizeLayerRects(const hwc_display_contents_1_t *list) {
const hwc_display_contents_1_t *list, const int& dpy) {
int i=list->numHwLayers-2; int i=list->numHwLayers-2;
hwc_rect_t irect;
while(i > 0) { while(i > 0) {
//see if there is no blending required. //see if there is no blending required.
//If it is opaque see if we can substract this region from below layers. //If it is opaque see if we can substract this region from below
//layers.
if(list->hwLayers[i].blending == HWC_BLENDING_NONE) { if(list->hwLayers[i].blending == HWC_BLENDING_NONE) {
int j= i-1; int j= i-1;
hwc_rect_t& topframe = hwc_rect_t& topframe =
@@ -1210,7 +1205,6 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
int retireFd = -1; int retireFd = -1;
int fbFd = -1; int fbFd = -1;
bool swapzero = false; bool swapzero = false;
int mdpVersion = qdutils::MDPVersion::getInstance().getMDPVersion();
struct mdp_buf_sync data; struct mdp_buf_sync data;
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
@@ -1556,7 +1550,6 @@ int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
int rotFlags = ovutils::ROT_FLAGS_NONE; int rotFlags = ovutils::ROT_FLAGS_NONE;
uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd)); uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size); Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size);
LayerProp *layerProp = ctx->layerProp[dpy];
#ifdef VPU_TARGET #ifdef VPU_TARGET
if(ctx->mVPUClient != NULL && if(ctx->mVPUClient != NULL &&
@@ -1597,7 +1590,7 @@ int configureNonSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
*rot = ctx->mRotMgr->getNext(); *rot = ctx->mRotMgr->getNext();
if(*rot == NULL) return -1; if(*rot == NULL) return -1;
if(!dpy) if(!dpy)
BwcPM::setBwc(ctx, crop, dst, transform, mdpFlags); BwcPM::setBwc(crop, dst, transform, mdpFlags);
//Configure rotator for pre-rotation //Configure rotator for pre-rotation
if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale) < 0) { if(configRotator(*rot, whf, crop, mdpFlags, orient, downscale) < 0) {
ALOGE("%s: configRotator failed!", __FUNCTION__); ALOGE("%s: configRotator failed!", __FUNCTION__);
@@ -1674,7 +1667,6 @@ int configureSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
int rotFlags = ROT_FLAGS_NONE; int rotFlags = ROT_FLAGS_NONE;
uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd)); uint32_t format = ovutils::getMdpFormat(hnd->format, isTileRendered(hnd));
Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size); Whf whf(getWidth(hnd), getHeight(hnd), format, hnd->size);
LayerProp *layerProp = ctx->layerProp[dpy];
#ifdef VPU_TARGET #ifdef VPU_TARGET
if(ctx->mVPUClient != NULL && if(ctx->mVPUClient != NULL &&
@@ -1815,8 +1807,6 @@ int configureSourceSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
int hw_w = ctx->dpyAttr[dpy].xres;
int hw_h = ctx->dpyAttr[dpy].yres;
hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf);; hwc_rect_t crop = integerizeSourceCrop(layer->sourceCropf);;
hwc_rect_t dst = layer->displayFrame; hwc_rect_t dst = layer->displayFrame;
int transform = layer->transform; int transform = layer->transform;
@@ -1838,7 +1828,7 @@ int configureSourceSplit(hwc_context_t *ctx, hwc_layer_1_t *layer,
(*rot) = ctx->mRotMgr->getNext(); (*rot) = ctx->mRotMgr->getNext();
if((*rot) == NULL) return -1; if((*rot) == NULL) return -1;
if(!dpy) if(!dpy)
BwcPM::setBwc(ctx, crop, dst, transform, mdpFlagsL); BwcPM::setBwc(crop, dst, transform, mdpFlagsL);
//Configure rotator for pre-rotation //Configure rotator for pre-rotation
if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale) < 0) { if(configRotator(*rot, whf, crop, mdpFlagsL, orient, downscale) < 0) {
ALOGE("%s: configRotator failed!", __FUNCTION__); ALOGE("%s: configRotator failed!", __FUNCTION__);
@@ -1998,7 +1988,7 @@ bool canUseMDPforVirtualDisplay(hwc_context_t* ctx,
return true; return true;
} }
void BwcPM::setBwc(hwc_context_t *ctx, const hwc_rect_t& crop, void BwcPM::setBwc(const hwc_rect_t& crop,
const hwc_rect_t& dst, const int& transform, const hwc_rect_t& dst, const int& transform,
ovutils::eMdpFlags& mdpFlags) { ovutils::eMdpFlags& mdpFlags) {
//Target doesnt support Bwc //Target doesnt support Bwc

View File

@@ -136,7 +136,7 @@ struct VsyncState {
}; };
struct BwcPM { struct BwcPM {
static void setBwc(hwc_context_t *ctx, const hwc_rect_t& crop, static void setBwc(const hwc_rect_t& crop,
const hwc_rect_t& dst, const int& transform, const hwc_rect_t& dst, const int& transform,
ovutils::eMdpFlags& mdpFlags); ovutils::eMdpFlags& mdpFlags);
}; };
@@ -247,8 +247,7 @@ bool isValidRect(const hwc_rect_t& rect);
hwc_rect_t deductRect(const hwc_rect_t& rect1, const hwc_rect_t& rect2); hwc_rect_t deductRect(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
hwc_rect_t getIntersection(const hwc_rect_t& rect1, const hwc_rect_t& rect2); 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); hwc_rect_t getUnion(const hwc_rect_t& rect1, const hwc_rect_t& rect2);
void optimizeLayerRects(hwc_context_t *ctx, void optimizeLayerRects(const hwc_display_contents_1_t *list);
const hwc_display_contents_1_t *list, const int& dpy);
bool areLayersIntersecting(const hwc_layer_1_t* layer1, bool areLayersIntersecting(const hwc_layer_1_t* layer1,
const hwc_layer_1_t* layer2); const hwc_layer_1_t* layer2);
@@ -395,7 +394,7 @@ static inline bool isSecureDisplayBuffer(const private_handle_t* hnd) {
static inline int getWidth(const private_handle_t* hnd) { static inline int getWidth(const private_handle_t* hnd) {
if(isYuvBuffer(hnd)) { if(isYuvBuffer(hnd)) {
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) { if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
return metadata->bufferDim.sliceWidth; return metadata->bufferDim.sliceWidth;
} }
@@ -405,7 +404,7 @@ static inline int getWidth(const private_handle_t* hnd) {
static inline int getHeight(const private_handle_t* hnd) { static inline int getHeight(const private_handle_t* hnd) {
if(isYuvBuffer(hnd)) { if(isYuvBuffer(hnd)) {
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata; MetaData_t *metadata = reinterpret_cast<MetaData_t*>(hnd->base_metadata);
if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) { if(metadata && metadata->operation & UPDATE_BUFFER_GEOMETRY) {
return metadata->bufferDim.sliceHeight; return metadata->bufferDim.sliceHeight;
} }

View File

@@ -62,7 +62,7 @@ void HWCVirtualVDS::init(hwc_context_t *ctx) {
ctx->mMDPComp[dpy]->reset(); ctx->mMDPComp[dpy]->reset();
} }
void HWCVirtualVDS::destroy(hwc_context_t *ctx, size_t numDisplays, void HWCVirtualVDS::destroy(hwc_context_t *ctx, size_t /*numDisplays*/,
hwc_display_contents_1_t** displays) { hwc_display_contents_1_t** displays) {
int dpy = HWC_DISPLAY_VIRTUAL; int dpy = HWC_DISPLAY_VIRTUAL;

View File

@@ -75,11 +75,11 @@ public:
// instantiates mdpcomp, copybit and fbupdate objects and initialize those // instantiates mdpcomp, copybit and fbupdate objects and initialize those
// objects for virtual display during virtual display connect. This function // objects for virtual display during virtual display connect. This function
// is no-op for V4L2 design // is no-op for V4L2 design
virtual void init(hwc_context_t *ctx) {}; virtual void init(hwc_context_t *) {};
// Destroys mdpcomp, copybit and fbupdate objects and for virtual display // Destroys mdpcomp, copybit and fbupdate objects and for virtual display
// during virtual display disconnect. This function is no-op for V4L2 design // during virtual display disconnect. This function is no-op for V4L2 design
virtual void destroy(hwc_context_t *ctx, size_t numDisplays, virtual void destroy(hwc_context_t *, size_t ,
hwc_display_contents_1_t** displays){}; hwc_display_contents_1_t** ) {};
}; };
}; //namespace }; //namespace

View File

@@ -1,6 +1,6 @@
/* /*
* Copyright (C) 2010 The Android Open Source Project * Copyright (C) 2010 The Android Open Source Project
* Copyright (C) 2012-2013, The Linux Foundation. All rights reserved. * Copyright (C) 2012-2014, The Linux Foundation. All rights reserved.
* *
* Not a Contribution, Apache license notifications and license are * Not a Contribution, Apache license notifications and license are
* retained for attribution purposes only. * retained for attribution purposes only.
@@ -30,6 +30,8 @@
#include "string.h" #include "string.h"
#include "external.h" #include "external.h"
#include "overlay.h" #include "overlay.h"
#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
namespace qhwc { namespace qhwc {
@@ -133,7 +135,7 @@ static void *vsync_loop(void *param)
} }
// send timestamp to SurfaceFlinger // send timestamp to SurfaceFlinger
ALOGD_IF (logvsync, ALOGD_IF (logvsync,
"%s: timestamp %llu sent to SF for dpy=%d", "%s: timestamp %"PRIu64" sent to SF for dpy=%d",
__FUNCTION__, timestamp[dpy], dpy); __FUNCTION__, timestamp[dpy], dpy);
ctx->proc->vsync(ctx->proc, dpy, timestamp[dpy]); ctx->proc->vsync(ctx->proc, dpy, timestamp[dpy]);
} }