mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] egl: better debug output for EGL errors
This commit is contained in:
parent
88b15cb3fe
commit
202739c5be
@ -34,7 +34,7 @@ make_object(
|
|||||||
add_library(renderer_EGL STATIC
|
add_library(renderer_EGL STATIC
|
||||||
egl.c
|
egl.c
|
||||||
dynprocs.c
|
dynprocs.c
|
||||||
debug.c
|
egldebug.c
|
||||||
shader.c
|
shader.c
|
||||||
texture.c
|
texture.c
|
||||||
model.c
|
model.c
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
Looking Glass - KVM FrameRelay (KVMFR) Client
|
|
||||||
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
|
||||||
https://looking-glass.hostfission.com
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation; either version 2 of the License, or (at your option) any later
|
|
||||||
version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
|
||||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <GL/gl.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void egl_debug_printf(char * format, ...)
|
|
||||||
{
|
|
||||||
va_list args;
|
|
||||||
va_start(args, format);
|
|
||||||
vfprintf(stderr, format, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
GLenum error = glGetError();
|
|
||||||
switch(error)
|
|
||||||
{
|
|
||||||
case GL_NO_ERROR:
|
|
||||||
fprintf(stderr, " (GL_NO_ERROR)\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_INVALID_ENUM:
|
|
||||||
fprintf(stderr, " (GL_INVALID_ENUM)\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_INVALID_VALUE:
|
|
||||||
fprintf(stderr, " (GL_INVALID_VALUE)\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_INVALID_OPERATION:
|
|
||||||
fprintf(stderr, " (GL_INVALID_OPERATION)\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
|
||||||
fprintf(stderr, " (GL_INVALID_FRAMEBUFFER_OPERATION)\n");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_OUT_OF_MEMORY:
|
|
||||||
fprintf(stderr, " (GL_OUT_OF_MEMORY)\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
@ -651,9 +651,9 @@ bool egl_render_startup(void * opaque, SDL_Window * window)
|
|||||||
*
|
*
|
||||||
* ref: https://forums.developer.nvidia.com/t/egl-ext-image-dma-buf-import-broken-egl-bad-alloc-with-tons-of-free-ram/165552
|
* ref: https://forums.developer.nvidia.com/t/egl-ext-image-dma-buf-import-broken-egl-bad-alloc-with-tons-of-free-ram/165552
|
||||||
*/
|
*/
|
||||||
if (strstr(vendor, "NVIDIA") != NULL)
|
// if (strstr(vendor, "NVIDIA") != NULL)
|
||||||
DEBUG_WARN("NVIDIA driver detected, ignoring broken DMA support");
|
// DEBUG_WARN("NVIDIA driver detected, ignoring broken DMA support");
|
||||||
else
|
// else
|
||||||
this->dmaSupport = true;
|
this->dmaSupport = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
45
client/renderers/EGL/egldebug.c
Normal file
45
client/renderers/EGL/egldebug.c
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||||
|
Copyright (C) 2017-2021 Geoffrey McRae <geoff@hostfission.com>
|
||||||
|
https://looking-glass.hostfission.com
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along with
|
||||||
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "egldebug.h"
|
||||||
|
#include <SDL2/SDL_egl.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
|
||||||
|
const char * egl_getErrorStr(void)
|
||||||
|
{
|
||||||
|
switch (eglGetError())
|
||||||
|
{
|
||||||
|
case EGL_SUCCESS : return "EGL_SUCCESS";
|
||||||
|
case EGL_NOT_INITIALIZED : return "EGL_NOT_INITIALIZED";
|
||||||
|
case EGL_BAD_ACCESS : return "EGL_BAD_ACCESS";
|
||||||
|
case EGL_BAD_ALLOC : return "EGL_BAD_ALLOC";
|
||||||
|
case EGL_BAD_ATTRIBUTE : return "EGL_BAD_ATTRIBUTE";
|
||||||
|
case EGL_BAD_CONTEXT : return "EGL_BAD_CONTEXT";
|
||||||
|
case EGL_BAD_CONFIG : return "EGL_BAD_CONFIG";
|
||||||
|
case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
|
||||||
|
case EGL_BAD_DISPLAY : return "EGL_BAD_DISPLAY";
|
||||||
|
case EGL_BAD_SURFACE : return "EGL_BAD_SURFACE";
|
||||||
|
case EGL_BAD_MATCH : return "EGL_BAD_MATCH";
|
||||||
|
case EGL_BAD_PARAMETER : return "EGL_BAD_PARAMETER";
|
||||||
|
case EGL_BAD_NATIVE_PIXMAP : return "EGL_BAD_NATIVE_PIXMAP";
|
||||||
|
case EGL_BAD_NATIVE_WINDOW : return "EGL_BAD_NATIVE_WINDOW";
|
||||||
|
case EGL_CONTEXT_LOST : return "EGL_CONTEXT_LOST";
|
||||||
|
default : return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Looking Glass - KVM FrameRelay (KVMFR) Client
|
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||||
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
Copyright (C) 2017-2021 Geoffrey McRae <geoff@hostfission.com>
|
||||||
https://looking-glass.hostfission.com
|
https://looking-glass.hostfission.com
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
@ -17,11 +17,13 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <common/debug.h>
|
#include "common/debug.h"
|
||||||
|
|
||||||
#define EGL_DEBUG_PRINT(type, fmt, ...) do {egl_debug_printf(type " %20s:%-4u | %-30s | " fmt, STRIPPATH(__FILE__), __LINE__, __FUNCTION__, ##__VA_ARGS__);} while (0)
|
const char * egl_getErrorStr(void);
|
||||||
#define EGL_ERROR(fmt, ...) EGL_DEBUG_PRINT("[E]", fmt, ##__VA_ARGS__)
|
|
||||||
|
|
||||||
void egl_debug_printf(char * format, ...);
|
#define DEBUG_EGL_WARN(fmt, ...) \
|
||||||
|
DEBUG_WARN(fmt " (%s)", ##__VA_ARGS__, egl_getErrorStr())
|
||||||
|
|
||||||
|
#define DEBUG_EGL_ERROR(fmt, ...) \
|
||||||
|
DEBUG_ERROR(fmt " (%s)", ##__VA_ARGS__, egl_getErrorStr())
|
@ -20,9 +20,9 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "texture.h"
|
#include "texture.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/framebuffer.h"
|
#include "common/framebuffer.h"
|
||||||
#include "debug.h"
|
|
||||||
#include "dynprocs.h"
|
#include "dynprocs.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "egldebug.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -142,7 +142,8 @@ static bool egl_texture_map(EGL_Texture * texture, uint8_t i)
|
|||||||
|
|
||||||
if (!texture->buf[i].map)
|
if (!texture->buf[i].map)
|
||||||
{
|
{
|
||||||
EGL_ERROR("glMapBufferRange failed for %d of %lu bytes", i, texture->pboBufferSize);
|
DEBUG_EGL_ERROR("glMapBufferRange failed for %d of %lu bytes", i,
|
||||||
|
texture->pboBufferSize);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +388,7 @@ bool egl_texture_update_from_dma(EGL_Texture * texture, const FrameBuffer * fram
|
|||||||
|
|
||||||
if (image == EGL_NO_IMAGE)
|
if (image == EGL_NO_IMAGE)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("failed to create ELGImage for DMA transfer");
|
DEBUG_EGL_ERROR("Failed to create ELGImage for DMA transfer");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +482,7 @@ enum EGL_TexStatus egl_texture_bind(EGL_Texture * texture)
|
|||||||
case GL_INVALID_VALUE:
|
case GL_INVALID_VALUE:
|
||||||
glDeleteSync(texture->buf[b].sync);
|
glDeleteSync(texture->buf[b].sync);
|
||||||
texture->buf[b].sync = 0;
|
texture->buf[b].sync = 0;
|
||||||
EGL_ERROR("glClientWaitSync failed");
|
DEBUG_EGL_ERROR("glClientWaitSync failed");
|
||||||
return EGL_TEX_STATUS_ERROR;
|
return EGL_TEX_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user