All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Sinclair Yeh <syeh@vmware.com>
Cc: daniel.vetter@ffwll.ch, thellstrom@vmware.com,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 08/11] drm/vmwgfx: Add and connect atomic state object check/commit
Date: Tue, 28 Mar 2017 09:45:08 +0200	[thread overview]
Message-ID: <20170328074508.s2r4pafu6vsqmoox@phenom.ffwll.local> (raw)
In-Reply-To: <1490652064-44817-9-git-send-email-syeh@vmware.com>

On Mon, Mar 27, 2017 at 03:01:01PM -0700, Sinclair Yeh wrote:
> This connects the main state object check and commit function.
> 
> Signed-off-by: Sinclair Yeh <syeh@vmware.com>
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 66 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 66 insertions(+)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 2250a34a..6b593aaf 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -1581,8 +1581,74 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
>  	return &vfb->base;
>  }
>  
> +
> +
> +/**
> + * vmw_kms_atomic_check_modeset- validate state object for modeset changes
> + *
> + * @dev: DRM device
> + * @state: the driver state object
> + *
> + * This is a simple wrapper around drm_atomic_helper_check_modeset() for
> + * us to assign a value to mode->crtc_clock so that
> + * drm_calc_timestamping_constants() won't throw an error message
> + *
> + * RETURNS
> + * Zero for success or -errno
> + */
> +int
> +vmw_kms_atomic_check_modeset(struct drm_device *dev,
> +			     struct drm_atomic_state *state)
> +{
> +	struct drm_crtc_state *crtc_state;
> +	struct drm_crtc *crtc;
> +	int i, ret;
> +
> +
> +	for_each_crtc_in_state(state, crtc, crtc_state, i) {
> +		if (crtc_state->mode.crtc_clock == 0) {
> +			/*
> +			 * Our virtual device does not have a dot clock,
> +			 * so use the logical clock value as the dot clock.
> +			 */
> +			crtc_state->mode.crtc_clock = crtc_state->mode.clock;

Can't you stuff this into your crtc->atomic_check function? At least I
don't see a depency here ... With that you could forgo this vmw version of
atomic_commit.

> +		}
> +	}
> +
> +	ret = drm_atomic_helper_check_modeset(dev, state);
> +	if (ret)
> +		return ret;
> +
> +	return drm_atomic_helper_check_planes(dev, state);
> +}
> +
> +
> +/**
> + * vmw_kms_atomic_commit - Perform an atomic state commit
> + *
> + * @dev: DRM device
> + * @state: the driver state object
> + * @nonblock: Whether nonblocking behaviour is requested
> + *
> + * This is a simple wrapper around drm_atomic_helper_commit() for
> + * us to clear the nonblocking value.
> + * Nonblocking commits should avoid waiting on GPU completion to return.
> + * That is always the case for us.

That's not all they do, they also avoid any other stalls. Atomic can do an
entire modeset in nonblocking mode.

Since the helpers provide you nonblocking commit for essentially for free
there's also no reason anymore to clear this, or at least I think it
should be a lot better than the one given here :-)
-Daniel

> + *
> + * RETURNS
> + * Zero for success or negative error code on failure.
> + */
> +int vmw_kms_atomic_commit(struct drm_device *dev,
> +			  struct drm_atomic_state *state,
> +			  bool nonblock)
> +{
> +	return drm_atomic_helper_commit(dev, state, false);
> +}
> +
>  static const struct drm_mode_config_funcs vmw_kms_funcs = {
>  	.fb_create = vmw_kms_fb_create,
> +	.atomic_check = vmw_kms_atomic_check_modeset,
> +	.atomic_commit = vmw_kms_atomic_commit,
>  };
>  
>  static int vmw_kms_generic_present(struct vmw_private *dev_priv,
> -- 
> 2.7.4
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-03-28  7:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 22:00 [PATCH 00/11] Enable Atomic Mode Set on vmwgfx Sinclair Yeh
2017-03-27 22:00 ` [PATCH 01/11] drm/vmwgfx: Add universal plane support Sinclair Yeh
2017-03-28  7:07   ` Daniel Vetter
2017-03-27 22:00 ` [PATCH 02/11] drm/vmwgfx: CRTC atomic state Sinclair Yeh
2017-03-27 22:00 ` [PATCH 03/11] drm/vmwgfx: Plane " Sinclair Yeh
2017-03-28  7:33   ` Daniel Vetter
2017-03-27 22:00 ` [PATCH 04/11] drm/vmwgfx: Connector " Sinclair Yeh
2017-03-27 22:00 ` [PATCH 05/11] drm/vmwgfx: Add and connect CRTC helper functions Sinclair Yeh
2017-03-28  7:56   ` Daniel Vetter
2017-03-27 22:00 ` [PATCH 06/11] drm/vmwgfx: Add and connect plane " Sinclair Yeh
2017-03-28  7:40   ` Daniel Vetter
2017-03-27 22:01 ` [PATCH 07/11] drm/vmwgfx: Add and connect connector helper function Sinclair Yeh
2017-03-28  7:41   ` Daniel Vetter
2017-03-27 22:01 ` [PATCH 08/11] drm/vmwgfx: Add and connect atomic state object check/commit Sinclair Yeh
2017-03-28  7:45   ` Daniel Vetter [this message]
2017-03-27 22:01 ` [PATCH 09/11] drm/vmwgfx: Fixes to vmwgfx_fb Sinclair Yeh
2017-03-27 22:01 ` [PATCH 10/11] drm/vmwgfx: Switch over to internal atomic API for STDU Sinclair Yeh
2017-03-28  7:49   ` Daniel Vetter
2017-03-29 21:05     ` Sinclair Yeh
2017-03-30  7:42       ` Daniel Vetter
2017-03-27 22:01 ` [PATCH 11/11] drm/vmwgfx: Switch over to internal atomic API for SOU and LDU Sinclair Yeh
2017-03-28  7:51   ` Daniel Vetter
2017-03-28  7:54 ` [PATCH 00/11] Enable Atomic Mode Set on vmwgfx Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170328074508.s2r4pafu6vsqmoox@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=syeh@vmware.com \
    --cc=thellstrom@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.