Remove unneeded width, height and use_sub_window arguments

This commit is contained in:
Simon Fels 2016-11-08 08:15:25 +01:00
commit 2717449710
7 changed files with 15 additions and 31 deletions

View file

@ -25,7 +25,7 @@ typedef void (*emugl_crash_func_t)(const char* format, ...);
#define LIST_RENDER_API_FUNCTIONS(X) \ #define LIST_RENDER_API_FUNCTIONS(X) \
X(int, initLibrary, (), ()) \ X(int, initLibrary, (), ()) \
X(int, setStreamMode, (int mode), (mode)) \ X(int, setStreamMode, (int mode), (mode)) \
X(int, initOpenGLRenderer, (EGLNativeDisplayType native_display, int width, int height, bool useSubWindow, char* addr, size_t addrLen, emugl_logger_struct logfuncs, emugl_crash_func_t crashfunc), (width, height, useSubWindow, addr, addrLen, logfuncs, crashfunc)) \ X(int, initOpenGLRenderer, (EGLNativeDisplayType native_display, char* addr, size_t addrLen, emugl_logger_struct logfuncs, emugl_crash_func_t crashfunc), (native_display, addr, addrLen, logfuncs, crashfunc)) \
X(void, getHardwareStrings, (const char** vendor, const char** renderer, const char** version), (vendor, renderer, version)) \ X(void, getHardwareStrings, (const char** vendor, const char** renderer, const char** version), (vendor, renderer, version)) \
X(void, setPostCallback, (OnPostFn onPost, void* onPostContext), (onPost, onPostContext)) \ X(void, setPostCallback, (OnPostFn onPost, void* onPostContext), (onPost, onPostContext)) \
X(bool, showOpenGLSubwindow, (FBNativeWindowType window, int wx, int wy, int ww, int wh, int fbw, int fbh, float dpr, float zRot), (window, wx, wy, ww, wh, fbw, fbh, dpr, zRot)) \ X(bool, showOpenGLSubwindow, (FBNativeWindowType window, int wx, int wy, int ww, int wh, int fbw, int fbh, float dpr, float zRot), (window, wx, wy, ww, wh, fbw, fbh, dpr, zRot)) \

View file

