From 4e4348fed0204e37a22f4d9747e81fa0e353eaed Mon Sep 17 00:00:00 2001 From: Jianwei Fan Date: Tue, 2 Aug 2022 11:37:42 +0000 Subject: [PATCH] drm/rockchip: direct_show: fix some parameters Signed-off-by: Jianwei Fan Change-Id: I5c018d13c52e6946add366ebc46242c9ca78f7ff --- .../drm/rockchip/rockchip_drm_direct_show.c | 18 +++++++++++++----- .../drm/rockchip/rockchip_drm_direct_show.h | 4 ++-- .../gpu/drm/rockchip/rockchip_drm_self_test.c | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.c b/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.c index 6679689f3316..9989820b5fc6 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.c @@ -172,7 +172,7 @@ void rockchip_drm_direct_show_free_buffer(struct drm_device *drm, drm_gem_object_put(obj); } -struct drm_plane *rockchip_drm_direct_show_get_plane(struct drm_device *drm, char *name) +struct drm_plane *rockchip_drm_direct_show_get_plane(struct drm_device *drm, const char *name) { struct drm_plane *plane; @@ -190,15 +190,23 @@ struct drm_plane *rockchip_drm_direct_show_get_plane(struct drm_device *drm, cha return plane; } -struct drm_crtc *rockchip_drm_direct_show_get_crtc(struct drm_device *drm) +struct drm_crtc *rockchip_drm_direct_show_get_crtc(struct drm_device *drm, const char *name) { struct drm_crtc *crtc = NULL; bool crtc_active = false; drm_for_each_crtc(crtc, drm) { - if (crtc->state && crtc->state->active) { - crtc_active = true; - break; + if (name == NULL) { + if (crtc->state && crtc->state->active) { + crtc_active = true; + break; + } + } else { + if (crtc->state && crtc->state->active && + !strncmp(crtc->name, name, DRM_PROP_NAME_LEN)) { + crtc_active = true; + break; + } } } diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.h b/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.h index 14a542fd63e2..939f0d451057 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.h +++ b/drivers/gpu/drm/rockchip/rockchip_drm_direct_show.h @@ -56,8 +56,8 @@ int rockchip_drm_direct_show_alloc_buffer(struct drm_device *drm, struct rockchip_drm_direct_show_buffer *buffer); void rockchip_drm_direct_show_free_buffer(struct drm_device *drm, struct rockchip_drm_direct_show_buffer *buffer); -struct drm_crtc *rockchip_drm_direct_show_get_crtc(struct drm_device *drm); -struct drm_plane *rockchip_drm_direct_show_get_plane(struct drm_device *drm, char *name); +struct drm_crtc *rockchip_drm_direct_show_get_crtc(struct drm_device *drm, const char *name); +struct drm_plane *rockchip_drm_direct_show_get_plane(struct drm_device *drm, const char *name); int rockchip_drm_direct_show_commit(struct drm_device *drm, struct rockchip_drm_direct_show_commit_info *commit_info); int rockchip_drm_direct_show_disable_plane(struct drm_device *drm, struct drm_plane *plane); diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_self_test.c b/drivers/gpu/drm/rockchip/rockchip_drm_self_test.c index b26bc2a7e466..7c764fca154d 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_self_test.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_self_test.c @@ -145,7 +145,7 @@ static void rockchip_drm_self_test_commit(struct work_struct *work) rockchip_drm_draw_color_bar(self_test->drm_buffer[1]); /* get crtc and plane */ - self_test->crtc = rockchip_drm_direct_show_get_crtc(self_test->dev); + self_test->crtc = rockchip_drm_direct_show_get_crtc(self_test->dev, NULL); if (self_test->crtc == NULL) { pr_info("error: failed to get crtc\n"); goto free_buffer;