Set Position for HDMI in setPosition

This is necessary to adjust aspect ratio based on the crop, since
src values are modified in crop.

Change-Id: Icfb20df5b6ac4e93dfa85b73c4f74b738a4d3e59
CRs-fixed: 290069
This commit is contained in:
Saurabh Shah 2011-06-01 16:41:33 -07:00 committed by Govind Surti
parent 58c70bc3e5
commit 3ce61a332f
2 changed files with 17 additions and 15 deletions

View File

@ -179,7 +179,8 @@ unsigned int overlay::getOverlayConfig (unsigned int format3D) {
Overlay::Overlay() : mChannelUP(false), mHDMIConnected(false),
mCloseChannel(false), mS3DFormat(0),
mWidth(0), mHeight(0) {
mWidth(0), mHeight(0),
mCroppedSrcWidth(0), mCroppedSrcHeight(0) {
}
Overlay::~Overlay() {
@ -199,6 +200,8 @@ bool Overlay::startChannel(int w, int h, int format, int fbnum,
unsigned int format3D, int channel,
bool ignoreFB, int num_buffers) {
int zorder = 0;
mCroppedSrcWidth = w;
mCroppedSrcHeight = h;
if (format3D)
zorder = channel;
mChannelUP = objOvCtrlChannel[channel].startControlChannel(w, h, format, fbnum,
@ -216,13 +219,6 @@ bool Overlay::startChannelHDMI(int w, int h, int format, bool norot) {
bool ret = startChannel(w, h, format, FRAMEBUFFER_0, norot);
if(ret) {
ret = startChannel(w, h, format, FRAMEBUFFER_1, true, 0, 0, VG1_PIPE);
overlay_rect rect;
if(ret && objOvCtrlChannel[VG1_PIPE].getAspectRatioPosition(w, h, &rect)) {
if(!setChannelPosition(rect.x, rect.y, rect.w, rect.h, VG1_PIPE)) {
LOGE("Failed to upscale for framebuffer 1");
return false;
}
}
}
return ret;
}
@ -273,13 +269,15 @@ bool Overlay::getOrientation(int& orientation, int channel) const {
}
bool Overlay::setPosition(int x, int y, uint32_t w, uint32_t h) {
if(mS3DFormat && mHDMIConnected) {
return setPositionS3D(x, y, w, h);
}
if(mHDMIConnected) {
overlay_rect rect;
objOvCtrlChannel[VG1_PIPE].getAspectRatioPosition(w, h, &rect);
setChannelPosition(rect.x, rect.y, rect.w, rect.h, VG1_PIPE);
if(mS3DFormat) {
return setPositionS3D(x, y, w, h);
} else {
overlay_rect rect;
objOvCtrlChannel[VG1_PIPE].getAspectRatioPosition(mCroppedSrcWidth,
mCroppedSrcHeight, &rect);
setChannelPosition(rect.x, rect.y, rect.w, rect.h, VG1_PIPE);
}
}
return setChannelPosition(x, y, w, h, VG0_PIPE);
}
@ -420,6 +418,8 @@ bool Overlay::setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h) {
bool ret;
overlay_rect rect, inRect;
inRect.x = x; inRect.y = y; inRect.w = w; inRect.h = h;
mCroppedSrcWidth = w;
mCroppedSrcHeight = h;
if (mHDMIConnected) {
if (mS3DFormat) {

View File

@ -212,7 +212,9 @@ class Overlay {
unsigned int mS3DFormat;
int mWidth;
int mHeight;
//Actual cropped source width and height of overlay
int mCroppedSrcWidth;
int mCroppedSrcHeight;
OverlayControlChannel objOvCtrlChannel[2];
OverlayDataChannel objOvDataChannel[2];