Fix positioning of small videos.

Small videos (width < 128) have their stride as 128. For HDMI
destination position was set only once, before the actual width was
supplied through crop. Now the position is set during a setPosition
API call.

Change-Id: If49ac23b9294951aaf4ad9d5432653082b4a7802
CRs-fixed: 286953
This commit is contained in:
Saurabh Shah 2011-05-20 13:57:35 -07:00 committed by Govind Surti
parent c17c053935
commit 58c70bc3e5
3 changed files with 14 additions and 8 deletions

View File

@ -198,7 +198,7 @@ public:
if (!mHandle.pobjControlChannel[channel])
return false;
return mHandle.pobjControlChannel[channel]->getAspectRatioPosition(mHandle.w,
mHandle.h, mHandle.format, rect);
mHandle.h, rect);
}
bool setParameter(int param, int value, int channel) {

View File

@ -217,7 +217,7 @@ bool Overlay::startChannelHDMI(int w, int h, int format, bool 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, format, &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;
@ -275,9 +275,13 @@ 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);
} else {
return setChannelPosition(x, y, w, h, VG0_PIPE);
}
if(mHDMIConnected) {
overlay_rect rect;
objOvCtrlChannel[VG1_PIPE].getAspectRatioPosition(w, h, &rect);
setChannelPosition(rect.x, rect.y, rect.w, rect.h, VG1_PIPE);
}
return setChannelPosition(x, y, w, h, VG0_PIPE);
}
bool Overlay::setChannelPosition(int x, int y, uint32_t w, uint32_t h, int channel) {
@ -521,7 +525,7 @@ OverlayControlChannel::~OverlayControlChannel() {
closeControlChannel();
}
bool OverlayControlChannel::getAspectRatioPosition(int w, int h, int format, overlay_rect *rect)
bool OverlayControlChannel::getAspectRatioPosition(int w, int h, overlay_rect *rect)
{
int width = w, height = h, x, y;
int fbWidth = getFBWidth();
@ -529,7 +533,7 @@ bool OverlayControlChannel::getAspectRatioPosition(int w, int h, int format, ove
// width and height for YUV TILE format
int tempWidth = w, tempHeight = h;
/* Calculate the width and height if it is YUV TILE format*/
if(format == HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED) {
if(getFormat() == HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED) {
tempWidth = w - ( (((w-1)/64 +1)*64) - w);
tempHeight = h - ((((h-1)/32 +1)*32) - h);
}
@ -779,6 +783,7 @@ bool OverlayControlChannel::startControlChannel(int w, int h,
unsigned int format3D, int zorder,
bool ignoreFB) {
mNoRot = norot;
mFormat = format;
mUIChannel = uichannel;
fb_fix_screeninfo finfo;
fb_var_screeninfo vinfo;

View File

@ -117,7 +117,7 @@ class OverlayControlChannel {
int mFBHeight;
int mFBbpp;
int mFBystride;
int mFormat;
int mFD;
int mRotFD;
int mSize;
@ -155,9 +155,10 @@ public:
bool getOrientation(int& orientation) const;
bool setSource(uint32_t w, uint32_t h, int format,
int orientation, bool ignoreFB);
bool getAspectRatioPosition(int w, int h, int format, overlay_rect *rect);
bool getAspectRatioPosition(int w, int h, overlay_rect *rect);
bool getPositionS3D(int channel, int format, overlay_rect *rect);
bool updateOverlaySource(uint32_t w, uint32_t h, int format, int orientation);
bool getFormat() const { return mFormat; }
};
class OverlayDataChannel {