From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: dri-devel@lists.freedesktop.org
Subject: [PATCH 1/6] drm/fb: Enable choosing a preferred noedid mode
Date: Wed, 25 Jul 2012 13:07:37 +1000 [thread overview]
Message-ID: <1343185657.3715.33.camel@pasglop> (raw)
This adds a "preferred" argument to drm_add_modes_noedid() which
allow drivers such as cirrusdrmfb to select a preferred mode based
on firmware configuration
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
drivers/gpu/drm/cirrus/cirrus_mode.c | 8 +++++++-
drivers/gpu/drm/drm_crtc_helper.c | 2 +-
drivers/gpu/drm/drm_edid.c | 7 ++++++-
include/drm/drm_crtc.h | 2 +-
4 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index a44d31a..e3d2dc0 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -495,13 +495,19 @@ static struct drm_encoder *cirrus_encoder_init(struct drm_device *dev)
int cirrus_vga_get_modes(struct drm_connector *connector)
{
+ int count = 0;
+
/* Just add a static list of modes */
+ count += drm_add_modes_noedid(connector, 640, 480, false);
+ count += drm_add_modes_noedid(connector, 800, 600, false);
+ count += drm_add_modes_noedid(connector, 1024, 768, false);
+ count += drm_add_modes_noedid(connector, 1280, 1024, false);
drm_add_modes_noedid(connector, 640, 480);
drm_add_modes_noedid(connector, 800, 600);
drm_add_modes_noedid(connector, 1024, 768);
drm_add_modes_noedid(connector, 1280, 1024);
- return 4;
+ return count;
}
static int cirrus_vga_mode_valid(struct drm_connector *connector,
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 3252e70..2b8612f 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -126,7 +126,7 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
count = (*connector_funcs->get_modes)(connector);
if (count == 0 && connector->status == connector_status_connected)
- count = drm_add_modes_noedid(connector, 1024, 768);
+ count = drm_add_modes_noedid(connector, 1024, 768, false);
if (count == 0)
goto prune;
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index a8743c3..38cab74 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1945,7 +1945,7 @@ EXPORT_SYMBOL(drm_add_edid_modes);
* Return number of modes added or 0 if we couldn't find any.
*/
int drm_add_modes_noedid(struct drm_connector *connector,
- int hdisplay, int vdisplay)
+ int hdisplay, int vdisplay, bool preferred)
{
int i, count, num_modes = 0;
struct drm_display_mode *mode;
@@ -1973,6 +1973,11 @@ int drm_add_modes_noedid(struct drm_connector *connector,
continue;
mode = drm_mode_duplicate(dev, ptr);
if (mode) {
+ if (preferred && ptr->hdisplay == hdisplay &&
+ ptr->vdisplay == vdisplay) {
+ mode->type |= DRM_MODE_TYPE_PREFERRED;
+ preferred = false;
+ }
drm_mode_probed_add(connector, mode);
num_modes++;
}
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index a1a0386..e8e94b7 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1033,7 +1033,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev,
bool interlaced, int margins, int GTF_M,
int GTF_2C, int GTF_K, int GTF_2J);
extern int drm_add_modes_noedid(struct drm_connector *connector,
- int hdisplay, int vdisplay);
+ int hdisplay, int vdisplay, bool preferred);
extern int drm_edid_header_is_valid(const u8 *raw_edid);
extern bool drm_edid_block_valid(u8 *raw_edid, int block);
reply other threads:[~2012-07-25 3:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1343185657.3715.33.camel@pasglop \
--to=benh@kernel.crashing.org \
--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