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

Commit a5529c87 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

remove support for PUSH_BUFFER surfaces and overlays

the same functionality is now supported through
the h/w composer HAL, and YUV support in the GPU.

Change-Id: I8146605449954b8e8fd7f78810b7d873c2d8f5bf
parent 4eaf95af
Loading
Loading
Loading
Loading
+3 −49
Original line number Original line Diff line number Diff line
@@ -34,18 +34,15 @@ namespace android {


typedef int32_t    SurfaceID;
typedef int32_t    SurfaceID;


class IMemoryHeap;
class OverlayRef;
class GraphicBuffer;
class GraphicBuffer;


class ISurface : public IInterface
class ISurface : public IInterface
{
{
protected:
protected:
    enum {
    enum {
        REGISTER_BUFFERS = IBinder::FIRST_CALL_TRANSACTION,
        RESERVED0 = IBinder::FIRST_CALL_TRANSACTION,
        UNREGISTER_BUFFERS,
        RESERVED1,
        POST_BUFFER, // one-way transaction
        RESERVED2,
        CREATE_OVERLAY,
        REQUEST_BUFFER,
        REQUEST_BUFFER,
        SET_BUFFER_COUNT,
        SET_BUFFER_COUNT,
    };
    };
@@ -66,49 +63,6 @@ public:
     * sets the number of buffers dequeuable for this surface.
     * sets the number of buffers dequeuable for this surface.
     */
     */
    virtual status_t setBufferCount(int bufferCount) = 0;
    virtual status_t setBufferCount(int bufferCount) = 0;
    
    // ------------------------------------------------------------------------
    // Deprecated...
    // ------------------------------------------------------------------------

    class BufferHeap {
    public:
        enum {
            /* rotate source image */
            ROT_0     = 0,
            ROT_90    = HAL_TRANSFORM_ROT_90,
            ROT_180   = HAL_TRANSFORM_ROT_180,
            ROT_270   = HAL_TRANSFORM_ROT_270,
        };
        BufferHeap();
        
        BufferHeap(uint32_t w, uint32_t h,
                int32_t hor_stride, int32_t ver_stride, 
                PixelFormat format, const sp<IMemoryHeap>& heap);
        
        BufferHeap(uint32_t w, uint32_t h,
                int32_t hor_stride, int32_t ver_stride, 
                PixelFormat format, uint32_t transform, uint32_t flags,
                const sp<IMemoryHeap>& heap);
        
        ~BufferHeap(); 
        
        uint32_t w;
        uint32_t h;
        int32_t hor_stride;
        int32_t ver_stride;
        PixelFormat format;
        uint32_t transform;
        uint32_t flags;
        sp<IMemoryHeap> heap;
    };
    
    virtual status_t registerBuffers(const BufferHeap& buffers) = 0;
    virtual void postBuffer(ssize_t offset) = 0; // one-way
    virtual void unregisterBuffers() = 0;
    
    virtual sp<OverlayRef> createOverlay(
            uint32_t w, uint32_t h, int32_t format, int32_t orientation) = 0;
};
};


// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
+0 −1
Original line number Original line Diff line number Diff line
@@ -42,7 +42,6 @@ public:
        eDestroyBackbuffer  = 0x00000020,
        eDestroyBackbuffer  = 0x00000020,
        eSecure             = 0x00000080,
        eSecure             = 0x00000080,
        eNonPremultiplied   = 0x00000100,
        eNonPremultiplied   = 0x00000100,
        ePushBuffers        = 0x00000200,
        eOpaque             = 0x00000400,
        eOpaque             = 0x00000400,


        eFXSurfaceNormal    = 0x00000000,
        eFXSurfaceNormal    = 0x00000000,

include/ui/IOverlay.h

deleted100644 → 0
+0 −53
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_IOVERLAY_H
#define ANDROID_IOVERLAY_H

#include <stdint.h>
#include <sys/types.h>

#include <utils/Errors.h>
#include <binder/IInterface.h>
#include <utils/RefBase.h>
#include <ui/PixelFormat.h>

namespace android {

class IOverlay : public IInterface
{
public: 
    DECLARE_META_INTERFACE(Overlay);

    virtual void destroy() = 0; // one-way
};

// ----------------------------------------------------------------------------

class BnOverlay : public BnInterface<IOverlay>
{
public:
    virtual status_t    onTransact( uint32_t code,
                                    const Parcel& data,
                                    Parcel* reply,
                                    uint32_t flags = 0);
};

// ----------------------------------------------------------------------------

}; // namespace android

#endif // ANDROID_IOVERLAY_H

include/ui/Overlay.h

deleted100644 → 0
+0 −119
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef ANDROID_OVERLAY_H
#define ANDROID_OVERLAY_H

#include <stdint.h>
#include <sys/types.h>

#include <utils/Errors.h>
#include <binder/IInterface.h>
#include <utils/RefBase.h>
#include <utils/threads.h>

#include <ui/PixelFormat.h>
#include <ui/IOverlay.h>

#include <hardware/overlay.h>

namespace android {

class IMemory;
class IMemoryHeap;

// ----------------------------------------------------------------------------

class OverlayRef : public LightRefBase<OverlayRef>
{
public:
    OverlayRef(overlay_handle_t, const sp<IOverlay>&,
            uint32_t w, uint32_t h, int32_t f, uint32_t ws, uint32_t hs);

    static sp<OverlayRef> readFromParcel(const Parcel& data);
    static status_t writeToParcel(Parcel* reply, const sp<OverlayRef>& o);    

private:
    friend class LightRefBase<OverlayRef>;
    friend class Overlay;

    OverlayRef();
    virtual ~OverlayRef();

    overlay_handle_t mOverlayHandle;
    sp<IOverlay> mOverlayChannel;
    uint32_t mWidth;
    uint32_t mHeight;
    int32_t  mFormat;
    int32_t  mWidthStride;
    int32_t  mHeightStride;
    bool mOwnHandle;
};

// ----------------------------------------------------------------------------

class Overlay : public virtual RefBase
{
public:
    Overlay(const sp<OverlayRef>& overlayRef);

    /* destroys this overlay */
    void destroy();
    
    /* get the HAL handle for this overlay */
    overlay_handle_t getHandleRef() const;

    /* blocks until an overlay buffer is available and return that buffer. */
    status_t dequeueBuffer(overlay_buffer_t* buffer);

    /* release the overlay buffer and post it */
    status_t queueBuffer(overlay_buffer_t buffer);

    /* change the width and height of the overlay */
    status_t resizeInput(uint32_t width, uint32_t height);

    status_t setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h) ;

    status_t getCrop(uint32_t* x, uint32_t* y, uint32_t* w, uint32_t* h) ;

    /* set the buffer attributes */
    status_t setParameter(int param, int value);

    /* returns the address of a given buffer if supported, NULL otherwise. */
    void* getBufferAddress(overlay_buffer_t buffer);

    /* get physical informations about the overlay */
    uint32_t getWidth() const;
    uint32_t getHeight() const;
    int32_t getFormat() const;
    int32_t getWidthStride() const;
    int32_t getHeightStride() const;
    int32_t getBufferCount() const;
    status_t getStatus() const;
    
private:
    virtual ~Overlay();

    sp<OverlayRef> mOverlayRef;
    overlay_data_device_t *mOverlayData;
    status_t mStatus;
};

// ----------------------------------------------------------------------------

}; // namespace android

