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

Commit 67514c24 authored by Marissa Wall's avatar Marissa Wall
Browse files

gralloc: support codec2 via GraphicBufferAllocator/Mapper

Codec2 is moving to GraphicBufferAllocator/Mapper. This patch
cleans up GBA/M so codec2 can use it.

- Since the graphic buffer id isn't used by GBA/M, deprecate
  the old allocate function.
- Include Rect so clients aren't required to include Rect.

Bug: 145139476
Test: Cherry pick ag/9741096 and run
    android.media.cts.MediaMetadataRetrieverTest#testThumbnailVP9Hdr

Change-Id: I3c0a03b771423f23741731e725a2846709ffc5da
parent 6eeaf925
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -111,11 +111,10 @@ void GraphicBufferAllocator::dumpToSystemLog()
    ALOGD("%s", s.c_str());
}

status_t GraphicBufferAllocator::allocate(uint32_t width, uint32_t height,
        PixelFormat format, uint32_t layerCount, uint64_t usage,
status_t GraphicBufferAllocator::allocate(uint32_t width, uint32_t height, PixelFormat format,
                                          uint32_t layerCount, uint64_t usage,
                                          buffer_handle_t* handle, uint32_t* stride,
        uint64_t /*graphicBufferId*/, std::string requestorName)
{
                                          std::string requestorName) {
    ATRACE_CALL();

    // make sure to not allocate a N x 0 or 0 x N buffer, since this is
@@ -175,6 +174,13 @@ status_t GraphicBufferAllocator::allocate(uint32_t width, uint32_t height,
    }
}

status_t GraphicBufferAllocator::allocate(uint32_t width, uint32_t height, PixelFormat format,
                                          uint32_t layerCount, uint64_t usage,
                                          buffer_handle_t* handle, uint32_t* stride,
                                          uint64_t /*graphicBufferId*/, std::string requestorName) {
    return allocate(width, height, format, layerCount, usage, handle, stride, requestorName);
}

status_t GraphicBufferAllocator::free(buffer_handle_t handle)
{
    ATRACE_CALL();
+5 −0
Original line number Diff line number Diff line
@@ -42,11 +42,16 @@ class GraphicBufferAllocator : public Singleton<GraphicBufferAllocator>
public:
    static inline GraphicBufferAllocator& get() { return getInstance(); }

    // DEPRECATED: GraphicBufferAllocator does not use the graphicBufferId
    status_t allocate(uint32_t w, uint32_t h, PixelFormat format,
            uint32_t layerCount, uint64_t usage,
            buffer_handle_t* handle, uint32_t* stride, uint64_t graphicBufferId,
            std::string requestorName);

    status_t allocate(uint32_t w, uint32_t h, PixelFormat format, uint32_t layerCount,
                      uint64_t usage, buffer_handle_t* handle, uint32_t* stride,
                      std::string requestorName);

    status_t free(buffer_handle_t handle);

    size_t getTotalSize() const;
+1 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <memory>

#include <ui/PixelFormat.h>
#include <ui/Rect.h>
#include <utils/Singleton.h>


@@ -36,7 +37,6 @@ namespace android {
// ---------------------------------------------------------------------------

class GrallocMapper;
class Rect;

class GraphicBufferMapper : public Singleton<GraphicBufferMapper>
{