diff options
Diffstat (limited to 'include/drm')
| -rw-r--r-- | include/drm/drmP.h | 9 | ||||
| -rw-r--r-- | include/drm/drm_atomic.h | 95 | ||||
| -rw-r--r-- | include/drm/drm_blend.h | 1 | ||||
| -rw-r--r-- | include/drm/drm_color_mgmt.h | 2 | ||||
| -rw-r--r-- | include/drm/drm_connector.h | 21 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 34 | ||||
| -rw-r--r-- | include/drm/drm_dp_helper.h | 166 | ||||
| -rw-r--r-- | include/drm/drm_dp_mst_helper.h | 26 | ||||
| -rw-r--r-- | include/drm/drm_drv.h | 75 | ||||
| -rw-r--r-- | include/drm/drm_fb_cma_helper.h | 4 | ||||
| -rw-r--r-- | include/drm/drm_gem_cma_helper.h | 17 | ||||
| -rw-r--r-- | include/drm/drm_irq.h | 21 | ||||
| -rw-r--r-- | include/drm/drm_prime.h | 7 |
13 files changed, 403 insertions, 75 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index e1daa4f343cd..52085832f711 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
| @@ -320,15 +320,6 @@ struct pci_controller; | |||
| 320 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) | 320 | #define DRM_IF_VERSION(maj, min) (maj << 16 | min) |
| 321 | 321 | ||
| 322 | 322 | ||
| 323 | /* Flags and return codes for get_vblank_timestamp() driver function. */ | ||
| 324 | #define DRM_CALLED_FROM_VBLIRQ 1 | ||
| 325 | #define DRM_VBLANKTIME_SCANOUTPOS_METHOD (1 << 0) | ||
| 326 | |||
| 327 | /* get_scanout_position() return flags */ | ||
| 328 | #define DRM_SCANOUTPOS_VALID (1 << 0) | ||
| 329 | #define DRM_SCANOUTPOS_IN_VBLANK (1 << 1) | ||
| 330 | #define DRM_SCANOUTPOS_ACCURATE (1 << 2) | ||
| 331 | |||
| 332 | /** | 323 | /** |
| 333 | * DRM device structure. This structure represent a complete card that | 324 | * DRM device structure. This structure represent a complete card that |
| 334 | * may contain multiple heads. | 325 | * may contain multiple heads. |
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 788daf756f48..8645dcdef031 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h | |||
| @@ -155,6 +155,53 @@ struct __drm_connnectors_state { | |||
| 155 | }; | 155 | }; |
| 156 | 156 | ||
| 157 | /** | 157 | /** |
| 158 | * struct drm_private_state_funcs - atomic state functions for private objects | ||
| 159 | * | ||
| 160 | * These hooks are used by atomic helpers to create, swap and destroy states of | ||
| 161 | * private objects. The structure itself is used as a vtable to identify the | ||
| 162 | * associated private object type. Each private object type that needs to be | ||
| 163 | * added to the atomic states is expected to have an implementation of these | ||
| 164 | * hooks and pass a pointer to it's drm_private_state_funcs struct to | ||
| 165 | * drm_atomic_get_private_obj_state(). | ||
| 166 | */ | ||
| 167 | struct drm_private_state_funcs { | ||
| 168 | /** | ||
| 169 | * @duplicate_state: | ||
| 170 | * | ||
| 171 | * Duplicate the current state of the private object and return it. It | ||
| 172 | * is an error to call this before obj->state has been initialized. | ||
| 173 | * | ||
| 174 | * RETURNS: | ||
| 175 | * | ||
| 176 | * Duplicated atomic state or NULL when obj->state is not | ||
| 177 | * initialized or allocation failed. | ||
| 178 | */ | ||
| 179 | void *(*duplicate_state)(struct drm_atomic_state *state, void *obj); | ||
| 180 | |||
| 181 | /** | ||
| 182 | * @swap_state: | ||
| 183 | * | ||
| 184 | * This function swaps the existing state of a private object @obj with | ||
| 185 | * it's newly created state, the pointer to which is passed as | ||
| 186 | * @obj_state_ptr. | ||
| 187 | */ | ||
| 188 | void (*swap_state)(void *obj, void **obj_state_ptr); | ||
| 189 | |||
| 190 | /** | ||
| 191 | * @destroy_state: | ||
| 192 | * | ||
| 193 | * Frees the private object state created with @duplicate_state. | ||
| 194 | */ | ||
| 195 | void (*destroy_state)(void *obj_state); | ||
| 196 | }; | ||
| 197 | |||
| 198 | struct __drm_private_objs_state { | ||
| 199 | void *obj; | ||
| 200 | void *obj_state; | ||
| 201 | const struct drm_private_state_funcs *funcs; | ||
| 202 | }; | ||
| 203 | |||
| 204 | /** | ||
| 158 | * struct drm_atomic_state - the global state object for atomic updates | 205 | * struct drm_atomic_state - the global state object for atomic updates |
| 159 | * @ref: count of all references to this state (will not be freed until zero) | 206 | * @ref: count of all references to this state (will not be freed until zero) |
| 160 | * @dev: parent DRM device | 207 | * @dev: parent DRM device |
| @@ -164,6 +211,8 @@ struct __drm_connnectors_state { | |||
| 164 | * @crtcs: pointer to array of CRTC pointers | 211 | * @crtcs: pointer to array of CRTC pointers |
| 165 | * @num_connector: size of the @connectors and @connector_states arrays | 212 | * @num_connector: size of the @connectors and @connector_states arrays |
| 166 | * @connectors: pointer to array of structures with per-connector data | 213 | * @connectors: pointer to array of structures with per-connector data |
| 214 | * @num_private_objs: size of the @private_objs array | ||
| 215 | * @private_objs: pointer to array of private object pointers | ||
| 167 | * @acquire_ctx: acquire context for this atomic modeset state update | 216 | * @acquire_ctx: acquire context for this atomic modeset state update |
| 168 | */ | 217 | */ |
| 169 | struct drm_atomic_state { | 218 | struct drm_atomic_state { |
| @@ -176,6 +225,8 @@ struct drm_atomic_state { | |||
| 176 | struct __drm_crtcs_state *crtcs; | 225 | struct __drm_crtcs_state *crtcs; |
| 177 | int num_connector; | 226 | int num_connector; |
| 178 | struct __drm_connnectors_state *connectors; | 227 | struct __drm_connnectors_state *connectors; |
| 228 | int num_private_objs; | ||
| 229 | struct __drm_private_objs_state *private_objs; | ||
| 179 | 230 | ||
| 180 | struct drm_modeset_acquire_ctx *acquire_ctx; | 231 | struct drm_modeset_acquire_ctx *acquire_ctx; |
| 181 | 232 | ||
| @@ -268,6 +319,11 @@ int drm_atomic_connector_set_property(struct drm_connector *connector, | |||
| 268 | struct drm_connector_state *state, struct drm_property *property, | 319 | struct drm_connector_state *state, struct drm_property *property, |
| 269 | uint64_t val); | 320 | uint64_t val); |
| 270 | 321 | ||
| 322 | void * __must_check | ||
| 323 | drm_atomic_get_private_obj_state(struct drm_atomic_state *state, | ||
| 324 | void *obj, | ||
| 325 | const struct drm_private_state_funcs *funcs); | ||
| 326 | |||
| 271 | /** | 327 | /** |
| 272 | * drm_atomic_get_existing_crtc_state - get crtc state, if it exists | 328 | * drm_atomic_get_existing_crtc_state - get crtc state, if it exists |
| 273 | * @state: global atomic state object | 329 | * @state: global atomic state object |
| @@ -753,6 +809,45 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); | |||
| 753 | for_each_if (plane) | 809 | for_each_if (plane) |
| 754 | 810 | ||
| 755 | /** | 811 | /** |
| 812 | * __for_each_private_obj - iterate over all private objects | ||
| 813 | * @__state: &struct drm_atomic_state pointer | ||
| 814 | * @obj: private object iteration cursor | ||
| 815 | * @obj_state: private object state iteration cursor | ||
| 816 | * @__i: int iteration cursor, for macro-internal use | ||
| 817 | * @__funcs: &struct drm_private_state_funcs iteration cursor | ||
| 818 | * | ||
| 819 | * This macro iterates over the array containing private object data in atomic | ||
| 820 | * state | ||
| 821 | */ | ||
| 822 | #define __for_each_private_obj(__state, obj, obj_state, __i, __funcs) \ | ||
| 823 | for ((__i) = 0; \ | ||
| 824 | (__i) < (__state)->num_private_objs && \ | ||
| 825 | ((obj) = (__state)->private_objs[__i].obj, \ | ||
| 826 | (__funcs) = (__state)->private_objs[__i].funcs, \ | ||
| 827 | (obj_state) = (__state)->private_objs[__i].obj_state, \ | ||
| 828 | 1); \ | ||
| 829 | (__i)++) \ | ||
| 830 | |||
| 831 | /** | ||
| 832 | * for_each_private_obj - iterate over a specify type of private object | ||
| 833 | * @__state: &struct drm_atomic_state pointer | ||
| 834 | * @obj_funcs: &struct drm_private_state_funcs function table to filter | ||
| 835 | * private objects | ||
| 836 | * @obj: private object iteration cursor | ||
| 837 | * @obj_state: private object state iteration cursor | ||
| 838 | * @__i: int iteration cursor, for macro-internal use | ||
| 839 | * @__funcs: &struct drm_private_state_funcs iteration cursor | ||
| 840 | * | ||
| 841 | * This macro iterates over the private objects state array while filtering the | ||
| 842 | * objects based on the vfunc table that is passed as @obj_funcs. New macros | ||
| 843 | * can be created by passing in the vfunc table associated with a specific | ||
| 844 | * private object. | ||
| 845 | */ | ||
| 846 | #define for_each_private_obj(__state, obj_funcs, obj, obj_state, __i, __funcs) \ | ||
| 847 | __for_each_private_obj(__state, obj, obj_state, __i, __funcs) \ | ||
| 848 | for_each_if (__funcs == obj_funcs) | ||
| 849 | |||
| 850 | /** | ||
| 756 | * drm_atomic_crtc_needs_modeset - compute combined modeset need | 851 | * drm_atomic_crtc_needs_modeset - compute combined modeset need |
| 757 | * @state: &drm_crtc_state for the CRTC | 852 | * @state: &drm_crtc_state for the CRTC |
| 758 | * | 853 | * |
diff --git a/include/drm/drm_blend.h b/include/drm/drm_blend.h index 13221cf9b3eb..bc9e596be4c2 100644 --- a/include/drm/drm_blend.h +++ b/include/drm/drm_blend.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | 28 | ||
| 29 | struct drm_device; | 29 | struct drm_device; |
| 30 | struct drm_atomic_state; | 30 | struct drm_atomic_state; |
| 31 | struct drm_plane; | ||
| 31 | 32 | ||
| 32 | /* | 33 | /* |
| 33 | * Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the | 34 | * Rotation property bits. DRM_ROTATE_<degrees> rotates the image by the |
diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index bce4a532836d..03a59cbce621 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
| 27 | 27 | ||
| 28 | struct drm_crtc; | ||
| 29 | |||
| 28 | uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t bit_precision); | 30 | uint32_t drm_color_lut_extract(uint32_t user_input, uint32_t bit_precision); |
| 29 | 31 | ||
| 30 | void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, | 32 | void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, |
diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 4eeda120e46d..9c15993b9071 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
| 27 | #include <linux/ctype.h> | 27 | #include <linux/ctype.h> |
| 28 | #include <linux/hdmi.h> | ||
| 28 | #include <drm/drm_mode_object.h> | 29 | #include <drm/drm_mode_object.h> |
| 29 | 30 | ||
| 30 | #include <uapi/drm/drm_mode.h> | 31 | #include <uapi/drm/drm_mode.h> |
| @@ -326,6 +327,21 @@ struct drm_connector_state { | |||
| 326 | struct drm_atomic_state *state; | 327 | struct drm_atomic_state *state; |
| 327 | 328 | ||
| 328 | struct drm_tv_connector_state tv; | 329 | struct drm_tv_connector_state tv; |
| 330 | |||
| 331 | /** | ||
| 332 | * @picture_aspect_ratio: Connector property to control the | ||
| 333 | * HDMI infoframe aspect ratio setting. | ||
| 334 | * | ||
| 335 | * The %DRM_MODE_PICTURE_ASPECT_\* values much match the | ||
| 336 | * values for &enum hdmi_picture_aspect | ||
| 337 | */ | ||
| 338 | enum hdmi_picture_aspect picture_aspect_ratio; | ||
| 339 | |||
| 340 | /** | ||
| 341 | * @scaling_mode: Connector property to control the | ||
| 342 | * upscaling, mostly used for built-in panels. | ||
| 343 | */ | ||
| 344 | unsigned int scaling_mode; | ||
| 329 | }; | 345 | }; |
| 330 | 346 | ||
| 331 | /** | 347 | /** |
| @@ -675,6 +691,7 @@ struct drm_cmdline_mode { | |||
| 675 | * @tile_v_loc: vertical location of this tile | 691 | * @tile_v_loc: vertical location of this tile |
| 676 | * @tile_h_size: horizontal size of this tile. | 692 | * @tile_h_size: horizontal size of this tile. |
| 677 | * @tile_v_size: vertical size of this tile. | 693 | * @tile_v_size: vertical size of this tile. |
| 694 | * @scaling_mode_property: Optional atomic property to control the upscaling. | ||
| 678 | * | 695 | * |
| 679 | * Each connector may be connected to one or more CRTCs, or may be clonable by | 696 | * Each connector may be connected to one or more CRTCs, or may be clonable by |
| 680 | * another connector if they can share a CRTC. Each connector also has a specific | 697 | * another connector if they can share a CRTC. Each connector also has a specific |
| @@ -754,6 +771,8 @@ struct drm_connector { | |||
| 754 | struct drm_property_blob *edid_blob_ptr; | 771 | struct drm_property_blob *edid_blob_ptr; |
| 755 | struct drm_object_properties properties; | 772 | struct drm_object_properties properties; |
| 756 | 773 | ||
| 774 | struct drm_property *scaling_mode_property; | ||
| 775 | |||
| 757 | /** | 776 | /** |
| 758 | * @path_blob_ptr: | 777 | * @path_blob_ptr: |
| 759 | * | 778 | * |
| @@ -953,6 +972,8 @@ int drm_mode_create_tv_properties(struct drm_device *dev, | |||
| 953 | unsigned int num_modes, | 972 | unsigned int num_modes, |
| 954 | const char * const modes[]); | 973 | const char * const modes[]); |
| 955 | int drm_mode_create_scaling_mode_property(struct drm_device *dev); | 974 | int drm_mode_create_scaling_mode_property(struct drm_device *dev); |
| 975 | int drm_connector_attach_scaling_mode_property(struct drm_connector *connector, | ||
| 976 | u32 scaling_mode_mask); | ||
| 956 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); | 977 | int drm_mode_create_aspect_ratio_property(struct drm_device *dev); |
| 957 | int drm_mode_create_suggested_offset_properties(struct drm_device *dev); | 978 | int drm_mode_create_suggested_offset_properties(struct drm_device *dev); |
| 958 | 979 | ||
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index a8176a836e25..adf4e91a9399 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -93,11 +93,6 @@ struct drm_plane_helper_funcs; | |||
| 93 | * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings | 93 | * @adjusted_mode: for use by helpers and drivers to compute adjusted mode timings |
| 94 | * @mode: current mode timings | 94 | * @mode: current mode timings |
| 95 | * @mode_blob: &drm_property_blob for @mode | 95 | * @mode_blob: &drm_property_blob for @mode |
| 96 | * @degamma_lut: Lookup table for converting framebuffer pixel data | ||
| 97 | * before apply the conversion matrix | ||
| 98 | * @ctm: Transformation matrix | ||
| 99 | * @gamma_lut: Lookup table for converting pixel data after the | ||
| 100 | * conversion matrix | ||
| 101 | * @state: backpointer to global drm_atomic_state | 96 | * @state: backpointer to global drm_atomic_state |
| 102 | * | 97 | * |
| 103 | * Note that the distinction between @enable and @active is rather subtile: | 98 | * Note that the distinction between @enable and @active is rather subtile: |
| @@ -144,9 +139,30 @@ struct drm_crtc_state { | |||
| 144 | /* blob property to expose current mode to atomic userspace */ | 139 | /* blob property to expose current mode to atomic userspace */ |
| 145 | struct drm_property_blob *mode_blob; | 140 | struct drm_property_blob *mode_blob; |
| 146 | 141 | ||
| 147 | /* blob property to expose color management to userspace */ | 142 | /** |
| 143 | * @degamma_lut: | ||
| 144 | * | ||
| 145 | * Lookup table for converting framebuffer pixel data before apply the | ||
| 146 | * color conversion matrix @ctm. See drm_crtc_enable_color_mgmt(). The | ||
| 147 | * blob (if not NULL) is an array of &struct drm_color_lut. | ||
| 148 | */ | ||
| 148 | struct drm_property_blob *degamma_lut; | 149 | struct drm_property_blob *degamma_lut; |
| 150 | |||
| 151 | /** | ||
| 152 | * @ctm: | ||
| 153 | * | ||
| 154 | * Color transformation matrix. See drm_crtc_enable_color_mgmt(). The | ||
| 155 | * blob (if not NULL) is a &struct drm_color_ctm. | ||
| 156 | */ | ||
| 149 | struct drm_property_blob *ctm; | 157 | struct drm_property_blob *ctm; |
| 158 | |||
| 159 | /** | ||
| 160 | * @gamma_lut: | ||
| 161 | * | ||
| 162 | * Lookup table for converting pixel data after the color conversion | ||
| 163 | * matrix @ctm. See drm_crtc_enable_color_mgmt(). The blob (if not | ||
| 164 | * NULL) is an array of &struct drm_color_lut. | ||
| 165 | */ | ||
| 150 | struct drm_property_blob *gamma_lut; | 166 | struct drm_property_blob *gamma_lut; |
| 151 | 167 | ||
| 152 | /** | 168 | /** |
| @@ -313,6 +329,12 @@ struct drm_crtc_funcs { | |||
| 313 | * | 329 | * |
| 314 | * This callback is optional. | 330 | * This callback is optional. |
| 315 | * | 331 | * |
| 332 | * Atomic drivers who want to support gamma tables should implement the | ||
| 333 | * atomic color management support, enabled by calling | ||
| 334 | * drm_crtc_enable_color_mgmt(), which then supports the legacy gamma | ||
| 335 | * interface through the drm_atomic_helper_legacy_gamma_set() | ||
| 336 | * compatibility implementation. | ||
| 337 | * | ||
| 316 | * NOTE: | 338 | * NOTE: |
| 317 | * | 339 | * |
| 318 | * Drivers that support gamma tables and also fbdev emulation through | 340 | * Drivers that support gamma tables and also fbdev emulation through |
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h index c0bd0d7651a9..f7007e544f29 100644 --- a/include/drm/drm_dp_helper.h +++ b/include/drm/drm_dp_helper.h | |||
| @@ -179,6 +179,111 @@ | |||
| 179 | 179 | ||
| 180 | #define DP_GUID 0x030 /* 1.2 */ | 180 | #define DP_GUID 0x030 /* 1.2 */ |
| 181 | 181 | ||
| 182 | #define DP_DSC_SUPPORT 0x060 /* DP 1.4 */ | ||
| 183 | # define DP_DSC_DECOMPRESSION_IS_SUPPORTED (1 << 0) | ||
| 184 | |||
| 185 | #define DP_DSC_REV 0x061 | ||
| 186 | # define DP_DSC_MAJOR_MASK (0xf << 0) | ||
| 187 | # define DP_DSC_MINOR_MASK (0xf << 4) | ||
| 188 | # define DP_DSC_MAJOR_SHIFT 0 | ||
| 189 | # define DP_DSC_MINOR_SHIFT 4 | ||
| 190 | |||
| 191 | #define DP_DSC_RC_BUF_BLK_SIZE 0x062 | ||
| 192 | # define DP_DSC_RC_BUF_BLK_SIZE_1 0x0 | ||
| 193 | # define DP_DSC_RC_BUF_BLK_SIZE_4 0x1 | ||
| 194 | # define DP_DSC_RC_BUF_BLK_SIZE_16 0x2 | ||
| 195 | # define DP_DSC_RC_BUF_BLK_SIZE_64 0x3 | ||
| 196 | |||
| 197 | #define DP_DSC_RC_BUF_SIZE 0x063 | ||
| 198 | |||
| 199 | #define DP_DSC_SLICE_CAP_1 0x064 | ||
| 200 | # define DP_DSC_1_PER_DP_DSC_SINK (1 << 0) | ||
| 201 | # define DP_DSC_2_PER_DP_DSC_SINK (1 << 1) | ||
| 202 | # define DP_DSC_4_PER_DP_DSC_SINK (1 << 3) | ||
| 203 | # define DP_DSC_6_PER_DP_DSC_SINK (1 << 4) | ||
| 204 | # define DP_DSC_8_PER_DP_DSC_SINK (1 << 5) | ||
| 205 | # define DP_DSC_10_PER_DP_DSC_SINK (1 << 6) | ||
| 206 | # define DP_DSC_12_PER_DP_DSC_SINK (1 << 7) | ||
| 207 | |||
| 208 | #define DP_DSC_LINE_BUF_BIT_DEPTH 0x065 | ||
| 209 | # define DP_DSC_LINE_BUF_BIT_DEPTH_MASK (0xf << 0) | ||
| 210 | # define DP_DSC_LINE_BUF_BIT_DEPTH_9 0x0 | ||
| 211 | # define DP_DSC_LINE_BUF_BIT_DEPTH_10 0x1 | ||
| 212 | # define DP_DSC_LINE_BUF_BIT_DEPTH_11 0x2 | ||
| 213 | # define DP_DSC_LINE_BUF_BIT_DEPTH_12 0x3 | ||
| 214 | # define DP_DSC_LINE_BUF_BIT_DEPTH_13 0x4 | ||
| 215 | # define DP_DSC_LINE_BUF_BIT_DEPTH_14 0x5 | ||
| 216 | # define DP_DSC_LINE_BUF_BIT_DEPTH_15 0x6 | ||
| 217 | # define DP_DSC_LINE_BUF_BIT_DEPTH_16 0x7 | ||
| 218 | # define DP_DSC_LINE_BUF_BIT_DEPTH_8 0x8 | ||
| 219 | |||
| 220 | #define DP_DSC_BLK_PREDICTION_SUPPORT 0x066 | ||
| 221 | # define DP_DSC_BLK_PREDICTION_IS_SUPPORTED (1 << 0) | ||
| 222 | |||
| 223 | #define DP_DSC_MAX_BITS_PER_PIXEL_LOW 0x067 /* eDP 1.4 */ | ||
| 224 | |||
| 225 | #define DP_DSC_MAX_BITS_PER_PIXEL_HI 0x068 /* eDP 1.4 */ | ||
| 226 | |||
| 227 | #define DP_DSC_DEC_COLOR_FORMAT_CAP 0x069 | ||
| 228 | # define DP_DSC_RGB (1 << 0) | ||
| 229 | # define DP_DSC_YCbCr444 (1 << 1) | ||
| 230 | # define DP_DSC_YCbCr422_Simple (1 << 2) | ||
| 231 | # define DP_DSC_YCbCr422_Native (1 << 3) | ||
| 232 | # define DP_DSC_YCbCr420_Native (1 << 4) | ||
| 233 | |||
| 234 | #define DP_DSC_DEC_COLOR_DEPTH_CAP 0x06A | ||
| 235 | # define DP_DSC_8_BPC (1 << 1) | ||
| 236 | # define DP_DSC_10_BPC (1 << 2) | ||
| 237 | # define DP_DSC_12_BPC (1 << 3) | ||
| 238 | |||
| 239 | #define DP_DSC_PEAK_THROUGHPUT 0x06B | ||
| 240 | # define DP_DSC_THROUGHPUT_MODE_0_MASK (0xf << 0) | ||
| 241 | # define DP_DSC_THROUGHPUT_MODE_0_SHIFT 0 | ||
| 242 | # define DP_DSC_THROUGHPUT_MODE_0_340 (1 << 0) | ||
| 243 | # define DP_DSC_THROUGHPUT_MODE_0_400 (2 << 0) | ||
| 244 | # define DP_DSC_THROUGHPUT_MODE_0_450 (3 << 0) | ||
| 245 | # define DP_DSC_THROUGHPUT_MODE_0_500 (4 << 0) | ||
| 246 | # define DP_DSC_THROUGHPUT_MODE_0_550 (5 << 0) | ||
| 247 | # define DP_DSC_THROUGHPUT_MODE_0_600 (6 << 0) | ||
| 248 | # define DP_DSC_THROUGHPUT_MODE_0_650 (7 << 0) | ||
| 249 | # define DP_DSC_THROUGHPUT_MODE_0_700 (8 << 0) | ||
| 250 | # define DP_DSC_THROUGHPUT_MODE_0_750 (9 << 0) | ||
| 251 | # define DP_DSC_THROUGHPUT_MODE_0_800 (10 << 0) | ||
| 252 | # define DP_DSC_THROUGHPUT_MODE_0_850 (11 << 0) | ||
| 253 | # define DP_DSC_THROUGHPUT_MODE_0_900 (12 << 0) | ||
| 254 | # define DP_DSC_THROUGHPUT_MODE_0_950 (13 << 0) | ||
| 255 | # define DP_DSC_THROUGHPUT_MODE_0_1000 (14 << 0) | ||
| 256 | # define DP_DSC_THROUGHPUT_MODE_1_MASK (0xf << 4) | ||
| 257 | # define DP_DSC_THROUGHPUT_MODE_1_SHIFT 4 | ||
| 258 | # define DP_DSC_THROUGHPUT_MODE_1_340 (1 << 4) | ||
| 259 | # define DP_DSC_THROUGHPUT_MODE_1_400 (2 << 4) | ||
| 260 | # define DP_DSC_THROUGHPUT_MODE_1_450 (3 << 4) | ||
| 261 | # define DP_DSC_THROUGHPUT_MODE_1_500 (4 << 4) | ||
| 262 | # define DP_DSC_THROUGHPUT_MODE_1_550 (5 << 4) | ||
| 263 | # define DP_DSC_THROUGHPUT_MODE_1_600 (6 << 4) | ||
| 264 | # define DP_DSC_THROUGHPUT_MODE_1_650 (7 << 4) | ||
| 265 | # define DP_DSC_THROUGHPUT_MODE_1_700 (8 << 4) | ||
| 266 | # define DP_DSC_THROUGHPUT_MODE_1_750 (9 << 4) | ||
| 267 | # define DP_DSC_THROUGHPUT_MODE_1_800 (10 << 4) | ||
| 268 | # define DP_DSC_THROUGHPUT_MODE_1_850 (11 << 4) | ||
| 269 | # define DP_DSC_THROUGHPUT_MODE_1_900 (12 << 4) | ||
| 270 | # define DP_DSC_THROUGHPUT_MODE_1_950 (13 << 4) | ||
| 271 | # define DP_DSC_THROUGHPUT_MODE_1_1000 (14 << 4) | ||
| 272 | |||
| 273 | #define DP_DSC_MAX_SLICE_WIDTH 0x06C | ||
| 274 | |||
| 275 | #define DP_DSC_SLICE_CAP_2 0x06D | ||
| 276 | # define DP_DSC_16_PER_DP_DSC_SINK (1 << 0) | ||
| 277 | # define DP_DSC_20_PER_DP_DSC_SINK (1 << 1) | ||
| 278 | # define DP_DSC_24_PER_DP_DSC_SINK (1 << 2) | ||
| 279 | |||
| 280 | #define DP_DSC_BITS_PER_PIXEL_INC 0x06F | ||
| 281 | # define DP_DSC_BITS_PER_PIXEL_1_16 0x0 | ||
| 282 | # define DP_DSC_BITS_PER_PIXEL_1_8 0x1 | ||
| 283 | # define DP_DSC_BITS_PER_PIXEL_1_4 0x2 | ||
| 284 | # define DP_DSC_BITS_PER_PIXEL_1_2 0x3 | ||
| 285 | # define DP_DSC_BITS_PER_PIXEL_1 0x4 | ||
| 286 | |||
| 182 | #define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ | 287 | #define DP_PSR_SUPPORT 0x070 /* XXX 1.2? */ |
| 183 | # define DP_PSR_IS_SUPPORTED 1 | 288 | # define DP_PSR_IS_SUPPORTED 1 |
| 184 | # define DP_PSR2_IS_SUPPORTED 2 /* eDP 1.4 */ | 289 | # define DP_PSR2_IS_SUPPORTED 2 /* eDP 1.4 */ |
| @@ -339,6 +444,8 @@ | |||
| 339 | #define DP_AUX_FRAME_SYNC_VALUE 0x15c /* eDP 1.4 */ | 444 | #define DP_AUX_FRAME_SYNC_VALUE 0x15c /* eDP 1.4 */ |
| 340 | # define DP_AUX_FRAME_SYNC_VALID (1 << 0) | 445 | # define DP_AUX_FRAME_SYNC_VALID (1 << 0) |
| 341 | 446 | ||
| 447 | #define DP_DSC_ENABLE 0x160 /* DP 1.4 */ | ||
| 448 | |||
| 342 | #define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */ | 449 | #define DP_PSR_EN_CFG 0x170 /* XXX 1.2? */ |
| 343 | # define DP_PSR_ENABLE (1 << 0) | 450 | # define DP_PSR_ENABLE (1 << 0) |
| 344 | # define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) | 451 | # define DP_PSR_MAIN_LINK_ACTIVE (1 << 1) |
| @@ -603,6 +710,9 @@ | |||
| 603 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* 1.2 */ | 710 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI0 0x2003 /* 1.2 */ |
| 604 | 711 | ||
| 605 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */ | 712 | #define DP_DEVICE_SERVICE_IRQ_VECTOR_ESI1 0x2004 /* 1.2 */ |
| 713 | # define DP_RX_GTC_MSTR_REQ_STATUS_CHANGE (1 << 0) | ||
| 714 | # define DP_LOCK_ACQUISITION_REQUEST (1 << 1) | ||
| 715 | # define DP_CEC_IRQ (1 << 2) | ||
| 606 | 716 | ||
| 607 | #define DP_LINK_SERVICE_IRQ_VECTOR_ESI0 0x2005 /* 1.2 */ | 717 | #define DP_LINK_SERVICE_IRQ_VECTOR_ESI0 0x2005 /* 1.2 */ |
| 608 | 718 | ||
| @@ -636,6 +746,62 @@ | |||
| 636 | # define DP_VSC_EXT_CEA_SDP_SUPPORTED (1 << 6) /* DP 1.4 */ | 746 | # define DP_VSC_EXT_CEA_SDP_SUPPORTED (1 << 6) /* DP 1.4 */ |
| 637 | # define DP_VSC_EXT_CEA_SDP_CHAINING_SUPPORTED (1 << 7) /* DP 1.4 */ | 747 | # define DP_VSC_EXT_CEA_SDP_CHAINING_SUPPORTED (1 << 7) /* DP 1.4 */ |
| 638 | 748 | ||
| 749 | /* HDMI CEC tunneling over AUX DP 1.3 section 5.3.3.3.1 DPCD 1.4+ */ | ||
| 750 | #define DP_CEC_TUNNELING_CAPABILITY 0x3000 | ||
| 751 | # define DP_CEC_TUNNELING_CAPABLE (1 << 0) | ||
| 752 | # define DP_CEC_SNOOPING_CAPABLE (1 << 1) | ||
| 753 | # define DP_CEC_MULTIPLE_LA_CAPABLE (1 << 2) | ||
| 754 | |||
| 755 | #define DP_CEC_TUNNELING_CONTROL 0x3001 | ||
| 756 | # define DP_CEC_TUNNELING_ENABLE (1 << 0) | ||
| 757 | # define DP_CEC_SNOOPING_ENABLE (1 << 1) | ||
| 758 | |||
| 759 | #define DP_CEC_RX_MESSAGE_INFO 0x3002 | ||
| 760 | # define DP_CEC_RX_MESSAGE_LEN_MASK (0xf << 0) | ||
| 761 | # define DP_CEC_RX_MESSAGE_LEN_SHIFT 0 | ||
| 762 | # define DP_CEC_RX_MESSAGE_HPD_STATE (1 << 4) | ||
| 763 | # define DP_CEC_RX_MESSAGE_HPD_LOST (1 << 5) | ||
| 764 | # define DP_CEC_RX_MESSAGE_ACKED (1 << 6) | ||
| 765 | # define DP_CEC_RX_MESSAGE_ENDED (1 << 7) | ||
| 766 | |||
| 767 | #define DP_CEC_TX_MESSAGE_INFO 0x3003 | ||
| 768 | # define DP_CEC_TX_MESSAGE_LEN_MASK (0xf << 0) | ||
| 769 | # define DP_CEC_TX_MESSAGE_LEN_SHIFT 0 | ||
| 770 | # define DP_CEC_TX_RETRY_COUNT_MASK (0x7 << 4) | ||
| 771 | # define DP_CEC_TX_RETRY_COUNT_SHIFT 4 | ||
| 772 | # define DP_CEC_TX_MESSAGE_SEND (1 << 7) | ||
| 773 | |||
| 774 | #define DP_CEC_TUNNELING_IRQ_FLAGS 0x3004 | ||
| 775 | # define DP_CEC_RX_MESSAGE_INFO_VALID (1 << 0) | ||
| 776 | # define DP_CEC_RX_MESSAGE_OVERFLOW (1 << 1) | ||
| 777 | # define DP_CEC_TX_MESSAGE_SENT (1 << 4) | ||
| 778 | # define DP_CEC_TX_LINE_ERROR (1 << 5) | ||
| 779 | # define DP_CEC_TX_ADDRESS_NACK_ERROR (1 << 6) | ||
| 780 | # define DP_CEC_TX_DATA_NACK_ERROR (1 << 7) | ||
| 781 | |||
| 782 | #define DP_CEC_LOGICAL_ADDRESS_MASK 0x300E /* 0x300F word */ | ||
| 783 | # define DP_CEC_LOGICAL_ADDRESS_0 (1 << 0) | ||
| 784 | # define DP_CEC_LOGICAL_ADDRESS_1 (1 << 1) | ||
| 785 | # define DP_CEC_LOGICAL_ADDRESS_2 (1 << 2) | ||
| 786 | # define DP_CEC_LOGICAL_ADDRESS_3 (1 << 3) | ||
| 787 | # define DP_CEC_LOGICAL_ADDRESS_4 (1 << 4) | ||
| 788 | # define DP_CEC_LOGICAL_ADDRESS_5 (1 << 5) | ||
| 789 | # define DP_CEC_LOGICAL_ADDRESS_6 (1 << 6) | ||
| 790 | # define DP_CEC_LOGICAL_ADDRESS_7 (1 << 7) | ||
| 791 | #define DP_CEC_LOGICAL_ADDRESS_MASK_2 0x300F /* 0x300E word */ | ||
| 792 | # define DP_CEC_LOGICAL_ADDRESS_8 (1 << 0) | ||
| 793 | # define DP_CEC_LOGICAL_ADDRESS_9 (1 << 1) | ||
| 794 | # define DP_CEC_LOGICAL_ADDRESS_10 (1 << 2) | ||
| 795 | # define DP_CEC_LOGICAL_ADDRESS_11 (1 << 3) | ||
| 796 | # define DP_CEC_LOGICAL_ADDRESS_12 (1 << 4) | ||
| 797 | # define DP_CEC_LOGICAL_ADDRESS_13 (1 << 5) | ||
| 798 | # define DP_CEC_LOGICAL_ADDRESS_14 (1 << 6) | ||
| 799 | # define DP_CEC_LOGICAL_ADDRESS_15 (1 << 7) | ||
| 800 | |||
| 801 | #define DP_CEC_RX_MESSAGE_BUFFER 0x3010 | ||
| 802 | #define DP_CEC_TX_MESSAGE_BUFFER 0x3020 | ||
| 803 | #define DP_CEC_MESSAGE_BUFFER_LENGTH 0x10 | ||
| 804 | |||
| 639 | /* DP 1.2 Sideband message defines */ | 805 | /* DP 1.2 Sideband message defines */ |
| 640 | /* peer device type - DP 1.2a Table 2-92 */ | 806 | /* peer device type - DP 1.2a Table 2-92 */ |
| 641 | #define DP_PEER_DEVICE_NONE 0x0 | 807 | #define DP_PEER_DEVICE_NONE 0x0 |
diff --git a/include/drm/drm_dp_mst_helper.h b/include/drm/drm_dp_mst_helper.h index 5b024764666c..177ab6f86855 100644 --- a/include/drm/drm_dp_mst_helper.h +++ b/include/drm/drm_dp_mst_helper.h | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
| 26 | #include <drm/drm_dp_helper.h> | 26 | #include <drm/drm_dp_helper.h> |
| 27 | #include <drm/drm_atomic.h> | ||
| 27 | 28 | ||
| 28 | struct drm_dp_mst_branch; | 29 | struct drm_dp_mst_branch; |
| 29 | 30 | ||
| @@ -403,6 +404,12 @@ struct drm_dp_payload { | |||
| 403 | int vcpi; | 404 | int vcpi; |
| 404 | }; | 405 | }; |
| 405 | 406 | ||
| 407 | struct drm_dp_mst_topology_state { | ||
| 408 | int avail_slots; | ||
| 409 | struct drm_atomic_state *state; | ||
| 410 | struct drm_dp_mst_topology_mgr *mgr; | ||
| 411 | }; | ||
| 412 | |||
| 406 | /** | 413 | /** |
| 407 | * struct drm_dp_mst_topology_mgr - DisplayPort MST manager | 414 | * struct drm_dp_mst_topology_mgr - DisplayPort MST manager |
| 408 | * | 415 | * |
| @@ -481,6 +488,16 @@ struct drm_dp_mst_topology_mgr { | |||
| 481 | int pbn_div; | 488 | int pbn_div; |
| 482 | 489 | ||
| 483 | /** | 490 | /** |
| 491 | * @state: State information for topology manager | ||
| 492 | */ | ||
| 493 | struct drm_dp_mst_topology_state *state; | ||
| 494 | |||
| 495 | /** | ||
| 496 | * @funcs: Atomic helper callbacks | ||
| 497 | */ | ||
| 498 | const struct drm_private_state_funcs *funcs; | ||
| 499 | |||
| 500 | /** | ||
| 484 | * @qlock: protects @tx_msg_downq, the &drm_dp_mst_branch.txslost and | 501 | * @qlock: protects @tx_msg_downq, the &drm_dp_mst_branch.txslost and |
| 485 | * &drm_dp_sideband_msg_tx.state once they are queued | 502 | * &drm_dp_sideband_msg_tx.state once they are queued |
| 486 | */ | 503 | */ |
| @@ -596,4 +613,13 @@ void drm_dp_mst_dump_topology(struct seq_file *m, | |||
| 596 | 613 | ||
| 597 | void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr); | 614 | void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr); |
| 598 | int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr); | 615 | int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr); |
| 616 | struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct drm_atomic_state *state, | ||
| 617 | struct drm_dp_mst_topology_mgr *mgr); | ||
| 618 | int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state, | ||
| 619 | struct drm_dp_mst_topology_mgr *mgr, | ||
| 620 | struct drm_dp_mst_port *port, int pbn); | ||
| 621 | int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state, | ||
| 622 | struct drm_dp_mst_topology_mgr *mgr, | ||
| 623 | int slots); | ||
| 624 | |||
| 599 | #endif | 625 | #endif |
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 53b98321df9b..e64e33b9dd26 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h | |||
| @@ -104,23 +104,6 @@ struct drm_driver { | |||
| 104 | int (*open) (struct drm_device *, struct drm_file *); | 104 | int (*open) (struct drm_device *, struct drm_file *); |
| 105 | 105 | ||
| 106 | /** | 106 | /** |
| 107 | * @preclose: | ||
| 108 | * | ||
| 109 | * One of the driver callbacks when a new &struct drm_file is closed. | ||
| 110 | * Useful for tearing down driver-private data structures allocated in | ||
| 111 | * @open like buffer allocators, execution contexts or similar things. | ||
| 112 | * | ||
| 113 | * Since the display/modeset side of DRM can only be owned by exactly | ||
| 114 | * one &struct drm_file (see &drm_file.is_master and &drm_device.master) | ||
| 115 | * there should never be a need to tear down any modeset related | ||
| 116 | * resources in this callback. Doing so would be a driver design bug. | ||
| 117 | * | ||
| 118 | * FIXME: It is not really clear why there's both @preclose and | ||
| 119 | * @postclose. Without a really good reason, use @postclose only. | ||
| 120 | */ | ||
| 121 | void (*preclose) (struct drm_device *, struct drm_file *file_priv); | ||
| 122 | |||
| 123 | /** | ||
| 124 | * @postclose: | 107 | * @postclose: |
| 125 | * | 108 | * |
| 126 | * One of the driver callbacks when a new &struct drm_file is closed. | 109 | * One of the driver callbacks when a new &struct drm_file is closed. |
| @@ -131,9 +114,6 @@ struct drm_driver { | |||
| 131 | * one &struct drm_file (see &drm_file.is_master and &drm_device.master) | 114 | * one &struct drm_file (see &drm_file.is_master and &drm_device.master) |
| 132 | * there should never be a need to tear down any modeset related | 115 | * there should never be a need to tear down any modeset related |
| 133 | * resources in this callback. Doing so would be a driver design bug. | 116 | * resources in this callback. Doing so would be a driver design bug. |
| 134 | * | ||
| 135 | * FIXME: It is not really clear why there's both @preclose and | ||
| 136 | * @postclose. Without a really good reason, use @postclose only. | ||
| 137 | */ | 117 | */ |
| 138 | void (*postclose) (struct drm_device *, struct drm_file *); | 118 | void (*postclose) (struct drm_device *, struct drm_file *); |
| 139 | 119 | ||
| @@ -150,7 +130,7 @@ struct drm_driver { | |||
| 150 | * state changes, e.g. in conjunction with the :ref:`vga_switcheroo` | 130 | * state changes, e.g. in conjunction with the :ref:`vga_switcheroo` |
| 151 | * infrastructure. | 131 | * infrastructure. |
| 152 | * | 132 | * |
| 153 | * This is called after @preclose and @postclose have been called. | 133 | * This is called after @postclose hook has been called. |
| 154 | * | 134 | * |
| 155 | * NOTE: | 135 | * NOTE: |
| 156 | * | 136 | * |
| @@ -261,8 +241,10 @@ struct drm_driver { | |||
| 261 | * DRM device. | 241 | * DRM device. |
| 262 | * pipe: | 242 | * pipe: |
| 263 | * Id of the crtc to query. | 243 | * Id of the crtc to query. |
| 264 | * flags: | 244 | * in_vblank_irq: |
| 265 | * Flags from the caller (DRM_CALLED_FROM_VBLIRQ or 0). | 245 | * True when called from drm_crtc_handle_vblank(). Some drivers |
| 246 | * need to apply some workarounds for gpu-specific vblank irq quirks | ||
| 247 | * if flag is set. | ||
| 266 | * vpos: | 248 | * vpos: |
| 267 | * Target location for current vertical scanout position. | 249 | * Target location for current vertical scanout position. |
| 268 | * hpos: | 250 | * hpos: |
| @@ -283,22 +265,19 @@ struct drm_driver { | |||
| 283 | * | 265 | * |
| 284 | * Returns: | 266 | * Returns: |
| 285 | * | 267 | * |
| 286 | * Flags, or'ed together as follows: | 268 | * True on success, false if a reliable scanout position counter could |
| 269 | * not be read out. | ||
| 287 | * | 270 | * |
| 288 | * DRM_SCANOUTPOS_VALID: | 271 | * FIXME: |
| 289 | * Query successful. | ||
| 290 | * DRM_SCANOUTPOS_INVBL: | ||
| 291 | * Inside vblank. | ||
| 292 | * DRM_SCANOUTPOS_ACCURATE: Returned position is accurate. A lack of | ||
| 293 | * this flag means that returned position may be offset by a | ||
| 294 | * constant but unknown small number of scanlines wrt. real scanout | ||
| 295 | * position. | ||
| 296 | * | 272 | * |
| 273 | * Since this is a helper to implement @get_vblank_timestamp, we should | ||
| 274 | * move it to &struct drm_crtc_helper_funcs, like all the other | ||
| 275 | * helper-internal hooks. | ||
| 297 | */ | 276 | */ |
| 298 | int (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, | 277 | bool (*get_scanout_position) (struct drm_device *dev, unsigned int pipe, |
| 299 | unsigned int flags, int *vpos, int *hpos, | 278 | bool in_vblank_irq, int *vpos, int *hpos, |
| 300 | ktime_t *stime, ktime_t *etime, | 279 | ktime_t *stime, ktime_t *etime, |
| 301 | const struct drm_display_mode *mode); | 280 | const struct drm_display_mode *mode); |
| 302 | 281 | ||
| 303 | /** | 282 | /** |
| 304 | * @get_vblank_timestamp: | 283 | * @get_vblank_timestamp: |
| @@ -328,22 +307,25 @@ struct drm_driver { | |||
| 328 | * Returns true upper bound on error for timestamp. | 307 | * Returns true upper bound on error for timestamp. |
| 329 | * vblank_time: | 308 | * vblank_time: |
| 330 | * Target location for returned vblank timestamp. | 309 | * Target location for returned vblank timestamp. |
| 331 | * flags: | 310 | * in_vblank_irq: |
| 332 | * 0 = Defaults, no special treatment needed. | 311 | * True when called from drm_crtc_handle_vblank(). Some drivers |
| 333 | * DRM_CALLED_FROM_VBLIRQ = Function is called from vblank | 312 | * need to apply some workarounds for gpu-specific vblank irq quirks |
| 334 | * irq handler. Some drivers need to apply some workarounds | 313 | * if flag is set. |
| 335 | * for gpu-specific vblank irq quirks if flag is set. | ||
| 336 | * | 314 | * |
| 337 | * Returns: | 315 | * Returns: |
| 338 | * | 316 | * |
| 339 | * Zero if timestamping isn't supported in current display mode or a | 317 | * True on success, false on failure, which means the core should |
| 340 | * negative number on failure. A positive status code on success, | 318 | * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). |
| 341 | * which describes how the vblank_time timestamp was computed. | 319 | * |
| 320 | * FIXME: | ||
| 321 | * | ||
| 322 | * We should move this hook to &struct drm_crtc_funcs like all the other | ||
| 323 | * vblank hooks. | ||
| 342 | */ | 324 | */ |
| 343 | int (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, | 325 | bool (*get_vblank_timestamp) (struct drm_device *dev, unsigned int pipe, |
| 344 | int *max_error, | 326 | int *max_error, |
| 345 | struct timeval *vblank_time, | 327 | struct timeval *vblank_time, |
| 346 | unsigned flags); | 328 | bool in_vblank_irq); |
| 347 | 329 | ||
| 348 | /* these have to be filled in */ | 330 | /* these have to be filled in */ |
| 349 | 331 | ||
| @@ -516,6 +498,7 @@ struct drm_driver { | |||
| 516 | /* List of devices hanging off this driver with stealth attach. */ | 498 | /* List of devices hanging off this driver with stealth attach. */ |
| 517 | struct list_head legacy_dev_list; | 499 | struct list_head legacy_dev_list; |
| 518 | int (*firstopen) (struct drm_device *); | 500 | int (*firstopen) (struct drm_device *); |
| 501 | void (*preclose) (struct drm_device *, struct drm_file *file_priv); | ||
| 519 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); | 502 | int (*dma_ioctl) (struct drm_device *dev, void *data, struct drm_file *file_priv); |
| 520 | int (*dma_quiescent) (struct drm_device *); | 503 | int (*dma_quiescent) (struct drm_device *); |
| 521 | int (*context_dtor) (struct drm_device *dev, int context); | 504 | int (*context_dtor) (struct drm_device *dev, int context); |
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h index a5ecc0a58260..199a63f48659 100644 --- a/include/drm/drm_fb_cma_helper.h +++ b/include/drm/drm_fb_cma_helper.h | |||
| @@ -41,6 +41,10 @@ struct drm_framebuffer *drm_fb_cma_create(struct drm_device *dev, | |||
| 41 | struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, | 41 | struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb, |
| 42 | unsigned int plane); | 42 | unsigned int plane); |
| 43 | 43 | ||
| 44 | dma_addr_t drm_fb_cma_get_gem_addr(struct drm_framebuffer *fb, | ||
| 45 | struct drm_plane_state *state, | ||
| 46 | unsigned int plane); | ||
| 47 | |||
| 44 | int drm_fb_cma_prepare_fb(struct drm_plane *plane, | 48 | int drm_fb_cma_prepare_fb(struct drm_plane *plane, |
| 45 | struct drm_plane_state *state); | 49 | struct drm_plane_state *state); |
| 46 | 50 | ||
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h index f962d33667cf..b42529e0fae0 100644 --- a/include/drm/drm_gem_cma_helper.h +++ b/include/drm/drm_gem_cma_helper.h | |||
| @@ -26,6 +26,13 @@ to_drm_gem_cma_obj(struct drm_gem_object *gem_obj) | |||
| 26 | return container_of(gem_obj, struct drm_gem_cma_object, base); | 26 | return container_of(gem_obj, struct drm_gem_cma_object, base); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | #ifndef CONFIG_MMU | ||
| 30 | #define DRM_GEM_CMA_UNMAPPED_AREA_FOPS \ | ||
| 31 | .get_unmapped_area = drm_gem_cma_get_unmapped_area, | ||
| 32 | #else | ||
| 33 | #define DRM_GEM_CMA_UNMAPPED_AREA_FOPS | ||
| 34 | #endif | ||
| 35 | |||
| 29 | /** | 36 | /** |
| 30 | * DEFINE_DRM_GEM_CMA_FOPS() - macro to generate file operations for CMA drivers | 37 | * DEFINE_DRM_GEM_CMA_FOPS() - macro to generate file operations for CMA drivers |
| 31 | * @name: name for the generated structure | 38 | * @name: name for the generated structure |
| @@ -50,6 +57,7 @@ to_drm_gem_cma_obj(struct drm_gem_object *gem_obj) | |||
| 50 | .read = drm_read,\ | 57 | .read = drm_read,\ |
| 51 | .llseek = noop_llseek,\ | 58 | .llseek = noop_llseek,\ |
| 52 | .mmap = drm_gem_cma_mmap,\ | 59 | .mmap = drm_gem_cma_mmap,\ |
| 60 | DRM_GEM_CMA_UNMAPPED_AREA_FOPS \ | ||
| 53 | } | 61 | } |
| 54 | 62 | ||
| 55 | /* free GEM object */ | 63 | /* free GEM object */ |
| @@ -85,15 +93,6 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, | |||
| 85 | unsigned long len, | 93 | unsigned long len, |
| 86 | unsigned long pgoff, | 94 | unsigned long pgoff, |
| 87 | unsigned long flags); | 95 | unsigned long flags); |
| 88 | #else | ||
| 89 | static inline unsigned long drm_gem_cma_get_unmapped_area(struct file *filp, | ||
| 90 | unsigned long addr, | ||
| 91 | unsigned long len, | ||
| 92 | unsigned long pgoff, | ||
| 93 | unsigned long flags) | ||
| 94 | { | ||
| 95 | return -EINVAL; | ||
| 96 | } | ||
| 97 | #endif | 96 | #endif |
| 98 | 97 | ||
| 99 | #ifdef CONFIG_DEBUG_FS | 98 | #ifdef CONFIG_DEBUG_FS |
diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h index cf0be6594c8c..569ca86d4e1f 100644 --- a/include/drm/drm_irq.h +++ b/include/drm/drm_irq.h | |||
| @@ -121,6 +121,18 @@ struct drm_vblank_crtc { | |||
| 121 | * drm_calc_timestamping_constants(). | 121 | * drm_calc_timestamping_constants(). |
| 122 | */ | 122 | */ |
| 123 | int linedur_ns; | 123 | int linedur_ns; |
| 124 | |||
| 125 | /** | ||
| 126 | * @hwmode: | ||
| 127 | * | ||
| 128 | * Cache of the current hardware display mode. Only valid when @enabled | ||
| 129 | * is set. This is used by helpers like | ||
| 130 | * drm_calc_vbltimestamp_from_scanoutpos(). We can't just access the | ||
| 131 | * hardware mode by e.g. looking at &drm_crtc_state.adjusted_mode, | ||
| 132 | * because that one is really hard to get from interrupt context. | ||
| 133 | */ | ||
| 134 | struct drm_display_mode hwmode; | ||
| 135 | |||
| 124 | /** | 136 | /** |
| 125 | * @enabled: Tracks the enabling state of the corresponding &drm_crtc to | 137 | * @enabled: Tracks the enabling state of the corresponding &drm_crtc to |
| 126 | * avoid double-disabling and hence corrupting saved state. Needed by | 138 | * avoid double-disabling and hence corrupting saved state. Needed by |
| @@ -153,11 +165,10 @@ void drm_crtc_vblank_on(struct drm_crtc *crtc); | |||
| 153 | void drm_vblank_cleanup(struct drm_device *dev); | 165 | void drm_vblank_cleanup(struct drm_device *dev); |
| 154 | u32 drm_accurate_vblank_count(struct drm_crtc *crtc); | 166 | u32 drm_accurate_vblank_count(struct drm_crtc *crtc); |
| 155 | 167 | ||
| 156 | int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, | 168 | bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, |
| 157 | unsigned int pipe, int *max_error, | 169 | unsigned int pipe, int *max_error, |
| 158 | struct timeval *vblank_time, | 170 | struct timeval *vblank_time, |
| 159 | unsigned flags, | 171 | bool in_vblank_irq); |
| 160 | const struct drm_display_mode *mode); | ||
| 161 | void drm_calc_timestamping_constants(struct drm_crtc *crtc, | 172 | void drm_calc_timestamping_constants(struct drm_crtc *crtc, |
| 162 | const struct drm_display_mode *mode); | 173 | const struct drm_display_mode *mode); |
| 163 | 174 | ||
diff --git a/include/drm/drm_prime.h b/include/drm/drm_prime.h index 0b2a235c4be0..59ccab402e85 100644 --- a/include/drm/drm_prime.h +++ b/include/drm/drm_prime.h | |||
| @@ -50,6 +50,8 @@ struct drm_prime_file_private { | |||
| 50 | struct rb_root handles; | 50 | struct rb_root handles; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | struct device; | ||
| 54 | |||
| 53 | struct dma_buf_export_info; | 55 | struct dma_buf_export_info; |
| 54 | struct dma_buf; | 56 | struct dma_buf; |
| 55 | 57 | ||
| @@ -65,6 +67,11 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, | |||
| 65 | int *prime_fd); | 67 | int *prime_fd); |
| 66 | struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, | 68 | struct drm_gem_object *drm_gem_prime_import(struct drm_device *dev, |
| 67 | struct dma_buf *dma_buf); | 69 | struct dma_buf *dma_buf); |
| 70 | |||
| 71 | struct drm_gem_object *drm_gem_prime_import_dev(struct drm_device *dev, | ||
| 72 | struct dma_buf *dma_buf, | ||
| 73 | struct device *attach_dev); | ||
| 74 | |||
| 68 | int drm_gem_prime_fd_to_handle(struct drm_device *dev, | 75 | int drm_gem_prime_fd_to_handle(struct drm_device *dev, |
| 69 | struct drm_file *file_priv, int prime_fd, uint32_t *handle); | 76 | struct drm_file *file_priv, int prime_fd, uint32_t *handle); |
| 70 | struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, | 77 | struct dma_buf *drm_gem_dmabuf_export(struct drm_device *dev, |
