Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1638303
| From | Jose Abreu <Jose.Abreu@synopsys.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 1/8] drm: Add crtc/encoder/bridge->mode_valid() callbacks |
| Date | 2017-05-09 19:10 +0200 |
| Message-ID | <tFgO6-4HS-37@gated-at.bofh.it> (permalink) |
| References | <tFgO5-4HS-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This adds a new callback to crtc, encoder and bridge helper functions
called mode_valid(). This callback shall be implemented if the
corresponding component has some sort of restriction in the modes
that can be displayed. A NULL callback implicates that the component
can display all the modes.
We also change the description of connector->mode_valid() callback
so that it matches the existing behaviour: It is never called in
atomic check phase.
Only the callbacks were implemented to simplify review process,
following patches will make use of them.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Carlos Palminha <palminha@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@linux.ie>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Archit Taneja <architt@codeaurora.org>
---
Changes v1->v2:
- Change description of connector->mode_valid() (Daniel)
include/drm/drm_bridge.h | 20 ++++++++++++++
include/drm/drm_modeset_helper_vtables.h | 45 ++++++++++++++++++++++++++++++++
2 files changed, 65 insertions(+)
diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index fdd82fc..00c6c36 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -59,6 +59,26 @@ struct drm_bridge_funcs {
void (*detach)(struct drm_bridge *bridge);
/**
+ * @mode_valid:
+ *
+ * This callback is used to check if a specific mode is valid in this
+ * bridge. This should be implemented if the bridge has some sort of
+ * restriction in the modes it can display. For example, a given bridge
+ * may be responsible to set a clock value. If the clock can not
+ * produce all the values for the available modes then this callback
+ * can be used to restrict the number of modes to only the ones that
+ * can be displayed.
+ *
+ * This is called at mode probe and at atomic check phase.
+ *
+ * RETURNS:
+ *
+ * drm_mode_status Enum
+ */
+ enum drm_mode_status (*mode_valid)(struct drm_bridge *crtc,
+ const struct drm_display_mode *mode);
+
+ /**
* @mode_fixup:
*
* This callback is used to validate and adjust a mode. The paramater
diff --git a/include/drm/drm_modeset_helper_vtables.h b/include/drm/drm_modeset_helper_vtables.h
index c01c328..eec2c70 100644
--- a/include/drm/drm_modeset_helper_vtables.h
+++ b/include/drm/drm_modeset_helper_vtables.h
@@ -106,6 +106,26 @@ struct drm_crtc_helper_funcs {
void (*commit)(struct drm_crtc *crtc);
/**
+ * @mode_valid:
+ *
+ * This callback is used to check if a specific mode is valid in this
+ * crtc. This should be implemented if the crtc has some sort of
+ * restriction in the modes it can display. For example, a given crtc
+ * may be responsible to set a clock value. If the clock can not
+ * produce all the values for the available modes then this callback
+ * can be used to restrict the number of modes to only the ones that
+ * can be displayed.
+ *
+ * This is called at mode probe and at atomic check phase.
+ *
+ * RETURNS:
+ *
+ * drm_mode_status Enum
+ */
+ enum drm_mode_status (*mode_valid)(struct drm_crtc *crtc,
+ const struct drm_display_mode *mode);
+
+ /**
* @mode_fixup:
*
* This callback is used to validate a mode. The parameter mode is the
@@ -457,6 +477,26 @@ struct drm_encoder_helper_funcs {
void (*dpms)(struct drm_encoder *encoder, int mode);
/**
+ * @mode_valid:
+ *
+ * This callback is used to check if a specific mode is valid in this
+ * encoder. This should be implemented if the encoder has some sort
+ * of restriction in the modes it can display. For example, a given
+ * encoder may be responsible to set a clock value. If the clock can
+ * not produce all the values for the available modes then this callback
+ * can be used to restrict the number of modes to only the ones that
+ * can be displayed.
+ *
+ * This is called at mode probe and at atomic check phase.
+ *
+ * RETURNS:
+ *
+ * drm_mode_status Enum
+ */
+ enum drm_mode_status (*mode_valid)(struct drm_encoder *crtc,
+ const struct drm_display_mode *mode);
+
+ /**
* @mode_fixup:
*
* This callback is used to validate and adjust a mode. The parameter
@@ -795,6 +835,11 @@ struct drm_connector_helper_funcs {
* (which is usually derived from the EDID data block from the sink).
* See e.g. drm_helper_probe_single_connector_modes().
*
+ * This callback is never called in atomic check phase so that userspace
+ * can override kernel sink checks in case of broken EDID with wrong
+ * limits from the sink. You can use the remaining mode_valid()
+ * callbacks to validate the mode against your video path.
+ *
* NOTE:
*
* This only filters the mode list supplied to userspace in the
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/8] Introduce new mode validation callbacks Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
[PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Ville Syrjälä <ville.syrjala@linux.intel.com> - 2017-05-10 15:50 +0200
Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 16:10 +0200
Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 16:10 +0200
Re: [PATCH v2 6/8] drm: Introduce drm_bridge_mode_valid() Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 17:20 +0200
[PATCH v2 4/8] drm: Add drm_connector_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
[PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
Re: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 10:10 +0200
Re: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 11:00 +0200
Re: [PATCH v2 2/8] drm: Add drm_crtc_mode_valid() Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 17:20 +0200
[PATCH v2 8/8] drm: arc: Use crtc->mode_valid() callback Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
[PATCH v2 5/8] drm: Use new mode_valid() helpers in connector probe helper Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
Re: [PATCH v2 5/8] drm: Use new mode_valid() helpers in connector probe helper Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 10:10 +0200
Re: [PATCH v2 5/8] drm: Use new mode_valid() helpers in connector probe helper Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 11:10 +0200
[PATCH v2 1/8] drm: Add crtc/encoder/bridge->mode_valid() callbacks Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
Re: [PATCH v2 1/8] drm: Add crtc/encoder/bridge->mode_valid() callbacks Daniel Vetter <daniel@ffwll.ch> - 2017-05-10 10:10 +0200
Re: [PATCH v2 1/8] drm: Add crtc/encoder/bridge->mode_valid() callbacks Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-10 11:10 +0200
[PATCH v2 3/8] drm: Add drm_encoder_mode_valid() Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-09 19:10 +0200
csiph-web