Bug 759506 - GonkNativeWindow and layers changes for B2G zero-copy OMX hardware decoding r=kanru

This commit is contained in:
Edwin Flores 2012-09-27 16:33:42 +12:00
Родитель 10f459ae75
Коммит 2d29e71ff1
4 изменённых файлов: 29 добавлений и 7 удалений

Просмотреть файл

@ -303,6 +303,18 @@ int GonkNativeWindow::getSlotFromBufferLocked(
return BAD_VALUE;
}
mozilla::layers::SurfaceDescriptor *
GonkNativeWindow::getSurfaceDescriptorFromBuffer(ANativeWindowBuffer* buffer)
{
int buf = getSlotFromBufferLocked(buffer);
if (buf < 0 || buf >= mBufferCount ||
mSlots[buf].mBufferState != BufferSlot::DEQUEUED) {
return nullptr;
}
return &mSlots[buf].mSurfaceDescriptor;
}
int GonkNativeWindow::queueBuffer(ANativeWindowBuffer* buffer)
{
{
@ -433,9 +445,10 @@ int GonkNativeWindow::cancelBuffer(ANativeWindowBuffer* buffer)
int GonkNativeWindow::perform(int operation, va_list args)
{
switch (operation) {
case NATIVE_WINDOW_SET_BUFFERS_SIZE:
case NATIVE_WINDOW_SET_SCALING_MODE:
case NATIVE_WINDOW_SET_CROP:
case NATIVE_WINDOW_CONNECT:
// deprecated. must return NO_ERROR.
return NO_ERROR;
case NATIVE_WINDOW_DISCONNECT:
// deprecated. must return NO_ERROR.
return NO_ERROR;
@ -451,9 +464,7 @@ int GonkNativeWindow::perform(int operation, va_list args)
return dispatchSetBuffersDimensions(args);
case NATIVE_WINDOW_SET_BUFFERS_FORMAT:
return dispatchSetBuffersFormat(args);
case NATIVE_WINDOW_SET_CROP:
case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM:
case NATIVE_WINDOW_SET_SCALING_MODE:
case NATIVE_WINDOW_LOCK:
case NATIVE_WINDOW_UNLOCK_AND_POST:
case NATIVE_WINDOW_API_CONNECT:

Просмотреть файл

@ -50,11 +50,13 @@ public:
class GonkNativeWindow : public EGLNativeBase<ANativeWindow, GonkNativeWindow, RefBase>
{
typedef mozilla::layers::SurfaceDescriptor SurfaceDescriptor;
typedef mozilla::layers::GraphicBufferLocked GraphicBufferLocked;
public:
enum { MIN_UNDEQUEUED_BUFFERS = 2 };
enum { MIN_BUFFER_SLOTS = MIN_UNDEQUEUED_BUFFERS };
enum { NUM_BUFFER_SLOTS = 32 };
enum { NATIVE_WINDOW_SET_BUFFERS_SIZE = 0x10000000 };
GonkNativeWindow();
GonkNativeWindow(GonkNativeWindowNewFrameCallback* aCallback);
@ -80,6 +82,8 @@ public:
// Release all internal buffers
void abandon();
SurfaceDescriptor *getSurfaceDescriptorFromBuffer(ANativeWindowBuffer* buffer);
protected:
virtual int cancelBuffer(ANativeWindowBuffer* buffer);
virtual int dequeueBuffer(ANativeWindowBuffer** buffer);
@ -234,6 +238,7 @@ private:
class CameraGraphicBuffer : public mozilla::layers::GraphicBufferLocked
{
typedef mozilla::layers::SurfaceDescriptor SurfaceDescriptor;
typedef mozilla::layers::ImageBridgeChild ImageBridgeChild;
public:
CameraGraphicBuffer(GonkNativeWindow* aNativeWindow,

Просмотреть файл

@ -33,6 +33,12 @@ CPPSRCS += \
GonkCameraHwMgr.cpp \
GonkNativeWindow.cpp \
$(NULL)
else ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
CPPSRCS += \
FallbackCameraManager.cpp \
FallbackCameraControl.cpp \
GonkNativeWindow.cpp \
$(NULL)
else
CPPSRCS += \
FallbackCameraManager.cpp \
@ -46,7 +52,9 @@ XPIDLSRCS = \
$(NULL)
EXPORTS = \
CameraCommon.h \
DOMCameraManager.h \
GonkNativeWindow.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1001,9 +1001,7 @@ ShadowImageLayerOGL::RenderLayer(int aPreviousFrameBuffer,
program->SetTextureUnit(0);
program->LoadMask(GetMaskLayer());
mOGLManager->BindAndDrawQuadWithTextureRect(program,
GetVisibleRegion().GetBounds(),
nsIntSize(mSize.width, mSize.height));
mOGLManager->BindAndDrawQuad(program);
gl()->fBindTexture(LOCAL_GL_TEXTURE_EXTERNAL, 0);
#endif
} else if (mSharedHandle) {