[PATCH weston v12 01/40] compositor-drm: Introduce drm_output_state structure

Pekka Paalanen ppaalanen at gmail.com
Thu Sep 28 10:32:34 UTC 2017


On Tue, 26 Sep 2017 18:15:34 +0100
Daniel Stone <daniels at collabora.com> wrote:

> Currently this doesn't actually really do anything, but will be used in
> the future to track the state for both modeset and repaint requests.
> Completion of the request gives us a single request-completion path for
> both pageflip and vblank events.
> 
> This merges the timing paths for scanout and plane-but-but-atomic-plane
> content.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  libweston/compositor-drm.c | 354 ++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 300 insertions(+), 54 deletions(-)
> 

Hi,

two minor nits below.

> @@ -1304,6 +1524,8 @@ static void
>  drm_output_start_repaint_loop(struct weston_output *output_base)
>  {
>  	struct drm_output *output = to_drm_output(output_base);
> +	struct drm_pending_state *pending_state = NULL;
> +	struct drm_output_state *state;
>  	struct drm_backend *backend =
>  		to_drm_backend(output_base->compositor);
>  	uint32_t fb_id;
> @@ -1364,10 +1586,16 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
>  
>  	assert(!output->page_flip_pending);
>  	assert(!output->fb_last);
> +	assert(!output->state_last);
> +
> +	pending_state = drm_pending_state_alloc(backend);
> +	state = drm_output_state_duplicate(output->state_cur, pending_state,
> +					   DRM_OUTPUT_STATE_PRESERVE_PLANES);
>  
>  	if (drmModePageFlip(backend->drm.fd, output->crtc_id, fb_id,
>  			    DRM_MODE_PAGE_FLIP_EVENT, output) < 0) {
>  		weston_log("queueing pageflip failed: %m\n");
> +		drm_pending_state_free(pending_state);

Should not call this, because the finish_frame path also calls
drm_pending_state_free().

>  		goto finish_frame;
>  	}
>  
> @@ -1378,9 +1606,15 @@ drm_output_start_repaint_loop(struct weston_output *output_base)
>  	output->fb_last = drm_fb_ref(output->fb_current);
>  	output->page_flip_pending = 1;
>  
> +	drm_output_assign_state(state, DRM_OUTPUT_STATE_UPDATE_ASYNCHRONOUS);
> +	drm_pending_state_free(pending_state);
> +
>  	return;
>  
>  finish_frame:
> +	if (pending_state)
> +		drm_pending_state_free(pending_state);

No need to check, drm_pending_state_free(NULL) is fine.

> +
>  	/* if we cannot page-flip, immediately finish frame */
>  	weston_output_finish_frame(output_base, NULL,
>  				   WP_PRESENTATION_FEEDBACK_INVALID);

With those fixed:
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170928/51c8931e/attachment-0001.sig>


More information about the wayland-devel mailing list