diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2023-02-15 19:15:14 +0300 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2023-03-13 12:36:59 +0300 |
commit | 6ffdf8865dc52e33b9867fe745f681175b997209 (patch) | |
tree | fd20ddc477626d0caa961fbc305f3faea2d51970 | |
parent | f8ad33797ab3dd3ea011c1d5f52ec684fe925271 (diff) | |
download | linux-6ffdf8865dc52e33b9867fe745f681175b997209.tar.xz |
drm/cirrus: Inline cirrus_check_size() into primary-plane atomic_check
Inline the framebuffer size check into the primary plane's atomic_check
cirrus_primary_plane_atomic_check(). No functional changes.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230215161517.5113-15-tzimmermann@suse.de
-rw-r--r-- | drivers/gpu/drm/tiny/cirrus.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c index 6c2be39d79a5..8a1ae94d9106 100644 --- a/drivers/gpu/drm/tiny/cirrus.c +++ b/drivers/gpu/drm/tiny/cirrus.c @@ -317,21 +317,6 @@ static void cirrus_pitch_set(struct cirrus_device *cirrus, cirrus_set_start_address(cirrus, 0); } -static int cirrus_check_size(int width, int height, - struct drm_framebuffer *fb) -{ - int pitch = width * 2; - - if (fb) - pitch = cirrus_pitch(fb); - - if (pitch > CIRRUS_MAX_PITCH) - return -EINVAL; - if (pitch * height > CIRRUS_VRAM_SIZE) - return -EINVAL; - return 0; -} - /* ------------------------------------------------------------------ */ /* cirrus display pipe */ @@ -354,6 +339,7 @@ static int cirrus_primary_plane_helper_atomic_check(struct drm_plane *plane, struct drm_crtc *new_crtc = new_plane_state->crtc; struct drm_crtc_state *new_crtc_state = NULL; int ret; + unsigned int pitch; if (new_crtc) new_crtc_state = drm_atomic_get_new_crtc_state(state, new_crtc); @@ -367,7 +353,15 @@ static int cirrus_primary_plane_helper_atomic_check(struct drm_plane *plane, else if (!new_plane_state->visible) return 0; - return cirrus_check_size(fb->width, fb->height, fb); + pitch = cirrus_pitch(fb); + + /* validate size constraints */ + if (pitch > CIRRUS_MAX_PITCH) + return -EINVAL; + else if (pitch * fb->height > CIRRUS_VRAM_SIZE) + return -EINVAL; + + return 0; } static void cirrus_primary_plane_helper_atomic_update(struct drm_plane *plane, |