Rework client renderer setup
This gets us rid of one unneeded socket based communication point which we kept around for historic reasons (from Android QEMU) but don't really need in our case. This allows a simplication of our setup and improves performance.
This commit is contained in:
parent
aa23c349a1
commit
7ce2da3be3
39 changed files with 998 additions and 1596 deletions
1
external/android-emugl/CMakeLists.txt
vendored
1
external/android-emugl/CMakeLists.txt
vendored
|
|
@ -3,6 +3,7 @@
|
|||
set(CMAKE_C_FLAGS "-Wall")
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/external/android-emugl/shared
|
||||
${CMAKE_SOURCE_DIR}/external/android-emugl/host/include
|
||||
${CMAKE_SOURCE_DIR}/external/android-emugl/shared/OpenglCodecCommon
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "OpenglRender/render_api_functions.h"
|
||||
|
||||
#include <KHR/khrplatform.h>
|
||||
|
||||
/* This header and its declarations must be usable from C code.
|
||||
*
|
||||
* If RENDER_API_NO_PROTOTYPES is #defined before including this header, only
|
||||
* the interface function pointer types will be declared, not the prototypes.
|
||||
* This allows the client to use those names for its function pointer variables.
|
||||
*
|
||||
* All interfaces which can fail return an int, with zero indicating failure
|
||||
* and anything else indicating success.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Use KHRONOS_APICALL to control visibility, but do not use KHRONOS_APIENTRY
|
||||
// because we don't need the functions to be __stdcall on Win32.
|
||||
#define RENDER_APICALL KHRONOS_APICALL
|
||||
#define RENDER_APIENTRY
|
||||
|
||||
#define RENDER_API_DECLARE(return_type, func_name, signature, callargs) \
|
||||
typedef return_type (RENDER_APIENTRY *func_name ## Fn) signature; \
|
||||
RENDER_APICALL return_type RENDER_APIENTRY func_name signature;
|
||||
|
||||
typedef void (*emugl_logger_func_t)(const char* fmt, ...);
|
||||
|
||||
typedef struct {
|
||||
emugl_logger_func_t coarse;
|
||||
emugl_logger_func_t fine;
|
||||
} emugl_logger_struct;
|
||||
|
||||
LIST_RENDER_API_FUNCTIONS(RENDER_API_DECLARE)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
// Auto-generated with: android/scripts/gen-entries.py --mode=funcargs distrib/android-emugl/host/libs/libOpenglRender/render_api.entries --output=distrib/android-emugl/host/include/OpenglRender/render_api_functions.h
|
||||
// DO NOT EDIT THIS FILE
|
||||
|
||||
#ifndef RENDER_API_FUNCTIONS_H
|
||||
#define RENDER_API_FUNCTIONS_H
|
||||
|
||||
#include "OpenglRender/render_api_platform_types.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
||||
/* list of constants to be passed to setStreamMode */
|
||||
#define RENDER_API_STREAM_MODE_DEFAULT 0
|
||||
#define RENDER_API_STREAM_MODE_TCP 1
|
||||
#define RENDER_API_STREAM_MODE_UNIX 2
|
||||
#define RENDER_API_STREAM_MODE_PIPE 3
|
||||
|
||||
typedef void (*OnPostFn)(void* context, int width, int height, int ydir,
|
||||
int format, int type, unsigned char* pixels);
|
||||
typedef void (*emugl_crash_func_t)(const char* format, ...);
|
||||
|
||||
#define LIST_RENDER_API_FUNCTIONS(X) \
|
||||
X(int, initLibrary, (), ()) \
|
||||
X(int, setStreamMode, (int mode), (mode)) \
|
||||
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, 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, destroyOpenGLSubwindow, (), ()) \
|
||||
X(void, setOpenGLDisplayRotation, (float zRot), (zRot)) \
|
||||
X(void, setOpenGLDisplayTranslation, (float px, float py), (px, py)) \
|
||||
X(void, repaintOpenGLDisplay, (), ()) \
|
||||
X(int, stopOpenGLRenderer, (), ()) \
|
||||
|
||||
|
||||
#endif // RENDER_API_FUNCTIONS_H
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Define FBNativeWindowType which corresponds to the type of native
|
||||
// host UI window handles.
|
||||
|
||||
#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
|
||||
#include <windows.h>
|
||||
|
||||
typedef HWND FBNativeWindowType;
|
||||
|
||||
#elif defined(__linux__)
|
||||
|
||||
// Really a Window handle, but we don't want to include the X11 headers here.
|
||||
#include <stdint.h>
|
||||
typedef uint32_t FBNativeWindowType;
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
typedef void* FBNativeWindowType;
|
||||
|
||||
#else
|
||||
#warning "Unsupported platform"
|
||||
#endif
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
class IOStream {
|
||||
public:
|
||||
|
||||
IOStream(size_t bufSize) {
|
||||
m_buf = NULL;
|
||||
m_bufsize = bufSize;
|
||||
|
|
@ -31,19 +30,15 @@ public:
|
|||
}
|
||||
|
||||
virtual void *allocBuffer(size_t minSize) = 0;
|
||||
virtual int commitBuffer(size_t size) = 0;
|
||||
virtual const unsigned char *readFully( void *buf, size_t len) = 0;
|
||||
virtual const unsigned char *read( void *buf, size_t *inout_len) = 0;
|
||||
virtual int writeFully(const void* buf, size_t len) = 0;
|
||||
virtual size_t commitBuffer(size_t size) = 0;
|
||||
virtual const unsigned char *read(void *buf, size_t *inout_len) = 0;
|
||||
virtual void forceStop() = 0;
|
||||
|
||||
virtual ~IOStream() {
|
||||
|
||||
// NOTE: m_buf is 'owned' by the child class thus we expect it to be released by it
|
||||
}
|
||||
|
||||
unsigned char *alloc(size_t len) {
|
||||
|
||||
if (m_buf && len > m_free) {
|
||||
if (flush() < 0) {
|
||||
ERR("Failed to flush in alloc\n");
|
||||
|
|
@ -70,7 +65,6 @@ public:
|
|||
}
|
||||
|
||||
int flush() {
|
||||
|
||||
if (!m_buf || m_free == m_bufsize) return 0;
|
||||
|
||||
int stat = commitBuffer(m_bufsize - m_free);
|
||||
|
|
@ -79,12 +73,6 @@ public:
|
|||
return stat;
|
||||
}
|
||||
|
||||
const unsigned char *readback(void *buf, size_t len) {
|
||||
flush();
|
||||
return readFully(buf, len);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
unsigned char *m_buf;
|
||||
size_t m_bufsize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue