Squashed: gralloc1/binder/requestor
This is a combination of the following three commits:
libui: Convert Allocator and Mapper to gralloc1
Converts GraphicBufferAllocator and GraphicBufferMapper to speak
gralloc 1.0 (via the C++ shim and optionally the 1On0 adapter) instead
of gralloc 0.x.
-----
Create graphic buffer using binder interfaces
Using binder interfaces rather than directly allocating the buffer prevents
SELinux warnings.
-----
Add requestor name to GraphicBuffer alloc metadata
Adds a requestor name (usually the BufferQueue consumer's name) to the
metadata that GraphicBufferAllocator stores on allocation so that
`dumpsys SurfaceFlinger` can attempt to attribute buffer usage to the
correct client.
Bug: 28401203
Bug: 29402015
Bug: 30776557
diff --git a/include/gui/IGraphicBufferAlloc.h b/include/gui/IGraphicBufferAlloc.h
index f3c46ec..600cf27 100644
--- a/include/gui/IGraphicBufferAlloc.h
+++ b/include/gui/IGraphicBufferAlloc.h
@@ -21,14 +21,15 @@
#include <sys/types.h>
#include <binder/IInterface.h>
+#include <ui/GraphicBuffer.h>
#include <ui/PixelFormat.h>
#include <utils/RefBase.h>
+#include <string>
+
namespace android {
// ----------------------------------------------------------------------------
-class GraphicBuffer;
-
class IGraphicBufferAlloc : public IInterface
{
public:
@@ -37,7 +38,13 @@
/* Create a new GraphicBuffer for the client to use.
*/
virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
- PixelFormat format, uint32_t usage, status_t* error) = 0;
+ PixelFormat format, uint32_t usage, std::string requestorName,
+ status_t* error) = 0;
+
+ sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
+ PixelFormat format, uint32_t usage, status_t* error) {
+ return createGraphicBuffer(w, h, format, usage, "<Unknown>", error);
+ }
};
// ----------------------------------------------------------------------------