1 /****************************************************************************
3 ** This file is part of QtCompositor**
5 ** Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies).
6 ** All rights reserved.
8 ** Contact: Nokia Corporation qt-info@nokia.com
10 ** You may use this file under the terms of the BSD license as follows:
12 ** Redistribution and use in source and binary forms, with or without
13 ** modification, are permitted provided that the following conditions are
16 ** Redistributions of source code must retain the above copyright
17 ** notice, this list of conditions and the following disclaimer.
19 ** Redistributions in binary form must reproduce the above copyright
20 ** notice, this list of conditions and the following disclaimer in the
21 ** documentation and/or other materials provided with the distribution.
23 ** Neither the name of Nokia Corporation and its Subsidiary(-ies) nor the
24 ** names of its contributors may be used to endorse or promote products
25 ** derived from this software without specific prior written permission.
27 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 ****************************************************************************/
41 #ifndef GRAPHICSHARDWAREINTEGRATION_H
42 #define GRAPHICSHARDWAREINTEGRATION_H
44 #include <QtOpenGL/qgl.h>
45 #include <wayland-server.h>
47 #include "waylandcompositor.h"
48 #include "wayland_wrapper/wldisplay.h"
50 class GraphicsHardwareIntegration
53 GraphicsHardwareIntegration(WaylandCompositor *compositor);
55 virtual void initializeHardware(Wayland::Display *waylandDisplay) = 0;
57 /** Bind the Wayland buffer to the textureId. The correct context is the current context,
58 so there is no need to do makeCurrent in this function.
60 virtual GLuint createTextureFromBuffer(struct wl_buffer *buffer) = 0;
61 virtual bool isYInverted(struct wl_buffer *) const { return true; }
63 virtual bool setDirectRenderSurface(WaylandSurface *) {return false;}
64 virtual bool postBuffer(struct wl_buffer *) {return false;}
66 static GraphicsHardwareIntegration *createGraphicsHardwareIntegration(WaylandCompositor *compositor);
69 WaylandCompositor *m_compositor;
72 #endif // GRAPHICSHARDWAREINTEGRATION_H