Two further KMS binding prerequisites used by the in-tree DisplayLink
DL3 (vino) driver, beyond the simple-display-pipe header set:

- drm_blend.h, for drm_plane_create_rotation_property() and the
  DRM_MODE_ROTATE_* / DRM_MODE_REFLECT_* constants, so a driver can
  attach the standard atomic plane rotation property.

- a rust_helper for drm_atomic_get_new_crtc_state(): it is static
  inline in <drm/drm_atomic.h> and so is not callable from Rust
  directly. It returns a CRTC's new state within an atomic commit
  (NULL when the CRTC is not part of the commit), letting a driver
  inspect the proposed configuration from its mode_config
  atomic_check(). vino uses it to sum the pixel clocks of all heads
  and reject a modeset that would exceed the dock's USB bandwidth.

Signed-off-by: Mike Lothian <[email protected]>
Assisted-by: Claude:claude-opus-4-8 [Claude-Code]
---
 rust/bindings/bindings_helper.h |  1 +
 rust/helpers/drm.c              | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index 5b311944cc14..5ff21c33385e 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -31,6 +31,7 @@
 #include <linux/acpi.h>
 #include <linux/gpu_buddy.h>
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_blend.h>
 #include <drm/drm_connector.h>
 #include <drm/drm_device.h>
 #include <drm/drm_drv.h>
diff --git a/rust/helpers/drm.c b/rust/helpers/drm.c
index 65f3f22b0e1d..5087daa23ed8 100644
--- a/rust/helpers/drm.c
+++ b/rust/helpers/drm.c
@@ -1,11 +1,23 @@
 // SPDX-License-Identifier: GPL-2.0
 
+#include <drm/drm_atomic.h>
 #include <drm/drm_gem.h>
 #include <drm/drm_gem_shmem_helper.h>
 #include <drm/drm_vma_manager.h>
 
 #ifdef CONFIG_DRM
 
+/* Read-only accessor for a CRTC's *new* state within an atomic commit 
(returns NULL if the CRTC
+ * is not part of the commit). It is static-inline in <drm/drm_atomic.h>, so 
Rust cannot call it
+ * directly; the vino driver uses it in its combined-bandwidth atomic_check.
+ */
+__rust_helper struct drm_crtc_state *
+rust_helper_drm_atomic_get_new_crtc_state(const struct drm_atomic_commit 
*state,
+                                         struct drm_crtc *crtc)
+{
+       return drm_atomic_get_new_crtc_state(state, crtc);
+}
+
 __rust_helper void rust_helper_drm_gem_object_get(struct drm_gem_object *obj)
 {
        drm_gem_object_get(obj);
-- 
2.54.0

Reply via email to