Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db13e364 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge changes Ie03796ae,Ide3e980a into gingerbread

* changes:
  [3171580] SurfaceFlinger Bypass mode. (DO NOT MERGE)
  [3171580] Add transform field to native buffers. (DO NOT MERGE)
parents c24928fd 22c67843
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include <utils/Flattenable.h>
#include <pixelflinger/pixelflinger.h>

#include <hardware/hardware.h>

struct android_native_buffer_t;

namespace android {
@@ -63,6 +65,13 @@ public:
        USAGE_HW_MASK           = GRALLOC_USAGE_HW_MASK
    };

    enum {
        TRANSFORM_IDENTITY      = 0,
        TRANSFORM_ROT_90        = HAL_TRANSFORM_ROT_90,
        TRANSFORM_ROT_180       = HAL_TRANSFORM_ROT_180,
        TRANSFORM_ROT_270       = HAL_TRANSFORM_ROT_270
    };

    GraphicBuffer();

    // creates w * h buffer
@@ -79,6 +88,7 @@ public:
    uint32_t getHeight() const          { return height; }
    uint32_t getStride() const          { return stride; }
    uint32_t getUsage() const           { return usage; }
    uint32_t getTransform() const       { return transform; }
    PixelFormat getPixelFormat() const  { return format; }
    Rect getBounds() const              { return Rect(width, height); }
    
+6 −2
Original line number Diff line number Diff line
@@ -52,7 +52,11 @@ typedef struct android_native_buffer_t
    int format;
    int usage;

    void* reserved[2];
    /* transformation as defined in hardware.h */
    uint8_t transform;

    uint8_t reserved_bytes[3];
    void* reserved[1];

    buffer_handle_t handle;

+13 −6
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ GraphicBuffer::GraphicBuffer()
    stride = 
    format = 
    usage  = 0;
    transform = 0;
    handle = NULL;
}

@@ -57,7 +58,8 @@ GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
    height = 
    stride = 
    format = 
    usage  = 0;
    usage  =
    transform = 0;
    handle = NULL;
    mInitCheck = initSize(w, h, reqFormat, reqUsage);
}
@@ -74,6 +76,7 @@ GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h,
    stride = inStride;
    format = inFormat;
    usage  = inUsage;
    transform = 0;
    handle = inHandle;
}

@@ -182,8 +185,10 @@ status_t GraphicBuffer::lock(GGLSurface* sur, uint32_t usage)
    return res;
}

const int kFlattenFdsOffset = 9;

size_t GraphicBuffer::getFlattenedSize() const {
    return (8 + (handle ? handle->numInts : 0))*sizeof(int);
    return (kFlattenFdsOffset + (handle ? handle->numInts : 0))*sizeof(int);
}

size_t GraphicBuffer::getFdCount() const {
@@ -208,13 +213,14 @@ status_t GraphicBuffer::flatten(void* buffer, size_t size,
    buf[5] = usage;
    buf[6] = 0;
    buf[7] = 0;
    buf[8] = transform;

    if (handle) {
        buf[6] = handle->numFds;
        buf[7] = handle->numInts;
        native_handle_t const* const h = handle;
        memcpy(fds,     h->data,             h->numFds*sizeof(int));
        memcpy(&buf[8], h->data + h->numFds, h->numInts*sizeof(int));
        memcpy(&buf[kFlattenFdsOffset], h->data + h->numFds, h->numInts*sizeof(int));
    }

    return NO_ERROR;
@@ -223,7 +229,7 @@ status_t GraphicBuffer::flatten(void* buffer, size_t size,
status_t GraphicBuffer::unflatten(void const* buffer, size_t size,
        int fds[], size_t count)
{
    if (size < 8*sizeof(int)) return NO_MEMORY;
    if (size < kFlattenFdsOffset*sizeof(int)) return NO_MEMORY;

    int const* buf = static_cast<int const*>(buffer);
    if (buf[0] != 'GBFR') return BAD_TYPE;
@@ -231,7 +237,7 @@ status_t GraphicBuffer::unflatten(void const* buffer, size_t size,
    const size_t numFds  = buf[6];
    const size_t numInts = buf[7];

    const size_t sizeNeeded = (8 + numInts) * sizeof(int);
    const size_t sizeNeeded = (kFlattenFdsOffset + numInts) * sizeof(int);
    if (size < sizeNeeded) return NO_MEMORY;

    size_t fdCountNeeded = 0;
@@ -248,9 +254,10 @@ status_t GraphicBuffer::unflatten(void const* buffer, size_t size,
        stride = buf[3];
        format = buf[4];
        usage  = buf[5];
        transform = buf[8];
        native_handle* h = native_handle_create(numFds, numInts);
        memcpy(h->data,          fds,     numFds*sizeof(int));
        memcpy(h->data + numFds, &buf[8], numInts*sizeof(int));
        memcpy(h->data + numFds, &buf[kFlattenFdsOffset], numInts*sizeof(int));
        handle = h;
    } else {
        width = height = stride = format = usage = 0;
+1 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ ifeq ($(TARGET_BOARD_PLATFORM), omap3)
endif
ifeq ($(TARGET_BOARD_PLATFORM), s5pc110)
	LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY
	LOCAL_CFLAGS += -DUSE_COMPOSITION_BYPASS
endif


+6 −0
Original line number Diff line number Diff line
@@ -339,6 +339,12 @@ void DisplayHardware::flip(const Region& dirty) const
    //glClear(GL_COLOR_BUFFER_BIT);
}

status_t DisplayHardware::postBypassBuffer(const native_handle_t* handle) const
{
   framebuffer_device_t *fbDev = (framebuffer_device_t *)mNativeWindow->getDevice();
   return fbDev->post(fbDev, handle);
}

uint32_t DisplayHardware::getFlags() const
{
    return mFlags;
Loading