From b148226e21c5e701faa615dcd24b23c9c9b29be8 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 25 Oct 2019 14:47:43 +0200 Subject: Compositor: Use logging category in egl client integration Change-Id: I5ad3663b3710b939f08798abad3bc985ab460e88 Reviewed-by: Paul Olav Tvete --- .../waylandeglclientbufferintegration.cpp | 45 ++++++++++++++-------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp index 036d17852..dd23f6f9c 100644 --- a/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp +++ b/src/hardwareintegration/compositor/wayland-egl/waylandeglclientbufferintegration.cpp @@ -220,7 +220,8 @@ void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBu gl_egl_image_target_texture_2d = reinterpret_cast(eglGetProcAddress("glEGLImageTargetTexture2DOES")); if (!gl_egl_image_target_texture_2d) { - qWarning("QtCompositor: bindTextureToBuffer() failed. Could not find glEGLImageTargetTexture2DOES."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "BindTextureToBuffer() failed. Could not find glEGLImageTargetTexture2DOES."; return; } @@ -265,8 +266,10 @@ void WaylandEglClientBufferIntegrationPrivate::initEglTexture(WaylandEglClientBu buffer->waylandBufferHandle(), attribs); - if (image == EGL_NO_IMAGE_KHR) - qWarning("failed to create EGL image for plane %d", i); + if (image == EGL_NO_IMAGE_KHR) { + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to create EGL image for plane" << i; + } state.egl_images << image; state.textures[i] = nullptr; @@ -315,13 +318,14 @@ bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuf } if (state.egl_stream == EGL_NO_STREAM_KHR) { - qWarning("%s:%d: eglCreateStreamFromFileDescriptorKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError()); + qCWarning(qLcWaylandCompositorHardwareIntegration, "%s:%d: eglCreateStreamFromFileDescriptorKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError()); return false; } state.eglMode = BufferState::ModeEGLStream; if (!QOpenGLContext::currentContext()) { - qWarning("EglClientBufferIntegration: creating texture with no current context"); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "EglClientBufferIntegration: creating texture with no current context"; return false; } @@ -334,7 +338,7 @@ bool WaylandEglClientBufferIntegrationPrivate::initEglStream(WaylandEglClientBuf auto newStream = funcs->stream_consumer_gltexture(egl_display, state.egl_stream); if (!newStream) { EGLint code = eglGetError(); - qWarning() << "Could not initialize EGLStream:" << egl_error_string(code) << hex << (long)code; + qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not initialize EGLStream:" << egl_error_string(code) << hex << (long)code; funcs->destroy_stream(egl_display, state.egl_stream); state.egl_stream = EGL_NO_STREAM_KHR; return false; @@ -362,7 +366,9 @@ void WaylandEglClientBufferIntegrationPrivate::handleEglstreamTexture(WaylandEgl if (stream_state == EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR) { if (funcs->stream_consumer_acquire(egl_display, state.egl_stream) != EGL_TRUE) - qWarning("%s:%d: eglStreamConsumerAcquireKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, eglGetError()); + qCWarning(qLcWaylandCompositorHardwareIntegration, + "%s:%d: eglStreamConsumerAcquireKHR failed: 0x%x", Q_FUNC_INFO, __LINE__, + eglGetError()); } if (usingLocalContext) @@ -388,7 +394,7 @@ WaylandEglClientBufferIntegration::~WaylandEglClientBufferIntegration() if (d->egl_unbind_wayland_display && d->display_bound) { Q_ASSERT(d->wlDisplay); if (!d->egl_unbind_wayland_display(d->egl_display, d->wlDisplay)) - qWarning() << "Qt Wayland Compositor: eglUnbindWaylandDisplayWL failed"; + qCWarning(qLcWaylandCompositorHardwareIntegration) << "eglUnbindWaylandDisplayWL failed"; } } @@ -400,39 +406,45 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface(); if (!nativeInterface) { - qWarning("QtCompositor: Failed to initialize EGL display. No native platform interface available."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to initialize EGL display. No native platform interface available."; return false; } d->egl_display = nativeInterface->nativeResourceForIntegration("EglDisplay"); if (!d->egl_display) { - qWarning("QtCompositor: Failed to initialize EGL display. Could not get EglDisplay for window."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to initialize EGL display. Could not get EglDisplay for window."; return false; } const char *extensionString = eglQueryString(d->egl_display, EGL_EXTENSIONS); if ((!extensionString || !strstr(extensionString, "EGL_WL_bind_wayland_display")) && !ignoreBindDisplay) { - qWarning("QtCompositor: Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to initialize EGL display. There is no EGL_WL_bind_wayland_display extension."; return false; } d->egl_bind_wayland_display = reinterpret_cast(eglGetProcAddress("eglBindWaylandDisplayWL")); d->egl_unbind_wayland_display = reinterpret_cast(eglGetProcAddress("eglUnbindWaylandDisplayWL")); if ((!d->egl_bind_wayland_display || !d->egl_unbind_wayland_display) && !ignoreBindDisplay) { - qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to initialize EGL display. Could not find eglBindWaylandDisplayWL and eglUnbindWaylandDisplayWL."; return false; } d->egl_query_wayland_buffer = reinterpret_cast(eglGetProcAddress("eglQueryWaylandBufferWL")); if (!d->egl_query_wayland_buffer) { - qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to initialize EGL display. Could not find eglQueryWaylandBufferWL."; return false; } d->egl_create_image = reinterpret_cast(eglGetProcAddress("eglCreateImageKHR")); d->egl_destroy_image = reinterpret_cast(eglGetProcAddress("eglDestroyImageKHR")); if (!d->egl_create_image || !d->egl_destroy_image) { - qWarning("QtCompositor: Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to initialize EGL display. Could not find eglCreateImageKHR and eglDestroyImageKHR."; return false; } @@ -440,10 +452,11 @@ bool WaylandEglClientBufferIntegration::initializeHardware(struct wl_display *di d->display_bound = d->egl_bind_wayland_display(d->egl_display, display); if (!d->display_bound) { if (!ignoreBindDisplay) { - qWarning("QtCompositor: Failed to initialize EGL display. Could not bind Wayland display."); + qCWarning(qLcWaylandCompositorHardwareIntegration) + << "Failed to initialize EGL display. Could not bind Wayland display."; return false; } else { - qWarning("QtCompositor: Could not bind Wayland display. Ignoring."); + qCWarning(qLcWaylandCompositorHardwareIntegration) << "Could not bind Wayland display. Ignoring."; } } d->wlDisplay = display; -- cgit v1.2.3