#endif // ANDROID_OVERLAY_H
+0 −112
Original line number Original line Diff line number Diff line
@@ -21,9 +21,7 @@
#include <sys/types.h>
#include <sys/types.h>


#include <binder/Parcel.h>
#include <binder/Parcel.h>
#include <binder/IMemory.h>


#include <ui/Overlay.h>
#include <ui/GraphicBuffer.h>
#include <ui/GraphicBuffer.h>


#include <surfaceflinger/Surface.h>
#include <surfaceflinger/Surface.h>
@@ -33,36 +31,6 @@ namespace android {


// ----------------------------------------------------------------------
// ----------------------------------------------------------------------


ISurface::BufferHeap::BufferHeap() 
    : w(0), h(0), hor_stride(0), ver_stride(0), format(0),
    transform(0), flags(0) 
{     
}

ISurface::BufferHeap::BufferHeap(uint32_t w, uint32_t h,
        int32_t hor_stride, int32_t ver_stride,
        PixelFormat format, const sp<IMemoryHeap>& heap)
    : w(w), h(h), hor_stride(hor_stride), ver_stride(ver_stride),
      format(format), transform(0), flags(0), heap(heap) 
{
}

ISurface::BufferHeap::BufferHeap(uint32_t w, uint32_t h,
        int32_t hor_stride, int32_t ver_stride,
        PixelFormat format, uint32_t transform, uint32_t flags,
        const sp<IMemoryHeap>& heap)
        : w(w), h(h), hor_stride(hor_stride), ver_stride(ver_stride),
          format(format), transform(transform), flags(flags), heap(heap) 
{
}


ISurface::BufferHeap::~BufferHeap() 
{     
}

// ----------------------------------------------------------------------

class BpSurface : public BpInterface<ISurface>
class BpSurface : public BpInterface<ISurface>
{
{
public:
public:
@@ -96,51 +64,6 @@ public:
        status_t err = reply.readInt32();
        status_t err = reply.readInt32();
        return err;
        return err;
    }
    }

    virtual status_t registerBuffers(const BufferHeap& buffers)
    {
        Parcel data, reply;
        data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
        data.writeInt32(buffers.w);
        data.writeInt32(buffers.h);
        data.writeInt32(buffers.hor_stride);
        data.writeInt32(buffers.ver_stride);
        data.writeInt32(buffers.format);
        data.writeInt32(buffers.transform);
        data.writeInt32(buffers.flags);
        data.writeStrongBinder(buffers.heap->asBinder());
        remote()->transact(REGISTER_BUFFERS, data, &reply);
        status_t result = reply.readInt32();
        return result;
    }

    virtual void postBuffer(ssize_t offset)
    {
        Parcel data, reply;
        data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
        data.writeInt32(offset);
        remote()->transact(POST_BUFFER, data, &reply, IBinder::FLAG_ONEWAY);
    }

    virtual void unregisterBuffers()
    {
        Parcel data, reply;
        data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
        remote()->transact(UNREGISTER_BUFFERS, data, &reply);
    }

    virtual sp<OverlayRef> createOverlay(
             uint32_t w, uint32_t h, int32_t format, int32_t orientation)
    {
        Parcel data, reply;
        data.writeInterfaceToken(ISurface::getInterfaceDescriptor());
        data.writeInt32(w);
        data.writeInt32(h);
        data.writeInt32(format);
        data.writeInt32(orientation);
        remote()->transact(CREATE_OVERLAY, data, &reply);
        return OverlayRef::readFromParcel(reply);
    }
};
};


