Commit 46b75778 authored by Daniel Vetter's avatar Daniel Vetter

drm/lease: Check for lessor outside of locks

The lessor is invariant over a lifetime of a lease, we don't have to
grab any locks for that. Speeds up the common case of not being a lease.

Cc: Keith Packard <keithp@keithp.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20190228144910.26488-5-daniel.vetter@ffwll.ch
parent 4285c7e1
...@@ -111,7 +111,7 @@ static bool _drm_has_leased(struct drm_master *master, int id) ...@@ -111,7 +111,7 @@ static bool _drm_has_leased(struct drm_master *master, int id)
*/ */
bool _drm_lease_held(struct drm_file *file_priv, int id) bool _drm_lease_held(struct drm_file *file_priv, int id)
{ {
if (file_priv == NULL || file_priv->master == NULL) if (!file_priv || !file_priv->master)
return true; return true;
return _drm_lease_held_master(file_priv->master, id); return _drm_lease_held_master(file_priv->master, id);
...@@ -133,7 +133,7 @@ bool drm_lease_held(struct drm_file *file_priv, int id) ...@@ -133,7 +133,7 @@ bool drm_lease_held(struct drm_file *file_priv, int id)
struct drm_master *master; struct drm_master *master;
bool ret; bool ret;
if (file_priv == NULL || file_priv->master == NULL) if (!file_priv || !file_priv->master || !file_priv->master->lessor)
return true; return true;
master = file_priv->master; master = file_priv->master;
...@@ -159,7 +159,7 @@ uint32_t drm_lease_filter_crtcs(struct drm_file *file_priv, uint32_t crtcs_in) ...@@ -159,7 +159,7 @@ uint32_t drm_lease_filter_crtcs(struct drm_file *file_priv, uint32_t crtcs_in)
int count_in, count_out; int count_in, count_out;
uint32_t crtcs_out = 0; uint32_t crtcs_out = 0;
if (file_priv == NULL || file_priv->master == NULL) if (!file_priv || !file_priv->master || !file_priv->master->lessor)
return crtcs_in; return crtcs_in;
master = file_priv->master; master = file_priv->master;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment