Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1639265 > unrolled thread
| Started by | Jose Abreu <Jose.Abreu@synopsys.com> |
|---|---|
| First post | 2017-05-11 11:10 +0200 |
| Last post | 2017-05-11 11:10 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v3 0/6] Introduce new mode validation callbacks Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-11 11:10 +0200
[PATCH v3 5/6] drm: Use mode_valid() in atomic modeset Jose Abreu <Jose.Abreu@synopsys.com> - 2017-05-11 11:10 +0200
| From | Jose Abreu <Jose.Abreu@synopsys.com> |
|---|---|
| Date | 2017-05-11 11:10 +0200 |
| Subject | [PATCH v3 0/6] Introduce new mode validation callbacks |
| Message-ID | <tFSgF-4pU-3@gated-at.bofh.it> |
This series is a follow up from the discussion at [1]. We start by
introducing crtc->mode_valid(), encoder->mode_valid() and
bridge->mode_valid() callbacks which will be used in followup
patches and also by cleaning the documentation a little bit.
We proceed by introducing new helpers to call this new callbacks
at 2/6.
At 3/6 a helper function is introduced that calls all mode_valid()
from a set of bridges.
Next, at 4/6 we modify the connector probe helper so that only modes
which are supported by a given bridge+encoder+crtc combination are
probbed.
At 5/6 we call all the mode_valid() callbacks for a given pipeline,
except the connector->mode_valid one, so that the mode is validated.
This is done before calling mode_fixup().
Finally, at 6/6 we use the new crtc->mode_valid() callback in arcpgu
and remove the atomic_check() callback.
[1] https://patchwork.kernel.org/patch/9702233/
Jose Abreu (6):
drm: Add crtc/encoder/bridge->mode_valid() callbacks
drm: Add drm_{crtc/encoder/connector}_mode_valid()
drm: Introduce drm_bridge_mode_valid()
drm: Use new mode_valid() helpers in connector probe helper
drm: Use mode_valid() in atomic modeset
drm: arc: Use crtc->mode_valid() callback
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>
drivers/gpu/drm/arc/arcpgu_crtc.c | 39 ++++++----
drivers/gpu/drm/drm_atomic_helper.c | 76 +++++++++++++++++++-
drivers/gpu/drm/drm_bridge.c | 33 +++++++++
drivers/gpu/drm/drm_crtc_helper_internal.h | 13 ++++
drivers/gpu/drm/drm_probe_helper.c | 103 ++++++++++++++++++++++++++-
include/drm/drm_bridge.h | 22 ++++++
include/drm/drm_modeset_helper_vtables.h | 110 ++++++++++++++++++++++-------
7 files changed, 348 insertions(+), 48 deletions(-)
--
1.9.1
[toc] | [next] | [standalone]
| From | Jose Abreu <Jose.Abreu@synopsys.com> |
|---|---|
| Date | 2017-05-11 11:10 +0200 |
| Subject | [PATCH v3 5/6] drm: Use mode_valid() in atomic modeset |
| Message-ID | <tFSgH-4pU-27@gated-at.bofh.it> |
| In reply to | #1639265 |
This patches makes use of the new mode_valid() callbacks introduced
previously to validate the full video pipeline when modesetting.
This calls the encoder->mode_valid(), bridge->mode_valid() and
crtc->mode_valid() so that we can make sure that the mode will
be accepted in every components.
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:
- Removed call to connector->mode_valid (Ville, Daniel)
- Change function name (Ville)
- Use for_each_new_connector_in_state (Ville)
- Do not validate if connector and mode didn't change (Ville)
- Use new helpers to call mode_valid
drivers/gpu/drm/drm_atomic_helper.c | 76 +++++++++++++++++++++++++++++++++++--
1 file changed, 73 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 8be9719..5a3c458 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -32,6 +32,7 @@
#include <drm/drm_atomic_helper.h>
#include <linux/dma-fence.h>
+#include "drm_crtc_helper_internal.h"
#include "drm_crtc_internal.h"
/**
@@ -452,6 +453,69 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
return 0;
}
+static enum drm_mode_status mode_valid_path(struct drm_connector *connector,
+ struct drm_encoder *encoder,
+ struct drm_crtc *crtc,
+ struct drm_display_mode *mode)
+{
+ enum drm_mode_status ret;
+
+ ret = drm_encoder_mode_valid(encoder, mode);
+ if (ret != MODE_OK) {
+ DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] mode_valid() failed\n",
+ encoder->base.id, encoder->name);
+ return ret;
+ }
+
+ ret = drm_bridge_mode_valid(encoder->bridge, mode);
+ if (ret != MODE_OK) {
+ DRM_DEBUG_ATOMIC("[BRIDGE] mode_valid() failed\n");
+ return ret;
+ }
+
+ ret = drm_crtc_mode_valid(crtc, mode);
+ if (ret != MODE_OK) {
+ DRM_DEBUG_ATOMIC("[CRTC:%d:%s] mode_valid() failed\n",
+ crtc->base.id, crtc->name);
+ return ret;
+ }
+
+ return ret;
+}
+
+static int
+mode_valid(struct drm_atomic_state *state)
+{
+ struct drm_connector_state *conn_state;
+ struct drm_connector *connector;
+ int i;
+
+ for_each_new_connector_in_state(state, connector, conn_state, i) {
+ struct drm_encoder *encoder = conn_state->best_encoder;
+ struct drm_crtc *crtc = conn_state->crtc;
+ struct drm_crtc_state *crtc_state;
+ enum drm_mode_status mode_status;
+ struct drm_display_mode *mode;
+
+ if (!crtc || !encoder)
+ continue;
+
+ crtc_state = drm_atomic_get_new_crtc_state(state, crtc);
+ if (!crtc_state)
+ continue;
+ if (!crtc_state->mode_changed && !crtc_state->connectors_changed)
+ continue;
+
+ mode = &crtc_state->mode;
+
+ mode_status = mode_valid_path(connector, encoder, crtc, mode);
+ if (mode_status != MODE_OK)
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
/**
* drm_atomic_helper_check_modeset - validate state object for modeset changes
* @dev: DRM device
@@ -466,13 +530,15 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
* 2. &drm_connector_helper_funcs.atomic_check to validate the connector state.
* 3. If it's determined a modeset is needed then all connectors on the affected crtc
* crtc are added and &drm_connector_helper_funcs.atomic_check is run on them.
- * 4. &drm_bridge_funcs.mode_fixup is called on all encoder bridges.
- * 5. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state.
+ * 4. &drm_encoder_helper_funcs.mode_valid, &drm_bridge_funcs.mode_valid and
+ * &drm_crtc_helper_funcs.mode_valid are called on the affected components.
+ * 5. &drm_bridge_funcs.mode_fixup is called on all encoder bridges.
+ * 6. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state.
* This function is only called when the encoder will be part of a configured crtc,
* it must not be used for implementing connector property validation.
* If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called
* instead.
- * 6. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints.
+ * 7. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints.
*
* &drm_crtc_state.mode_changed is set when the input mode is changed.
* &drm_crtc_state.connectors_changed is set when a connector is added or
@@ -617,6 +683,10 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
return ret;
}
+ ret = mode_valid(state);
+ if (ret)
+ return ret;
+
return mode_fixup(state);
}
EXPORT_SYMBOL(drm_atomic_helper_check_modeset);
--
1.9.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web