@ -162,7 +162,7 @@ void FrameBuffer::finalize(){
s_egl.eglDestroySurface(m_eglDisplay, m_pbufSurface); s_egl.eglDestroySurface(m_eglDisplay, m_pbufSurface);
} }
bool FrameBuffer::initialize(EGLNativeDisplayType nativeDisplay, int width, int height, bool useSubWindow) bool FrameBuffer::initialize(EGLNativeDisplayType nativeDisplay)
{ {
GL_LOG("FrameBuffer::initialize"); GL_LOG("FrameBuffer::initialize");
if (s_theFrameBuffer != NULL) { if (s_theFrameBuffer != NULL) {
@ -172,7 +172,7 @@ bool FrameBuffer::initialize(EGLNativeDisplayType nativeDisplay, int width, int
// //
// allocate space for the FrameBuffer object // allocate space for the FrameBuffer object
// //
FrameBuffer *fb = new FrameBuffer(width, height, useSubWindow); FrameBuffer *fb = new FrameBuffer();
if (!fb) { if (!fb) {
ERR("Failed to create fb\n"); ERR("Failed to create fb\n");
return false; return false;
@ -218,7 +218,7 @@ bool FrameBuffer::initialize(EGLNativeDisplayType nativeDisplay, int width, int
// //
// Create EGL context for framebuffer post rendering. // Create EGL context for framebuffer post rendering.
// //
GLint surfaceType = (useSubWindow ? EGL_WINDOW_BIT : 0) | EGL_PBUFFER_BIT; GLint surfaceType = EGL_WINDOW_BIT| EGL_PBUFFER_BIT;
const GLint configAttribs[] = { const GLint configAttribs[] = {
EGL_RED_SIZE, 1, EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1, EGL_GREEN_SIZE, 1,
@ -427,8 +427,7 @@ bool FrameBuffer::initialize(EGLNativeDisplayType nativeDisplay, int width, int
return true; return true;
} }
FrameBuffer::FrameBuffer(int p_width, int p_height, bool useSubWindow) : FrameBuffer::FrameBuffer() :
m_useSubWindow(useSubWindow),
m_configs(NULL), m_configs(NULL),
m_eglDisplay(EGL_NO_DISPLAY), m_eglDisplay(EGL_NO_DISPLAY),
m_colorBufferHelper(new ColorBufferHelper(this)), m_colorBufferHelper(new ColorBufferHelper(this)),

View file

@ -76,7 +76,7 @@ public:
// own sub-windows. If false, this means the caller will use // own sub-windows. If false, this means the caller will use
// setPostCallback() instead to retrieve the content. // setPostCallback() instead to retrieve the content.
// Returns true on success, false otherwise. // Returns true on success, false otherwise.
static bool initialize(EGLNativeDisplayType nativeDisplay, int width, int height, bool useSubWindow); static bool initialize(EGLNativeDisplayType nativeDisplay);
FrameBufferWindow* createWindow(int x, int y, int width, int height); FrameBufferWindow* createWindow(int x, int y, int width, int height);
void destroyWindow(FrameBufferWindow *window); void destroyWindow(FrameBufferWindow *window);
@ -248,7 +248,7 @@ public:
bool unbind_locked(); bool unbind_locked();
private: private:
FrameBuffer(int p_width, int p_height, bool useSubWindow); FrameBuffer();
~FrameBuffer(); ~FrameBuffer();
HandleType genHandle(); HandleType genHandle();
@ -257,7 +257,6 @@ private:
private: private:
static FrameBuffer *s_theFrameBuffer; static FrameBuffer *s_theFrameBuffer;
static HandleType s_nextHandle; static HandleType s_nextHandle;
bool m_useSubWindow;
emugl::Mutex m_lock; emugl::Mutex m_lock;
FbConfigList* m_configs; FbConfigList* m_configs;
FBNativeWindowType m_nativeWindow; FBNativeWindowType m_nativeWindow;

View file

@ -74,8 +74,7 @@ RENDER_APICALL int RENDER_APIENTRY initLibrary(void)
} }
RENDER_APICALL int RENDER_APIENTRY initOpenGLRenderer( RENDER_APICALL int RENDER_APIENTRY initOpenGLRenderer(
EGLNativeDisplayType native_display, EGLNativeDisplayType native_display, char* addr, size_t addrLen,
int width, int height, bool useSubWindow, char* addr, size_t addrLen,
emugl_logger_struct logfuncs, emugl_crash_func_t crashfunc) { emugl_logger_struct logfuncs, emugl_crash_func_t crashfunc) {
set_emugl_crash_reporter(crashfunc); set_emugl_crash_reporter(crashfunc);
set_emugl_logger(logfuncs.coarse); set_emugl_logger(logfuncs.coarse);
@ -113,7 +112,7 @@ RENDER_APICALL int RENDER_APIENTRY initOpenGLRenderer(
// initialize the renderer and listen to connections // initialize the renderer and listen to connections
// on a thread in the current process. // on a thread in the current process.
// //
s_renderWindow = new RenderWindow(native_display, width, height, kUseThread, useSubWindow); s_renderWindow = new RenderWindow(native_display, kUseThread);
if (!s_renderWindow) { if (!s_renderWindow) {
ERR("Could not create rendering window class"); ERR("Could not create rendering window class");
GL_LOG("Could not create rendering window class"); GL_LOG("Could not create rendering window class");

View file

@ -73,9 +73,6 @@ struct RenderWindowMessage {
// CMD_INITIALIZE // CMD_INITIALIZE
struct { struct {
EGLNativeDisplayType nativeDisplay; EGLNativeDisplayType nativeDisplay;
int width;
int height;
bool useSubWindow;
} init; } init;
// CMD_SET_POST_CALLBACK // CMD_SET_POST_CALLBACK
@ -118,13 +115,9 @@ struct RenderWindowMessage {
bool result = false; bool result = false;
switch (msg.cmd) { switch (msg.cmd) {
case CMD_INITIALIZE: case CMD_INITIALIZE:
D("CMD_INITIALIZE w=%d h=%d\n", msg.init.width, msg.init.height); D("CMD_INITIALIZE\n");
GL_LOG("RenderWindow: CMD_INITIALIZE w=%d h=%d", GL_LOG("RenderWindow: CMD_INITIALIZE");
msg.init.width, msg.init.height); result = FrameBuffer::initialize(msg.init.nativeDisplay);
result = FrameBuffer::initialize(msg.init.nativeDisplay,
msg.init.width,
msg.init.height,
msg.init.useSubWindow);
break; break;
case CMD_FINALIZE: case CMD_FINALIZE:
@ -252,10 +245,7 @@ private:
} // namespace } // namespace
RenderWindow::RenderWindow(EGLNativeDisplayType native_display, RenderWindow::RenderWindow(EGLNativeDisplayType native_display,
int width, bool use_thread) :
int height,
bool use_thread,
bool use_sub_window) :
mValid(false), mValid(false),
mHasSubWindow(false), mHasSubWindow(false),
mThread(NULL), mThread(NULL),
@ -269,9 +259,6 @@ RenderWindow::RenderWindow(EGLNativeDisplayType native_display,
RenderWindowMessage msg; RenderWindowMessage msg;
msg.cmd = CMD_INITIALIZE; msg.cmd = CMD_INITIALIZE;
msg.init.nativeDisplay = native_display; msg.init.nativeDisplay = native_display;
msg.init.width = width;
msg.init.height = height;
msg.init.useSubWindow = use_sub_window;
mValid = processMessage(msg); mValid = processMessage(msg);
} }

View file

@ -59,7 +59,7 @@ public:
// //
// Note that this call doesn't display anything, it just initializes // Note that this call doesn't display anything, it just initializes
// the library, use setupSubWindow() to display something. // the library, use setupSubWindow() to display something.
RenderWindow(EGLNativeDisplayType native_display, int width, int height, bool use_thread, bool use_sub_window); RenderWindow(EGLNativeDisplayType native_display, bool use_thread);
// Destructor. This will automatically call removeSubWindow() is needed. // Destructor. This will automatically call removeSubWindow() is needed.
~RenderWindow(); ~RenderWindow();

View file

@ -78,7 +78,7 @@ void GLRendererServer::start() {
// The width & height we supply here are the dimensions the internal framebuffer // The width & height we supply here are the dimensions the internal framebuffer
// will use. Making this static prevents us for now to resize the window we create // will use. Making this static prevents us for now to resize the window we create
// later for the actual display. // later for the actual display.
if (!initOpenGLRenderer(window_creator_->native_display(), width, height, true, server_addr, sizeof(server_addr), log_funcs, logger_write)) if (!initOpenGLRenderer(window_creator_->native_display(), server_addr, sizeof(server_addr), log_funcs, logger_write))
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to setup OpenGL renderer")); BOOST_THROW_EXCEPTION(std::runtime_error("Failed to setup OpenGL renderer"));
socket_path_ = server_addr; socket_path_ = server_addr;