lkml.org 
[lkml]   [2018]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drm/kms/plane: Avoiding redundant checks in case of EDEADLK retries
Date
1. Currently, if modeset_lock is re-tried many times in case of EDEADLK
error, then this will be the code flow

retry:
ret = drm_modeset_lock();

if (ret)-->this is true
goto out;

out:
if (fb)
if (plane->old_fb)
if (ret == -EDEADLK)
goto retry;
It can be observed that checks on fb, old_fb are redundant
in retry-case.
If we keep if (ret == -EDEADLK) right after the out label,
that will avoid redundant checks.
It won't affect normal scenario (non-retry case).
2. Moved NULL assignment inside if statement related to NULL check

Signed-off-by: Satendra Singh Thakur <satendra.t@samsung.com>
---
drivers/gpu/drm/drm_plane.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index 0350544..ed42cd4 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -658,9 +658,10 @@ static int __setplane_internal(struct drm_plane *plane,
}

out:
- if (plane->old_fb)
+ if (plane->old_fb) {
drm_framebuffer_put(plane->old_fb);
- plane->old_fb = NULL;
+ plane->old_fb = NULL;
+ }

return ret;
}
@@ -1097,17 +1098,17 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
}

out:
- if (fb)
- drm_framebuffer_put(fb);
- if (plane->old_fb)
- drm_framebuffer_put(plane->old_fb);
- plane->old_fb = NULL;
-
if (ret == -EDEADLK) {
ret = drm_modeset_backoff(&ctx);
if (!ret)
goto retry;
}
+ if (fb)
+ drm_framebuffer_put(fb);
+ if (plane->old_fb) {
+ drm_framebuffer_put(plane->old_fb);
+ plane->old_fb = NULL;
+ }

drm_modeset_drop_locks(&ctx);
drm_modeset_acquire_fini(&ctx);
--
2.7.4
\
 
 \ /
  Last update: 2018-07-30 07:56    [W:0.105 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site