hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/include/drm/drm_crtc.h
....@@ -39,8 +39,8 @@
3939 #include <drm/drm_framebuffer.h>
4040 #include <drm/drm_modes.h>
4141 #include <drm/drm_connector.h>
42
+#include <drm/drm_device.h>
4243 #include <drm/drm_property.h>
43
-#include <drm/drm_bridge.h>
4444 #include <drm/drm_edid.h>
4545 #include <drm/drm_plane.h>
4646 #include <drm/drm_blend.h>
....@@ -53,6 +53,7 @@
5353 struct drm_file;
5454 struct drm_clip_rect;
5555 struct drm_printer;
56
+struct drm_self_refresh_data;
5657 struct device_node;
5758 struct dma_fence;
5859 struct edid;
....@@ -78,7 +79,7 @@
7879 /**
7980 * struct drm_crtc_state - mutable CRTC state
8081 *
81
- * Note that the distinction between @enable and @active is rather subtile:
82
+ * Note that the distinction between @enable and @active is rather subtle:
8283 * Flipping @active while @enable is set without changing anything else may
8384 * never return in a failure from the &drm_mode_config_funcs.atomic_check
8485 * callback. Userspace assumes that a DPMS On will always succeed. In other
....@@ -173,12 +174,25 @@
173174 * @no_vblank:
174175 *
175176 * 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.
182196 *
183197 * __drm_atomic_helper_crtc_duplicate_state() will not reset the value
184198 * from the current state, the CRTC driver is then responsible for
....@@ -275,15 +289,6 @@
275289 struct drm_property_blob *gamma_lut;
276290
277291 /**
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
- /**
287292 * @target_vblank:
288293 *
289294 * Target vertical blank period when a page flip
....@@ -292,12 +297,32 @@
292297 u32 target_vblank;
293298
294299 /**
295
- * @pageflip_flags:
300
+ * @async_flip:
296301 *
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.
299304 */
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;
301326
302327 /**
303328 * @event:
....@@ -323,7 +348,14 @@
323348 * - Events for disabled CRTCs are not allowed, and drivers can ignore
324349 * that case.
325350 *
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,
327359 * which the driver should call on the provided event upon completion of
328360 * the atomic commit. Note that if the driver supports vblank signalling
329361 * and timestamping the vblank counters and timestamps must agree with
....@@ -472,7 +504,7 @@
472504 /**
473505 * @destroy:
474506 *
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
476508 * through drm_mode_config_cleanup() since a CRTC cannot be hotplugged
477509 * in DRM.
478510 */
....@@ -743,6 +775,9 @@
743775 * provided from the configured source. Drivers must accept an "auto"
744776 * source name that will select a default source for this CRTC.
745777 *
778
+ * This may trigger an atomic modeset commit if necessary, to enable CRC
779
+ * generation.
780
+ *
746781 * Note that "auto" can depend upon the current modeset configuration,
747782 * e.g. it could pick an encoder or output specific CRC sampling point.
748783 *
....@@ -754,6 +789,7 @@
754789 * 0 on success or a negative error code on failure.
755790 */
756791 int (*set_crc_source)(struct drm_crtc *crtc, const char *source);
792
+
757793 /**
758794 * @verify_crc_source:
759795 *
....@@ -851,55 +887,48 @@
851887 * new drivers as the replacement of &drm_driver.disable_vblank hook.
852888 */
853889 void (*disable_vblank)(struct drm_crtc *crtc);
854
-};
855890
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);
885931 };
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
903932
904933 /**
905934 * struct drm_crtc - central CRTC control structure
....@@ -1006,11 +1035,12 @@
10061035 * Programmed mode in hw, after adjustments for encoders, crtc, panel
10071036 * scaling etc. Should only be used by legacy drivers, for high
10081037 * precision vblank timestamps in
1009
- * drm_calc_vbltimestamp_from_scanoutpos().
1038
+ * drm_crtc_vblank_helper_get_vblank_timestamp().
10101039 *
10111040 * Note that atomic drivers should not use this, but instead use
10121041 * &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,
10141044 * which is filled out by calling drm_calc_timestamping_constants().
10151045 */
10161046 struct drm_display_mode hwmode;
....@@ -1136,20 +1166,12 @@
11361166 */
11371167 char timeline_name[32];
11381168
1139
-#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
11401169 /**
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().
11461173 */
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;
11531175 };
11541176
11551177 /**
....@@ -1211,9 +1233,6 @@
12111233 {
12121234 return 1 << drm_crtc_index(crtc);
12131235 }
1214
-
1215
-int drm_crtc_force_disable(struct drm_crtc *crtc);
1216
-int drm_crtc_force_disable_all(struct drm_device *dev);
12171236
12181237 int drm_mode_set_config_internal(struct drm_mode_set *set);
12191238 struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);