diff --git a/libhwcomposer/hwc_video.cpp b/libhwcomposer/hwc_video.cpp index 4e7bc5f..cbfcd8e 100644 --- a/libhwcomposer/hwc_video.cpp +++ b/libhwcomposer/hwc_video.cpp @@ -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; diff --git a/liboverlay/pipes/overlayVideoExtPipe.h b/liboverlay/pipes/overlayVideoExtPipe.h index d4e1f3f..b498576 100644 --- a/liboverlay/pipes/overlayVideoExtPipe.h +++ b/liboverlay/pipes/overlayVideoExtPipe.h @@ -57,11 +57,13 @@ public: void dump() const; private: overlay::GenericPipe 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) {