Skip to content

Commit 3b8a684

Browse files
committed
drm/atomic-helper: Add an atomice best_encoder callback
With legacy helpers all the routing was already set up when calling best_encoder and so could be inspected. But with atomic it's staged, hence we need a new atomic compliant callback for drivers which need to inspect the requested state and can't just decided the best encoder statically. This is needed to fix up i915 dp mst where we need to pick the right encoder depending upon the requested CRTC for the connector. v2: Don't forget to amend the kerneldoc Cc: Chris Wilson <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Theodore Ts'o <[email protected]> Acked-by: Thierry Reding <[email protected]> Reviewed-by: Ander Conselvan de Oliveira <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
1 parent 74d3329 commit 3b8a684

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

drivers/gpu/drm/drm_atomic_helper.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ update_connector_routing(struct drm_atomic_state *state, int conn_idx)
196196
}
197197

198198
funcs = connector->helper_private;
199-
new_encoder = funcs->best_encoder(connector);
199+
200+
if (funcs->atomic_best_encoder)
201+
new_encoder = funcs->atomic_best_encoder(connector,
202+
connector_state);
203+
else
204+
new_encoder = funcs->best_encoder(connector);
200205

201206
if (!new_encoder) {
202207
DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",

include/drm/drm_crtc_helper.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ struct drm_encoder_helper_funcs {
168168
* @get_modes: get mode list for this connector
169169
* @mode_valid: is this mode valid on the given connector? (optional)
170170
* @best_encoder: return the preferred encoder for this connector
171+
* @atomic_best_encoder: atomic version of @best_encoder
171172
*
172173
* The helper operations are called by the mid-layer CRTC helper.
173174
*/
@@ -176,6 +177,8 @@ struct drm_connector_helper_funcs {
176177
enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
177178
struct drm_display_mode *mode);
178179
struct drm_encoder *(*best_encoder)(struct drm_connector *connector);
180+
struct drm_encoder *(*atomic_best_encoder)(struct drm_connector *connector,
181+
struct drm_connector_state *connector_state);
179182
};
180183

181184
extern void drm_helper_disable_unused_functions(struct drm_device *dev);

0 commit comments

Comments
 (0)