1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
4 * Copyright (C) 2011 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ****************************************************************************/
21 #ifndef _DRMGLESGRAPHICSYSTEM_H_
22 #define _DRMGLESGRAPHICSYSTEM_H_
24 #include "GraphicSystems/BaseGraphicSystem.h"
25 #include "GraphicSystems/GLESGraphicSystem.h"
26 #include "ShaderProgramFactory.h"
28 #include "EGL/eglext.h"
29 #include "GLES2/gl2.h"
30 #include "GLES2/gl2ext.h"
34 #include "wayland-util.h"
37 #include <xf86drmMode.h>
47 drmModeModeInfo modeInfo;
55 struct DrmOutput *output;
62 struct DrmMode* currentMode;
63 struct wl_list modeList;
66 drmModeCrtcPtr orgCrtc;
69 struct gbm_surface *surface;
70 struct DrmFb *current, *next;
71 EGLSurface eglSurface;
73 BaseWindowSystem *windowSystem;
76 class DrmGLESGraphicSystem : public GLESGraphicsystem
80 DrmGLESGraphicSystem(int windowWidth, int windowHeight,
81 PfnShaderProgramCreator shaderProgram);
82 virtual ~DrmGLESGraphicSystem();
84 virtual bool init(EGLNativeDisplayType display, EGLNativeWindowType window);
85 virtual void activateGraphicContext();
86 virtual void swapBuffers();
87 virtual void updateScreenList(LmScreenList& screenList);
88 virtual void switchScreen(uint screenid);
92 struct wl_list m_outputList;
98 uint32_t m_crtcAllocator;
99 uint32_t m_connectorAllocator;
100 DrmOutput* m_currentOutput;
102 PFNEGLBINDWAYLANDDISPLAYWL m_pfEglBindWaylandDisplayWL;
103 PFNEGLUNBINDWAYLANDDISPLAYWL m_pfEglUnbindWaylandDisplayWL;
107 bool initializeSystem();
108 bool createOutputs();
109 int createOutputForConnector(drmModeRes* resources, drmModeConnector* connector, int x, int y);
110 int drmOutputAddMode(struct DrmOutput* output, drmModeModeInfo* info);
111 int drmOutputPrepareRender(struct DrmOutput* output);
114 #endif /* _DRMGLESGRAPHICSYSTEM_H_ */