From: Rob Clark <robdclark@gmail.com>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 4/5] drm/fb: small cleanup
Date: Fri, 6 Mar 2015 16:23:09 -0500 [thread overview]
Message-ID: <1425676990-14341-5-git-send-email-robdclark@gmail.com> (raw)
In-Reply-To: <1425676990-14341-1-git-send-email-robdclark@gmail.com>
Flip conditional to reduce indentation level of rest of fxn, and use
min/max to make the code clearer.
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
drivers/gpu/drm/drm_fb_helper.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 1e6a0c7..5ec3849 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1035,22 +1035,24 @@ static int drm_fb_helper_single_fb_probe(struct drm_fb_helper *fb_helper,
for (i = 0; i < fb_helper->crtc_count; i++) {
struct drm_display_mode *desired_mode;
int x, y;
+
desired_mode = fb_helper->crtc_info[i].desired_mode;
+
+ if (!desired_mode)
+ continue;
+
+ crtc_count++;
+
x = fb_helper->crtc_info[i].x;
y = fb_helper->crtc_info[i].y;
- if (desired_mode) {
- if (gamma_size == 0)
- gamma_size = fb_helper->crtc_info[i].mode_set.crtc->gamma_size;
- if (desired_mode->hdisplay + x < sizes.fb_width)
- sizes.fb_width = desired_mode->hdisplay + x;
- if (desired_mode->vdisplay + y < sizes.fb_height)
- sizes.fb_height = desired_mode->vdisplay + y;
- if (desired_mode->hdisplay + x > sizes.surface_width)
- sizes.surface_width = desired_mode->hdisplay + x;
- if (desired_mode->vdisplay + y > sizes.surface_height)
- sizes.surface_height = desired_mode->vdisplay + y;
- crtc_count++;
- }
+
+ if (gamma_size == 0)
+ gamma_size = fb_helper->crtc_info[i].mode_set.crtc->gamma_size;
+
+ sizes.surface_width = max_t(u32, desired_mode->hdisplay + x, sizes.surface_width);
+ sizes.surface_height = max_t(u32, desired_mode->vdisplay + y, sizes.surface_width);
+ sizes.fb_width = min_t(u32, desired_mode->hdisplay + x, sizes.fb_width);
+ sizes.fb_height = min_t(u32, desired_mode->vdisplay + y, sizes.fb_height);
}
if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) {
--
2.1.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-03-06 21:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-06 21:23 [PATCH 0/5] drm/fb: handle tile connectors Rob Clark
2015-03-06 21:23 ` [PATCH 1/5] drm/cma: use correct fb width/height Rob Clark
2015-03-07 17:56 ` Laurent Pinchart
2015-03-07 18:35 ` Rob Clark
2015-03-06 21:23 ` [PATCH 2/5] drm/exynos: " Rob Clark
2015-03-11 13:35 ` Inki Dae
2015-03-06 21:23 ` [PATCH 3/5] drm/rockchip: " Rob Clark
2015-03-06 21:23 ` Rob Clark [this message]
2015-03-07 6:21 ` [PATCH 4/5] drm/fb: small cleanup Daniel Kurtz
2015-03-06 21:23 ` [PATCH 5/5] drm/fb: handle tiled connectors better Rob Clark
2015-03-07 13:48 ` Rob Clark
[not found] <Message-ID: <CAGS+omD-_wkA3eRLi9ki0srRF6rpAOGNeKNOemXOxj6tt76iow@mail.gmail.com>
2015-03-07 13:48 ` [PATCH 4/5] drm/fb: small cleanup Rob Clark
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425676990-14341-5-git-send-email-robdclark@gmail.com \
--to=robdclark@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox