display: Add support for video rotation on Ext display

- sourceTransform in the hwc_layer_t has the source buffer transform,
  use this transform for external display.
- This helps in showing videos with source orientation properly on the
  external display

CRs-fixed: 387357
Change-Id: I2ac7e5481a27b93d10ba3fc1ad2e4a8788dc20a5
(cherry picked from commit a51a41188d34db49528edadadbf9ddbc052e772d)
This commit is contained in:
Arun Kumar K.R 2012-08-28 18:33:09 -07:00 committed by Andrew Sutherland
parent b39f56b071
commit 6f560322d7
2 changed files with 10 additions and 4 deletions

View File

@ -215,9 +215,8 @@ bool configExtVid(hwc_context_t *ctx, hwc_layer_t *layer) {
//Only for External
ov.setCrop(dcrop, ovutils::OV_PIPE1);
// FIXME: Use source orientation for TV when source is portrait
//Only for External
ov.setTransform(0, ovutils::OV_PIPE1);
//use sourceTransform only for External
ov.setTransform(layer->sourceTransform, ovutils::OV_PIPE1);
ovutils::Dim dpos;
hwc_rect_t displayFrame = layer->displayFrame;

View File

@ -57,11 +57,13 @@ public:
void dump() const;
private:
overlay::GenericPipe<ovutils::EXTERNAL> mVideoExt;
utils::eTransform mSrcTransform;
};
//------------------Inlines -----------------------------
inline VideoExtPipe::VideoExtPipe() {}
inline VideoExtPipe::VideoExtPipe() :
mSrcTransform(utils::OVERLAY_TRANSFORM_0) {}
inline VideoExtPipe::~VideoExtPipe() { close(); }
inline bool VideoExtPipe::init(RotatorBase* rot) {
ALOGE_IF(DEBUG_OVERLAY, "VideoExtPipe init");
@ -86,6 +88,10 @@ inline bool VideoExtPipe::setPosition(const utils::Dim& dim)
// Use cached crop data to get aspect ratio
utils::Dim crop = mVideoExt.getCrop();
utils::Whf whf(crop.w, crop.h, 0);
// Swap width and height when there is a 90/270 deg rotation
if(mSrcTransform & HAL_TRANSFORM_ROT_90)
utils::swap(whf.w, whf.h);
d = mVideoExt.getAspectRatio(whf);
}
ALOGE_IF(DEBUG_OVERLAY, "Calculated aspect ratio for EXT: x=%d, y=%d, w=%d,"
@ -94,6 +100,7 @@ inline bool VideoExtPipe::setPosition(const utils::Dim& dim)
return mVideoExt.setPosition(d);
}
inline bool VideoExtPipe::setTransform(const utils::eTransform& param) {
mSrcTransform = param;
return mVideoExt.setTransform(param);
}
inline bool VideoExtPipe::setSource(const utils::PipeArgs& args) {