Skip to content

Commit

Permalink
frameworks/base: android_native_buffer_t -> ANativeWindowBuffer
Browse files Browse the repository at this point in the history
Change-Id: Idc2eabaa805bb6d308ebb315872623f28d428417
Signed-off-by: Iliyan Malchev <malchev@google.com>
  • Loading branch information
Iliyan Malchev committed May 3, 2011
1 parent be0cc36 commit b2a153a
Show file tree
Hide file tree
Showing 24 changed files with 117 additions and 117 deletions.
16 changes: 8 additions & 8 deletions include/gui/SurfaceTextureClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ class SurfaceTextureClient
SurfaceTextureClient(const SurfaceTextureClient& rhs);

// ANativeWindow hooks
static int cancelBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int perform(ANativeWindow* window, int operation, ...);
static int query(const ANativeWindow* window, int what, int* value);
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int setSwapInterval(ANativeWindow* window, int interval);

int cancelBuffer(android_native_buffer_t* buffer);
int dequeueBuffer(android_native_buffer_t** buffer);
int lockBuffer(android_native_buffer_t* buffer);
int cancelBuffer(ANativeWindowBuffer* buffer);
int dequeueBuffer(ANativeWindowBuffer** buffer);
int lockBuffer(ANativeWindowBuffer* buffer);
int perform(int operation, va_list args);
int query(int what, int* value) const;
int queueBuffer(android_native_buffer_t* buffer);
int queueBuffer(ANativeWindowBuffer* buffer);
int setSwapInterval(int interval);

int dispatchConnect(va_list args);
Expand Down
2 changes: 1 addition & 1 deletion include/media/stagefright/HardwareAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ struct UseAndroidNativeBufferParams {
OMX_U32 nPortIndex;
OMX_PTR pAppPrivate;
OMX_BUFFERHEADERTYPE **bufferHeader;
const sp<android_native_buffer_t>& nativeBuffer;
const sp<ANativeWindowBuffer>& nativeBuffer;
};

// A pointer to this struct is passed to OMX_GetParameter when the extension
Expand Down
16 changes: 8 additions & 8 deletions include/surfaceflinger/Surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,17 @@ class Surface
* ANativeWindow hooks
*/
static int setSwapInterval(ANativeWindow* window, int interval);
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
static int cancelBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
static int cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int query(const ANativeWindow* window, int what, int* value);
static int perform(ANativeWindow* window, int operation, ...);

int dequeueBuffer(android_native_buffer_t** buffer);
int lockBuffer(android_native_buffer_t* buffer);
int queueBuffer(android_native_buffer_t* buffer);
int cancelBuffer(android_native_buffer_t* buffer);
int dequeueBuffer(ANativeWindowBuffer** buffer);
int lockBuffer(ANativeWindowBuffer* buffer);
int queueBuffer(ANativeWindowBuffer* buffer);
int cancelBuffer(ANativeWindowBuffer* buffer);
int query(int what, int* value) const;
int perform(int operation, va_list args);

Expand Down
6 changes: 3 additions & 3 deletions include/ui/FramebufferNativeWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class FramebufferNativeWindow
friend class LightRefBase<FramebufferNativeWindow>;
~FramebufferNativeWindow(); // this class cannot be overloaded
static int setSwapInterval(ANativeWindow* window, int interval);
static int dequeueBuffer(ANativeWindow* window, android_native_buffer_t** buffer);
static int lockBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int queueBuffer(ANativeWindow* window, android_native_buffer_t* buffer);
static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer);
static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer);
static int query(const ANativeWindow* window, int what, int* value);
static int perform(ANativeWindow* window, int operation, ...);

Expand Down
12 changes: 6 additions & 6 deletions include/ui/GraphicBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <utils/Flattenable.h>
#include <pixelflinger/pixelflinger.h>

struct android_native_buffer_t;
struct ANativeWindowBuffer;

namespace android {

Expand All @@ -38,7 +38,7 @@ class GraphicBufferMapper;

class GraphicBuffer
: public EGLNativeBase<
android_native_buffer_t,
ANativeWindowBuffer,
GraphicBuffer,
LightRefBase<GraphicBuffer> >, public Flattenable
{
Expand Down Expand Up @@ -74,8 +74,8 @@ class GraphicBuffer
GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage,
uint32_t stride, native_handle_t* handle, bool keepOwnership);

// create a buffer from an existing android_native_buffer_t
GraphicBuffer(android_native_buffer_t* buffer, bool keepOwnership);
// create a buffer from an existing ANativeWindowBuffer
GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership);

// return status
status_t initCheck() const;
Expand All @@ -94,7 +94,7 @@ class GraphicBuffer
status_t lock(GGLSurface* surface, uint32_t usage);
status_t unlock();

