Skip to content

Commit

Permalink
MGS-5777 eglretrace is missing for FB imx6q and imx7ulp
Browse files Browse the repository at this point in the history
Waffle only supports wayland and gbm, but not FBDEV.
Disable waffle and add glws_nonx support for FB backend for imx6q and imx7ulp
  • Loading branch information
b18948 authored and Adrian Negreanu committed Sep 15, 2021
1 parent d1815b9 commit d989795
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ elseif (APPLE)
elseif (ENABLE_X11)
find_package (X11)

if (X11_FOUND)
if (X11_FOUND AND ENABLE_X11)
include_directories (${X11_INCLUDE_DIR})
add_definitions (-DHAVE_X11)
else ()
Expand Down
29 changes: 28 additions & 1 deletion retrace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ if (WIN32 OR APPLE OR X11_FOUND)
install_pdb (glretrace DESTINATION bin)
endif ()

if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE)
if (ENABLE_EGL AND ENABLE_X11 AND X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE)
add_executable (eglretrace
glws_xlib.cpp
glws_egl_xlib.cpp
Expand All @@ -177,6 +177,33 @@ if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE)
install (TARGETS eglretrace RUNTIME DESTINATION bin)
endif ()

if (ENABLE_EGL AND NOT ENABLE_X11 AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE )
add_executable (eglretrace
glws_nonx.cpp )

add_dependencies (eglretrace glproc)
include_directories (${CMAKE_SYSROOT}/usr/include/HAL/)

target_link_libraries (eglretrace retrace_common
glretrace_common
glhelpers
glproc_egl
${CMAKE_THREAD_LIBS_INIT}
${CMAKE_DL_LIBS}
${Vivante_G2D_LIBRARY}
${Vivante_VDK_LIBRARY}
)

if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries (eglretrace rt)
if (READPROC_H_FOUND)
target_link_libraries (eglretrace ${proc_LIBRARY})
endif ()
endif ()

install (TARGETS eglretrace RUNTIME DESTINATION bin)
endif()

if (ENABLE_EGL AND ENABLE_WAFFLE)
link_directories(${Waffle_LIBRARY_DIRS})
link_directories(${WAFFLE_LIBRARY_DIRS})
Expand Down
18 changes: 10 additions & 8 deletions retrace/glws_nonx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ static bool has_EGL_KHR_create_context = false;
static bool check_dfb();

static EGLenum
translateAPI(glprofile::Profile profile)
translateAPI(Profile profile)
{
switch (profile.api) {
case glprofile::API_GL:
case glfeatures::API_GL:
return EGL_OPENGL_API;
case glprofile::API_GLES:
case glfeatures::API_GLES:
return EGL_OPENGL_ES_API;
default:
assert(0);
Expand All @@ -52,6 +52,7 @@ bindAPI(EGLenum api)
std::cerr << "error: eglBindAPI failed\n";
exit(1);
}

}

class NonxVisual : public Visual
Expand Down Expand Up @@ -288,12 +289,12 @@ cleanup(void) {
Visual *
createVisual(bool doubleBuffer, unsigned samples, Profile profile) {
EGLint api_bits;
if (profile.api == glprofile::API_GL) {
if (profile.api == glfeatures::API_GL) {
api_bits = EGL_OPENGL_BIT;
if (profile.core && !has_EGL_KHR_create_context) {
return NULL;
}
} else if (profile.api == glprofile::API_GLES) {
} else if (profile.api == glfeatures::API_GLES) {
switch (profile.major) {
case 1:
api_bits = EGL_OPENGL_ES_BIT;
Expand Down Expand Up @@ -407,7 +408,7 @@ createContext(const Visual *_visual, Context *shareContext, bool debug)
}

int contextFlags = 0;
if (profile.api == glprofile::API_GL) {
if (profile.api == glfeatures::API_GL) {
load("libGL.so.1");

if (has_EGL_KHR_create_context) {
Expand All @@ -422,7 +423,8 @@ createContext(const Visual *_visual, Context *shareContext, bool debug)
std::cerr << "error: EGL_KHR_create_context not supported\n";
return NULL;
}
} else if (profile.api == glprofile::API_GLES) {
} else if (profile.api == glfeatures::API_GLES)
{
if (profile.major >= 2) {
load("libGLESv2.so.2");
} else {
Expand Down Expand Up @@ -464,7 +466,7 @@ createContext(const Visual *_visual, Context *shareContext, bool debug)
}

bool
makeCurrentInternal(Drawable *drawable, Context *context)
makeCurrentInternal(Drawable *drawable, Drawable *readable, Context *context)
{
if (!drawable || !context) {
return eglMakeCurrent(vdk_egl.eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
Expand Down

0 comments on commit d989795

Please sign in to comment.