Merge "hwc: Do not use fb handle in hwc_prepare"
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
commit
83593a3aeb
@@ -156,21 +156,17 @@ static int hwc_prepare_primary(hwc_composer_device_1 *dev,
|
||||
ctx->dpyAttr[dpy].isActive) {
|
||||
reset_layer_prop(ctx, dpy, list->numHwLayers - 1);
|
||||
handleGeomChange(ctx, dpy, list);
|
||||
uint32_t last = list->numHwLayers - 1;
|
||||
hwc_layer_1_t *fbLayer = &list->hwLayers[last];
|
||||
if(fbLayer->handle) {
|
||||
setListStats(ctx, list, dpy);
|
||||
setListStats(ctx, list, dpy);
|
||||
#ifdef VPU_TARGET
|
||||
ctx->mVPUClient->prepare(ctx, list);
|
||||
ctx->mVPUClient->prepare(ctx, list);
|
||||
#endif
|
||||
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
||||
const int fbZ = 0;
|
||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
||||
}
|
||||
if (ctx->mMDP.version < qdutils::MDP_V4_0) {
|
||||
if(ctx->mCopyBit[dpy])
|
||||
ctx->mCopyBit[dpy]->prepare(ctx, list, dpy);
|
||||
}
|
||||
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
||||
const int fbZ = 0;
|
||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
||||
}
|
||||
if (ctx->mMDP.version < qdutils::MDP_V4_0) {
|
||||
if(ctx->mCopyBit[dpy])
|
||||
ctx->mCopyBit[dpy]->prepare(ctx, list, dpy);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -187,24 +183,20 @@ static int hwc_prepare_external(hwc_composer_device_1 *dev,
|
||||
ctx->dpyAttr[dpy].connected) {
|
||||
reset_layer_prop(ctx, dpy, list->numHwLayers - 1);
|
||||
handleGeomChange(ctx, dpy, list);
|
||||
uint32_t last = list->numHwLayers - 1;
|
||||
hwc_layer_1_t *fbLayer = &list->hwLayers[last];
|
||||
if(!ctx->dpyAttr[dpy].isPause) {
|
||||
if(fbLayer->handle) {
|
||||
ctx->dpyAttr[dpy].isConfiguring = false;
|
||||
setListStats(ctx, list, dpy);
|
||||
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
||||
const int fbZ = 0;
|
||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
||||
}
|
||||
ctx->dpyAttr[dpy].isConfiguring = false;
|
||||
setListStats(ctx, list, dpy);
|
||||
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
||||
const int fbZ = 0;
|
||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
||||
}
|
||||
|
||||
if(ctx->listStats[dpy].isDisplayAnimating) {
|
||||
// Mark all app layers as HWC_OVERLAY for external during
|
||||
// animation, so that SF doesnt draw it on FB
|
||||
for(int i = 0 ;i < ctx->listStats[dpy].numAppLayers; i++) {
|
||||
hwc_layer_1_t *layer = &list->hwLayers[i];
|
||||
layer->compositionType = HWC_OVERLAY;
|
||||
}
|
||||
if(ctx->listStats[dpy].isDisplayAnimating) {
|
||||
// Mark all app layers as HWC_OVERLAY for external during
|
||||
// animation, so that SF doesnt draw it on FB
|
||||
for(int i = 0 ;i < ctx->listStats[dpy].numAppLayers; i++) {
|
||||
hwc_layer_1_t *layer = &list->hwLayers[i];
|
||||
layer->compositionType = HWC_OVERLAY;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -230,24 +222,20 @@ static int hwc_prepare_virtual(hwc_composer_device_1 *dev,
|
||||
ctx->dpyAttr[dpy].connected) {
|
||||
reset_layer_prop(ctx, dpy, list->numHwLayers - 1);
|
||||
handleGeomChange(ctx, dpy, list);
|
||||
uint32_t last = list->numHwLayers - 1;
|
||||
hwc_layer_1_t *fbLayer = &list->hwLayers[last];
|
||||
if(!ctx->dpyAttr[dpy].isPause) {
|
||||
if(fbLayer->handle) {
|
||||
ctx->dpyAttr[dpy].isConfiguring = false;
|
||||
setListStats(ctx, list, dpy);
|
||||
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
||||
const int fbZ = 0;
|
||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
||||
}
|
||||
ctx->dpyAttr[dpy].isConfiguring = false;
|
||||
setListStats(ctx, list, dpy);
|
||||
if(ctx->mMDPComp[dpy]->prepare(ctx, list) < 0) {
|
||||
const int fbZ = 0;
|
||||
ctx->mFBUpdate[dpy]->prepare(ctx, list, fbZ);
|
||||
}
|
||||
|
||||
if(ctx->listStats[dpy].isDisplayAnimating) {
|
||||
// Mark all app layers as HWC_OVERLAY for virtual during
|
||||
// animation, so that SF doesnt draw it on FB
|
||||
for(int i = 0 ;i < ctx->listStats[dpy].numAppLayers; i++) {
|
||||
hwc_layer_1_t *layer = &list->hwLayers[i];
|
||||
layer->compositionType = HWC_OVERLAY;
|
||||
}
|
||||
if(ctx->listStats[dpy].isDisplayAnimating) {
|
||||
// Mark all app layers as HWC_OVERLAY for virtual during
|
||||
// animation, so that SF doesnt draw it on FB
|
||||
for(int i = 0 ;i < ctx->listStats[dpy].numAppLayers; i++) {
|
||||
hwc_layer_1_t *layer = &list->hwLayers[i];
|
||||
layer->compositionType = HWC_OVERLAY;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -164,8 +164,6 @@ bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
|
||||
LayerProp *layerProp = ctx->layerProp[dpy];
|
||||
size_t fbLayerIndex = ctx->listStats[dpy].fbLayerIndex;
|
||||
hwc_layer_1_t *fbLayer = &list->hwLayers[fbLayerIndex];
|
||||
private_handle_t *fbHnd = (private_handle_t *)fbLayer->handle;
|
||||
|
||||
|
||||
// Following are MDP3 limitations for which we
|
||||
// need to fallback to GPU composition:
|
||||
@@ -202,9 +200,9 @@ bool CopyBit::prepare(hwc_context_t *ctx, hwc_display_contents_1_t *list,
|
||||
|
||||
//Allocate render buffers if they're not allocated
|
||||
if (useCopybitForYUV || useCopybitForRGB) {
|
||||
int ret = allocRenderBuffers(fbHnd->width,
|
||||
fbHnd->height,
|
||||
fbHnd->format);
|
||||
int ret = allocRenderBuffers(mAlignedFBWidth,
|
||||
mAlignedFBHeight,
|
||||
HAL_PIXEL_FORMAT_RGBA_8888);
|
||||
if (ret < 0) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -696,8 +694,15 @@ struct copybit_device_t* CopyBit::getCopyBitDevice() {
|
||||
return mEngine;
|
||||
}
|
||||
|
||||
CopyBit::CopyBit():mIsModeOn(false), mCopyBitDraw(false),
|
||||
mCurRenderBufferIndex(0){
|
||||
CopyBit::CopyBit(hwc_context_t *ctx, const int& dpy) : mIsModeOn(false),
|
||||
mCopyBitDraw(false), mCurRenderBufferIndex(0) {
|
||||
|
||||
getBufferSizeAndDimensions(ctx->dpyAttr[dpy].xres,
|
||||
ctx->dpyAttr[dpy].yres,
|
||||
HAL_PIXEL_FORMAT_RGBA_8888,
|
||||
mAlignedFBWidth,
|
||||
mAlignedFBHeight);
|
||||
|
||||
hw_module_t const *module;
|
||||
for (int i = 0; i < NUM_RENDER_BUFFERS; i++) {
|
||||
mRenderBuffer[i] = NULL;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace qhwc {
|
||||
|
||||
class CopyBit {
|
||||
public:
|
||||
CopyBit();
|
||||
CopyBit(hwc_context_t *ctx, const int& dpy);
|
||||
~CopyBit();
|
||||
// API to get copybit engine(non static)
|
||||
struct copybit_device_t *getCopyBitDevice();
|
||||
@@ -89,6 +89,8 @@ private:
|
||||
|
||||
//Dynamic composition threshold for deciding copybit usage.
|
||||
double mDynThreshold;
|
||||
int mAlignedFBWidth;
|
||||
int mAlignedFBHeight;
|
||||
};
|
||||
|
||||
}; //namespace qhwc
|
||||
|
||||
@@ -39,20 +39,29 @@ namespace ovutils = overlay::utils;
|
||||
|
||||
IFBUpdate* IFBUpdate::getObject(hwc_context_t *ctx, const int& dpy) {
|
||||
if(isDisplaySplit(ctx, dpy)) {
|
||||
return new FBUpdateSplit(dpy);
|
||||
return new FBUpdateSplit(ctx, dpy);
|
||||
}
|
||||
return new FBUpdateNonSplit(dpy);
|
||||
return new FBUpdateNonSplit(ctx, dpy);
|
||||
}
|
||||
|
||||
inline void IFBUpdate::reset() {
|
||||
IFBUpdate::IFBUpdate(hwc_context_t *ctx, const int& dpy) : mDpy(dpy) {
|
||||
getBufferSizeAndDimensions(ctx->dpyAttr[dpy].xres,
|
||||
ctx->dpyAttr[dpy].yres,
|
||||
HAL_PIXEL_FORMAT_RGBA_8888,
|
||||
mAlignedFBWidth,
|
||||
mAlignedFBHeight);
|
||||
}
|
||||
|
||||
void IFBUpdate::reset() {
|
||||
mModeOn = false;
|
||||
mRot = NULL;
|
||||
}
|
||||
|
||||
//================= Low res====================================
|
||||
FBUpdateNonSplit::FBUpdateNonSplit(const int& dpy): IFBUpdate(dpy) {}
|
||||
FBUpdateNonSplit::FBUpdateNonSplit(hwc_context_t *ctx, const int& dpy):
|
||||
IFBUpdate(ctx, dpy) {}
|
||||
|
||||
inline void FBUpdateNonSplit::reset() {
|
||||
void FBUpdateNonSplit::reset() {
|
||||
IFBUpdate::reset();
|
||||
mDest = ovutils::OV_INVALID;
|
||||
}
|
||||
@@ -107,9 +116,10 @@ bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *lis
|
||||
layer->compositionType = HWC_OVERLAY;
|
||||
}
|
||||
overlay::Overlay& ov = *(ctx->mOverlay);
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
ovutils::Whf info(getWidth(hnd), getHeight(hnd),
|
||||
ovutils::getMdpFormat(hnd->format), hnd->size);
|
||||
|
||||
ovutils::Whf info(mAlignedFBWidth,
|
||||
mAlignedFBHeight,
|
||||
ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
|
||||
//Request a pipe
|
||||
ovutils::eMdpPipeType type = ovutils::OV_MDP_PIPE_ANY;
|
||||
@@ -160,7 +170,7 @@ bool FBUpdateNonSplit::configure(hwc_context_t *ctx, hwc_display_contents_1 *lis
|
||||
displayFrame = sourceCrop;
|
||||
}
|
||||
}
|
||||
calcExtDisplayPosition(ctx, hnd, mDpy, sourceCrop, displayFrame,
|
||||
calcExtDisplayPosition(ctx, NULL, mDpy, sourceCrop, displayFrame,
|
||||
transform, orient);
|
||||
setMdpFlags(layer, mdpFlags, 0, transform);
|
||||
// For External use rotator if there is a rotation value set
|
||||
@@ -212,9 +222,10 @@ bool FBUpdateNonSplit::draw(hwc_context_t *ctx, private_handle_t *hnd)
|
||||
}
|
||||
|
||||
//================= High res====================================
|
||||
FBUpdateSplit::FBUpdateSplit(const int& dpy): IFBUpdate(dpy) {}
|
||||
FBUpdateSplit::FBUpdateSplit(hwc_context_t *ctx, const int& dpy):
|
||||
IFBUpdate(ctx, dpy) {}
|
||||
|
||||
inline void FBUpdateSplit::reset() {
|
||||
void FBUpdateSplit::reset() {
|
||||
IFBUpdate::reset();
|
||||
mDestLeft = ovutils::OV_INVALID;
|
||||
mDestRight = ovutils::OV_INVALID;
|
||||
@@ -246,9 +257,10 @@ bool FBUpdateSplit::configure(hwc_context_t *ctx,
|
||||
layer->compositionType = HWC_OVERLAY;
|
||||
}
|
||||
overlay::Overlay& ov = *(ctx->mOverlay);
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
ovutils::Whf info(getWidth(hnd), getHeight(hnd),
|
||||
ovutils::getMdpFormat(hnd->format), hnd->size);
|
||||
|
||||
ovutils::Whf info(mAlignedFBWidth,
|
||||
mAlignedFBHeight,
|
||||
ovutils::getMdpFormat(HAL_PIXEL_FORMAT_RGBA_8888));
|
||||
|
||||
//Request left pipe
|
||||
ovutils::eDest destL = ov.nextPipe(ovutils::OV_MDP_PIPE_ANY, mDpy,
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace ovutils = overlay::utils;
|
||||
//Framebuffer update Interface
|
||||
class IFBUpdate {
|
||||
public:
|
||||
explicit IFBUpdate(const int& dpy) : mDpy(dpy) {}
|
||||
explicit IFBUpdate(hwc_context_t *ctx, const int& dpy);
|
||||
virtual ~IFBUpdate() {};
|
||||
// Sets up members and prepares overlay if conditions are met
|
||||
virtual bool prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
||||
@@ -51,12 +51,14 @@ protected:
|
||||
const int mDpy; // display to update
|
||||
bool mModeOn; // if prepare happened
|
||||
overlay::Rotator *mRot;
|
||||
int mAlignedFBWidth;
|
||||
int mAlignedFBHeight;
|
||||
};
|
||||
|
||||
//Non-Split panel handler.
|
||||
class FBUpdateNonSplit : public IFBUpdate {
|
||||
public:
|
||||
explicit FBUpdateNonSplit(const int& dpy);
|
||||
explicit FBUpdateNonSplit(hwc_context_t *ctx, const int& dpy);
|
||||
virtual ~FBUpdateNonSplit() {};
|
||||
bool prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
||||
int fbZorder);
|
||||
@@ -77,7 +79,7 @@ private:
|
||||
//Split panel handler.
|
||||
class FBUpdateSplit : public IFBUpdate {
|
||||
public:
|
||||
explicit FBUpdateSplit(const int& dpy);
|
||||
explicit FBUpdateSplit(hwc_context_t *ctx, const int& dpy);
|
||||
virtual ~FBUpdateSplit() {};
|
||||
bool prepare(hwc_context_t *ctx, hwc_display_contents_1 *list,
|
||||
int fbZorder);
|
||||
|
||||
@@ -55,7 +55,7 @@ static void setup(hwc_context_t* ctx, int dpy)
|
||||
if (compositionType & (qdutils::COMPOSITION_TYPE_DYN |
|
||||
qdutils::COMPOSITION_TYPE_MDP |
|
||||
qdutils::COMPOSITION_TYPE_C2D)) {
|
||||
ctx->mCopyBit[dpy] = new CopyBit();
|
||||
ctx->mCopyBit[dpy] = new CopyBit(ctx, dpy);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,8 @@ void initContext(hwc_context_t *ctx)
|
||||
if (compositionType & (qdutils::COMPOSITION_TYPE_DYN |
|
||||
qdutils::COMPOSITION_TYPE_MDP |
|
||||
qdutils::COMPOSITION_TYPE_C2D)) {
|
||||
ctx->mCopyBit[HWC_DISPLAY_PRIMARY] = new CopyBit();
|
||||
ctx->mCopyBit[HWC_DISPLAY_PRIMARY] = new CopyBit(ctx,
|
||||
HWC_DISPLAY_PRIMARY);
|
||||
}
|
||||
|
||||
ctx->mExtDisplay = new ExternalDisplay(ctx);
|
||||
@@ -1261,7 +1262,7 @@ void setMdpFlags(hwc_layer_1_t *layer,
|
||||
ovutils::eMdpFlags &mdpFlags,
|
||||
int rotDownscale, int transform) {
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
|
||||
MetaData_t *metadata = hnd ? (MetaData_t *)hnd->base_metadata : NULL;
|
||||
|
||||
if(layer->blending == HWC_BLENDING_PREMULT) {
|
||||
ovutils::setMdpFlags(mdpFlags,
|
||||
|
||||
Reference in New Issue
Block a user