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