[airlied: add two missing Kconfig] drm-misc-next for v5.18: UAPI Changes: - Fix invalid IN_FORMATS blob when plane->format_mod_supported is NULL. Cross-subsystem Changes: - Assorted dt bindings updates. - Fix vga16fb vga checking on x86. - Fix extra semicolon in rwsem.h's _down_write_nest_lock. - Assorted small fixes to agp and fbdev drivers. - Fix oops in creating a udmabuf with 0 pages. - Hot-unplug firmware fb devices on forced removal - Reqquest memory region in simplefb and simpledrm, and don't make the ioresource as busy. Core Changes: - Mock a drm_plane in drm-plane-helper selftest. - Assorted bug fixes to device logging, dbi. - Use DP helper for sink count in mst. - Assorted documentation fixes. - Assorted small fixes. - Move DP headers to drm/dp, and add a drm dp helper module. - Move the buddy allocator from i915 to common drm. - Add simple pci and platform module init macros to remove a lot of boilerplate from some drivers. - Support microsoft extension for HMDs and specialized monitors. - Improve edid parser's deep color handling. - Add type 7 timing support to edid parser. - Add a weak backpointer to the ttm_bo from ttm_resource - Add 3 eDP panels. Driver Changes: - Add support for HDMI and JZ4780 to ingenic. - Add support for higher DP/eDP bitrates to nouveau. - Assorted driver fixes to tilcdc, vmwgfx, sn65dsi83, meson, stm, panfrost, v3d, gma500, vc4, virtio, mgag200, ast, radeon, amdgpu, nouveau, various bridge drivers. - Convert and revert exynos dsi support to bridge driver. - Add vcc supply regulator support for sn65dsi83. - More conversion of bridge/chipone-icn6211 to atomic. - Remove conflicting fb's from stm, and add support for new hw version. - Add device link in parade-ps8640 to fix suspend/resume. - Update Boe-tv110c9m init sequence. - Add wide screen support to AST2600. - Fix omapdrm implicit dma_buf fencing. - Add support for multiple overlay planes to vkms. - Convert bridge/anx7625 to atomic, add HDCP support, add eld support for audio, and fix HPD. - Add driver for ChromeOS privacy screen. - Handover display from firmware to vc4 more gracefully, and support nomodeset. - Add flexible and ycbcr pixel formats to stm/ltdc. - Convert exynos mipi dsi to atomic. - Add initial dual core group GPUs support to panfrost. - No longer add exclusive fence in amdgpu as shared fence. - Add CSC and full range supoprt to vc4. - Shutdown the display on system shutdown and unbind. - Add Multi-Inno Technology MI0700S4T-6 simple panel. Signed-off-by: Dave Airlie <airlied@redhat.com>
Showing the changes to include (22 of 233 files). Show all
Unified · Split
| @@ -51,7 +51,9 @@ struct dw_mipi_dsi_plat_data { · 50 unmodified lines | |||
| 51 | unsigned int max_data_lanes; | 51 | unsigned int max_data_lanes; |
| 52 | 52 | ||
| 53 | enum drm_mode_status (*mode_valid)(void *priv_data, | 53 | enum drm_mode_status (*mode_valid)(void *priv_data, |
| 54 | const struct drm_display_mode *mode); | 54 | const struct drm_display_mode *mode, |
| 55 | unsigned long mode_flags, | ||
| 56 | u32 lanes, u32 format); | ||
| 55 | 57 | ||
| 56 | const struct dw_mipi_dsi_phy_ops *phy_ops; | 58 | const struct dw_mipi_dsi_phy_ops *phy_ops; |
| 57 | const struct dw_mipi_dsi_host_ops *host_ops; | 59 | const struct dw_mipi_dsi_host_ops *host_ops; |
File renamed without changes.
File renamed without changes.
| @@ -1038,11 +1038,8 @@ struct drm_panel; · 1037 unmodified lines | |||
| 1038 | #define DP_SIDEBAND_MSG_UP_REQ_BASE 0x1600 /* 1.2 MST */ | 1038 | #define DP_SIDEBAND_MSG_UP_REQ_BASE 0x1600 /* 1.2 MST */ |
| 1039 | 1039 | ||
| 1040 | /* DPRX Event Status Indicator */ | 1040 | /* DPRX Event Status Indicator */ |
| 1041 | #define DP_SINK_COUNT_ESI 0x2002 /* 1.2 */ | 1041 | #define DP_SINK_COUNT_ESI 0x2002 /* same as 0x200 */ |
| 1042 | /* 0-5 sink count */ | 1042 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* same as 0x201 */ |
| 1043 | # define DP_SINK_COUNT_CP_READY (1 << 6) | ||
| 1044 | |||
| 1045 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* 1.2 */ | ||
| 1046 | 1043 | ||
| 1047 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */ | 1044 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */ |
| 1048 | # define DP_RX_GTC_MSTR_REQ_STATUS_CHANGE (1 << 0) | 1045 | # define DP_RX_GTC_MSTR_REQ_STATUS_CHANGE (1 << 0) |
| @@ -23,7 +23,7 @@ · 22 unmodified lines | |||
| 23 | #define _DRM_DP_MST_HELPER_H_ | 23 | #define _DRM_DP_MST_HELPER_H_ |
| 24 | 24 | ||
| 25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 26 | #include <drm/drm_dp_helper.h> | 26 | #include <drm/dp/drm_dp_helper.h> |
| 27 | #include <drm/drm_atomic.h> | 27 | #include <drm/drm_atomic.h> |
| 28 | 28 | ||
| 29 | #if IS_ENABLED(CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS) | 29 | #if IS_ENABLED(CONFIG_DRM_DEBUG_DP_MST_TOPOLOGY_REFS) |
| @@ -0,0 +1,150 @@ | |||
| 1 | /* SPDX-License-Identifier: MIT */ | ||
| 2 | /* | ||
| 3 | * Copyright © 2021 Intel Corporation | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef __DRM_BUDDY_H__ | ||
| 7 | #define __DRM_BUDDY_H__ | ||
| 8 | |||
| 9 | #include <linux/bitops.h> | ||
| 10 | #include <linux/list.h> | ||
| 11 | #include <linux/slab.h> | ||
| 12 | #include <linux/sched.h> | ||
| 13 | |||
| 14 | #include <drm/drm_print.h> | ||
| 15 | |||
| 16 | #define range_overflows(start, size, max) ({ \ | ||
| 17 | typeof(start) start__ = (start); \ | ||
| 18 | typeof(size) size__ = (size); \ | ||
| 19 | typeof(max) max__ = (max); \ | ||
| 20 | (void)(&start__ == &size__); \ | ||
| 21 | (void)(&start__ == &max__); \ | ||
| 22 | start__ >= max__ || size__ > max__ - start__; \ | ||
| 23 | }) | ||
| 24 | |||
| 25 | struct drm_buddy_block { | ||
| 26 | #define DRM_BUDDY_HEADER_OFFSET GENMASK_ULL(63, 12) | ||
| 27 | #define DRM_BUDDY_HEADER_STATE GENMASK_ULL(11, 10) | ||
| 28 | #define DRM_BUDDY_ALLOCATED (1 << 10) | ||
| 29 | #define DRM_BUDDY_FREE (2 << 10) | ||
| 30 | #define DRM_BUDDY_SPLIT (3 << 10) | ||
| 31 | /* Free to be used, if needed in the future */ | ||
| 32 | #define DRM_BUDDY_HEADER_UNUSED GENMASK_ULL(9, 6) | ||
| 33 | #define DRM_BUDDY_HEADER_ORDER GENMASK_ULL(5, 0) | ||
| 34 | u64 header; | ||
| 35 | |||
| 36 | struct drm_buddy_block *left; | ||
| 37 | struct drm_buddy_block *right; | ||
| 38 | struct drm_buddy_block *parent; | ||
| 39 | |||
| 40 | void *private; /* owned by creator */ | ||
| 41 | |||
| 42 | /* | ||
| 43 | * While the block is allocated by the user through drm_buddy_alloc*, | ||
| 44 | * the user has ownership of the link, for example to maintain within | ||
| 45 | * a list, if so desired. As soon as the block is freed with | ||
| 46 | * drm_buddy_free* ownership is given back to the mm. | ||
| 47 | */ | ||
| 48 | struct list_head link; | ||
| 49 | struct list_head tmp_link; | ||
| 50 | }; | ||
| 51 | |||
| 52 | /* Order-zero must be at least PAGE_SIZE */ | ||
| 53 | #define DRM_BUDDY_MAX_ORDER (63 - PAGE_SHIFT) | ||
| 54 | |||
| 55 | /* | ||
| 56 | * Binary Buddy System. | ||
| 57 | * | ||
| 58 | * Locking should be handled by the user, a simple mutex around | ||
| 59 | * drm_buddy_alloc* and drm_buddy_free* should suffice. | ||
| 60 | */ | ||
| 61 | struct drm_buddy { | ||
| 62 | /* Maintain a free list for each order. */ | ||
| 63 | struct list_head *free_list; | ||
| 64 | |||
| 65 | /* | ||
| 66 | * Maintain explicit binary tree(s) to track the allocation of the | ||
| 67 | * address space. This gives us a simple way of finding a buddy block | ||
| 68 | * and performing the potentially recursive merge step when freeing a | ||
| 69 | * block. Nodes are either allocated or free, in which case they will | ||
| 70 | * also exist on the respective free list. | ||
| 71 | */ | ||
| 72 | struct drm_buddy_block **roots; | ||
| 73 | |||
| 74 | /* | ||
| 75 | * Anything from here is public, and remains static for the lifetime of | ||
| 76 | * the mm. Everything above is considered do-not-touch. | ||
| 77 | */ | ||
| 78 | unsigned int n_roots; | ||
| 79 | unsigned int max_order; | ||
| 80 | |||
| 81 | /* Must be at least PAGE_SIZE */ | ||
| 82 | u64 chunk_size; | ||
| 83 | u64 size; | ||
| 84 | u64 avail; | ||
| 85 | }; | ||
| 86 | |||
| 87 | static inline u64 | ||
| 88 | drm_buddy_block_offset(struct drm_buddy_block *block) | ||
| 89 | { | ||
| 90 | return block->header & DRM_BUDDY_HEADER_OFFSET; | ||
| 91 | } | ||
| 92 | |||
| 93 | static inline unsigned int | ||
| 94 | drm_buddy_block_order(struct drm_buddy_block *block) | ||
| 95 | { | ||
| 96 | return block->header & DRM_BUDDY_HEADER_ORDER; | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline unsigned int | ||
| 100 | drm_buddy_block_state(struct drm_buddy_block *block) | ||
| 101 | { | ||
| 102 | return block->header & DRM_BUDDY_HEADER_STATE; | ||
| 103 | } | ||
| 104 | |||
| 105 | static inline bool | ||
| 106 | drm_buddy_block_is_allocated(struct drm_buddy_block *block) | ||
| 107 | { | ||
| 108 | return drm_buddy_block_state(block) == DRM_BUDDY_ALLOCATED; | ||
| 109 | } | ||
| 110 | |||
| 111 | static inline bool | ||
| 112 | drm_buddy_block_is_free(struct drm_buddy_block *block) | ||
| 113 | { | ||
| 114 | return drm_buddy_block_state(block) == DRM_BUDDY_FREE; | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline bool | ||
| 118 | drm_buddy_block_is_split(struct drm_buddy_block *block) | ||
| 119 | { | ||
| 120 | return drm_buddy_block_state(block) == DRM_BUDDY_SPLIT; | ||
| 121 | } | ||
| 122 | |||
| 123 | static inline u64 | ||
| 124 | drm_buddy_block_size(struct drm_buddy *mm, | ||
| 125 | struct drm_buddy_block *block) | ||
| 126 | { | ||
| 127 | return mm->chunk_size << drm_buddy_block_order(block); | ||
| 128 | } | ||
| 129 | |||
| 130 | int drm_buddy_init(struct drm_buddy *mm, u64 size, u64 chunk_size); | ||
| 131 | |||
| 132 | void drm_buddy_fini(struct drm_buddy *mm); | ||
| 133 | |||
| 134 | struct drm_buddy_block * | ||
| 135 | drm_buddy_alloc_blocks(struct drm_buddy *mm, unsigned int order); | ||
| 136 | |||
| 137 | int drm_buddy_alloc_range(struct drm_buddy *mm, | ||
| 138 | struct list_head *blocks, | ||
| 139 | u64 start, u64 size); | ||
| 140 | |||
| 141 | void drm_buddy_free_block(struct drm_buddy *mm, struct drm_buddy_block *block); | ||
| 142 | |||
| 143 | void drm_buddy_free_list(struct drm_buddy *mm, struct list_head *objects); | ||
| 144 | |||
| 145 | void drm_buddy_print(struct drm_buddy *mm, struct drm_printer *p); | ||
| 146 | void drm_buddy_block_print(struct drm_buddy *mm, | ||
| 147 | struct drm_buddy_block *block, | ||
| 148 | struct drm_printer *p); | ||
| 149 | |||
| 150 | #endif | ||
| @@ -522,9 +522,9 @@ struct drm_display_info { · 521 unmodified lines | |||
| 522 | enum subpixel_order subpixel_order; | 522 | enum subpixel_order subpixel_order; |
| 523 | 523 | ||
| 524 | #define DRM_COLOR_FORMAT_RGB444 (1<<0) | 524 | #define DRM_COLOR_FORMAT_RGB444 (1<<0) |
| 525 | #define DRM_COLOR_FORMAT_YCRCB444 (1<<1) | 525 | #define DRM_COLOR_FORMAT_YCBCR444 (1<<1) |
| 526 | #define DRM_COLOR_FORMAT_YCRCB422 (1<<2) | 526 | #define DRM_COLOR_FORMAT_YCBCR422 (1<<2) |
| 527 | #define DRM_COLOR_FORMAT_YCRCB420 (1<<3) | 527 | #define DRM_COLOR_FORMAT_YCBCR420 (1<<3) |
| 528 | 528 | ||
| 529 | /** | 529 | /** |
| 530 | * @panel_orientation: Read only connector property for built-in panels, | 530 | * @panel_orientation: Read only connector property for built-in panels, |
| @@ -592,10 +592,16 @@ struct drm_display_info { · 61 unmodified lines | |||
| 592 | bool rgb_quant_range_selectable; | 592 | bool rgb_quant_range_selectable; |
| 593 | 593 | ||
| 594 | /** | 594 | /** |
| 595 | * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even | 595 | * @edid_hdmi_dc_rgb444_modes: Mask of supported hdmi deep color modes |
| 596 | * more stuff redundant with @bus_formats. | 596 | * in RGB 4:4:4. Even more stuff redundant with @bus_formats. |
| 597 | */ | 597 | */ |
| 598 | u8 edid_hdmi_dc_modes; | 598 | u8 edid_hdmi_rgb444_dc_modes; |
| 599 | |||
| 600 | /** | ||
| 601 | * @edid_hdmi_dc_ycbcr444_modes: Mask of supported hdmi deep color | ||
| 602 | * modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats. | ||
| 603 | */ | ||
| 604 | u8 edid_hdmi_ycbcr444_dc_modes; | ||
| 599 | 605 | ||
| 600 | /** | 606 | /** |
| 601 | * @cea_rev: CEA revision of the HDMI sink. | 607 | * @cea_rev: CEA revision of the HDMI sink. |
| @@ -285,6 +285,10 @@ struct drm_crtc_state { · 284 unmodified lines | |||
| 285 | * Lookup table for converting pixel data after the color conversion | 285 | * Lookup table for converting pixel data after the color conversion |
| 286 | * matrix @ctm. See drm_crtc_enable_color_mgmt(). The blob (if not | 286 | * matrix @ctm. See drm_crtc_enable_color_mgmt(). The blob (if not |
| 287 | * NULL) is an array of &struct drm_color_lut. | 287 | * NULL) is an array of &struct drm_color_lut. |
| 288 | * | ||
| 289 | * Note that for mostly historical reasons stemming from Xorg heritage, | ||
| 290 | * this is also used to store the color map (also sometimes color lut, | ||
| 291 | * CLUT or color palette) for indexed formats like DRM_FORMAT_C8. | ||
| 288 | */ | 292 | */ |
| 289 | struct drm_property_blob *gamma_lut; | 293 | struct drm_property_blob *gamma_lut; |
| 290 | 294 | ||
| @@ -1075,12 +1079,18 @@ struct drm_crtc { · 784 unmodified lines | |||
| 1075 | /** | 1079 | /** |
| 1076 | * @gamma_size: Size of legacy gamma ramp reported to userspace. Set up | 1080 | * @gamma_size: Size of legacy gamma ramp reported to userspace. Set up |
| 1077 | * by calling drm_mode_crtc_set_gamma_size(). | 1081 | * by calling drm_mode_crtc_set_gamma_size(). |
| 1082 | * | ||
| 1083 | * Note that atomic drivers need to instead use | ||
| 1084 | * &drm_crtc_state.gamma_lut. See drm_crtc_enable_color_mgmt(). | ||
| 1078 | */ | 1085 | */ |
| 1079 | uint32_t gamma_size; | 1086 | uint32_t gamma_size; |
| 1080 | 1087 | ||
| 1081 | /** | 1088 | /** |
| 1082 | * @gamma_store: Gamma ramp values used by the legacy SETGAMMA and | 1089 | * @gamma_store: Gamma ramp values used by the legacy SETGAMMA and |
| 1083 | * GETGAMMA IOCTls. Set up by calling drm_mode_crtc_set_gamma_size(). | 1090 | * GETGAMMA IOCTls. Set up by calling drm_mode_crtc_set_gamma_size(). |
| 1091 | * | ||
| 1092 | * Note that atomic drivers need to instead use | ||
| 1093 | * &drm_crtc_state.gamma_lut. See drm_crtc_enable_color_mgmt(). | ||
| 1084 | */ | 1094 | */ |
| 1085 | uint16_t *gamma_store; | 1095 | uint16_t *gamma_store; |
| 1086 | 1096 | ||
| @@ -8,7 +8,7 @@ · 7 unmodified lines | |||
| 8 | #ifndef DRM_DSC_H_ | 8 | #ifndef DRM_DSC_H_ |
| 9 | #define DRM_DSC_H_ | 9 | #define DRM_DSC_H_ |
| 10 | 10 | ||
| 11 | #include <drm/drm_dp_helper.h> | 11 | #include <drm/dp/drm_dp_helper.h> |
| 12 | 12 | ||
| 13 | /* VESA Display Stream Compression DSC 1.2 constants */ | 13 | /* VESA Display Stream Compression DSC 1.2 constants */ |
| 14 | #define DSC_NUM_BUF_RANGES 15 | 14 | #define DSC_NUM_BUF_RANGES 15 |
| @@ -401,8 +401,8 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, · 400 unmodified lines | |||
| 401 | const struct drm_display_mode *mode); | 401 | const struct drm_display_mode *mode); |
| 402 | 402 | ||
| 403 | void | 403 | void |
| 404 | drm_hdmi_avi_infoframe_colorspace(struct hdmi_avi_infoframe *frame, | 404 | drm_hdmi_avi_infoframe_colorimetry(struct hdmi_avi_infoframe *frame, |
| 405 | const struct drm_connector_state *conn_state); | 405 | const struct drm_connector_state *conn_state); |
| 406 | 406 | ||
| 407 | void | 407 | void |
| 408 | drm_hdmi_avi_infoframe_bars(struct hdmi_avi_infoframe *frame, | 408 | drm_hdmi_avi_infoframe_bars(struct hdmi_avi_infoframe *frame, |
| @@ -194,7 +194,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb, · 193 unmodified lines | |||
| 194 | #ifdef CONFIG_DEBUG_FS | 194 | #ifdef CONFIG_DEBUG_FS |
| 195 | void mipi_dbi_debugfs_init(struct drm_minor *minor); | 195 | void mipi_dbi_debugfs_init(struct drm_minor *minor); |
| 196 | #else | 196 | #else |
| 197 | #define mipi_dbi_debugfs_init NULL | 197 | static inline void mipi_dbi_debugfs_init(struct drm_minor *minor) {} |
| 198 | #endif | 198 | #endif |
| 199 | 199 | ||
| 200 | #endif /* __LINUX_MIPI_DBI_H */ | 200 | #endif /* __LINUX_MIPI_DBI_H */ |
| @@ -34,6 +34,7 @@ struct drm_modeset_lock; · 33 unmodified lines | |||
| 34 | * struct drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx) | 34 | * struct drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx) |
| 35 | * @ww_ctx: base acquire ctx | 35 | * @ww_ctx: base acquire ctx |
| 36 | * @contended: used internally for -EDEADLK handling | 36 | * @contended: used internally for -EDEADLK handling |
| 37 | * @stack_depot: used internally for contention debugging | ||
| 37 | * @locked: list of held locks | 38 | * @locked: list of held locks |
| 38 | * @trylock_only: trylock mode used in atomic contexts/panic notifiers | 39 | * @trylock_only: trylock mode used in atomic contexts/panic notifiers |
| 39 | * @interruptible: whether interruptible locking should be used. | 40 | * @interruptible: whether interruptible locking should be used. |
| @@ -0,0 +1,125 @@ | |||
| 1 | /* SPDX-License-Identifier: MIT */ | ||
| 2 | |||
| 3 | #ifndef DRM_MODULE_H | ||
| 4 | #define DRM_MODULE_H | ||
| 5 | |||
| 6 | #include <linux/pci.h> | ||
| 7 | #include <linux/platform_device.h> | ||
| 8 | |||
| 9 | #include <drm/drm_drv.h> | ||
| 10 | |||
| 11 | /** | ||
| 12 | * DOC: overview | ||
| 13 | * | ||
| 14 | * This library provides helpers registering DRM drivers during module | ||
| 15 | * initialization and shutdown. The provided helpers act like bus-specific | ||
| 16 | * module helpers, such as module_pci_driver(), but respect additional | ||
| 17 | * parameters that control DRM driver registration. | ||
| 18 | * | ||
| 19 | * Below is an example of initializing a DRM driver for a device on the | ||
| 20 | * PCI bus. | ||
| 21 | * | ||
| 22 | * .. code-block:: c | ||
| 23 | * | ||
| 24 | * struct pci_driver my_pci_drv = { | ||
| 25 | * }; | ||
| 26 | * | ||
| 27 | * drm_module_pci_driver(my_pci_drv); | ||
| 28 | * | ||
| 29 | * The generated code will test if DRM drivers are enabled and register | ||
| 30 | * the PCI driver my_pci_drv. For more complex module initialization, you | ||
| 31 | * can still use module_init() and module_exit() in your driver. | ||
| 32 | */ | ||
| 33 | |||
| 34 | /* | ||
| 35 | * PCI drivers | ||
| 36 | */ | ||
| 37 | |||
| 38 | static inline int __init drm_pci_register_driver(struct pci_driver *pci_drv) | ||
| 39 | { | ||
| 40 | if (drm_firmware_drivers_only()) | ||
| 41 | return -ENODEV; | ||
| 42 | |||
| 43 | return pci_register_driver(pci_drv); | ||
| 44 | } | ||
| 45 | |||
| 46 | /** | ||
| 47 | * drm_module_pci_driver - Register a DRM driver for PCI-based devices | ||
| 48 | * @__pci_drv: the PCI driver structure | ||
| 49 | * | ||
| 50 | * Registers a DRM driver for devices on the PCI bus. The helper | ||
| 51 | * macro behaves like module_pci_driver() but tests the state of | ||
| 52 | * drm_firmware_drivers_only(). For more complex module initialization, | ||
| 53 | * use module_init() and module_exit() directly. | ||
| 54 | * | ||
| 55 | * Each module may only use this macro once. Calling it replaces | ||
| 56 | * module_init() and module_exit(). | ||
| 57 | */ | ||
| 58 | #define drm_module_pci_driver(__pci_drv) \ | ||
| 59 | module_driver(__pci_drv, drm_pci_register_driver, pci_unregister_driver) | ||
| 60 | |||
| 61 | static inline int __init | ||
| 62 | drm_pci_register_driver_if_modeset(struct pci_driver *pci_drv, int modeset) | ||
| 63 | { | ||
| 64 | if (drm_firmware_drivers_only() && modeset == -1) | ||
| 65 | return -ENODEV; | ||
| 66 | if (modeset == 0) | ||
| 67 | return -ENODEV; | ||
| 68 | |||
| 69 | return pci_register_driver(pci_drv); | ||
| 70 | } | ||
| 71 | |||
| 72 | static inline void __exit | ||
| 73 | drm_pci_unregister_driver_if_modeset(struct pci_driver *pci_drv, int modeset) | ||
| 74 | { | ||
| 75 | pci_unregister_driver(pci_drv); | ||
| 76 | } | ||
| 77 | |||
| 78 | /** | ||
| 79 | * drm_module_pci_driver_if_modeset - Register a DRM driver for PCI-based devices | ||
| 80 | * @__pci_drv: the PCI driver structure | ||
| 81 | * @__modeset: an additional parameter that disables the driver | ||
| 82 | * | ||
| 83 | * This macro is deprecated and only provided for existing drivers. For | ||
| 84 | * new drivers, use drm_module_pci_driver(). | ||
| 85 | * | ||
| 86 | * Registers a DRM driver for devices on the PCI bus. The helper macro | ||
| 87 | * behaves like drm_module_pci_driver() with an additional driver-specific | ||
| 88 | * flag. If __modeset is 0, the driver has been disabled, if __modeset is | ||
| 89 | * -1 the driver state depends on the global DRM state. For all other | ||
| 90 | * values, the PCI driver has been enabled. The default should be -1. | ||
| 91 | */ | ||
| 92 | #define drm_module_pci_driver_if_modeset(__pci_drv, __modeset) \ | ||
| 93 | module_driver(__pci_drv, drm_pci_register_driver_if_modeset, \ | ||
| 94 | drm_pci_unregister_driver_if_modeset, __modeset) | ||
| 95 | |||
| 96 | /* | ||
| 97 | * Platform drivers | ||
| 98 | */ | ||
| 99 | |||
| 100 | static inline int __init | ||
| 101 | drm_platform_driver_register(struct platform_driver *platform_drv) | ||
| 102 | { | ||
| 103 | if (drm_firmware_drivers_only()) | ||
| 104 | return -ENODEV; | ||
| 105 | |||
| 106 | return platform_driver_register(platform_drv); | ||
| 107 | } | ||
| 108 | |||
| 109 | /** | ||
| 110 | * drm_module_platform_driver - Register a DRM driver for platform devices | ||
| 111 | * @__platform_drv: the platform driver structure | ||
| 112 | * | ||
| 113 | * Registers a DRM driver for devices on the platform bus. The helper | ||
| 114 | * macro behaves like module_platform_driver() but tests the state of | ||
| 115 | * drm_firmware_drivers_only(). For more complex module initialization, | ||
| 116 | * use module_init() and module_exit() directly. | ||
| 117 | * | ||
| 118 | * Each module may only use this macro once. Calling it replaces | ||
| 119 | * module_init() and module_exit(). | ||
| 120 | */ | ||
| 121 | #define drm_module_platform_driver(__platform_drv) \ | ||
| 122 | module_driver(__platform_drv, drm_platform_driver_register, \ | ||
| 123 | platform_driver_unregister) | ||
| 124 | |||
| 125 | #endif | ||
| @@ -516,7 +516,7 @@ struct drm_plane_funcs { · 515 unmodified lines | |||
| 516 | * This optional hook is used for the DRM to determine if the given | 516 | * This optional hook is used for the DRM to determine if the given |
| 517 | * format/modifier combination is valid for the plane. This allows the | 517 | * format/modifier combination is valid for the plane. This allows the |
| 518 | * DRM to generate the correct format bitmask (which formats apply to | 518 | * DRM to generate the correct format bitmask (which formats apply to |
| 519 | * which modifier), and to valdiate modifiers at atomic_check time. | 519 | * which modifier), and to validate modifiers at atomic_check time. |
| 520 | * | 520 | * |
| 521 | * If not present, then any modifier in the plane's modifier | 521 | * If not present, then any modifier in the plane's modifier |
| 522 | * list is allowed with any of the plane's formats. | 522 | * list is allowed with any of the plane's formats. |
| @@ -73,10 +73,21 @@ struct drm_privacy_screen { · 72 unmodified lines | |||
| 73 | * for more info. | 73 | * for more info. |
| 74 | */ | 74 | */ |
| 75 | enum drm_privacy_screen_status hw_state; | 75 | enum drm_privacy_screen_status hw_state; |
| 76 | /** | ||
| 77 | * @drvdata: Private data owned by the privacy screen provider | ||
| 78 | */ | ||
| 79 | void *drvdata; | ||
| 76 | }; | 80 | }; |
| 77 | 81 | ||
| 82 | static inline | ||
| 83 | void *drm_privacy_screen_get_drvdata(struct drm_privacy_screen *priv) | ||
| 84 | { | ||
| 85 | return priv->drvdata; | ||
| 86 | } | ||
| 87 | |||
| 78 | struct drm_privacy_screen *drm_privacy_screen_register( | 88 | struct drm_privacy_screen *drm_privacy_screen_register( |
| 79 | struct device *parent, const struct drm_privacy_screen_ops *ops); | 89 | struct device *parent, const struct drm_privacy_screen_ops *ops, |
| 90 | void *data); | ||
| 80 | void drm_privacy_screen_unregister(struct drm_privacy_screen *priv); | 91 | void drm_privacy_screen_unregister(struct drm_privacy_screen *priv); |
| 81 | 92 | ||
| 82 | void drm_privacy_screen_call_notifier_chain(struct drm_privacy_screen *priv); | 93 | void drm_privacy_screen_call_notifier_chain(struct drm_privacy_screen *priv); |
| @@ -105,11 +105,11 @@ struct ttm_resource_manager_func { · 104 unmodified lines | |||
| 105 | * @use_type: The memory type is enabled. | 105 | * @use_type: The memory type is enabled. |
| 106 | * @use_tt: If a TT object should be used for the backing store. | 106 | * @use_tt: If a TT object should be used for the backing store. |
| 107 | * @size: Size of the managed region. | 107 | * @size: Size of the managed region. |
| 108 | * @bdev: ttm device this manager belongs to | ||
| 108 | * @func: structure pointer implementing the range manager. See above | 109 | * @func: structure pointer implementing the range manager. See above |
| 109 | * @move_lock: lock for move fence | 110 | * @move_lock: lock for move fence |
| 110 | * static information. bdev::driver::io_mem_free is never used. | ||
| 111 | * @lru: The lru list for this memory type. | ||
| 112 | * @move: The fence of the last pipelined move operation. | 111 | * @move: The fence of the last pipelined move operation. |
| 112 | * @lru: The lru list for this memory type. | ||
| 113 | * | 113 | * |
| 114 | * This structure is used to identify and manage memory types for a device. | 114 | * This structure is used to identify and manage memory types for a device. |
| 115 | */ | 115 | */ |
| @@ -119,20 +119,21 @@ struct ttm_resource_manager { · 3 unmodified lines | |||
| 119 | */ | 119 | */ |
| 120 | bool use_type; | 120 | bool use_type; |
| 121 | bool use_tt; | 121 | bool use_tt; |
| 122 | struct ttm_device *bdev; | ||
| 122 | uint64_t size; | 123 | uint64_t size; |
| 123 | const struct ttm_resource_manager_func *func; | 124 | const struct ttm_resource_manager_func *func; |
| 124 | spinlock_t move_lock; | 125 | spinlock_t move_lock; |
| 125 | 126 | ||
| 126 | /* | 127 | /* |
| 127 | * Protected by the global->lru_lock. | 128 | * Protected by @move_lock. |
| 128 | */ | 129 | */ |
| 129 | 130 | struct dma_fence *move; | |
| 130 | struct list_head lru[TTM_MAX_BO_PRIORITY]; | ||
| 131 | 131 | ||
| 132 | /* | 132 | /* |
| 133 | * Protected by @move_lock. | 133 | * Protected by the global->lru_lock. |
| 134 | */ | 134 | */ |
| 135 | struct dma_fence *move; | 135 | |
| 136 | struct list_head lru[TTM_MAX_BO_PRIORITY]; | ||
| 136 | }; | 137 | }; |
| 137 | 138 | ||
| 138 | /** | 139 | /** |
| @@ -160,6 +161,7 @@ struct ttm_bus_placement { · 21 unmodified lines | |||
| 160 | * @mem_type: Resource type of the allocation. | 161 | * @mem_type: Resource type of the allocation. |
| 161 | * @placement: Placement flags. | 162 | * @placement: Placement flags. |
| 162 | * @bus: Placement on io bus accessible to the CPU | 163 | * @bus: Placement on io bus accessible to the CPU |
| 164 | * @bo: weak reference to the BO, protected by ttm_device::lru_lock | ||
| 163 | * | 165 | * |
| 164 | * Structure indicating the placement and space resources used by a | 166 | * Structure indicating the placement and space resources used by a |
| 165 | * buffer object. | 167 | * buffer object. |
| @@ -170,6 +172,7 @@ struct ttm_resource { · 4 unmodified lines | |||
| 170 | uint32_t mem_type; | 172 | uint32_t mem_type; |
| 171 | uint32_t placement; | 173 | uint32_t placement; |
| 172 | struct ttm_bus_placement bus; | 174 | struct ttm_bus_placement bus; |
| 175 | struct ttm_buffer_object *bo; | ||
| 173 | }; | 176 | }; |
| 174 | 177 | ||
| 175 | /** | 178 | /** |
| @@ -261,14 +264,20 @@ ttm_resource_manager_cleanup(struct ttm_resource_manager *man) · 85 unmodified lines | |||
| 261 | void ttm_resource_init(struct ttm_buffer_object *bo, | 264 | void ttm_resource_init(struct ttm_buffer_object *bo, |
| 262 | const struct ttm_place *place, | 265 | const struct ttm_place *place, |
| 263 | struct ttm_resource *res); | 266 | struct ttm_resource *res); |
| 267 | void ttm_resource_fini(struct ttm_resource_manager *man, | ||
| 268 | struct ttm_resource *res); | ||
| 269 | |||
| 264 | int ttm_resource_alloc(struct ttm_buffer_object *bo, | 270 | int ttm_resource_alloc(struct ttm_buffer_object *bo, |
| 265 | const struct ttm_place *place, | 271 | const struct ttm_place *place, |
| 266 | struct ttm_resource **res); | 272 | struct ttm_resource **res); |
| 267 | void ttm_resource_free(struct ttm_buffer_object *bo, struct ttm_resource **res); | 273 | void ttm_resource_free(struct ttm_buffer_object *bo, struct ttm_resource **res); |
| 268 | bool ttm_resource_compat(struct ttm_resource *res, | 274 | bool ttm_resource_compat(struct ttm_resource *res, |
| 269 | struct ttm_placement *placement); | 275 | struct ttm_placement *placement); |
| 276 | void ttm_resource_set_bo(struct ttm_resource *res, | ||
| 277 | struct ttm_buffer_object *bo); | ||
| 270 | 278 | ||
| 271 | void ttm_resource_manager_init(struct ttm_resource_manager *man, | 279 | void ttm_resource_manager_init(struct ttm_resource_manager *man, |
| 280 | struct ttm_device *bdev, | ||
| 272 | unsigned long p_size); | 281 | unsigned long p_size); |
| 273 | 282 | ||
| 274 | int ttm_resource_manager_evict_all(struct ttm_device *bdev, | 283 | int ttm_resource_manager_evict_all(struct ttm_device *bdev, |
| @@ -52,13 +52,13 @@ · 51 unmodified lines | |||
| 52 | * | 52 | * |
| 53 | * struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(0xdeadbeaf); | 53 | * struct dma_buf_map map = DMA_BUF_MAP_INIT_VADDR(0xdeadbeaf); |
| 54 | * | 54 | * |
| 55 | * dma_buf_map_set_vaddr(&map. 0xdeadbeaf); | 55 | * dma_buf_map_set_vaddr(&map, 0xdeadbeaf); |
| 56 | * | 56 | * |
| 57 | * To set an address in I/O memory, use dma_buf_map_set_vaddr_iomem(). | 57 | * To set an address in I/O memory, use dma_buf_map_set_vaddr_iomem(). |
| 58 | * | 58 | * |
| 59 | * .. code-block:: c | 59 | * .. code-block:: c |
| 60 | * | 60 | * |
| 61 | * dma_buf_map_set_vaddr_iomem(&map. 0xdeadbeaf); | 61 | * dma_buf_map_set_vaddr_iomem(&map, 0xdeadbeaf); |
| 62 | * | 62 | * |
| 63 | * Instances of struct dma_buf_map do not have to be cleaned up, but | 63 | * Instances of struct dma_buf_map do not have to be cleaned up, but |
| 64 | * can be cleared to NULL with dma_buf_map_clear(). Cleared mappings | 64 | * can be cleared to NULL with dma_buf_map_clear(). Cleared mappings |
| @@ -458,8 +458,8 @@ void dma_resv_fini(struct dma_resv *obj); · 457 unmodified lines | |||
| 458 | int dma_resv_reserve_shared(struct dma_resv *obj, unsigned int num_fences); | 458 | int dma_resv_reserve_shared(struct dma_resv *obj, unsigned int num_fences); |
| 459 | void dma_resv_add_shared_fence(struct dma_resv *obj, struct dma_fence *fence); | 459 | void dma_resv_add_shared_fence(struct dma_resv *obj, struct dma_fence *fence); |
| 460 | void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence); | 460 | void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence); |
| 461 | int dma_resv_get_fences(struct dma_resv *obj, struct dma_fence **pfence_excl, | 461 | int dma_resv_get_fences(struct dma_resv *obj, bool write, |
| 462 | unsigned *pshared_count, struct dma_fence ***pshared); | 462 | unsigned int *num_fences, struct dma_fence ***fences); |
| 463 | int dma_resv_copy_fences(struct dma_resv *dst, struct dma_resv *src); | 463 | int dma_resv_copy_fences(struct dma_resv *dst, struct dma_resv *src); |
| 464 | long dma_resv_wait_timeout(struct dma_resv *obj, bool wait_all, bool intr, | 464 | long dma_resv_wait_timeout(struct dma_resv *obj, bool wait_all, bool intr, |
| 465 | unsigned long timeout); | 465 | unsigned long timeout); |
| @@ -502,6 +502,7 @@ struct fb_info { · 501 unmodified lines | |||
| 502 | } *apertures; | 502 | } *apertures; |
| 503 | 503 | ||
| 504 | bool skip_vt_switch; /* no VT switch on suspend/resume required */ | 504 | bool skip_vt_switch; /* no VT switch on suspend/resume required */ |
| 505 | bool forced_out; /* set when being removed by another driver */ | ||
| 505 | }; | 506 | }; |
| 506 | 507 | ||
| 507 | static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { | 508 | static inline struct apertures_struct *alloc_apertures(unsigned int max_num) { |
| @@ -230,7 +230,7 @@ extern void _down_write_nest_lock(struct rw_semaphore *sem, struct lockdep_map * · 229 unmodified lines | |||
| 230 | do { \ | 230 | do { \ |
| 231 | typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \ | 231 | typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \ |
| 232 | _down_write_nest_lock(sem, &(nest_lock)->dep_map); \ | 232 | _down_write_nest_lock(sem, &(nest_lock)->dep_map); \ |
| 233 | } while (0); | 233 | } while (0) |
| 234 | 234 | ||
| 235 | /* | 235 | /* |
| 236 | * Take/release a lock when not the owner will release it. | 236 | * Take/release a lock when not the owner will release it. |
| @@ -91,6 +91,7 @@ enum rpi_firmware_property_tag { · 90 unmodified lines | |||
| 91 | RPI_FIRMWARE_GET_POE_HAT_VAL = 0x00030049, | 91 | RPI_FIRMWARE_GET_POE_HAT_VAL = 0x00030049, |
| 92 | RPI_FIRMWARE_SET_POE_HAT_VAL = 0x00030050, | 92 | RPI_FIRMWARE_SET_POE_HAT_VAL = 0x00030050, |
| 93 | RPI_FIRMWARE_NOTIFY_XHCI_RESET = 0x00030058, | 93 | RPI_FIRMWARE_NOTIFY_XHCI_RESET = 0x00030058, |
| 94 | RPI_FIRMWARE_NOTIFY_DISPLAY_DONE = 0x00030066, | ||
| 94 | 95 | ||
| 95 | /* Dispmanx TAGS */ | 96 | /* Dispmanx TAGS */ |
| 96 | RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, | 97 | RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, |
| @@ -84,14 +84,14 @@ struct drm_panfrost_wait_bo { · 83 unmodified lines | |||
| 84 | __s64 timeout_ns; /* absolute */ | 84 | __s64 timeout_ns; /* absolute */ |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
| 87 | /* Valid flags to pass to drm_panfrost_create_bo */ | ||
| 87 | #define PANFROST_BO_NOEXEC 1 | 88 | #define PANFROST_BO_NOEXEC 1 |
| 88 | #define PANFROST_BO_HEAP 2 | 89 | #define PANFROST_BO_HEAP 2 |
| 89 | 90 | ||
| 90 | /** | 91 | /** |
| 91 | * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs. | 92 | * struct drm_panfrost_create_bo - ioctl argument for creating Panfrost BOs. |
| 92 | * | 93 | * |
| 93 | * There are currently no values for the flags argument, but it may be | 94 | * The flags argument is a bit mask of PANFROST_BO_* flags. |
| 94 | * used in a future extension. | ||
| 95 | */ | 95 | */ |
| 96 | struct drm_panfrost_create_bo { | 96 | struct drm_panfrost_create_bo { |
| 97 | __u32 size; | 97 | __u32 size; |