.. | .. |
---|
39 | 39 | #include <drm/drm_framebuffer.h> |
---|
40 | 40 | #include <drm/drm_modes.h> |
---|
41 | 41 | #include <drm/drm_connector.h> |
---|
| 42 | +#include <drm/drm_device.h> |
---|
42 | 43 | #include <drm/drm_property.h> |
---|
43 | | -#include <drm/drm_bridge.h> |
---|
44 | 44 | #include <drm/drm_edid.h> |
---|
45 | 45 | #include <drm/drm_plane.h> |
---|
46 | 46 | #include <drm/drm_blend.h> |
---|
.. | .. |
---|
53 | 53 | struct drm_file; |
---|
54 | 54 | struct drm_clip_rect; |
---|
55 | 55 | struct drm_printer; |
---|
| 56 | +struct drm_self_refresh_data; |
---|
56 | 57 | struct device_node; |
---|
57 | 58 | struct dma_fence; |
---|
58 | 59 | struct edid; |
---|
.. | .. |
---|
78 | 79 | /** |
---|
79 | 80 | * struct drm_crtc_state - mutable CRTC state |
---|
80 | 81 | * |
---|
81 | | - * Note that the distinction between @enable and @active is rather subtile: |
---|
| 82 | + * Note that the distinction between @enable and @active is rather subtle: |
---|
82 | 83 | * Flipping @active while @enable is set without changing anything else may |
---|
83 | 84 | * never return in a failure from the &drm_mode_config_funcs.atomic_check |
---|
84 | 85 | * callback. Userspace assumes that a DPMS On will always succeed. In other |
---|
.. | .. |
---|
173 | 174 | * @no_vblank: |
---|
174 | 175 | * |
---|
175 | 176 | * Reflects the ability of a CRTC to send VBLANK events. This state |
---|
176 | | - * usually depends on the pipeline configuration, and the main usuage |
---|
177 | | - * is CRTCs feeding a writeback connector operating in oneshot mode. |
---|
178 | | - * In this case the VBLANK event is only generated when a job is queued |
---|
179 | | - * to the writeback connector, and we want the core to fake VBLANK |
---|
180 | | - * events when this part of the pipeline hasn't changed but others had |
---|
181 | | - * or when the CRTC and connectors are being disabled. |
---|
| 177 | + * usually depends on the pipeline configuration. If set to true, DRM |
---|
| 178 | + * atomic helpers will send out a fake VBLANK event during display |
---|
| 179 | + * updates after all hardware changes have been committed. This is |
---|
| 180 | + * implemented in drm_atomic_helper_fake_vblank(). |
---|
| 181 | + * |
---|
| 182 | + * One usage is for drivers and/or hardware without support for VBLANK |
---|
| 183 | + * interrupts. Such drivers typically do not initialize vblanking |
---|
| 184 | + * (i.e., call drm_vblank_init() with the number of CRTCs). For CRTCs |
---|
| 185 | + * without initialized vblanking, this field is set to true in |
---|
| 186 | + * drm_atomic_helper_check_modeset(), and a fake VBLANK event will be |
---|
| 187 | + * send out on each update of the display pipeline by |
---|
| 188 | + * drm_atomic_helper_fake_vblank(). |
---|
| 189 | + * |
---|
| 190 | + * Another usage is CRTCs feeding a writeback connector operating in |
---|
| 191 | + * oneshot mode. In this case the fake VBLANK event is only generated |
---|
| 192 | + * when a job is queued to the writeback connector, and we want the |
---|
| 193 | + * core to fake VBLANK events when this part of the pipeline hasn't |
---|
| 194 | + * changed but others had or when the CRTC and connectors are being |
---|
| 195 | + * disabled. |
---|
182 | 196 | * |
---|
183 | 197 | * __drm_atomic_helper_crtc_duplicate_state() will not reset the value |
---|
184 | 198 | * from the current state, the CRTC driver is then responsible for |
---|
.. | .. |
---|
275 | 289 | struct drm_property_blob *gamma_lut; |
---|
276 | 290 | |
---|
277 | 291 | /** |
---|
278 | | - * @cubic_lut: |
---|
279 | | - * |
---|
280 | | - * Cubic Lookup table for converting pixel data. See |
---|
281 | | - * drm_crtc_enable_color_mgmt(). The blob (if not NULL) is a 3D array |
---|
282 | | - * of &struct drm_color_lut. |
---|
283 | | - */ |
---|
284 | | - struct drm_property_blob *cubic_lut; |
---|
285 | | - |
---|
286 | | - /** |
---|
287 | 292 | * @target_vblank: |
---|
288 | 293 | * |
---|
289 | 294 | * Target vertical blank period when a page flip |
---|
.. | .. |
---|
292 | 297 | u32 target_vblank; |
---|
293 | 298 | |
---|
294 | 299 | /** |
---|
295 | | - * @pageflip_flags: |
---|
| 300 | + * @async_flip: |
---|
296 | 301 | * |
---|
297 | | - * DRM_MODE_PAGE_FLIP_* flags, as passed to the page flip ioctl. |
---|
298 | | - * Zero in any other case. |
---|
| 302 | + * This is set when DRM_MODE_PAGE_FLIP_ASYNC is set in the legacy |
---|
| 303 | + * PAGE_FLIP IOCTL. It's not wired up for the atomic IOCTL itself yet. |
---|
299 | 304 | */ |
---|
300 | | - u32 pageflip_flags; |
---|
| 305 | + bool async_flip; |
---|
| 306 | + |
---|
| 307 | + /** |
---|
| 308 | + * @vrr_enabled: |
---|
| 309 | + * |
---|
| 310 | + * Indicates if variable refresh rate should be enabled for the CRTC. |
---|
| 311 | + * Support for the requested vrr state will depend on driver and |
---|
| 312 | + * hardware capabiltiy - lacking support is not treated as failure. |
---|
| 313 | + */ |
---|
| 314 | + bool vrr_enabled; |
---|
| 315 | + |
---|
| 316 | + /** |
---|
| 317 | + * @self_refresh_active: |
---|
| 318 | + * |
---|
| 319 | + * Used by the self refresh helpers to denote when a self refresh |
---|
| 320 | + * transition is occurring. This will be set on enable/disable callbacks |
---|
| 321 | + * when self refresh is being enabled or disabled. In some cases, it may |
---|
| 322 | + * not be desirable to fully shut off the crtc during self refresh. |
---|
| 323 | + * CRTC's can inspect this flag and determine the best course of action. |
---|
| 324 | + */ |
---|
| 325 | + bool self_refresh_active; |
---|
301 | 326 | |
---|
302 | 327 | /** |
---|
303 | 328 | * @event: |
---|
.. | .. |
---|
323 | 348 | * - Events for disabled CRTCs are not allowed, and drivers can ignore |
---|
324 | 349 | * that case. |
---|
325 | 350 | * |
---|
326 | | - * This can be handled by the drm_crtc_send_vblank_event() function, |
---|
| 351 | + * For very simple hardware without VBLANK interrupt, enabling |
---|
| 352 | + * &struct drm_crtc_state.no_vblank makes DRM's atomic commit helpers |
---|
| 353 | + * send a fake VBLANK event at the end of the display update after all |
---|
| 354 | + * hardware changes have been applied. See |
---|
| 355 | + * drm_atomic_helper_fake_vblank(). |
---|
| 356 | + * |
---|
| 357 | + * For more complex hardware this |
---|
| 358 | + * can be handled by the drm_crtc_send_vblank_event() function, |
---|
327 | 359 | * which the driver should call on the provided event upon completion of |
---|
328 | 360 | * the atomic commit. Note that if the driver supports vblank signalling |
---|
329 | 361 | * and timestamping the vblank counters and timestamps must agree with |
---|
.. | .. |
---|
472 | 504 | /** |
---|
473 | 505 | * @destroy: |
---|
474 | 506 | * |
---|
475 | | - * Clean up plane resources. This is only called at driver unload time |
---|
| 507 | + * Clean up CRTC resources. This is only called at driver unload time |
---|
476 | 508 | * through drm_mode_config_cleanup() since a CRTC cannot be hotplugged |
---|
477 | 509 | * in DRM. |
---|
478 | 510 | */ |
---|
.. | .. |
---|
743 | 775 | * provided from the configured source. Drivers must accept an "auto" |
---|
744 | 776 | * source name that will select a default source for this CRTC. |
---|
745 | 777 | * |
---|
| 778 | + * This may trigger an atomic modeset commit if necessary, to enable CRC |
---|
| 779 | + * generation. |
---|
| 780 | + * |
---|
746 | 781 | * Note that "auto" can depend upon the current modeset configuration, |
---|
747 | 782 | * e.g. it could pick an encoder or output specific CRC sampling point. |
---|
748 | 783 | * |
---|
.. | .. |
---|
754 | 789 | * 0 on success or a negative error code on failure. |
---|
755 | 790 | */ |
---|
756 | 791 | int (*set_crc_source)(struct drm_crtc *crtc, const char *source); |
---|
| 792 | + |
---|
757 | 793 | /** |
---|
758 | 794 | * @verify_crc_source: |
---|
759 | 795 | * |
---|
.. | .. |
---|
851 | 887 | * new drivers as the replacement of &drm_driver.disable_vblank hook. |
---|
852 | 888 | */ |
---|
853 | 889 | void (*disable_vblank)(struct drm_crtc *crtc); |
---|
854 | | -}; |
---|
855 | 890 | |
---|
856 | | -#if defined(CONFIG_ROCKCHIP_DRM_DEBUG) |
---|
857 | | - |
---|
858 | | -/** |
---|
859 | | - * struct vop_dump_info - vop dump plane info structure |
---|
860 | | - * |
---|
861 | | - * Store plane info used to write display data to /data/vop_buf/ |
---|
862 | | - * |
---|
863 | | - */ |
---|
864 | | -struct vop_dump_info { |
---|
865 | | - /* @win_id: vop hard win index */ |
---|
866 | | - u8 win_id; |
---|
867 | | - /* @area_id: vop hard area index inside win */ |
---|
868 | | - u8 area_id; |
---|
869 | | - /* @AFBC_flag: indicate the buffer compress by gpu or not */ |
---|
870 | | - bool AFBC_flag; |
---|
871 | | - /* @yuv_format: indicate yuv format or not */ |
---|
872 | | - bool yuv_format; |
---|
873 | | - /* @pitches: the buffer pitch size */ |
---|
874 | | - u32 pitches; |
---|
875 | | - /* @height: the buffer pitch height */ |
---|
876 | | - u32 height; |
---|
877 | | - /* @pixel_format: the buffer format */ |
---|
878 | | - u32 pixel_format; |
---|
879 | | - /* @offset: the buffer offset */ |
---|
880 | | - unsigned long offset; |
---|
881 | | - /* @num_pages: the pages number */ |
---|
882 | | - unsigned long num_pages; |
---|
883 | | - /* @pages: store the buffer all pages */ |
---|
884 | | - struct page **pages; |
---|
| 891 | + /** |
---|
| 892 | + * @get_vblank_timestamp: |
---|
| 893 | + * |
---|
| 894 | + * Called by drm_get_last_vbltimestamp(). Should return a precise |
---|
| 895 | + * timestamp when the most recent vblank interval ended or will end. |
---|
| 896 | + * |
---|
| 897 | + * Specifically, the timestamp in @vblank_time should correspond as |
---|
| 898 | + * closely as possible to the time when the first video scanline of |
---|
| 899 | + * the video frame after the end of vblank will start scanning out, |
---|
| 900 | + * the time immediately after end of the vblank interval. If the |
---|
| 901 | + * @crtc is currently inside vblank, this will be a time in the future. |
---|
| 902 | + * If the @crtc is currently scanning out a frame, this will be the |
---|
| 903 | + * past start time of the current scanout. This is meant to adhere |
---|
| 904 | + * to the OpenML OML_sync_control extension specification. |
---|
| 905 | + * |
---|
| 906 | + * Parameters: |
---|
| 907 | + * |
---|
| 908 | + * crtc: |
---|
| 909 | + * CRTC for which timestamp should be returned. |
---|
| 910 | + * max_error: |
---|
| 911 | + * Maximum allowable timestamp error in nanoseconds. |
---|
| 912 | + * Implementation should strive to provide timestamp |
---|
| 913 | + * with an error of at most max_error nanoseconds. |
---|
| 914 | + * Returns true upper bound on error for timestamp. |
---|
| 915 | + * vblank_time: |
---|
| 916 | + * Target location for returned vblank timestamp. |
---|
| 917 | + * in_vblank_irq: |
---|
| 918 | + * True when called from drm_crtc_handle_vblank(). Some drivers |
---|
| 919 | + * need to apply some workarounds for gpu-specific vblank irq quirks |
---|
| 920 | + * if flag is set. |
---|
| 921 | + * |
---|
| 922 | + * Returns: |
---|
| 923 | + * |
---|
| 924 | + * True on success, false on failure, which means the core should |
---|
| 925 | + * fallback to a simple timestamp taken in drm_crtc_handle_vblank(). |
---|
| 926 | + */ |
---|
| 927 | + bool (*get_vblank_timestamp)(struct drm_crtc *crtc, |
---|
| 928 | + int *max_error, |
---|
| 929 | + ktime_t *vblank_time, |
---|
| 930 | + bool in_vblank_irq); |
---|
885 | 931 | }; |
---|
886 | | - |
---|
887 | | -/** |
---|
888 | | - * struct vop_dump_list - store all buffer info per frame |
---|
889 | | - * |
---|
890 | | - * one frame maybe multiple buffer, all will be stored here. |
---|
891 | | - * |
---|
892 | | - */ |
---|
893 | | -struct vop_dump_list { |
---|
894 | | - struct list_head entry; |
---|
895 | | - struct vop_dump_info dump_info; |
---|
896 | | -}; |
---|
897 | | - |
---|
898 | | -enum vop_dump_status { |
---|
899 | | - DUMP_DISABLE = 0, |
---|
900 | | - DUMP_KEEP |
---|
901 | | -}; |
---|
902 | | -#endif |
---|
903 | 932 | |
---|
904 | 933 | /** |
---|
905 | 934 | * struct drm_crtc - central CRTC control structure |
---|
.. | .. |
---|
1006 | 1035 | * Programmed mode in hw, after adjustments for encoders, crtc, panel |
---|
1007 | 1036 | * scaling etc. Should only be used by legacy drivers, for high |
---|
1008 | 1037 | * precision vblank timestamps in |
---|
1009 | | - * drm_calc_vbltimestamp_from_scanoutpos(). |
---|
| 1038 | + * drm_crtc_vblank_helper_get_vblank_timestamp(). |
---|
1010 | 1039 | * |
---|
1011 | 1040 | * Note that atomic drivers should not use this, but instead use |
---|
1012 | 1041 | * &drm_crtc_state.adjusted_mode. And for high-precision timestamps |
---|
1013 | | - * drm_calc_vbltimestamp_from_scanoutpos() used &drm_vblank_crtc.hwmode, |
---|
| 1042 | + * drm_crtc_vblank_helper_get_vblank_timestamp() used |
---|
| 1043 | + * &drm_vblank_crtc.hwmode, |
---|
1014 | 1044 | * which is filled out by calling drm_calc_timestamping_constants(). |
---|
1015 | 1045 | */ |
---|
1016 | 1046 | struct drm_display_mode hwmode; |
---|
.. | .. |
---|
1136 | 1166 | */ |
---|
1137 | 1167 | char timeline_name[32]; |
---|
1138 | 1168 | |
---|
1139 | | -#if defined(CONFIG_ROCKCHIP_DRM_DEBUG) |
---|
1140 | 1169 | /** |
---|
1141 | | - * @vop_dump_status the status of vop dump control |
---|
1142 | | - * @vop_dump_list_head the list head of vop dump list |
---|
1143 | | - * @vop_dump_list_init_flag init once |
---|
1144 | | - * @vop_dump_times control the dump times |
---|
1145 | | - * @frme_count the frame of dump buf |
---|
| 1170 | + * @self_refresh_data: Holds the state for the self refresh helpers |
---|
| 1171 | + * |
---|
| 1172 | + * Initialized via drm_self_refresh_helper_init(). |
---|
1146 | 1173 | */ |
---|
1147 | | - enum vop_dump_status vop_dump_status; |
---|
1148 | | - struct list_head vop_dump_list_head; |
---|
1149 | | - bool vop_dump_list_init_flag; |
---|
1150 | | - int vop_dump_times; |
---|
1151 | | - int frame_count; |
---|
1152 | | -#endif |
---|
| 1174 | + struct drm_self_refresh_data *self_refresh_data; |
---|
1153 | 1175 | }; |
---|
1154 | 1176 | |
---|
1155 | 1177 | /** |
---|
.. | .. |
---|
1211 | 1233 | { |
---|
1212 | 1234 | return 1 << drm_crtc_index(crtc); |
---|
1213 | 1235 | } |
---|
1214 | | - |
---|
1215 | | -int drm_crtc_force_disable(struct drm_crtc *crtc); |
---|
1216 | | -int drm_crtc_force_disable_all(struct drm_device *dev); |
---|
1217 | 1236 | |
---|
1218 | 1237 | int drm_mode_set_config_internal(struct drm_mode_set *set); |
---|
1219 | 1238 | struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx); |
---|