hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/include/drm/drm_mode_config.h
....@@ -52,6 +52,12 @@
5252 * requested metadata, but most of that is left to the driver. See
5353 * &struct drm_mode_fb_cmd2 for details.
5454 *
55
+ * To validate the pixel format and modifier drivers can use
56
+ * drm_any_plane_has_format() to make sure at least one plane supports
57
+ * the requested values. Note that the driver must first determine the
58
+ * actual modifier used if the request doesn't have it specified,
59
+ * ie. when (@mode_cmd->flags & DRM_MODE_FB_MODIFIERS) == 0.
60
+ *
5561 * If the parameters are deemed valid and the backing storage objects in
5662 * the underlying memory manager all exist, then the driver allocates
5763 * a new &drm_framebuffer structure, subclassed to contain
....@@ -355,7 +361,7 @@
355361 *
356362 * This is the big scary modeset BKL which protects everything that
357363 * isn't protect otherwise. Scope is unclear and fuzzy, try to remove
358
- * anything from under it's protection and move it into more well-scoped
364
+ * anything from under its protection and move it into more well-scoped
359365 * locks.
360366 *
361367 * The one important thing this protects is the use of @acquire_ctx.
....@@ -385,18 +391,18 @@
385391 /**
386392 * @idr_mutex:
387393 *
388
- * Mutex for KMS ID allocation and management. Protects both @crtc_idr
394
+ * Mutex for KMS ID allocation and management. Protects both @object_idr
389395 * and @tile_idr.
390396 */
391397 struct mutex idr_mutex;
392398
393399 /**
394
- * @crtc_idr:
400
+ * @object_idr:
395401 *
396402 * Main KMS ID tracking object. Use this idr for all IDs, fb, crtc,
397403 * connector, modes - just makes life easier to have only one.
398404 */
399
- struct idr crtc_idr;
405
+ struct idr object_idr;
400406
401407 /**
402408 * @tile_idr:
....@@ -506,6 +512,15 @@
506512 */
507513 struct list_head property_list;
508514
515
+ /**
516
+ * @privobj_list:
517
+ *
518
+ * List of private objects linked with &drm_private_obj.head. This is
519
+ * invariant over the lifetime of a device and hence doesn't need any
520
+ * locks.
521
+ */
522
+ struct list_head privobj_list;
523
+
509524 int min_width, min_height;
510525 int max_width, max_height;
511526 const struct drm_mode_config_funcs *funcs;
....@@ -588,22 +603,22 @@
588603 struct drm_property *prop_src_h;
589604 /**
590605 * @prop_crtc_x: Default atomic plane property for the plane destination
591
- * position in the &drm_crtc is is being shown on.
606
+ * position in the &drm_crtc is being shown on.
592607 */
593608 struct drm_property *prop_crtc_x;
594609 /**
595610 * @prop_crtc_y: Default atomic plane property for the plane destination
596
- * position in the &drm_crtc is is being shown on.
611
+ * position in the &drm_crtc is being shown on.
597612 */
598613 struct drm_property *prop_crtc_y;
599614 /**
600615 * @prop_crtc_w: Default atomic plane property for the plane destination
601
- * position in the &drm_crtc is is being shown on.
616
+ * position in the &drm_crtc is being shown on.
602617 */
603618 struct drm_property *prop_crtc_w;
604619 /**
605620 * @prop_crtc_h: Default atomic plane property for the plane destination
606
- * position in the &drm_crtc is is being shown on.
621
+ * position in the &drm_crtc is being shown on.
607622 */
608623 struct drm_property *prop_crtc_h;
609624 /**
....@@ -628,6 +643,15 @@
628643 */
629644 struct drm_property *prop_crtc_id;
630645 /**
646
+ * @prop_fb_damage_clips: Optional plane property to mark damaged
647
+ * regions on the plane in framebuffer coordinates of the framebuffer
648
+ * attached to the plane.
649
+ *
650
+ * The layout of blob data is simply an array of &drm_mode_rect. Unlike
651
+ * plane src coordinates, damage clips are not in 16.16 fixed point.
652
+ */
653
+ struct drm_property *prop_fb_damage_clips;
654
+ /**
631655 * @prop_active: Default atomic CRTC property to control the active
632656 * state, which is the simplified implementation for DPMS in atomic
633657 * drivers.
....@@ -639,6 +663,11 @@
639663 * connectors must be of and active must be set to disabled, too.
640664 */
641665 struct drm_property *prop_mode_id;
666
+ /**
667
+ * @prop_vrr_enabled: Default atomic CRTC property to indicate
668
+ * whether variable refresh rate should be enabled on the CRTC.
669
+ */
670
+ struct drm_property *prop_vrr_enabled;
642671
643672 /**
644673 * @dvi_i_subconnector_property: Optional DVI-I property to
....@@ -650,6 +679,12 @@
650679 * select between analog or digital mode.
651680 */
652681 struct drm_property *dvi_i_select_subconnector_property;
682
+
683
+ /**
684
+ * @dp_subconnector_property: Optional DP property to differentiate
685
+ * between different DP downstream port types.
686
+ */
687
+ struct drm_property *dp_subconnector_property;
653688
654689 /**
655690 * @tv_subconnector_property: Optional TV property to differentiate
....@@ -668,22 +703,22 @@
668703 struct drm_property *tv_mode_property;
669704 /**
670705 * @tv_left_margin_property: Optional TV property to set the left
671
- * margin.
706
+ * margin (expressed in pixels).
672707 */
673708 struct drm_property *tv_left_margin_property;
674709 /**
675710 * @tv_right_margin_property: Optional TV property to set the right
676
- * margin.
711
+ * margin (expressed in pixels).
677712 */
678713 struct drm_property *tv_right_margin_property;
679714 /**
680715 * @tv_top_margin_property: Optional TV property to set the right
681
- * margin.
716
+ * margin (expressed in pixels).
682717 */
683718 struct drm_property *tv_top_margin_property;
684719 /**
685720 * @tv_bottom_margin_property: Optional TV property to set the right
686
- * margin.
721
+ * margin (expressed in pixels).
687722 */
688723 struct drm_property *tv_bottom_margin_property;
689724 /**
....@@ -760,17 +795,6 @@
760795 struct drm_property *gamma_lut_size_property;
761796
762797 /**
763
- * @cubic_lut_property: Optional CRTC property to set the 3D LUT used to
764
- * convert color spaces.
765
- */
766
- struct drm_property *cubic_lut_property;
767
- /**
768
- * @cubic_lut_size_property: Optional CRTC property for the size of the
769
- * 3D LUT as supported by the driver (read-only).
770
- */
771
- struct drm_property *cubic_lut_size_property;
772
-
773
- /**
774798 * @suggested_x_property: Optional connector property with a hint for
775799 * the position of the output on the host's screen.
776800 */
....@@ -819,14 +843,67 @@
819843 struct drm_property *writeback_out_fence_ptr_property;
820844
821845 /**
822
- * hdr_output_metadata_property: Connector property containing hdr
823
- * metatda. This will be provided by userspace compositors based
846
+ * @hdr_output_metadata_property: Connector property containing hdr
847
+ * metatada. This will be provided by userspace compositors based
824848 * on HDR content
825849 */
826850 struct drm_property *hdr_output_metadata_property;
827851
852
+ /**
853
+ * @content_protection_property: DRM ENUM property for content
854
+ * protection. See drm_connector_attach_content_protection_property().
855
+ */
856
+ struct drm_property *content_protection_property;
857
+
858
+ /**
859
+ * @hdcp_content_type_property: DRM ENUM property for type of
860
+ * Protected Content.
861
+ */
862
+ struct drm_property *hdcp_content_type_property;
863
+
828864 /* dumb ioctl parameters */
829865 uint32_t preferred_depth, prefer_shadow;
866
+
867
+ /**
868
+ * @prefer_shadow_fbdev:
869
+ *
870
+ * Hint to framebuffer emulation to prefer shadow-fb rendering.
871
+ */
872
+ bool prefer_shadow_fbdev;
873
+
874
+ /**
875
+ * @fbdev_use_iomem:
876
+ *
877
+ * Set to true if framebuffer reside in iomem.
878
+ * When set to true memcpy_toio() is used when copying the framebuffer in
879
+ * drm_fb_helper.drm_fb_helper_dirty_blit_real().
880
+ *
881
+ * FIXME: This should be replaced with a per-mapping is_iomem
882
+ * flag (like ttm does), and then used everywhere in fbdev code.
883
+ */
884
+ bool fbdev_use_iomem;
885
+
886
+ /**
887
+ * @quirk_addfb_prefer_xbgr_30bpp:
888
+ *
889
+ * Special hack for legacy ADDFB to keep nouveau userspace happy. Should
890
+ * only ever be set by the nouveau kernel driver.
891
+ */
892
+ bool quirk_addfb_prefer_xbgr_30bpp;
893
+
894
+ /**
895
+ * @quirk_addfb_prefer_host_byte_order:
896
+ *
897
+ * When set to true drm_mode_addfb() will pick host byte order
898
+ * pixel_format when calling drm_mode_addfb2(). This is how
899
+ * drm_mode_addfb() should have worked from day one. It
900
+ * didn't though, so we ended up with quirks in both kernel
901
+ * and userspace drivers to deal with the broken behavior.
902
+ * Simply fixing drm_mode_addfb() unconditionally would break
903
+ * these drivers, so add a quirk bit here to allow drivers
904
+ * opt-in.
905
+ */
906
+ bool quirk_addfb_prefer_host_byte_order;
830907
831908 /**
832909 * @async_page_flip: Does this device support async flips on the primary
....@@ -870,7 +947,23 @@
870947 const struct drm_mode_config_helper_funcs *helper_private;
871948 };
872949
873
-void drm_mode_config_init(struct drm_device *dev);
950
+int __must_check drmm_mode_config_init(struct drm_device *dev);
951
+
952
+/**
953
+ * drm_mode_config_init - DRM mode_configuration structure initialization
954
+ * @dev: DRM device
955
+ *
956
+ * This is the unmanaged version of drmm_mode_config_init() for drivers which
957
+ * still explicitly call drm_mode_config_cleanup().
958
+ *
959
+ * FIXME: This function is deprecated and drivers should be converted over to
960
+ * drmm_mode_config_init().
961
+ */
962
+static inline int drm_mode_config_init(struct drm_device *dev)
963
+{
964
+ return drmm_mode_config_init(dev);
965
+}
966
+
874967 void drm_mode_config_reset(struct drm_device *dev);
875968 void drm_mode_config_cleanup(struct drm_device *dev);
876969