blob: 87b320f431b88b498c97289621f7d9711128455c [file] [log] [blame]
The Android Open Source Projectedbf3b62009-03-03 19:31:44 -08001/*
2 * Copyright (C) 2007 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_ISURFACE_H
18#define ANDROID_ISURFACE_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <utils/Errors.h>
24#include <utils/IInterface.h>
25#include <utils/RefBase.h>
26#include <ui/PixelFormat.h>
27
28#include <hardware/hardware.h>
29
30namespace android {
31
32typedef int32_t SurfaceID;
33
34class IMemoryHeap;
35class OverlayRef;
36
37class ISurface : public IInterface
38{
39protected:
40 enum {
41 REGISTER_BUFFERS = IBinder::FIRST_CALL_TRANSACTION,
42 UNREGISTER_BUFFERS,
43 POST_BUFFER, // one-way transaction
44 CREATE_OVERLAY,
45 };
46
47public:
48 DECLARE_META_INTERFACE(Surface);
49
50
51 class BufferHeap {
52 public:
53 enum {
54 /* rotate source image 90 degrees */
55 ROT_90 = HAL_TRANSFORM_ROT_90,
56 };
57 BufferHeap();
58
59 BufferHeap(uint32_t w, uint32_t h,
60 int32_t hor_stride, int32_t ver_stride,
61 PixelFormat format, const sp<IMemoryHeap>& heap);
62
63 BufferHeap(uint32_t w, uint32_t h,
64 int32_t hor_stride, int32_t ver_stride,
65 PixelFormat format, uint32_t transform, uint32_t flags,
66 const sp<IMemoryHeap>& heap);
67
68 ~BufferHeap();
69
70 uint32_t w;
71 uint32_t h;
72 int32_t hor_stride;
73 int32_t ver_stride;
74 PixelFormat format;
75 uint32_t transform;
76 uint32_t flags;
77 sp<IMemoryHeap> heap;
78 };
79
80 virtual status_t registerBuffers(const BufferHeap& buffers) = 0;
81
82 virtual void postBuffer(ssize_t offset) = 0; // one-way
83
84 virtual void unregisterBuffers() = 0;
85
86 virtual sp<OverlayRef> createOverlay(
87 uint32_t w, uint32_t h, int32_t format) = 0;
88};
89
90// ----------------------------------------------------------------------------
91
92class BnSurface : public BnInterface<ISurface>
93{
94public:
95 virtual status_t onTransact( uint32_t code,
96 const Parcel& data,
97 Parcel* reply,
98 uint32_t flags = 0);
99};
100
101// ----------------------------------------------------------------------------
102
103}; // namespace android
104
105#endif // ANDROID_ISURFACE_H