Add overlay_buffer_info structure to hold the buffer geometry
The overlay_buffer_info buffer geometry and size. When calling the overlay from the gralloc or hardware composer, populate this structure with the information from the gralloc handle. (cherry picked from commit 128adc3b8177ef72f2bf21f4022d7ef06ed9281b) Change-Id: I2f60f691ac01e67f150c753f168be754b14f94e6
This commit is contained in:
parent
cb098e76e8
commit
49dbd79cf7
libgralloc-qsd8k
libhwcomposer
liboverlay
@ -227,9 +227,18 @@ static void *hdmi_ui_loop(void *ptr)
|
||||
pTemp->closeChannel();
|
||||
else if (m->enableHDMIOutput && !m->videoOverlay) {
|
||||
if (!pTemp->isChannelUP()) {
|
||||
int alignedW = ALIGN(m->info.xres, 32);
|
||||
if (pTemp->startChannel(alignedW, m->info.yres,
|
||||
m->fbFormat, 1, false, true, 0, VG0_PIPE, true)) {
|
||||
int alignedW = ALIGN(m->info.xres, 32);
|
||||
|
||||
private_handle_t const* hnd =
|
||||
reinterpret_cast<private_handle_t const*>(m->framebuffer);
|
||||
overlay_buffer_info info;
|
||||
info.width = alignedW;
|
||||
info.height = hnd->height;
|
||||
info.format = hnd->format;
|
||||
info.size = hnd->size;
|
||||
|
||||
if (pTemp->startChannel(info, 1,
|
||||
false, true, 0, VG0_PIPE, true)) {
|
||||
pTemp->setFd(m->framebuffer->fd);
|
||||
pTemp->setCrop(0, 0, m->info.xres, m->info.yres);
|
||||
} else
|
||||
|
@ -199,6 +199,12 @@ static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer) {
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
overlay::Overlay *ovLibObject = ctx->mOverlayLibObject;
|
||||
int orientation = 0;
|
||||
overlay_buffer_info info;
|
||||
info.width = hnd->width;
|
||||
info.height = hnd->height;
|
||||
info.format = hnd->format;
|
||||
info.size = hnd->size;
|
||||
|
||||
if (OVERLAY_CHANNEL_UP == ovLibObject->getChannelStatus())
|
||||
ovLibObject->getOrientation(orientation);
|
||||
|
||||
@ -208,9 +214,8 @@ static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer) {
|
||||
// Overlay channel is not started, or we have an orientation change
|
||||
// or there is a format change, call setSource to open the overlay
|
||||
// if necessary
|
||||
ret = ovLibObject->setSource(hnd->width, hnd->height, hnd->format,
|
||||
layer->transform, (ovLibObject->getHDMIStatus()?true:false),
|
||||
false);
|
||||
ret = ovLibObject->setSource(info, layer->transform,
|
||||
(ovLibObject->getHDMIStatus()?true:false), false);
|
||||
if (!ret) {
|
||||
LOGE("prepareOverlay setSource failed");
|
||||
return -1;
|
||||
@ -221,8 +226,7 @@ static int prepareOverlay(hwc_context_t *ctx, hwc_layer_t *layer) {
|
||||
} else {
|
||||
// The overlay goemetry may have changed, we only need to update the
|
||||
// overlay
|
||||
ret = ovLibObject->updateOverlaySource(hnd->width, hnd->height,
|
||||
hnd->format, layer->transform);
|
||||
ret = ovLibObject->updateOverlaySource(info, layer->transform);
|
||||
if (!ret) {
|
||||
LOGE("prepareOverlay updateOverlaySource failed");
|
||||
return -1;
|
||||
@ -475,6 +479,7 @@ static int drawLayerUsingOverlay(hwc_context_t *ctx, hwc_layer_t *layer)
|
||||
private_handle_t *hnd = (private_handle_t *)layer->handle;
|
||||
overlay::Overlay *ovLibObject = ctx->mOverlayLibObject;
|
||||
int ret = 0;
|
||||
|
||||
ret = ovLibObject->queueBuffer(hnd);
|
||||
if (!ret) {
|
||||
LOGE("drawLayerUsingOverlay queueBuffer failed");
|
||||
|
@ -46,44 +46,6 @@ int overlay::get_mdp_format(int format) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int overlay::get_size(int format, int w, int h) {
|
||||
int size, aligned_height, pitch;
|
||||
|
||||
size = w * h;
|
||||
switch (format) {
|
||||
case MDP_RGBA_8888:
|
||||
case MDP_BGRA_8888:
|
||||
case MDP_RGBX_8888:
|
||||
size *= 4;
|
||||
break;
|
||||
case MDP_RGB_565:
|
||||
case MDP_Y_CBCR_H2V1:
|
||||
size *= 2;
|
||||
break;
|
||||
case MDP_Y_CBCR_H2V2:
|
||||
case MDP_Y_CRCB_H2V2: {
|
||||
int alignedw = ALIGN(w, 16);
|
||||
int alignedh = h;
|
||||
size = alignedw*alignedh +
|
||||
(ALIGN(alignedw/2, 16) * (alignedh/2))*2;
|
||||
size = ALIGN(size, 4096);
|
||||
} break;
|
||||
case MDP_Y_CRCB_H2V2_TILE:
|
||||
aligned_height = (h + 31) & ~31;
|
||||
pitch = (w + 127) & ~127;
|
||||
size = pitch * aligned_height;
|
||||
size = (size + 8191) & ~8191;
|
||||
|
||||
aligned_height = ((h >> 1) + 31) & ~31;
|
||||
size += pitch * aligned_height;
|
||||
size = (size + 8191) & ~8191;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
int overlay::get_mdp_orientation(int rotation, int flip) {
|
||||
switch(flip) {
|
||||
case HAL_TRANSFORM_FLIP_V:
|
||||
@ -178,8 +140,10 @@ unsigned int overlay::getOverlayConfig (unsigned int format3D) {
|
||||
}
|
||||
|
||||
Overlay::Overlay() : mChannelUP(false), mHDMIConnected(false),
|
||||
mS3DFormat(0), mWidth(0), mHeight(0),
|
||||
mCroppedSrcWidth(0), mCroppedSrcHeight(0) {
|
||||
mS3DFormat(0), mCroppedSrcWidth(0),
|
||||
mCroppedSrcHeight(0) {
|
||||
mOVBufferInfo.width = mOVBufferInfo.height = 0;
|
||||
mOVBufferInfo.format = mOVBufferInfo.size = 0;
|
||||
}
|
||||
|
||||
Overlay::~Overlay() {
|
||||
@ -194,43 +158,47 @@ int Overlay::getFBHeight(int channel) const {
|
||||
return objOvCtrlChannel[channel].getFBHeight();
|
||||
}
|
||||
|
||||
bool Overlay::startChannel(int w, int h, int format, int fbnum,
|
||||
bool Overlay::startChannel(const overlay_buffer_info& info, int fbnum,
|
||||
bool norot, bool uichannel,
|
||||
unsigned int format3D, int channel,
|
||||
bool ignoreFB, int num_buffers) {
|
||||
int zorder = 0;
|
||||
mCroppedSrcWidth = w;
|
||||
mCroppedSrcHeight = h;
|
||||
int format = getColorFormat(info.format);
|
||||
mCroppedSrcWidth = info.width;
|
||||
mCroppedSrcHeight = info.height;
|
||||
if (format3D)
|
||||
zorder = channel;
|
||||
mChannelUP = objOvCtrlChannel[channel].startControlChannel(w, h, format, fbnum,
|
||||
norot, uichannel, format3D, zorder, ignoreFB);
|
||||
mChannelUP = objOvCtrlChannel[channel].startControlChannel(info.width,
|
||||
info.height, format, fbnum,
|
||||
norot, uichannel,
|
||||
format3D, zorder, ignoreFB);
|
||||
if (!mChannelUP) {
|
||||
LOGE("startChannel for fb%d failed", fbnum);
|
||||
return mChannelUP;
|
||||
}
|
||||
objOvCtrlChannel[channel].setSize(info.size);
|
||||
return objOvDataChannel[channel].startDataChannel(objOvCtrlChannel[channel], fbnum,
|
||||
norot, uichannel, num_buffers);
|
||||
}
|
||||
|
||||
bool Overlay::startChannelHDMI(int w, int h, int format, bool norot) {
|
||||
bool Overlay::startChannelHDMI(const overlay_buffer_info& info, bool norot) {
|
||||
|
||||
bool ret = startChannel(w, h, format, FRAMEBUFFER_0, norot);
|
||||
bool ret = startChannel(info, FRAMEBUFFER_0, norot);
|
||||
if(ret) {
|
||||
ret = startChannel(w, h, format, FRAMEBUFFER_1, true, 0, 0, VG1_PIPE);
|
||||
ret = startChannel(info, FRAMEBUFFER_1, true, 0, 0, VG1_PIPE);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Overlay::startChannelS3D(int w, int h, int format, bool norot) {
|
||||
bool Overlay::startChannelS3D(const overlay_buffer_info& info, bool norot) {
|
||||
bool ret = false;
|
||||
// Start both the channels for the S3D content
|
||||
if (mS3DFormat & HAL_3D_OUT_MONOSCOPIC_MASK)
|
||||
ret = startChannel(w, h, format, FRAMEBUFFER_0, norot, 0, mS3DFormat, VG0_PIPE);
|
||||
ret = startChannel(info, FRAMEBUFFER_0, norot, 0, mS3DFormat, VG0_PIPE);
|
||||
else
|
||||
ret = startChannel(w, h, format, FRAMEBUFFER_1, norot, 0, mS3DFormat, VG0_PIPE);
|
||||
ret = startChannel(info, FRAMEBUFFER_1, norot, 0, mS3DFormat, VG0_PIPE);
|
||||
if (ret) {
|
||||
ret = startChannel(w, h, format, FRAMEBUFFER_1, norot, 0, mS3DFormat, VG1_PIPE);
|
||||
ret = startChannel(info, FRAMEBUFFER_1, norot, 0, mS3DFormat, VG1_PIPE);
|
||||
}
|
||||
if (!ret) {
|
||||
closeChannel();
|
||||
@ -253,8 +221,10 @@ bool Overlay::closeChannel() {
|
||||
}
|
||||
mChannelUP = false;
|
||||
mS3DFormat = 0;
|
||||
mWidth = 0;
|
||||
mHeight = 0;
|
||||
mOVBufferInfo.width = 0;
|
||||
mOVBufferInfo.height = 0;
|
||||
mOVBufferInfo.format = 0;
|
||||
mOVBufferInfo.size = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -301,35 +271,33 @@ bool Overlay::setPositionS3D(int x, int y, uint32_t w, uint32_t h) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Overlay::updateOverlaySource(uint32_t w, uint32_t h, int format, int orientation) {
|
||||
bool Overlay::updateOverlaySource(const overlay_buffer_info& info, int orientation) {
|
||||
if (hasHDMIStatusChanged()) {
|
||||
return setSource(w, h, format, orientation, mHDMIConnected);
|
||||
return setSource(info, orientation, mHDMIConnected);
|
||||
}
|
||||
|
||||
bool ret = false;
|
||||
if (w == mWidth && h == mHeight) {
|
||||
if (info.width == mOVBufferInfo.width &&
|
||||
info.height == mOVBufferInfo.height) {
|
||||
objOvDataChannel[0].updateDataChannel(0, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set the overlay source info
|
||||
if (objOvCtrlChannel[0].isChannelUP()) {
|
||||
ret = objOvCtrlChannel[0].updateOverlaySource(w, h, format, orientation);
|
||||
if (!ret) {
|
||||
LOGE("objOvCtrlChannel[0].updateOverlaySource failed");
|
||||
return false;
|
||||
for (int i = 0; i < NUM_CHANNELS; i++) {
|
||||
if (objOvCtrlChannel[i].isChannelUP()) {
|
||||
ret = objOvCtrlChannel[i].updateOverlaySource(info, orientation);
|
||||
if (!ret) {
|
||||
LOGE("objOvCtrlChannel[%d].updateOverlaySource failed", i);
|
||||
return false;
|
||||
}
|
||||
objOvCtrlChannel[i].setSize(info.size);
|
||||
int updateDataChannel = orientation ? 1:0;
|
||||
ret = objOvDataChannel[i].updateDataChannel(updateDataChannel, info.size);
|
||||
}
|
||||
int updateDataChannel = orientation ? 1:0;
|
||||
int size = get_size(get_mdp_format(format), w, h);
|
||||
ret = objOvDataChannel[0].updateDataChannel(updateDataChannel, size);
|
||||
|
||||
if (ret && objOvCtrlChannel[1].isChannelUP())
|
||||
ret = objOvCtrlChannel[1].updateOverlaySource(w, h, format, orientation);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
mOVBufferInfo = info;
|
||||
} else
|
||||
LOGE("update failed");
|
||||
return ret;
|
||||
@ -351,23 +319,28 @@ int Overlay::hasHDMIStatusChanged() {
|
||||
return hdmiChanged;
|
||||
}
|
||||
|
||||
bool Overlay::setSource(uint32_t w, uint32_t h, int format, int orientation,
|
||||
bool hdmiConnected, bool ignoreFB, int num_buffers) {
|
||||
// Separate the color format from the 3D format.
|
||||
// If there is 3D content; the effective format passed by the client is:
|
||||
// effectiveFormat = 3D_IN | 3D_OUT | ColorFormat
|
||||
unsigned int format3D = FORMAT_3D(format);
|
||||
int colorFormat = COLOR_FORMAT(format);
|
||||
int Overlay::getS3DFormat(int format) {
|
||||
int format3D = FORMAT_3D(format);
|
||||
int fIn3D = FORMAT_3D_INPUT(format3D); // MSB 2 bytes are input format
|
||||
int fOut3D = FORMAT_3D_OUTPUT(format3D); // LSB 2 bytes are output format
|
||||
format3D = fIn3D | fOut3D;
|
||||
// Use the same in/out format if not mentioned
|
||||
if (!fIn3D) {
|
||||
format3D |= fOut3D << SHIFT_3D; //Set the input format
|
||||
}
|
||||
if (!fOut3D) {
|
||||
format3D |= fIn3D >> SHIFT_3D; //Set the output format
|
||||
}
|
||||
return format3D;
|
||||
}
|
||||
|
||||
bool Overlay::setSource(const overlay_buffer_info& info, int orientation,
|
||||
bool hdmiConnected, bool ignoreFB, int num_buffers) {
|
||||
// Separate the color format from the 3D format.
|
||||
// If there is 3D content; the effective format passed by the client is:
|
||||
// effectiveFormat = 3D_IN | 3D_OUT | ColorFormat
|
||||
unsigned int format3D = getS3DFormat(info.format);
|
||||
int colorFormat = getColorFormat(info.format);
|
||||
|
||||
if (format3D) {
|
||||
bool isTV3D = false;
|
||||
if (hdmiConnected)
|
||||
@ -385,21 +358,20 @@ bool Overlay::setSource(uint32_t w, uint32_t h, int format, int orientation,
|
||||
s3dChanged = 0x10;
|
||||
|
||||
stateChanged = s3dChanged|hasHDMIStatusChanged();
|
||||
if (stateChanged || !objOvCtrlChannel[0].setSource(w, h, colorFormat, orientation, ignoreFB)) {
|
||||
if (stateChanged || !objOvCtrlChannel[0].setSource(info.width, info.height, colorFormat, orientation, ignoreFB)) {
|
||||
closeChannel();
|
||||
mS3DFormat = format3D;
|
||||
|
||||
mWidth = w;
|
||||
mHeight = h;
|
||||
mOVBufferInfo = info;
|
||||
if (mHDMIConnected) {
|
||||
if (mS3DFormat) {
|
||||
// Start both the VG pipes
|
||||
return startChannelS3D(w, h, colorFormat, !orientation);
|
||||
return startChannelS3D(info, !orientation);
|
||||
} else {
|
||||
return startChannelHDMI(w, h, colorFormat, !orientation);
|
||||
return startChannelHDMI(info, !orientation);
|
||||
}
|
||||
} else {
|
||||
return startChannel(w, h, colorFormat, 0, !orientation,
|
||||
return startChannel(info, 0, !orientation,
|
||||
false, 0, VG0_PIPE, ignoreFB, num_buffers);
|
||||
}
|
||||
}
|
||||
@ -481,6 +453,10 @@ bool Overlay::queueBuffer(uint32_t offset, int channel) {
|
||||
bool Overlay::queueBuffer(buffer_handle_t buffer) {
|
||||
private_handle_t const* hnd = reinterpret_cast
|
||||
<private_handle_t const*>(buffer);
|
||||
if (!hnd) {
|
||||
LOGE("Overlay::queueBuffer invalid handle");
|
||||
return false;
|
||||
}
|
||||
const size_t offset = hnd->offset;
|
||||
const int fd = hnd->fd;
|
||||
bool ret = true;
|
||||
@ -659,9 +635,13 @@ bool OverlayControlChannel::openDevices(int fbnum) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OverlayControlChannel::setOverlayInformation(int w, int h,
|
||||
int format, int flags, int orientation, int zorder,
|
||||
bool OverlayControlChannel::setOverlayInformation(const overlay_buffer_info& info,
|
||||
int flags, int orientation, int zorder,
|
||||
bool ignoreFB, int requestType) {
|
||||
int w = info.width;
|
||||
int h = info.height;
|
||||
int format = info.format;
|
||||
|
||||
mOVInfo.src.width = w;
|
||||
mOVInfo.src.height = h;
|
||||
mOVInfo.src_rect.x = 0;
|
||||
@ -704,13 +684,16 @@ bool OverlayControlChannel::setOverlayInformation(int w, int h,
|
||||
if (!ignoreFB)
|
||||
mOVInfo.flags |= MDP_OV_PLAY_NOWAIT;
|
||||
}
|
||||
mSize = get_size(format, w, h);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OverlayControlChannel::startOVRotatorSessions(int w, int h,
|
||||
int format, int orientation, int requestType) {
|
||||
bool OverlayControlChannel::startOVRotatorSessions(
|
||||
const overlay_buffer_info& info,
|
||||
int orientation, int requestType) {
|
||||
bool ret = true;
|
||||
int w = info.width;
|
||||
int h = info.height;
|
||||
int format = info.format;
|
||||
|
||||
if (orientation) {
|
||||
mRotInfo.src.format = format;
|
||||
@ -763,13 +746,18 @@ bool OverlayControlChannel::startOVRotatorSessions(int w, int h,
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool OverlayControlChannel::updateOverlaySource(uint32_t w, uint32_t h, int format, int orientation)
|
||||
bool OverlayControlChannel::updateOverlaySource(const overlay_buffer_info& info,
|
||||
int orientation)
|
||||
{
|
||||
int hw_format = get_mdp_format(format);
|
||||
if (!setOverlayInformation(w, h, hw_format, 0, orientation, 0, 0, UPDATE_REQUEST))
|
||||
int hw_format = get_mdp_format(info.format);
|
||||
overlay_buffer_info ovBufInfo;
|
||||
ovBufInfo.width = info.width;
|
||||
ovBufInfo.height = info.height;
|
||||
ovBufInfo.format = hw_format;
|
||||
if (!setOverlayInformation(ovBufInfo, 0, orientation, 0, 0, UPDATE_REQUEST))
|
||||
return false;
|
||||
|
||||
return startOVRotatorSessions(w, h, hw_format, orientation, UPDATE_REQUEST);
|
||||
return startOVRotatorSessions(ovBufInfo, orientation, UPDATE_REQUEST);
|
||||
}
|
||||
|
||||
bool OverlayControlChannel::startControlChannel(int w, int h,
|
||||
@ -806,10 +794,14 @@ bool OverlayControlChannel::startControlChannel(int w, int h,
|
||||
return false;
|
||||
|
||||
int orientation = mNoRot ? 0: 1;
|
||||
if (!setOverlayInformation(w, h, hw_format, flags, orientation, zorder, ignoreFB, NEW_REQUEST))
|
||||
overlay_buffer_info ovBufInfo;
|
||||
ovBufInfo.width = w;
|
||||
ovBufInfo.height = h;
|
||||
ovBufInfo.format = hw_format;
|
||||
if (!setOverlayInformation(ovBufInfo, flags, orientation, zorder, ignoreFB, NEW_REQUEST))
|
||||
return false;
|
||||
|
||||
return startOVRotatorSessions(w, h, hw_format, orientation, NEW_REQUEST);
|
||||
return startOVRotatorSessions(ovBufInfo, orientation, NEW_REQUEST);
|
||||
}
|
||||
|
||||
bool OverlayControlChannel::closeControlChannel() {
|
||||
|
@ -90,6 +90,14 @@ enum {
|
||||
#define EDID_3D_INFO_FILE "/sys/class/graphics/fb1/3d_present"
|
||||
/* -------------------------- end 3D defines ----------------------------------------*/
|
||||
|
||||
// Struct to hold the buffer info: geometry and size
|
||||
struct overlay_buffer_info {
|
||||
int width;
|
||||
int height;
|
||||
int format;
|
||||
int size;
|
||||
};
|
||||
|
||||
namespace overlay {
|
||||
|
||||
enum {
|
||||
@ -130,10 +138,10 @@ class OverlayControlChannel {
|
||||
mdp_overlay mOVInfo;
|
||||
msm_rotator_img_info mRotInfo;
|
||||
bool openDevices(int fbnum = -1);
|
||||
bool setOverlayInformation(int w, int h, int format,
|
||||
bool setOverlayInformation(const overlay_buffer_info& info,
|
||||
int flags, int orientation, int zorder = 0, bool ignoreFB = false,
|
||||
int requestType = NEW_REQUEST);
|
||||
bool startOVRotatorSessions(int w, int h, int format, int orientation, int requestType);
|
||||
bool startOVRotatorSessions(const overlay_buffer_info& info, int orientation, int requestType);
|
||||
void swapOVRotWidthHeight();
|
||||
|
||||
public:
|
||||
@ -147,6 +155,7 @@ public:
|
||||
bool closeControlChannel();
|
||||
bool setPosition(int x, int y, uint32_t w, uint32_t h);
|
||||
bool setParameter(int param, int value, bool fetch = true);
|
||||
void setSize (int size) { mSize = size; }
|
||||
bool getPosition(int& x, int& y, uint32_t& w, uint32_t& h);
|
||||
bool getOvSessionID(int& sessionID) const;
|
||||
bool getRotSessionID(int& sessionID) const;
|
||||
@ -160,7 +169,7 @@ public:
|
||||
int orientation, bool ignoreFB);
|
||||
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 updateOverlaySource(const overlay_buffer_info& info, int orientation);
|
||||
bool getFormat() const { return mFormat; }
|
||||
};
|
||||
|
||||
@ -212,11 +221,10 @@ class Overlay {
|
||||
bool mChannelUP;
|
||||
bool mHDMIConnected;
|
||||
unsigned int mS3DFormat;
|
||||
int mWidth;
|
||||
int mHeight;
|
||||
//Actual cropped source width and height of overlay
|
||||
int mCroppedSrcWidth;
|
||||
int mCroppedSrcHeight;
|
||||
overlay_buffer_info mOVBufferInfo;
|
||||
OverlayControlChannel objOvCtrlChannel[2];
|
||||
OverlayDataChannel objOvDataChannel[2];
|
||||
|
||||
@ -224,7 +232,7 @@ public:
|
||||
Overlay();
|
||||
~Overlay();
|
||||
|
||||
bool startChannel(int w, int h, int format, int fbnum, bool norot = false,
|
||||
bool startChannel(const overlay_buffer_info& info, int fbnum, bool norot = false,
|
||||
bool uichannel = false, unsigned int format3D = 0,
|
||||
int channel = 0, bool ignoreFB = false,
|
||||
int num_buffers = 2);
|
||||
@ -240,24 +248,25 @@ public:
|
||||
int getFBHeight(int channel = 0) const;
|
||||
bool getOrientation(int& orientation, int channel = 0) const;
|
||||
bool queueBuffer(buffer_handle_t buffer);
|
||||
bool setSource(uint32_t w, uint32_t h, int format,
|
||||
int orientation, bool hdmiConnected,
|
||||
bool setSource(const overlay_buffer_info& info, int orientation, bool hdmiConnected,
|
||||
bool ignoreFB = false, int numBuffers = 2);
|
||||
bool setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h);
|
||||
int getChannelStatus() const { return (mChannelUP ? OVERLAY_CHANNEL_UP: OVERLAY_CHANNEL_DOWN); }
|
||||
void setHDMIStatus (bool isHDMIConnected) { mHDMIConnected = isHDMIConnected; }
|
||||
int getHDMIStatus() const {return (mHDMIConnected ? HDMI_ON : HDMI_OFF); }
|
||||
bool updateOverlaySource(uint32_t w, uint32_t h, int format, int orientation);
|
||||
bool updateOverlaySource(const overlay_buffer_info& info, int orientation);
|
||||
|
||||
private:
|
||||
bool startChannelHDMI(int w, int h, int format, bool norot);
|
||||
bool startChannelS3D(int w, int h, int format, bool norot);
|
||||
bool startChannelHDMI(const overlay_buffer_info& info, bool norot);
|
||||
bool startChannelS3D(const overlay_buffer_info& info, bool norot);
|
||||
bool setPositionS3D(int x, int y, uint32_t w, uint32_t h);
|
||||
bool setParameterS3D(int param, int value);
|
||||
bool setChannelPosition(int x, int y, uint32_t w, uint32_t h, int channel = 0);
|
||||
bool setChannelCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h, int channel);
|
||||
bool queueBuffer(int fd, uint32_t offset, int channel);
|
||||
int hasHDMIStatusChanged();
|
||||
int getColorFormat(int format) { return COLOR_FORMAT(format); }
|
||||
int getS3DFormat(int format);
|
||||
};
|
||||
|
||||
struct overlay_shared_data {
|
||||
|
@ -299,7 +299,7 @@ status_t OVHelper::getOVInfo(mdp_overlay& ovInfo) {
|
||||
}
|
||||
|
||||
status_t Rotator::startRotSession(msm_rotator_img_info& rotInfo,
|
||||
int numBuffers) {
|
||||
int size, int numBuffers) {
|
||||
status_t ret = ALREADY_EXISTS;
|
||||
if (mSessionID == NO_INIT && mFD == NO_INIT) {
|
||||
mNumBuffers = numBuffers;
|
||||
@ -322,7 +322,7 @@ status_t Rotator::startRotSession(msm_rotator_img_info& rotInfo,
|
||||
return NO_INIT;
|
||||
}
|
||||
|
||||
mSize = get_size(rotInfo.src.format, rotInfo.src.width, rotInfo.src.height);
|
||||
mSize = size;
|
||||
mPmemAddr = (void *) mmap(NULL, mSize* mNumBuffers, PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED, mPmemFD, 0);
|
||||
if (mPmemAddr == MAP_FAILED) {
|
||||
@ -379,14 +379,14 @@ status_t OverlayUI::closeChannel() {
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
status_t OverlayUI::setSource(int w, int h, int format, int orientation,
|
||||
status_t OverlayUI::setSource(const overlay_buffer_info& info, int orientation,
|
||||
bool useVGPipe, bool ignoreFB,
|
||||
int fbnum, int zorder) {
|
||||
status_t ret = NO_INIT;
|
||||
|
||||
int format3D = FORMAT_3D(format);
|
||||
int colorFormat = COLOR_FORMAT(format);
|
||||
format = get_mdp_format(colorFormat);
|
||||
int format3D = FORMAT_3D(info.format);
|
||||
int colorFormat = COLOR_FORMAT(info.format);
|
||||
int format = get_mdp_format(colorFormat);
|
||||
|
||||
if (format3D || !isRGBType(format))
|
||||
return ret;
|
||||
@ -399,7 +399,7 @@ status_t OverlayUI::setSource(int w, int h, int format, int orientation,
|
||||
if (mobjOVHelper.getOVInfo(ov) == NO_ERROR) {
|
||||
if (mOrientation == orientation &&
|
||||
mFBNum == fbnum &&
|
||||
checkOVState(w, h, format, orientation, zorder, ov))
|
||||
checkOVState(info.width, info.height, format, orientation, zorder, ov))
|
||||
return NO_ERROR;
|
||||
else
|
||||
mChannelState = PENDING_CLOSE;
|
||||
@ -412,7 +412,7 @@ status_t OverlayUI::setSource(int w, int h, int format, int orientation,
|
||||
mOrientation = orientation;
|
||||
mdp_overlay ovInfo;
|
||||
msm_rotator_img_info rotInfo;
|
||||
setupOvRotInfo(w, h, format, orientation, ovInfo, rotInfo);
|
||||
setupOvRotInfo(info.width, info.height, format, orientation, ovInfo, rotInfo);
|
||||
|
||||
int flags = 0;
|
||||
if (ignoreFB)
|
||||
@ -431,19 +431,20 @@ status_t OverlayUI::setSource(int w, int h, int format, int orientation,
|
||||
if (zorder != NO_INIT)
|
||||
ovInfo.z_order = zorder;
|
||||
|
||||
ret = startChannel(fbnum, ovInfo, rotInfo);
|
||||
ret = startChannel(fbnum, ovInfo, rotInfo, info.size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
status_t OverlayUI::startChannel(int fbnum, mdp_overlay& ovInfo,
|
||||
msm_rotator_img_info& rotInfo) {
|
||||
msm_rotator_img_info& rotInfo, int size) {
|
||||
status_t ret = BAD_VALUE;
|
||||
if (mChannelState == UP)
|
||||
return ret;
|
||||
|
||||
ret = mobjOVHelper.startOVSession(ovInfo, fbnum);
|
||||
if (ret == NO_ERROR && mOrientation)
|
||||
ret = mobjRotator.startRotSession(rotInfo);
|
||||
if (ret == NO_ERROR && mOrientation) {
|
||||
ret = mobjRotator.startRotSession(rotInfo, size);
|
||||
}
|
||||
|
||||
if (ret == NO_ERROR) {
|
||||
mChannelState = UP;
|
||||
|
@ -107,7 +107,8 @@ class Rotator {
|
||||
public:
|
||||
explicit Rotator() : mFD(NO_INIT), mSessionID(NO_INIT), mPmemFD(-1) { };
|
||||
~Rotator() { closeRotSession(); }
|
||||
status_t startRotSession(msm_rotator_img_info& rotInfo, int numBuffers = max_num_buffers);
|
||||
status_t startRotSession(msm_rotator_img_info& rotInfo, int size,
|
||||
int numBuffers = max_num_buffers);
|
||||
status_t closeRotSession();
|
||||
status_t rotateBuffer(msm_rotator_data_info& rotData);
|
||||
};
|
||||
@ -128,14 +129,14 @@ class OverlayUI {
|
||||
OverlayUI& operator=(const OverlayUI& objOverlay);
|
||||
|
||||
status_t startChannel(int fbnum, mdp_overlay& ovInfo,
|
||||
msm_rotator_img_info& rotInfo);
|
||||
msm_rotator_img_info& rotInfo, int size);
|
||||
public:
|
||||
|
||||
enum fbnum_t { FB0, FB1 };
|
||||
|
||||
explicit OverlayUI() : mChannelState(CLOSED), mOrientation(NO_INIT), mFBNum(NO_INIT) { };
|
||||
~OverlayUI() { closeChannel(); };
|
||||
status_t setSource(int w, int h, int format, int orientation,
|
||||
status_t setSource(const overlay_buffer_info& info, int orientation,
|
||||
bool useVGPipe = false, bool ignoreFB = true,
|
||||
int fbnum = FB0, int zorder = NO_INIT);
|
||||
status_t setPosition(int x, int y, int w, int h) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user