android_native_buffer_t* getNativeBuffer() const;
ANativeWindowBuffer* getNativeBuffer() const;

void setIndex(int index);
int getIndex() const;
Expand Down Expand Up @@ -149,7 +149,7 @@ class GraphicBuffer

// If we're wrapping another buffer then this reference will make sure it
// doesn't get freed.
sp<android_native_buffer_t> mWrappedBuffer;
sp<ANativeWindowBuffer> mWrappedBuffer;
};

}; // namespace android
Expand Down
20 changes: 10 additions & 10 deletions libs/gui/Surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,25 +513,25 @@ int Surface::setSwapInterval(ANativeWindow* window, int interval) {
}

int Surface::dequeueBuffer(ANativeWindow* window,
android_native_buffer_t** buffer) {
ANativeWindowBuffer** buffer) {
Surface* self = getSelf(window);
return self->dequeueBuffer(buffer);
}

int Surface::cancelBuffer(ANativeWindow* window,
android_native_buffer_t* buffer) {
ANativeWindowBuffer* buffer) {
Surface* self = getSelf(window);
return self->cancelBuffer(buffer);
}

int Surface::lockBuffer(ANativeWindow* window,
android_native_buffer_t* buffer) {
ANativeWindowBuffer* buffer) {
Surface* self = getSelf(window);
return self->lockBuffer(buffer);
}

int Surface::queueBuffer(ANativeWindow* window,
android_native_buffer_t* buffer) {
ANativeWindowBuffer* buffer) {
Surface* self = getSelf(window);
return self->queueBuffer(buffer);
}
Expand Down Expand Up @@ -570,7 +570,7 @@ bool Surface::needNewBuffer(int bufIdx,
return newNeewBuffer;
}

int Surface::dequeueBuffer(android_native_buffer_t** buffer)
int Surface::dequeueBuffer(ANativeWindowBuffer** buffer)
{
status_t err = validate();
if (err != NO_ERROR)
Expand Down Expand Up @@ -624,7 +624,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer)
return err;
}

