A bunch more changes to get the whole system properly booted

This commit is contained in:
Simon Fels 2016-06-19 13:26:32 +02:00
commit 720b71f1e8
58 changed files with 1835 additions and 532 deletions

View file

@ -2,7 +2,7 @@ set(SOURCES
ColorBuffer.cpp
FbConfig.cpp
FrameBuffer.cpp
NativeSubWindow_mir.cpp
NativeSubWindow_delegate.cpp
ReadBuffer.cpp
RenderContext.cpp
RenderControl.cpp
@ -19,9 +19,6 @@ set(SOURCES
UnixStream.cpp
WindowSurface.cpp)
include_directories(BEFORE
${MIRCLIENT_INCLUDE_DIRS})
add_library(OpenglRender ${SOURCES})
target_link_libraries(OpenglRender
emugl_common
@ -30,8 +27,5 @@ target_link_libraries(OpenglRender
renderControl_dec
OpenGLESDispatch
OpenglCodecCommon
mir_support
${EGL_LDFLAGS}
${EGL_LIBRARIES}
${MIRCLIENT_LDFLAGS}
${MIRCLIENT_LIBRARIES})
${EGL_LIBRARIES})

View file

@ -28,10 +28,6 @@
#include <stdio.h>
#include "mir_support/shared_state.h"
#define MID_AUBERGINE(x) (x)*0.368627451f, (x)*0.152941176f, (x)*0.31372549f
namespace {
// Helper class to call the bind_locked() / unbind_locked() properly.
@ -188,8 +184,7 @@ bool FrameBuffer::initialize(int width, int height, bool useSubWindow)
//
// Initialize backend EGL display
//
mir::support::SharedState::get()->ensure_connection();
fb->m_eglDisplay = s_egl.eglGetDisplay(mir::support::SharedState::get()->native_display());
fb->m_eglDisplay = s_egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (fb->m_eglDisplay == EGL_NO_DISPLAY) {
ERR("Failed to Initialize backend EGL display\n");
delete fb;
@ -582,7 +577,6 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window,
if (m_lastPostedColorBuffer) {
post(m_lastPostedColorBuffer, false);
} else {
s_gles2.glClearColor(MID_AUBERGINE(1.0), 1.0);
s_gles2.glClear(GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT |
GL_STENCIL_BUFFER_BIT);

View file

@ -20,10 +20,21 @@
#include <EGL/egl.h>
#include <memory>
#ifdef __cplusplus
extern "C" {
#endif
class SubWindowHandler {
public:
virtual ~SubWindowHandler() { }
virtual EGLNativeWindowType create_window(int x, int y, int width, int height) = 0;
virtual void destroy_window(EGLNativeWindowType win) = 0;
};
void registerSubWindowHandler(const std::shared_ptr<SubWindowHandler> &handler);
typedef void (*SubWindowRepaintCallback)(void*);
// Create a new sub-window that will be used to display the content of the

View file

@ -0,0 +1,72 @@
/*
* Copyright (C) 2011 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "NativeSubWindow.h"
#include <stdexcept>
#include <string>
#include <map>
namespace {
static std::shared_ptr<SubWindowHandler> current_handler = nullptr;
}
void registerSubWindowHandler(const std::shared_ptr<SubWindowHandler> &handler) {
if (current_handler)
throw std::runtime_error("A sub window handle is already registered");
current_handler = handler;
}
EGLNativeWindowType createSubWindow(FBNativeWindowType p_window,
int x,
int y,
int width,
int height,
SubWindowRepaintCallback repaint_callback,
void* repaint_callback_param) {
(void) p_window;
(void) repaint_callback;
(void) repaint_callback_param;
if (!current_handler)
return (EGLNativeWindowType) 0;
return current_handler->create_window(x, y, width, height);
}
void destroySubWindow(EGLNativeWindowType win) {
if (!current_handler)
return;
return current_handler->destroy_window(win);
}
int moveSubWindow(FBNativeWindowType p_parent_window,
EGLNativeWindowType p_sub_window,
int x,
int y,
int width,
int height) {
(void) p_parent_window;
(void) p_sub_window;
(void) x;
(void) y;
(void) width;
(void) height;
return true;
}