Skip to content
Commits on Source (6)
......@@ -31,6 +31,7 @@
#include "shared/helpers.h"
#include "shared/platform.h"
#include "shared/string-helpers.h"
#include "gl-renderer.h"
#include "gl-renderer-internal.h"
......@@ -477,7 +478,7 @@ gl_renderer_set_egl_device(struct gl_renderer *gr)
return;
}
gl_renderer_log_extensions("EGL device extensions", extensions);
gl_renderer_log_extensions(gr, "EGL device extensions", extensions);
/* Try to query the render node using EGL_DRM_RENDER_NODE_FILE_EXT */
if (weston_check_egl_extension(extensions, "EGL_EXT_device_drm_render_node"))
......@@ -490,8 +491,10 @@ gl_renderer_set_egl_device(struct gl_renderer *gr)
gr->drm_device = gr->query_device_string(gr->egl_device,
EGL_DRM_DEVICE_FILE_EXT);
if (!gr->drm_device)
weston_log("failed to query DRM device from EGL\n");
if (gr->drm_device)
weston_log("Using rendering device: %s\n", gr->drm_device);
else
weston_log("warning: failed to query rendering device from EGL\n");
}
int
......@@ -573,8 +576,7 @@ gl_renderer_setup_egl_client_extensions(struct gl_renderer *gr)
return 0;
}
gl_renderer_log_extensions("EGL client extensions",
extensions);
gl_renderer_log_extensions(gr, "EGL client extensions", extensions);
if (weston_check_egl_extension(extensions, "EGL_EXT_device_query")) {
gr->query_display_attrib =
......@@ -594,8 +596,10 @@ gl_renderer_setup_egl_client_extensions(struct gl_renderer *gr)
weston_log("warning: EGL_EXT_platform_base not supported.\n");
/* Surfaceless is unusable without platform_base extension */
if (gr->platform == EGL_PLATFORM_SURFACELESS_MESA)
if (gr->platform == EGL_PLATFORM_SURFACELESS_MESA) {
weston_log("Error: EGL surfaceless platform cannot be used.\n");
return -1;
}
return 0;
}
......@@ -615,6 +619,7 @@ gl_renderer_setup_egl_client_extensions(struct gl_renderer *gr)
/* at this point we definitely have some platform extensions but
* haven't found the supplied platform, so chances are it's
* not supported. */
weston_log("Error: EGL does not support %s platform.\n", extension_suffix);
return -1;
}
......@@ -739,5 +744,25 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
"to missing EGL_KHR_wait_sync extension\n");
}
weston_log("EGL features:\n");
weston_log_continue(STAMP_SPACE "EGL Wayland extension: %s\n",
yesno(gr->has_bind_display));
weston_log_continue(STAMP_SPACE "context priority: %s\n",
yesno(gr->has_context_priority));
weston_log_continue(STAMP_SPACE "buffer age: %s\n",
yesno(gr->has_egl_buffer_age));
weston_log_continue(STAMP_SPACE "partial update: %s\n",
yesno(gr->has_egl_partial_update));
weston_log_continue(STAMP_SPACE "swap buffers with damage: %s\n",
yesno(gr->swap_buffers_with_damage));
weston_log_continue(STAMP_SPACE "configless context: %s\n",
yesno(gr->has_configless_context));
weston_log_continue(STAMP_SPACE "surfaceless context: %s\n",
yesno(gr->has_surfaceless_context));
weston_log_continue(STAMP_SPACE "dmabuf support: %s\n",
gr->has_dmabuf_import ?
(gr->has_dmabuf_import_modifiers ? "modifiers" : "legacy") :
"no");
return 0;
}
......@@ -115,6 +115,7 @@ struct gl_shader_config {
struct gl_renderer {
struct weston_renderer base;
struct weston_compositor *compositor;
struct weston_log_scope *renderer_scope;
bool fragment_shader_debug;
bool fan_debug;
......@@ -213,7 +214,8 @@ void
gl_renderer_print_egl_error_state(void);
void
gl_renderer_log_extensions(const char *name, const char *extensions);
gl_renderer_log_extensions(struct gl_renderer *gr,
const char *name, const char *extensions);
void
log_egl_config_info(EGLDisplay egldpy, EGLConfig eglconfig);
......
......@@ -57,6 +57,7 @@
#include "shared/fd-util.h"
#include "shared/helpers.h"
#include "shared/platform.h"
#include "shared/string-helpers.h"
#include "shared/timespec-util.h"
#include "shared/weston-drm-fourcc.h"
#include "shared/weston-egl-ext.h"
......@@ -3241,30 +3242,36 @@ gl_renderer_create_surface(struct weston_surface *surface)
}
void
gl_renderer_log_extensions(const char *name, const char *extensions)
gl_renderer_log_extensions(struct gl_renderer *gr,
const char *name, const char *extensions)
{
const char *p, *end;
int l;
int len;
l = weston_log("%s:", name);
if (!weston_log_scope_is_enabled(gr->renderer_scope))
return;
l = weston_log_scope_printf(gr->renderer_scope, "%s:", name);
p = extensions;
while (*p) {
end = strchrnul(p, ' ');
len = end - p;
if (l + len > 78)
l = weston_log_continue("\n" STAMP_SPACE "%.*s",
len, p);
else
l += weston_log_continue(" %.*s", len, p);
if (l + len > 78) {
l = weston_log_scope_printf(gr->renderer_scope,
"\n %.*s", len, p);
} else {
l += weston_log_scope_printf(gr->renderer_scope,
" %.*s", len, p);
}
for (p = end; isspace(*p); p++)
;
}
weston_log_continue("\n");
weston_log_scope_printf(gr->renderer_scope, "\n");
}
static void
log_egl_info(EGLDisplay egldpy)
log_egl_info(struct gl_renderer *gr, EGLDisplay egldpy)
{
const char *str;
......@@ -3278,11 +3285,11 @@ log_egl_info(EGLDisplay egldpy)
weston_log("EGL client APIs: %s\n", str ? str : "(null)");
str = eglQueryString(egldpy, EGL_EXTENSIONS);
gl_renderer_log_extensions("EGL extensions", str ? str : "(null)");
gl_renderer_log_extensions(gr, "EGL extensions", str ? str : "(null)");
}
static void
log_gl_info(void)
log_gl_info(struct gl_renderer *gr)
{
const char *str;
......@@ -3299,7 +3306,7 @@ log_gl_info(void)
weston_log("GL renderer: %s\n", str ? str : "(null)");
str = (char *)glGetString(GL_EXTENSIONS);
gl_renderer_log_extensions("GL extensions", str ? str : "(null)");
gl_renderer_log_extensions(gr, "GL extensions", str ? str : "(null)");
}
static void
......@@ -3584,6 +3591,7 @@ gl_renderer_destroy(struct weston_compositor *ec)
weston_binding_destroy(gr->fan_binding);
weston_log_scope_destroy(gr->shader_scope);
weston_log_scope_destroy(gr->renderer_scope);
free(gr);
}
......@@ -3666,6 +3674,11 @@ gl_renderer_display_create(struct weston_compositor *ec,
wl_list_init(&gr->shader_list);
gr->platform = options->egl_platform;
gr->renderer_scope = weston_compositor_add_log_scope(ec, "gl-renderer",
"GL-renderer verbose messages\n", NULL, NULL, gr);
if (!gr->renderer_scope)
goto fail;
gr->shader_scope = gl_shader_scope_create(gr);
if (!gr->shader_scope)
goto fail;
......@@ -3686,7 +3699,7 @@ gl_renderer_display_create(struct weston_compositor *ec,
weston_drm_format_array_init(&gr->supported_formats);
log_egl_info(gr->egl_display);
log_egl_info(gr, gr->egl_display);
ec->renderer = &gr->base;
......@@ -3737,12 +3750,8 @@ gl_renderer_display_create(struct weston_compositor *ec,
wl_list_init(&gr->dmabuf_formats);
if (gr->has_surfaceless_context) {
weston_log("EGL_KHR_surfaceless_context available\n");
gr->dummy_surface = EGL_NO_SURFACE;
} else {
weston_log("EGL_KHR_surfaceless_context unavailable. "
"Trying PbufferSurface\n");
if (gl_renderer_create_pbuffer_surface(gr) < 0)
goto fail_with_error;
}
......@@ -3797,6 +3806,7 @@ fail_terminate:
eglTerminate(gr->egl_display);
fail:
weston_log_scope_destroy(gr->shader_scope);
weston_log_scope_destroy(gr->renderer_scope);
free(gr);
ec->renderer = NULL;
return -1;
......@@ -3919,7 +3929,7 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
}
gr->gl_version = get_gl_version();
log_gl_info();
log_gl_info(gr);
gr->image_target_texture_2d =
(void *) eglGetProcAddress("glEGLImageTargetTexture2DOES");
......@@ -3988,9 +3998,17 @@ gl_renderer_setup(struct weston_compositor *ec, EGLSurface egl_surface)
gr_gl_version_major(gr->gl_version),
gr_gl_version_minor(gr->gl_version));
weston_log_continue(STAMP_SPACE "read-back format: %s\n",
ec->read_format == PIXMAN_a8r8g8b8 ? "BGRA" : "RGBA");
weston_log_continue(STAMP_SPACE "EGL Wayland extension: %s\n",
gr->has_bind_display ? "yes" : "no");
ec->read_format == PIXMAN_a8r8g8b8 ? "BGRA" : "RGBA");
weston_log_continue(STAMP_SPACE "wl_shm 10 bpc formats: %s\n",
yesno(gr->has_texture_type_2_10_10_10_rev));
weston_log_continue(STAMP_SPACE "wl_shm 16 bpc formats: %s\n",
yesno(gr->has_texture_norm16));
weston_log_continue(STAMP_SPACE "wl_shm half-float formats: %s\n",
yesno(gr->gl_supports_color_transforms));
weston_log_continue(STAMP_SPACE "internal R and RG formats: %s\n",
yesno(gr->has_gl_texture_rg));
weston_log_continue(STAMP_SPACE "OES_EGL_image_external: %s\n",
yesno(gr->has_egl_image_external));
return 0;
}
......
......@@ -95,4 +95,10 @@ str_printf(char **str_out, const char *fmt, ...)
*str_out = NULL;
}
static inline const char *
yesno(bool cond)
{
return cond ? "yes" : "no";
}
#endif /* WESTON_STRING_HELPERS_H */