2 * Copyright (C) 2013 libhybris
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef FBDEV_WINDOW_H
18 #define FBDEV_WINDOW_H
20 #include "nativewindowbase.h"
22 #include <android/hardware/gralloc.h>
27 class HWComposerNativeWindowBuffer
: public BaseNativeWindowBuffer
{
28 friend class HWComposerNativeWindow
;
31 HWComposerNativeWindowBuffer(alloc_device_t
* alloc
,
36 virtual ~HWComposerNativeWindowBuffer() ;
42 alloc_device_t
* m_alloc
;
46 class HWComposerNativeWindow
: public BaseNativeWindow
{
48 HWComposerNativeWindow(unsigned int width
, unsigned int height
, unsigned int format
);
49 ~HWComposerNativeWindow();
50 void setup(gralloc_module_t
* gralloc
, alloc_device_t
* alloc
);
53 void lockFrontBuffer(HWComposerNativeWindowBuffer
**buffer
);
54 void unlockFrontBuffer(HWComposerNativeWindowBuffer
*buffer
);
57 // overloads from BaseNativeWindow
58 virtual int setSwapInterval(int interval
);
60 virtual int dequeueBuffer(BaseNativeWindowBuffer
** buffer
, int* fenceFd
);
61 virtual int queueBuffer(BaseNativeWindowBuffer
* buffer
, int fenceFd
);
62 virtual int cancelBuffer(BaseNativeWindowBuffer
* buffer
, int fenceFd
);
63 virtual int lockBuffer(BaseNativeWindowBuffer
* buffer
);
65 virtual unsigned int type() const;
66 virtual unsigned int width() const;
67 virtual unsigned int height() const;
68 virtual unsigned int format() const;
69 virtual unsigned int defaultWidth() const;
70 virtual unsigned int defaultHeight() const;
71 virtual unsigned int queueLength() const;
72 virtual unsigned int transformHint() const;
74 virtual int setUsage(int usage
);
75 virtual int setBuffersFormat(int format
);
76 virtual int setBuffersDimensions(int width
, int height
);
77 virtual int setBufferCount(int cnt
);
80 void destroyBuffers();
83 framebuffer_device_t
* m_fbDev
;
84 alloc_device_t
* m_alloc
;
86 unsigned int m_bufFormat
;
88 std::list
<HWComposerNativeWindowBuffer
*> m_bufList
;
89 HWComposerNativeWindowBuffer
* m_frontBuf
;
97 // vim: noai:ts=4:sw=4:ss=4:expandtab