From 4c394190a3020d954d6faa9a8079b91b31fd14a7 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 30 Aug 2011 11:29:46 +0200 Subject: [PATCH] compositor-openwfd: Fix wfd_destroy_output Dont (incorrectly) call destroy_output from wfd_destroy_output, rather merge both. --- compositor/compositor-openwfd.c | 63 ++++++++++++++------------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/compositor/compositor-openwfd.c b/compositor/compositor-openwfd.c index d4436e3d..71920409 100644 --- a/compositor/compositor-openwfd.c +++ b/compositor/compositor-openwfd.c @@ -190,9 +190,33 @@ wfd_output_set_cursor(struct wlsc_output *output_base, static void wfd_output_destroy(struct wlsc_output *output_base) { - destroy_output(output_base); + struct wfd_output *output = (struct wfd_output *) output_base; + struct wfd_compositor *ec = + (struct wfd_compositor *) output->base.compositor; + int i; - return; + glFramebufferRenderbuffer(GL_FRAMEBUFFER, + GL_COLOR_ATTACHMENT0, + GL_RENDERBUFFER, + 0); + + glBindRenderbuffer(GL_RENDERBUFFER, 0); + glDeleteRenderbuffers(2, output->rbo); + + for (i = 0; i < 2; i++) { + ec->base.destroy_image(ec->base.display, output->image[i]); + gbm_bo_destroy(output->bo[i]); + wfdDestroySource(ec->dev, output->source[i]); + } + + ec->used_pipelines &= ~(1 << output->pipeline_id); + wfdDestroyPipeline(ec->dev, output->pipeline); + wfdDestroyPort(ec->dev, output->port); + + wlsc_output_destroy(&output->base); + wl_list_remove(&output->base.link); + + free(output); } static int @@ -439,39 +463,6 @@ create_outputs(struct wfd_compositor *ec, int option_connector) return 0; } -static int -destroy_output(struct wfd_output *output) -{ - struct wfd_compositor *ec = - (struct wfd_compositor *) output->base.compositor; - int i; - - glFramebufferRenderbuffer(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, - 0); - - glBindRenderbuffer(GL_RENDERBUFFER, 0); - glDeleteRenderbuffers(2, output->rbo); - - for (i = 0; i < 2; i++) { - ec->base.destroy_image(ec->base.display, output->image[i]); - gbm_bo_destroy(output->bo[i]); - wfdDestroySource(ec->dev, output->source[i]); - } - - ec->used_pipelines &= ~(1 << output->pipeline_id); - wfdDestroyPipeline(ec->dev, output->pipeline); - wfdDestroyPort(ec->dev, output->port); - - wlsc_output_destroy(&output->base); - wl_list_remove(&output->base.link); - - free(output); - - return 0; -} - static int handle_port_state_change(struct wfd_compositor *ec) { @@ -516,7 +507,7 @@ handle_port_state_change(struct wfd_compositor *ec) if (!state && output_port_id == port_id) { x_offset += output->base.current->width; - destroy_output(output); + wfd_output_destroy(&output->base); continue; }