blob: 1c8043dbf048d99afdf0bca849e5878a16435e93 [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
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
28namespace android {
29
30typedef int32_t SurfaceID;
31
32class IMemoryHeap;
The Android Open Source Project27629322009-01-09 17:51:23 -080033class OverlayRef;
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070034
35class ISurface : public IInterface
36{
The Android Open Source Projecta6938ba2009-02-10 15:44:00 -080037protected:
38 enum {
39 REGISTER_BUFFERS = IBinder::FIRST_CALL_TRANSACTION,
40 UNREGISTER_BUFFERS,
41 POST_BUFFER, // one-way transaction
42 CREATE_OVERLAY,
43 };
44
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070045public:
46 DECLARE_META_INTERFACE(Surface);
47
The Android Open Source Projecta6938ba2009-02-10 15:44:00 -080048
49 class BufferHeap {
50 public:
51 enum {
52 /* flip source image horizontally */
53 FLIP_H = 0x01,
54 /* flip source image vertically */
55 FLIP_V = 0x02,
56 /* rotate source image 90 degrees */
57 ROT_90 = 0x04,
58 /* rotate source image 180 degrees */
59 ROT_180 = 0x03,
60 /* rotate source image 270 degrees */
61 ROT_270 = 0x07,
62 };
63 BufferHeap();
64
65 BufferHeap(uint32_t w, uint32_t h,
66 int32_t hor_stride, int32_t ver_stride,
67 PixelFormat format, const sp<IMemoryHeap>& heap);
68
69 BufferHeap(uint32_t w, uint32_t h,
70 int32_t hor_stride, int32_t ver_stride,
71 PixelFormat format, uint32_t transform, uint32_t flags,
72 const sp<IMemoryHeap>& heap);
73
74 ~BufferHeap();
75
76 uint32_t w;
77 uint32_t h;
78 int32_t hor_stride;
79 int32_t ver_stride;
80 PixelFormat format;
81 uint32_t transform;
82 uint32_t flags;
83 sp<IMemoryHeap> heap;
84 };
85
86 virtual status_t registerBuffers(const BufferHeap& buffers) = 0;
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070087
88 virtual void postBuffer(ssize_t offset) = 0; // one-way
89
90 virtual void unregisterBuffers() = 0;
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080091
The Android Open Source Project27629322009-01-09 17:51:23 -080092 virtual sp<OverlayRef> createOverlay(
The Android Open Source Projecte09fd9e2008-12-17 18:05:43 -080093 uint32_t w, uint32_t h, int32_t format) = 0;
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -070094};
95
96// ----------------------------------------------------------------------------
97
98class BnSurface : public BnInterface<ISurface>
99{
100public:
101 virtual status_t onTransact( uint32_t code,
102 const Parcel& data,
103 Parcel* reply,
104 uint32_t flags = 0);
105};
106
107// ----------------------------------------------------------------------------
108
109}; // namespace android
110
111#endif // ANDROID_ISURFACE_H