blob: d996af75a47898931c189d939c956f0da15fd06a [file] [log] [blame]
Jamie Gennisf7acf162011-01-12 18:30:40 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_SF_IGRAPHIC_BUFFER_ALLOC_H
18#define ANDROID_SF_IGRAPHIC_BUFFER_ALLOC_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/RefBase.h>
24
25#include <binder/IInterface.h>
26
27namespace android {
28// ----------------------------------------------------------------------------
29
30class IGraphicBufferAlloc : public IInterface
31{
32public:
33 DECLARE_META_INTERFACE(GraphicBufferAlloc);
34
35 /* Create a new GraphicBuffer for the client to use. The server will
36 * maintain a reference to the newly created GraphicBuffer until
37 * freeAllGraphicBuffers is called.
38 */
39 virtual sp<GraphicBuffer> createGraphicBuffer(uint32_t w, uint32_t h,
40 PixelFormat format, uint32_t usage) = 0;
41
42 /* Free all but one of the GraphicBuffer objects that the server is
43 * currently referencing. If bufIndex is not a valid index of the buffers
44 * the server is referencing, then all buffers are freed.
45 */
46 virtual void freeAllGraphicBuffersExcept(int bufIndex) = 0;
47};
48
49// ----------------------------------------------------------------------------
50
51class BnGraphicBufferAlloc : public BnInterface<IGraphicBufferAlloc>
52{
53public:
54 virtual status_t onTransact( uint32_t code,
55 const Parcel& data,
56 Parcel* reply,
57 uint32_t flags = 0);
58};
59
60// ----------------------------------------------------------------------------
61
62}; // namespace android
63
64#endif // ANDROID_SF_IGRAPHIC_BUFFER_ALLOC_H