From: Jeykumar Sankaran <jsanka@codeaurora.org>
To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Jeykumar Sankaran <jsanka@codeaurora.org>,
jcrouse@codeaurora.org, seanpaul@chromium.org,
robdclark@gmail.com, narmstrong@baylibre.com
Subject: [PATCH] drm: add fb max width/height fields to drm_mode_config
Date: Fri, 27 Sep 2019 18:31:24 -0700 [thread overview]
Message-ID: <1569634284-14147-2-git-send-email-jsanka@codeaurora.org> (raw)
In-Reply-To: <1569634284-14147-1-git-send-email-jsanka@codeaurora.org>
The mode_config max width/height values determine the maximum
resolution the pixel reader can handle. But the same values are
used to restrict the size of the framebuffer creation. Hardware's
with scaling blocks can operate on framebuffers larger/smaller than
that of the pixel reader resolutions by scaling them down/up before
rendering.
This changes adds a separate framebuffer max width/height fields
in drm_mode_config to allow vendors to set if they are different
than that of the default max resolution values.
Vendors setting these fields should fix their mode_set paths too
by filtering and validating the modes against the appropriate max
fields in their mode_valid() implementations.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
---
drivers/gpu/drm/drm_framebuffer.c | 15 +++++++++++----
include/drm/drm_mode_config.h | 3 +++
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 5756431..2083168 100644
--- a/drivers/gpu/drm/drm_framebuffer.c
+++ b/drivers/gpu/drm/drm_framebuffer.c
@@ -300,14 +300,21 @@ struct drm_framebuffer *
return ERR_PTR(-EINVAL);
}
- if ((config->min_width > r->width) || (r->width > config->max_width)) {
+ if ((config->min_width > r->width) ||
+ (!config->max_fb_width && r->width > config->max_width) ||
+ (config->max_fb_width && r->width > config->max_fb_width)) {
DRM_DEBUG_KMS("bad framebuffer width %d, should be >= %d && <= %d\n",
- r->width, config->min_width, config->max_width);
+ r->width, config->min_width, config->max_fb_width ?
+ config->max_fb_width : config->max_width);
return ERR_PTR(-EINVAL);
}
- if ((config->min_height > r->height) || (r->height > config->max_height)) {
+
+ if ((config->min_height > r->height) ||
+ (!config->max_fb_height && r->height > config->max_height) ||
+ (config->max_fb_height && r->height > config->max_fb_height)) {
DRM_DEBUG_KMS("bad framebuffer height %d, should be >= %d && <= %d\n",
- r->height, config->min_height, config->max_height);
+ r->height, config->min_height, config->max_fb_width ?
+ config->max_fb_height : config->max_height);
return ERR_PTR(-EINVAL);
}
diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h
index 3bcbe30..c6394ed 100644
--- a/include/drm/drm_mode_config.h
+++ b/include/drm/drm_mode_config.h
@@ -339,6 +339,8 @@ struct drm_mode_config_funcs {
* @min_height: minimum fb pixel height on this device
* @max_width: maximum fb pixel width on this device
* @max_height: maximum fb pixel height on this device
+ * @max_fb_width: maximum fb buffer width if differs from max_width
+ * @max_fb_height: maximum fb buffer height if differs from max_height
* @funcs: core driver provided mode setting functions
* @fb_base: base address of the framebuffer
* @poll_enabled: track polling support for this device
@@ -523,6 +525,7 @@ struct drm_mode_config {
int min_width, min_height;
int max_width, max_height;
+ int max_fb_width, max_fb_height;
const struct drm_mode_config_funcs *funcs;
resource_size_t fb_base;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-09-28 1:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-28 1:31 [PATCH] Add framebuffer max width/height fields to drm_mode_config Jeykumar Sankaran
2019-09-28 1:31 ` Jeykumar Sankaran [this message]
2019-09-29 4:43 ` drm: add fb " james qian wang (Arm Technology China)
-- strict thread matches above, loose matches on Subject: below --
2019-09-28 1:28 [PATCH] Add framebuffer " Jeykumar Sankaran
2019-09-28 1:28 ` [PATCH] drm: add fb " Jeykumar Sankaran
2019-09-30 10:39 ` Ville Syrjälä
2019-10-01 21:20 ` Jeykumar Sankaran
2019-10-02 13:45 ` Ville Syrjälä
2019-10-02 19:55 ` Rob Clark
2019-10-03 10:27 ` Ville Syrjälä
2019-10-14 8:24 ` Daniel Vetter
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=1569634284-14147-2-git-send-email-jsanka@codeaurora.org \
--to=jsanka@codeaurora.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jcrouse@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=robdclark@gmail.com \
--cc=seanpaul@chromium.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;
as well as URLs for NNTP newsgroup(s).