From 2cdb646531d949e08b8a0538b05bd38af3157408 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Mon, 29 Jan 2018 11:29:54 +0100 Subject: relases gbm buffers on init The wlr_drm_surface_init function is called (upon others) when the drm mode is changed. When the surface was used previously this replaced the gbm_surface, but did not replace the gbm buffers (front/back). With this, wlr_drm_surface_get_from never set up the new buffers with the new glViewport because surf->front existed. This frees the buffers to get new buffers on the new surface with the new viewport. --- backend/drm/renderer.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'backend') diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index 00182c59..d28164aa 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -66,6 +66,17 @@ bool wlr_drm_surface_init(struct wlr_drm_surface *surf, surf->width = width; surf->height = height; + if (surf->gbm) { + if (surf->front) { + gbm_surface_release_buffer(surf->gbm, surf->front); + surf->front = NULL; + } + if (surf->back) { + gbm_surface_release_buffer(surf->gbm, surf->back); + surf->back = NULL; + } + } + surf->gbm = gbm_surface_create(renderer->gbm, width, height, format, GBM_BO_USE_RENDERING | flags); if (!surf->gbm) { -- cgit v1.2.3 From cde0f454b376703e68662f9552b38fc10e97b74a Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Mon, 29 Jan 2018 11:49:31 +0100 Subject: Clean up the gbm/egl as well --- backend/drm/renderer.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'backend') diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c index d28164aa..350bfce4 100644 --- a/backend/drm/renderer.c +++ b/backend/drm/renderer.c @@ -75,6 +75,10 @@ bool wlr_drm_surface_init(struct wlr_drm_surface *surf, gbm_surface_release_buffer(surf->gbm, surf->back); surf->back = NULL; } + gbm_surface_destroy(surf->gbm); + } + if (surf->egl) { + eglDestroySurface(surf->renderer->egl.display, surf->egl); } surf->gbm = gbm_surface_create(renderer->gbm, width, height, -- cgit v1.2.3 From c5aac776929cd5abed96463b635f0382d3047fbf Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Tue, 30 Jan 2018 16:06:45 +0100 Subject: Fix some typos Prefer initialize over initialise since used more often in the sources. --- backend/drm/backend.c | 2 +- backend/drm/drm.c | 6 +++--- meson.build | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'backend') diff --git a/backend/drm/backend.c b/backend/drm/backend.c index de69dad5..4ca5718a 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -119,7 +119,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, char *name = drmGetDeviceNameFromFd2(gpu_fd); drmVersion *version = drmGetVersion(gpu_fd); - wlr_log(L_INFO, "Initalizing DRM backend for %s (%s)", name, version->name); + wlr_log(L_INFO, "Initializing DRM backend for %s (%s)", name, version->name); free(name); drmFreeVersion(version); diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 63a6e2da..cdd2f57e 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -469,7 +469,7 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output, wlr_output_update_mode(&conn->output, mode); // Since realloc_crtcs can deallocate planes on OTHER outputs, - // we actually need to reinitalise any than has changed + // we actually need to reinitialize any than has changed ssize_t output_index = -1; wl_list_for_each(conn, &drm->outputs, link) { output_index += 1; @@ -483,7 +483,7 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output, if (!wlr_drm_plane_surfaces_init(crtc->primary, drm, mode->width, mode->height, GBM_FORMAT_XRGB8888)) { - wlr_log(L_ERROR, "Failed to initalise renderer for plane"); + wlr_log(L_ERROR, "Failed to initialize renderer for plane"); goto error_conn; } @@ -949,7 +949,7 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) { conn->possible_crtc = 0; /* Fallthrough */ case WLR_DRM_CONN_NEEDS_MODESET: - wlr_log(L_INFO, "Emmiting destruction signal for '%s'", + wlr_log(L_INFO, "Emitting destruction signal for '%s'", conn->output.name); wl_signal_emit(&drm->backend.events.output_remove, &conn->output); break; diff --git a/meson.build b/meson.build index 55b07efa..236abd6b 100644 --- a/meson.build +++ b/meson.build @@ -36,7 +36,7 @@ wlr_inc = include_directories('include') cc = meson.get_compiler('c') -# Clang complains about some zeroed initialiser lists (= {0}), even though they +# Clang complains about some zeroed initializer lists (= {0}), even though they # are valid if cc.get_id() == 'clang' add_project_arguments('-Wno-missing-field-initializers', language: 'c') -- cgit v1.2.3 From bb39277e9772b0943e8e292e2a7eed9c5aac59e2 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 2 Feb 2018 22:27:18 +0100 Subject: backend/drm: update output enabled property on modeset --- backend/drm/drm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'backend') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index cdd2f57e..f6cc084e 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -207,6 +207,7 @@ static void wlr_drm_connector_swap_buffers(struct wlr_output *output) { if (drm->iface->crtc_pageflip(drm, conn, crtc, fb_id, NULL)) { conn->pageflip_pending = true; + wlr_output_update_enabled(output, true); } else { wl_event_source_timer_update(conn->retry_pageflip, 1000.0f / conn->output.current_mode->refresh); @@ -245,6 +246,7 @@ void wlr_drm_connector_start_renderer(struct wlr_drm_connector *conn) { struct wlr_drm_mode *mode = (struct wlr_drm_mode *)conn->output.current_mode; if (drm->iface->crtc_pageflip(drm, conn, crtc, fb_id, &mode->drm_mode)) { conn->pageflip_pending = true; + wlr_output_update_enabled(&conn->output, true); } else { wl_event_source_timer_update(conn->retry_pageflip, 1000.0f / conn->output.current_mode->refresh); -- cgit v1.2.3