int Surface::cancelBuffer(android_native_buffer_t* buffer)
int Surface::cancelBuffer(ANativeWindowBuffer* buffer)
{
status_t err = validate(true);
switch (err) {
Expand All @@ -651,7 +651,7 @@ int Surface::cancelBuffer(android_native_buffer_t* buffer)
}


int Surface::lockBuffer(android_native_buffer_t* buffer)
int Surface::lockBuffer(ANativeWindowBuffer* buffer)
{
status_t err = validate();
if (err != NO_ERROR)
Expand All @@ -670,7 +670,7 @@ int Surface::lockBuffer(android_native_buffer_t* buffer)
return err;
}

int Surface::queueBuffer(android_native_buffer_t* buffer)
int Surface::queueBuffer(ANativeWindowBuffer* buffer)
{
status_t err = validate();
if (err != NO_ERROR)
Expand Down Expand Up @@ -969,7 +969,7 @@ status_t Surface::lock(SurfaceInfo* other, Region* dirtyIn, bool blocking)
// we're intending to do software rendering from this point
setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);

android_native_buffer_t* out;
ANativeWindowBuffer* out;
status_t err = dequeueBuffer(&out);
LOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err));
if (err == NO_ERROR) {
Expand Down Expand Up @@ -1063,7 +1063,7 @@ int Surface::getBufferIndex(const sp<GraphicBuffer>& buffer) const
if (idx < 0) {
// The buffer doesn't have an index set. See if the handle the same as
// one of the buffers for which we do know the index. This can happen
// e.g. if GraphicBuffer is used to wrap an android_native_buffer_t that
// e.g. if GraphicBuffer is used to wrap an ANativeWindowBuffer that
// was dequeued from an ANativeWindow.
for (size_t i = 0; i < mBuffers.size(); i++) {
if (mBuffers[i] != 0 && buffer->handle == mBuffers[i]->handle) {
Expand Down
8 changes: 4 additions & 4 deletions libs/gui/SurfaceTextureClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@ int SurfaceTextureClient::setSwapInterval(ANativeWindow* window, int interval) {
}

int SurfaceTextureClient::dequeueBuffer(ANativeWindow* window,
android_native_buffer_t** buffer) {
ANativeWindowBuffer** buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->dequeueBuffer(buffer);
}

int SurfaceTextureClient::cancelBuffer(ANativeWindow* window,
android_native_buffer_t* buffer) {
ANativeWindowBuffer* buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->cancelBuffer(buffer);
}

int SurfaceTextureClient::lockBuffer(ANativeWindow* window,
android_native_buffer_t* buffer) {
ANativeWindowBuffer* buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->lockBuffer(buffer);
}

int SurfaceTextureClient::queueBuffer(ANativeWindow* window,
android_native_buffer_t* buffer) {
ANativeWindowBuffer* buffer) {
SurfaceTextureClient* c = getSelf(window);
return c->queueBuffer(buffer);
}
Expand Down
18 changes: 9 additions & 9 deletions libs/gui/tests/SurfaceTextureClient_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) {

TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) {
sp<ANativeWindow> anw(mSTC);
android_native_buffer_t* buf;
ANativeWindowBuffer* buf;
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
EXPECT_EQ(1, buf->width);
EXPECT_EQ(1, buf->height);
Expand All @@ -123,7 +123,7 @@ TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) {

TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) {
sp<ANativeWindow> anw(mSTC);
android_native_buffer_t* buf;
ANativeWindowBuffer* buf;
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 16, 8, PIXEL_FORMAT_RGB_565));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
EXPECT_EQ(16, buf->width);
Expand All @@ -134,7 +134,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) {

TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) {
sp<ANativeWindow> anw(mSTC);
android_native_buffer_t* buf;
ANativeWindowBuffer* buf;
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, PIXEL_FORMAT_RGB_565));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
EXPECT_EQ(1, buf->width);
Expand All @@ -145,7 +145,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) {

TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) {
sp<ANativeWindow> anw(mSTC);
android_native_buffer_t* buf;
ANativeWindowBuffer* buf;
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 16, 8, 0));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
EXPECT_EQ(16, buf->width);
Expand All @@ -156,7 +156,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) {

TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) {
sp<ANativeWindow> anw(mSTC);
android_native_buffer_t* buf;
ANativeWindowBuffer* buf;
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 16, 8, 0));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
EXPECT_EQ(16, buf->width);
Expand All @@ -173,7 +173,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) {

TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) {
sp<ANativeWindow> anw(mSTC);
android_native_buffer_t* buf;
ANativeWindowBuffer* buf;
EXPECT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, PIXEL_FORMAT_RGB_565));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
EXPECT_EQ(1, buf->width);
Expand All @@ -191,7 +191,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) {
TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) {
sp<ANativeWindow> anw(mSTC);
sp<SurfaceTexture> st(mST);
android_native_buffer_t* buf;
ANativeWindowBuffer* buf;
EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf));
EXPECT_EQ(16, buf->width);
Expand All @@ -203,7 +203,7 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) {
TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeAfterDequeue) {
sp<ANativeWindow> anw(mSTC);
sp<SurfaceTexture> st(mST);
android_native_buffer_t* buf[2];
ANativeWindowBuffer* buf[2];
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[0]));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[1]));
EXPECT_NE(buf[0], buf[1]);
Expand All @@ -224,7 +224,7 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeAfterDequeue) {
TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeVsGeometry) {
sp<ANativeWindow> anw(mSTC);
sp<SurfaceTexture> st(mST);
android_native_buffer_t* buf[2];
ANativeWindowBuffer* buf[2];
EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[0]));
ASSERT_EQ(OK, anw->dequeueBuffer(anw.get(), &buf[1]));
Expand Down
6 changes: 3 additions & 3 deletions libs/gui/tests/SurfaceTexture_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferNpot) {
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));

android_native_buffer_t* anb;
ANativeWindowBuffer* anb;
ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
ASSERT_TRUE(anb != NULL);

Expand Down Expand Up @@ -524,7 +524,7 @@ TEST_F(SurfaceTextureGLTest, DISABLED_TexturingFromCpuFilledYV12BufferPow2) {
ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(),
GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN));

android_native_buffer_t* anb;
ANativeWindowBuffer* anb;
ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
ASSERT_TRUE(anb != NULL);

Expand Down Expand Up @@ -583,7 +583,7 @@ TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) {

ASSERT_EQ(NO_ERROR, native_window_set_crop(mANW.get(), &crop));

android_native_buffer_t* anb;
ANativeWindowBuffer* anb;
ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
ASSERT_TRUE(anb != NULL);

Expand Down
2 changes: 1 addition & 1 deletion libs/gui/tests/Surface_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ TEST_F(SurfaceTest, ScreenshotsOfProtectedBuffersFail) {
ASSERT_EQ(NO_ERROR, native_window_set_usage(anw.get(),
GRALLOC_USAGE_PROTECTED));
ASSERT_EQ(NO_ERROR, native_window_set_buffer_count(anw.get(), 3));
android_native_buffer_t* buf = 0;
ANativeWindowBuffer* buf = 0;
for (int i = 0; i < 4; i++) {
// Loop to make sure SurfaceFlinger has retired a protected buffer.
ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &buf));
Expand Down

0 comments on commit b2a153a

Please sign in to comment.