[PATCH weston 3/4] compositor-drm: Don't schedule repaint on scanout buffer destroy handler

Kristian Høgsberg hoegsberg at gmail.com
Fri Nov 9 08:24:41 PST 2012


On Fri, Nov 09, 2012 at 02:19:04PM +0200, Ander Conselvan de Oliveira wrote:
> Let the compositor generic code decide what to do when the buffer goes
> away. We still have a valid reference do the bo, so we can still show
> the client contents until something else triggers a repaint.
> ---
>  src/compositor-drm.c |   11 +++--------
>  1 file changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index 3a7d432..9c9d54a 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -222,7 +222,7 @@ drm_fb_destroy_callback(struct gbm_bo *bo, void *data)
>  }
>  
>  static struct drm_fb *
> -drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_output *output)
> +drm_fb_get_from_bo(struct gbm_bo *bo)
>  {
>  	struct drm_fb *fb = gbm_bo_get_user_data(bo);
>  	struct drm_compositor *compositor =
> @@ -236,7 +236,6 @@ drm_fb_get_from_bo(struct gbm_bo *bo, struct drm_output *output)
>  	fb = malloc(sizeof *fb);
>  
>  	fb->bo = bo;
> -	fb->output = output;
>  	fb->is_client_buffer = 0;
>  	fb->buffer = NULL;
>  
> @@ -265,10 +264,6 @@ fb_handle_buffer_destroy(struct wl_listener *listener, void *data)
>  					 buffer_destroy_listener);
>  
>  	fb->buffer = NULL;
> -
> -	if (fb == fb->output->next ||
> -	    (fb == fb->output->current && !fb->output->next))
> -		weston_output_schedule_repaint(&fb->output->base);

Excellent... I was looking at this chunk when we talked about this
yesterday and by removing this, Pekka can easily drop in his
weston_buffer_reference function .

>  }
>  
>  static struct weston_plane *
> @@ -303,7 +298,7 @@ drm_output_prepare_scanout_surface(struct weston_output *_output,
>  		return NULL;
>  	}
>  
> -	output->next = drm_fb_get_from_bo(bo, output);
> +	output->next = drm_fb_get_from_bo(bo);
>  	if (!output->next) {
>  		gbm_bo_destroy(bo);
>  		return NULL;
> @@ -334,7 +329,7 @@ drm_output_render(struct drm_output *output, pixman_region32_t *damage)
>  		return;
>  	}
>  
> -	output->next = drm_fb_get_from_bo(bo, output);
> +	output->next = drm_fb_get_from_bo(bo);
>  	if (!output->next) {
>  		weston_log("failed to get drm_fb for bo\n");
>  		gbm_surface_release_buffer(output->surface, bo);
> -- 
> 1.7.10.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list