| .. | .. |
|---|
| 52 | 52 | * requested metadata, but most of that is left to the driver. See |
|---|
| 53 | 53 | * &struct drm_mode_fb_cmd2 for details. |
|---|
| 54 | 54 | * |
|---|
| 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 | + * |
|---|
| 55 | 61 | * If the parameters are deemed valid and the backing storage objects in |
|---|
| 56 | 62 | * the underlying memory manager all exist, then the driver allocates |
|---|
| 57 | 63 | * a new &drm_framebuffer structure, subclassed to contain |
|---|
| .. | .. |
|---|
| 355 | 361 | * |
|---|
| 356 | 362 | * This is the big scary modeset BKL which protects everything that |
|---|
| 357 | 363 | * 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 |
|---|
| 359 | 365 | * locks. |
|---|
| 360 | 366 | * |
|---|
| 361 | 367 | * The one important thing this protects is the use of @acquire_ctx. |
|---|
| .. | .. |
|---|
| 385 | 391 | /** |
|---|
| 386 | 392 | * @idr_mutex: |
|---|
| 387 | 393 | * |
|---|
| 388 | | - * Mutex for KMS ID allocation and management. Protects both @crtc_idr |
|---|
| 394 | + * Mutex for KMS ID allocation and management. Protects both @object_idr |
|---|
| 389 | 395 | * and @tile_idr. |
|---|
| 390 | 396 | */ |
|---|
| 391 | 397 | struct mutex idr_mutex; |
|---|
| 392 | 398 | |
|---|
| 393 | 399 | /** |
|---|
| 394 | | - * @crtc_idr: |
|---|
| 400 | + * @object_idr: |
|---|
| 395 | 401 | * |
|---|
| 396 | 402 | * Main KMS ID tracking object. Use this idr for all IDs, fb, crtc, |
|---|
| 397 | 403 | * connector, modes - just makes life easier to have only one. |
|---|
| 398 | 404 | */ |
|---|
| 399 | | - struct idr crtc_idr; |
|---|
| 405 | + struct idr object_idr; |
|---|
| 400 | 406 | |
|---|
| 401 | 407 | /** |
|---|
| 402 | 408 | * @tile_idr: |
|---|
| .. | .. |
|---|
| 506 | 512 | */ |
|---|
| 507 | 513 | struct list_head property_list; |
|---|
| 508 | 514 | |
|---|
| 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 | + |
|---|
| 509 | 524 | int min_width, min_height; |
|---|
| 510 | 525 | int max_width, max_height; |
|---|
| 511 | 526 | const struct drm_mode_config_funcs *funcs; |
|---|
| .. | .. |
|---|
| 588 | 603 | struct drm_property *prop_src_h; |
|---|
| 589 | 604 | /** |
|---|
| 590 | 605 | * @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. |
|---|
| 592 | 607 | */ |
|---|
| 593 | 608 | struct drm_property *prop_crtc_x; |
|---|
| 594 | 609 | /** |
|---|
| 595 | 610 | * @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. |
|---|
| 597 | 612 | */ |
|---|
| 598 | 613 | struct drm_property *prop_crtc_y; |
|---|
| 599 | 614 | /** |
|---|
| 600 | 615 | * @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. |
|---|
| 602 | 617 | */ |
|---|
| 603 | 618 | struct drm_property *prop_crtc_w; |
|---|
| 604 | 619 | /** |
|---|
| 605 | 620 | * @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. |
|---|
| 607 | 622 | */ |
|---|
| 608 | 623 | struct drm_property *prop_crtc_h; |
|---|
| 609 | 624 | /** |
|---|
| .. | .. |
|---|
| 628 | 643 | */ |
|---|
| 629 | 644 | struct drm_property *prop_crtc_id; |
|---|
| 630 | 645 | /** |
|---|
| 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 | + /** |
|---|
| 631 | 655 | * @prop_active: Default atomic CRTC property to control the active |
|---|
| 632 | 656 | * state, which is the simplified implementation for DPMS in atomic |
|---|
| 633 | 657 | * drivers. |
|---|
| .. | .. |
|---|
| 639 | 663 | * connectors must be of and active must be set to disabled, too. |
|---|
| 640 | 664 | */ |
|---|
| 641 | 665 | 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; |
|---|
| 642 | 671 | |
|---|
| 643 | 672 | /** |
|---|
| 644 | 673 | * @dvi_i_subconnector_property: Optional DVI-I property to |
|---|
| .. | .. |
|---|
| 650 | 679 | * select between analog or digital mode. |
|---|
| 651 | 680 | */ |
|---|
| 652 | 681 | 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; |
|---|
| 653 | 688 | |
|---|
| 654 | 689 | /** |
|---|
| 655 | 690 | * @tv_subconnector_property: Optional TV property to differentiate |
|---|
| .. | .. |
|---|
| 668 | 703 | struct drm_property *tv_mode_property; |
|---|
| 669 | 704 | /** |
|---|
| 670 | 705 | * @tv_left_margin_property: Optional TV property to set the left |
|---|
| 671 | | - * margin. |
|---|
| 706 | + * margin (expressed in pixels). |
|---|
| 672 | 707 | */ |
|---|
| 673 | 708 | struct drm_property *tv_left_margin_property; |
|---|
| 674 | 709 | /** |
|---|
| 675 | 710 | * @tv_right_margin_property: Optional TV property to set the right |
|---|
| 676 | | - * margin. |
|---|
| 711 | + * margin (expressed in pixels). |
|---|
| 677 | 712 | */ |
|---|
| 678 | 713 | struct drm_property *tv_right_margin_property; |
|---|
| 679 | 714 | /** |
|---|
| 680 | 715 | * @tv_top_margin_property: Optional TV property to set the right |
|---|
| 681 | | - * margin. |
|---|
| 716 | + * margin (expressed in pixels). |
|---|
| 682 | 717 | */ |
|---|
| 683 | 718 | struct drm_property *tv_top_margin_property; |
|---|
| 684 | 719 | /** |
|---|
| 685 | 720 | * @tv_bottom_margin_property: Optional TV property to set the right |
|---|
| 686 | | - * margin. |
|---|
| 721 | + * margin (expressed in pixels). |
|---|
| 687 | 722 | */ |
|---|
| 688 | 723 | struct drm_property *tv_bottom_margin_property; |
|---|
| 689 | 724 | /** |
|---|
| .. | .. |
|---|
| 760 | 795 | struct drm_property *gamma_lut_size_property; |
|---|
| 761 | 796 | |
|---|
| 762 | 797 | /** |
|---|
| 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 | | - /** |
|---|
| 774 | 798 | * @suggested_x_property: Optional connector property with a hint for |
|---|
| 775 | 799 | * the position of the output on the host's screen. |
|---|
| 776 | 800 | */ |
|---|
| .. | .. |
|---|
| 819 | 843 | struct drm_property *writeback_out_fence_ptr_property; |
|---|
| 820 | 844 | |
|---|
| 821 | 845 | /** |
|---|
| 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 |
|---|
| 824 | 848 | * on HDR content |
|---|
| 825 | 849 | */ |
|---|
| 826 | 850 | struct drm_property *hdr_output_metadata_property; |
|---|
| 827 | 851 | |
|---|
| 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 | + |
|---|
| 828 | 864 | /* dumb ioctl parameters */ |
|---|
| 829 | 865 | 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; |
|---|
| 830 | 907 | |
|---|
| 831 | 908 | /** |
|---|
| 832 | 909 | * @async_page_flip: Does this device support async flips on the primary |
|---|
| .. | .. |
|---|
| 870 | 947 | const struct drm_mode_config_helper_funcs *helper_private; |
|---|
| 871 | 948 | }; |
|---|
| 872 | 949 | |
|---|
| 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 | + |
|---|
| 874 | 967 | void drm_mode_config_reset(struct drm_device *dev); |
|---|
| 875 | 968 | void drm_mode_config_cleanup(struct drm_device *dev); |
|---|
| 876 | 969 | |
|---|