util: add wlr_ prefix to log symbols

This commit is contained in:
emersion 2018-07-09 22:49:54 +01:00
parent ffc8780893
commit 7cbef15206
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
98 changed files with 631 additions and 629 deletions

View file

@ -13,7 +13,7 @@ static bool egl_get_config(EGLDisplay disp, EGLint *attribs, EGLConfig *out,
ret = eglGetConfigs(disp, NULL, 0, &count);
if (ret == EGL_FALSE || count == 0) {
wlr_log(L_ERROR, "eglGetConfigs returned no configs");
wlr_log(WLR_ERROR, "eglGetConfigs returned no configs");
return false;
}
@ -21,7 +21,7 @@ static bool egl_get_config(EGLDisplay disp, EGLint *attribs, EGLConfig *out,
ret = eglChooseConfig(disp, attribs, configs, count, &matched);
if (ret == EGL_FALSE) {
wlr_log(L_ERROR, "eglChooseConfig failed");
wlr_log(WLR_ERROR, "eglChooseConfig failed");
return false;
}
@ -38,17 +38,17 @@ static bool egl_get_config(EGLDisplay disp, EGLint *attribs, EGLConfig *out,
}
}
wlr_log(L_ERROR, "no valid egl config found");
wlr_log(WLR_ERROR, "no valid egl config found");
return false;
}
static log_importance_t egl_log_importance_to_wlr(EGLint type) {
static enum wlr_log_importance egl_log_importance_to_wlr(EGLint type) {
switch (type) {
case EGL_DEBUG_MSG_CRITICAL_KHR: return L_ERROR;
case EGL_DEBUG_MSG_ERROR_KHR: return L_ERROR;
case EGL_DEBUG_MSG_WARN_KHR: return L_ERROR;
case EGL_DEBUG_MSG_INFO_KHR: return L_INFO;
default: return L_INFO;
case EGL_DEBUG_MSG_CRITICAL_KHR: return WLR_ERROR;
case EGL_DEBUG_MSG_ERROR_KHR: return WLR_ERROR;
case EGL_DEBUG_MSG_WARN_KHR: return WLR_ERROR;
case EGL_DEBUG_MSG_INFO_KHR: return WLR_INFO;
default: return WLR_INFO;
}
}
@ -92,7 +92,7 @@ static void print_dmabuf_formats(struct wlr_egl *egl) {
snprintf(&str_formats[i*5], (num - i) * 5 + 1, "%.4s ",
(char*)&formats[i]);
}
wlr_log(L_DEBUG, "Supported dmabuf buffer formats: %s", str_formats);
wlr_log(WLR_DEBUG, "Supported dmabuf buffer formats: %s", str_formats);
free(formats);
}
@ -114,7 +114,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
}
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
wlr_log(L_ERROR, "Failed to bind to the OpenGL ES API");
wlr_log(WLR_ERROR, "Failed to bind to the OpenGL ES API");
goto error;
}
@ -125,26 +125,26 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
egl->display = eglGetPlatformDisplayEXT(platform, remote_display, NULL);
}
if (egl->display == EGL_NO_DISPLAY) {
wlr_log(L_ERROR, "Failed to create EGL display");
wlr_log(WLR_ERROR, "Failed to create EGL display");
goto error;
}
EGLint major, minor;
if (eglInitialize(egl->display, &major, &minor) == EGL_FALSE) {
wlr_log(L_ERROR, "Failed to initialize EGL");
wlr_log(WLR_ERROR, "Failed to initialize EGL");
goto error;
}
if (!egl_get_config(egl->display, config_attribs, &egl->config, visual_id)) {
wlr_log(L_ERROR, "Failed to get EGL config");
wlr_log(WLR_ERROR, "Failed to get EGL config");
goto error;
}
egl->exts_str = eglQueryString(egl->display, EGL_EXTENSIONS);
wlr_log(L_INFO, "Using EGL %d.%d", (int)major, (int)minor);
wlr_log(L_INFO, "Supported EGL extensions: %s", egl->exts_str);
wlr_log(L_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
wlr_log(WLR_INFO, "Using EGL %d.%d", (int)major, (int)minor);
wlr_log(WLR_INFO, "Supported EGL extensions: %s", egl->exts_str);
wlr_log(WLR_INFO, "EGL vendor: %s", eglQueryString(egl->display, EGL_VENDOR));
egl->exts.image_base_khr =
check_egl_ext(egl->exts_str, "EGL_KHR_image_base")
@ -201,7 +201,7 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
egl->context = eglCreateContext(egl->display, egl->config,
EGL_NO_CONTEXT, attribs);
if (egl->context == EGL_NO_CONTEXT) {
wlr_log(L_ERROR, "Failed to create EGL context");
wlr_log(WLR_ERROR, "Failed to create EGL context");
goto error;
}
@ -210,15 +210,15 @@ bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
eglQueryContext(egl->display, egl->context,
EGL_CONTEXT_PRIORITY_LEVEL_IMG, &priority);
if (priority != EGL_CONTEXT_PRIORITY_HIGH_IMG) {
wlr_log(L_INFO, "Failed to obtain a high priority context");
wlr_log(WLR_INFO, "Failed to obtain a high priority context");
} else {
wlr_log(L_DEBUG, "Obtained high priority context");
wlr_log(WLR_DEBUG, "Obtained high priority context");
}
}
if (!eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
egl->context)) {
wlr_log(L_ERROR, "Failed to make EGL context current");
wlr_log(WLR_ERROR, "Failed to make EGL context current");
goto error;
}
@ -277,7 +277,7 @@ EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window) {
EGLSurface surf = eglCreatePlatformWindowSurfaceEXT(egl->display,
egl->config, window, NULL);
if (surf == EGL_NO_SURFACE) {
wlr_log(L_ERROR, "Failed to create EGL surface");
wlr_log(WLR_ERROR, "Failed to create EGL surface");
return EGL_NO_SURFACE;
}
return surf;
@ -292,7 +292,7 @@ static int egl_get_buffer_age(struct wlr_egl *egl, EGLSurface surface) {
EGLBoolean ok = eglQuerySurface(egl->display, surface,
EGL_BUFFER_AGE_EXT, &buffer_age);
if (!ok) {
wlr_log(L_ERROR, "Failed to get EGL surface buffer age");
wlr_log(WLR_ERROR, "Failed to get EGL surface buffer age");
return -1;
}
@ -302,7 +302,7 @@ static int egl_get_buffer_age(struct wlr_egl *egl, EGLSurface surface) {
bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface,
int *buffer_age) {
if (!eglMakeCurrent(egl->display, surface, surface, egl->context)) {
wlr_log(L_ERROR, "eglMakeCurrent failed");
wlr_log(WLR_ERROR, "eglMakeCurrent failed");
return false;
}
@ -344,7 +344,7 @@ bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
}
if (!ret) {
wlr_log(L_ERROR, "eglSwapBuffers failed");
wlr_log(WLR_ERROR, "eglSwapBuffers failed");
return false;
}
return true;
@ -462,24 +462,24 @@ int wlr_egl_get_dmabuf_formats(struct wlr_egl *egl,
int **formats) {
if (!egl->exts.image_dmabuf_import_ext ||
!egl->exts.image_dmabuf_import_modifiers_ext) {
wlr_log(L_DEBUG, "dmabuf extension not present");
wlr_log(WLR_DEBUG, "dmabuf extension not present");
return -1;
}
EGLint num;
if (!eglQueryDmaBufFormatsEXT(egl->display, 0, NULL, &num)) {
wlr_log(L_ERROR, "failed to query number of dmabuf formats");
wlr_log(WLR_ERROR, "failed to query number of dmabuf formats");
return -1;
}
*formats = calloc(num, sizeof(int));
if (*formats == NULL) {
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
return -1;
}
if (!eglQueryDmaBufFormatsEXT(egl->display, num, *formats, &num)) {
wlr_log(L_ERROR, "failed to query dmabuf format");
wlr_log(WLR_ERROR, "failed to query dmabuf format");
free(*formats);
return -1;
}
@ -490,26 +490,26 @@ int wlr_egl_get_dmabuf_modifiers(struct wlr_egl *egl,
int format, uint64_t **modifiers) {
if (!egl->exts.image_dmabuf_import_ext ||
!egl->exts.image_dmabuf_import_modifiers_ext) {
wlr_log(L_DEBUG, "dmabuf extension not present");
wlr_log(WLR_DEBUG, "dmabuf extension not present");
return -1;
}
EGLint num;
if (!eglQueryDmaBufModifiersEXT(egl->display, format, 0,
NULL, NULL, &num)) {
wlr_log(L_ERROR, "failed to query dmabuf number of modifiers");
wlr_log(WLR_ERROR, "failed to query dmabuf number of modifiers");
return -1;
}
*modifiers = calloc(num, sizeof(uint64_t));
if (*modifiers == NULL) {
wlr_log(L_ERROR, "Allocation failed: %s", strerror(errno));
wlr_log(WLR_ERROR, "Allocation failed: %s", strerror(errno));
return -1;
}
if (!eglQueryDmaBufModifiersEXT(egl->display, format, num,
*modifiers, NULL, &num)) {
wlr_log(L_ERROR, "failed to query dmabuf modifiers");
wlr_log(WLR_ERROR, "failed to query dmabuf modifiers");
free(*modifiers);
return -1;
}
@ -531,7 +531,7 @@ bool wlr_egl_export_image_to_dmabuf(struct wlr_egl *egl, EGLImageKHR image,
return false;
}
if (attribs->n_planes > WLR_DMABUF_MAX_PLANES) {
wlr_log(L_ERROR, "EGL returned %d planes, but only %d are supported",
wlr_log(WLR_ERROR, "EGL returned %d planes, but only %d are supported",
attribs->n_planes, WLR_DMABUF_MAX_PLANES);
return false;
}

View file

@ -258,7 +258,7 @@ static bool gles2_read_pixels(struct wlr_renderer *wlr_renderer,
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Cannot read pixels: unsupported pixel format");
wlr_log(WLR_ERROR, "Cannot read pixels: unsupported pixel format");
return false;
}
@ -325,7 +325,7 @@ static void gles2_init_wl_display(struct wlr_renderer *wlr_renderer,
struct wlr_gles2_renderer *renderer =
gles2_get_renderer_in_context(wlr_renderer);
if (!wlr_egl_bind_display(renderer->egl, wl_display)) {
wlr_log(L_INFO, "failed to bind wl_display to EGL");
wlr_log(WLR_INFO, "failed to bind wl_display to EGL");
}
}
@ -389,18 +389,18 @@ void pop_gles2_marker(void) {
}
}
static log_importance_t gles2_log_importance_to_wlr(GLenum type) {
static enum wlr_log_importance gles2_log_importance_to_wlr(GLenum type) {
switch (type) {
case GL_DEBUG_TYPE_ERROR_KHR: return L_ERROR;
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR: return L_DEBUG;
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR: return L_ERROR;
case GL_DEBUG_TYPE_PORTABILITY_KHR: return L_DEBUG;
case GL_DEBUG_TYPE_PERFORMANCE_KHR: return L_DEBUG;
case GL_DEBUG_TYPE_OTHER_KHR: return L_DEBUG;
case GL_DEBUG_TYPE_MARKER_KHR: return L_DEBUG;
case GL_DEBUG_TYPE_PUSH_GROUP_KHR: return L_DEBUG;
case GL_DEBUG_TYPE_POP_GROUP_KHR: return L_DEBUG;
default: return L_DEBUG;
case GL_DEBUG_TYPE_ERROR_KHR: return WLR_ERROR;
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR: return WLR_DEBUG;
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR: return WLR_ERROR;
case GL_DEBUG_TYPE_PORTABILITY_KHR: return WLR_DEBUG;
case GL_DEBUG_TYPE_PERFORMANCE_KHR: return WLR_DEBUG;
case GL_DEBUG_TYPE_OTHER_KHR: return WLR_DEBUG;
case GL_DEBUG_TYPE_MARKER_KHR: return WLR_DEBUG;
case GL_DEBUG_TYPE_PUSH_GROUP_KHR: return WLR_DEBUG;
case GL_DEBUG_TYPE_POP_GROUP_KHR: return WLR_DEBUG;
default: return WLR_DEBUG;
}
}
@ -490,9 +490,9 @@ struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl) {
wlr_egl_make_current(renderer->egl, EGL_NO_SURFACE, NULL);
renderer->exts_str = (const char*) glGetString(GL_EXTENSIONS);
wlr_log(L_INFO, "Using %s", glGetString(GL_VERSION));
wlr_log(L_INFO, "GL vendor: %s", glGetString(GL_VENDOR));
wlr_log(L_INFO, "Supported GLES2 extensions: %s", renderer->exts_str);
wlr_log(WLR_INFO, "Using %s", glGetString(GL_VERSION));
wlr_log(WLR_INFO, "GL vendor: %s", glGetString(GL_VENDOR));
wlr_log(WLR_INFO, "Supported GLES2 extensions: %s", renderer->exts_str);
if (glDebugMessageCallbackKHR && glDebugMessageControlKHR) {
glEnable(GL_DEBUG_OUTPUT_KHR);

View file

@ -44,13 +44,13 @@ static bool gles2_texture_write_pixels(struct wlr_texture *wlr_texture,
get_gles2_texture_in_context(wlr_texture);
if (texture->type != WLR_GLES2_TEXTURE_GLTEX) {
wlr_log(L_ERROR, "Cannot write pixels to immutable texture");
wlr_log(WLR_ERROR, "Cannot write pixels to immutable texture");
return false;
}
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
wlr_log(WLR_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
return false;
}
@ -141,14 +141,14 @@ struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
const struct wlr_gles2_pixel_format *fmt = get_gles2_format_from_wl(wl_fmt);
if (fmt == NULL) {
wlr_log(L_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
wlr_log(WLR_ERROR, "Unsupported pixel format %"PRIu32, wl_fmt);
return NULL;
}
struct wlr_gles2_texture *texture =
calloc(1, sizeof(struct wlr_gles2_texture));
if (texture == NULL) {
wlr_log(L_ERROR, "Allocation failed");
wlr_log(WLR_ERROR, "Allocation failed");
return NULL;
}
wlr_texture_init(&texture->wlr_texture, &texture_impl);
@ -183,7 +183,7 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
struct wlr_gles2_texture *texture =
calloc(1, sizeof(struct wlr_gles2_texture));
if (texture == NULL) {
wlr_log(L_ERROR, "Allocation failed");
wlr_log(WLR_ERROR, "Allocation failed");
return NULL;
}
wlr_texture_init(&texture->wlr_texture, &texture_impl);
@ -212,7 +212,7 @@ struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
texture->has_alpha = true;
break;
default:
wlr_log(L_ERROR, "Invalid or unsupported EGL buffer format");
wlr_log(WLR_ERROR, "Invalid or unsupported EGL buffer format");
free(texture);
return NULL;
}
@ -240,7 +240,7 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
}
if (!egl->exts.image_dmabuf_import_ext) {
wlr_log(L_ERROR, "Cannot create DMA-BUF texture: EGL extension "
wlr_log(WLR_ERROR, "Cannot create DMA-BUF texture: EGL extension "
"unavailable");
return NULL;
}
@ -260,7 +260,7 @@ struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
struct wlr_gles2_texture *texture =
calloc(1, sizeof(struct wlr_gles2_texture));
if (texture == NULL) {
wlr_log(L_ERROR, "Allocation failed");
wlr_log(WLR_ERROR, "Allocation failed");
return NULL;
}
wlr_texture_init(&texture->wlr_texture, &texture_impl);

View file

@ -28,10 +28,10 @@ bool _gles2_flush_errors(const char *file, int line) {
failure = true;
if (err == GL_OUT_OF_MEMORY) {
// The OpenGL context is now undefined
_wlr_log(L_ERROR, "[%s:%d] Fatal GL error: out of memory", file, line);
_wlr_log(WLR_ERROR, "[%s:%d] Fatal GL error: out of memory", file, line);
exit(1);
} else {
_wlr_log(L_ERROR, "[%s:%d] GL error %d %s", file, line, err, gles2_strerror(err));
_wlr_log(WLR_ERROR, "[%s:%d] GL error %d %s", file, line, err, gles2_strerror(err));
}
}
return failure;

View file

@ -157,14 +157,14 @@ bool wlr_renderer_format_supported(struct wlr_renderer *r,
void wlr_renderer_init_wl_display(struct wlr_renderer *r,
struct wl_display *wl_display) {
if (wl_display_init_shm(wl_display)) {
wlr_log(L_ERROR, "Failed to initialize shm");
wlr_log(WLR_ERROR, "Failed to initialize shm");
return;
}
size_t len;
const enum wl_shm_format *formats = wlr_renderer_get_formats(r, &len);
if (formats == NULL) {
wlr_log(L_ERROR, "Failed to initialize shm: cannot get formats");
wlr_log(WLR_ERROR, "Failed to initialize shm: cannot get formats");
return;
}
@ -185,7 +185,7 @@ struct wlr_renderer *wlr_renderer_autocreate(struct wlr_egl *egl,
EGLenum platform, void *remote_display, EGLint *config_attribs,
EGLint visual_id) {
if (!wlr_egl_init(egl, platform, remote_display, config_attribs, visual_id)) {
wlr_log(L_ERROR, "Could not initialize EGL");
wlr_log(WLR_ERROR, "Could not initialize EGL");
return NULL;
}