IMPLEMENT_META_INTERFACE(Surface, "android.ui.ISurface");
IMPLEMENT_META_INTERFACE(Surface, "android.ui.ISurface");
@@ -170,41 +93,6 @@ status_t BnSurface::onTransact(
            reply->writeInt32(err);
            reply->writeInt32(err);
            return NO_ERROR;
            return NO_ERROR;
        }
        }
        case REGISTER_BUFFERS: {
            CHECK_INTERFACE(ISurface, data, reply);
            BufferHeap buffer;
            buffer.w = data.readInt32();
            buffer.h = data.readInt32();
            buffer.hor_stride = data.readInt32();
            buffer.ver_stride= data.readInt32();
            buffer.format = data.readInt32();
            buffer.transform = data.readInt32();
            buffer.flags = data.readInt32();
            buffer.heap = interface_cast<IMemoryHeap>(data.readStrongBinder());
            status_t err = registerBuffers(buffer);
            reply->writeInt32(err);
            return NO_ERROR;
        } break;
        case UNREGISTER_BUFFERS: {
            CHECK_INTERFACE(ISurface, data, reply);
            unregisterBuffers();
            return NO_ERROR;
        } break;
        case POST_BUFFER: {
            CHECK_INTERFACE(ISurface, data, reply);
            ssize_t offset = data.readInt32();
            postBuffer(offset);
            return NO_ERROR;
        } break;
        case CREATE_OVERLAY: {
            CHECK_INTERFACE(ISurface, data, reply);
            int w = data.readInt32();
            int h = data.readInt32();
            int f = data.readInt32();
            int orientation = data.readInt32();
            sp<OverlayRef> o = createOverlay(w, h, f, orientation);
            return OverlayRef::writeToParcel(reply, o);
        } break;
        default:
        default:
            return BBinder::onTransact(code, data, reply, flags);
            return BBinder::onTransact(code, data, reply, flags);
    }
    }
Loading