diff options
author | Sinclair Yeh <syeh@vmware.com> | 2017-03-23 14:24:53 -0700 |
---|---|---|
committer | Sinclair Yeh <syeh@vmware.com> | 2017-03-31 15:21:02 -0700 |
commit | c46a30644a1e7093bbd839e9089f10d64e465302 (patch) | |
tree | b5c9ee75fcb69d4be7164b167cf918d13260383d /drivers/gpu/drm/vmwgfx | |
parent | d947d1b71deb1efa0e7b2600f09e7fe7ea1e622b (diff) | |
download | op-kernel-dev-c46a30644a1e7093bbd839e9089f10d64e465302.zip op-kernel-dev-c46a30644a1e7093bbd839e9089f10d64e465302.tar.gz |
drm/vmwgfx: Add and connect atomic state object check/commit
This connects the main state object check and commit function.
v2
* Use drm_atomic_helper_commit() rather than a vmwgfx-specific one
Signed-off-by: Sinclair Yeh <syeh@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 0644b71..1071e10 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -1579,8 +1579,56 @@ err_out: 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; + struct vmw_private *dev_priv = vmw_priv(dev); + int i; + + + for_each_crtc_in_state(state, crtc, crtc_state, i) { + unsigned long requested_bb_mem = 0; + + if (dev_priv->active_display_unit == vmw_du_screen_target) { + if (crtc->primary->fb) { + int cpp = crtc->primary->fb->pitches[0] / + crtc->primary->fb->width; + + requested_bb_mem += crtc->mode.hdisplay * cpp * + crtc->mode.vdisplay; + } + + if (requested_bb_mem > dev_priv->prim_bb_mem) + return -EINVAL; + } + } + + return drm_atomic_helper_check(dev, state); +} + + 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 = drm_atomic_helper_commit, }; static int vmw_kms_generic_present(struct vmw_private *dev_priv, |