hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
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
....@@ -273,7 +287,7 @@
273287 * NULL) is an array of &struct drm_color_lut.
274288 */
275289 struct drm_property_blob *gamma_lut;
276
-
290
+#if defined(CONFIG_ROCKCHIP_DRM_CUBIC_LUT)
277291 /**
278292 * @cubic_lut:
279293 *
....@@ -282,7 +296,7 @@
282296 * of &struct drm_color_lut.
283297 */
284298 struct drm_property_blob *cubic_lut;
285
-
299
+#endif
286300 /**
287301 * @target_vblank:
288302 *
....@@ -292,12 +306,32 @@
292306 u32 target_vblank;
293307
294308 /**
295
- * @pageflip_flags:
309
+ * @async_flip:
296310 *
297
- * DRM_MODE_PAGE_FLIP_* flags, as passed to the page flip ioctl.
298
- * Zero in any other case.
311
+ * This is set when DRM_MODE_PAGE_FLIP_ASYNC is set in the legacy
312
+ * PAGE_FLIP IOCTL. It's not wired up for the atomic IOCTL itself yet.
299313 */
300
- u32 pageflip_flags;
314
+ bool async_flip;
315
+
316
+ /**
317
+ * @vrr_enabled:
318
+ *
319
+ * Indicates if variable refresh rate should be enabled for the CRTC.
320
+ * Support for the requested vrr state will depend on driver and
321
+ * hardware capabiltiy - lacking support is not treated as failure.
322
+ */
323
+ bool vrr_enabled;
324
+
325
+ /**
326
+ * @self_refresh_active:
327
+ *
328
+ * Used by the self refresh helpers to denote when a self refresh
329
+ * transition is occurring. This will be set on enable/disable callbacks
330
+ * when self refresh is being enabled or disabled. In some cases, it may
331
+ * not be desirable to fully shut off the crtc during self refresh.
332
+ * CRTC's can inspect this flag and determine the best course of action.
333
+ */
334
+ bool self_refresh_active;
301335
302336 /**
303337 * @event:
....@@ -323,7 +357,14 @@
323357 * - Events for disabled CRTCs are not allowed, and drivers can ignore
324358 * that case.
325359 *
326
- * This can be handled by the drm_crtc_send_vblank_event() function,
360
+ * For very simple hardware without VBLANK interrupt, enabling
361
+ * &struct drm_crtc_state.no_vblank makes DRM's atomic commit helpers
362
+ * send a fake VBLANK event at the end of the display update after all
363
+ * hardware changes have been applied. See
364
+ * drm_atomic_helper_fake_vblank().
365
+ *
366
+ * For more complex hardware this
367
+ * can be handled by the drm_crtc_send_vblank_event() function,
327368 * which the driver should call on the provided event upon completion of
328369 * the atomic commit. Note that if the driver supports vblank signalling
329370 * and timestamping the vblank counters and timestamps must agree with
....@@ -472,7 +513,7 @@
472513 /**
473514 * @destroy:
474515 *
475
- * Clean up plane resources. This is only called at driver unload time
516
+ * Clean up CRTC resources. This is only called at driver unload time
476517 * through drm_mode_config_cleanup() since a CRTC cannot be hotplugged
477518 * in DRM.
478519 */
....@@ -743,6 +784,9 @@
743784 * provided from the configured source. Drivers must accept an "auto"
744785 * source name that will select a default source for this CRTC.
745786 *
787
+ * This may trigger an atomic modeset commit if necessary, to enable CRC
788
+ * generation.
789
+ *
746790 * Note that "auto" can depend upon the current modeset configuration,
747791 * e.g. it could pick an encoder or output specific CRC sampling point.
748792 *
....@@ -754,6 +798,7 @@
754798 * 0 on success or a negative error code on failure.
755799 */
756800 int (*set_crc_source)(struct drm_crtc *crtc, const char *source);
801
+
757802 /**
758803 * @verify_crc_source:
759804 *
....@@ -851,55 +896,48 @@
851896 * new drivers as the replacement of &drm_driver.disable_vblank hook.
852897 */
853898 void (*disable_vblank)(struct drm_crtc *crtc);
854
-};
855899
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;
900
+ /**
901
+ * @get_vblank_timestamp:
902
+ *
903
+ * Called by drm_get_last_vbltimestamp(). Should return a precise
904
+ * timestamp when the most recent vblank interval ended or will end.
905
+ *
906
+ * Specifically, the timestamp in @vblank_time should correspond as
907
+ * closely as possible to the time when the first video scanline of
908
+ * the video frame after the end of vblank will start scanning out,
909
+ * the time immediately after end of the vblank interval. If the
910
+ * @crtc is currently inside vblank, this will be a time in the future.
911
+ * If the @crtc is currently scanning out a frame, this will be the
912
+ * past start time of the current scanout. This is meant to adhere
913
+ * to the OpenML OML_sync_control extension specification.
914
+ *
915
+ * Parameters:
916
+ *
917
+ * crtc:
918
+ * CRTC for which timestamp should be returned.
919
+ * max_error:
920
+ * Maximum allowable timestamp error in nanoseconds.
921
+ * Implementation should strive to provide timestamp
922
+ * with an error of at most max_error nanoseconds.
923
+ * Returns true upper bound on error for timestamp.
924
+ * vblank_time:
925
+ * Target location for returned vblank timestamp.
926
+ * in_vblank_irq:
927
+ * True when called from drm_crtc_handle_vblank(). Some drivers
928
+ * need to apply some workarounds for gpu-specific vblank irq quirks
929
+ * if flag is set.
930
+ *
931
+ * Returns:
932
+ *
933
+ * True on success, false on failure, which means the core should
934
+ * fallback to a simple timestamp taken in drm_crtc_handle_vblank().
935
+ */
936
+ bool (*get_vblank_timestamp)(struct drm_crtc *crtc,
937
+ int *max_error,
938
+ ktime_t *vblank_time,
939
+ bool in_vblank_irq);
885940 };
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
903941
904942 /**
905943 * struct drm_crtc - central CRTC control structure
....@@ -1006,11 +1044,12 @@
10061044 * Programmed mode in hw, after adjustments for encoders, crtc, panel
10071045 * scaling etc. Should only be used by legacy drivers, for high
10081046 * precision vblank timestamps in
1009
- * drm_calc_vbltimestamp_from_scanoutpos().
1047
+ * drm_crtc_vblank_helper_get_vblank_timestamp().
10101048 *
10111049 * Note that atomic drivers should not use this, but instead use
10121050 * &drm_crtc_state.adjusted_mode. And for high-precision timestamps
1013
- * drm_calc_vbltimestamp_from_scanoutpos() used &drm_vblank_crtc.hwmode,
1051
+ * drm_crtc_vblank_helper_get_vblank_timestamp() used
1052
+ * &drm_vblank_crtc.hwmode,
10141053 * which is filled out by calling drm_calc_timestamping_constants().
10151054 */
10161055 struct drm_display_mode hwmode;
....@@ -1136,20 +1175,12 @@
11361175 */
11371176 char timeline_name[32];
11381177
1139
-#if defined(CONFIG_ROCKCHIP_DRM_DEBUG)
11401178 /**
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
1179
+ * @self_refresh_data: Holds the state for the self refresh helpers
1180
+ *
1181
+ * Initialized via drm_self_refresh_helper_init().
11461182 */
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
1183
+ struct drm_self_refresh_data *self_refresh_data;
11531184 };
11541185
11551186 /**
....@@ -1211,9 +1242,6 @@
12111242 {
12121243 return 1 << drm_crtc_index(crtc);
12131244 }
1214
-
1215
-int drm_crtc_force_disable(struct drm_crtc *crtc);
1216
-int drm_crtc_force_disable_all(struct drm_device *dev);
12171245
12181246 int drm_mode_set_config_internal(struct drm_mode_set *set);
12191247 struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);