forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
....@@ -25,11 +25,13 @@
2525 *
2626 **************************************************************************/
2727
28
-#include "vmwgfx_kms.h"
29
-#include <drm/drm_plane_helper.h>
3028 #include <drm/drm_atomic.h>
3129 #include <drm/drm_atomic_helper.h>
30
+#include <drm/drm_fourcc.h>
31
+#include <drm/drm_plane_helper.h>
32
+#include <drm/drm_vblank.h>
3233
34
+#include "vmwgfx_kms.h"
3335
3436 #define vmw_crtc_to_ldu(x) \
3537 container_of(x, struct vmw_legacy_display_unit, base.crtc)
....@@ -232,7 +234,10 @@
232234 .reset = vmw_du_crtc_reset,
233235 .atomic_duplicate_state = vmw_du_crtc_duplicate_state,
234236 .atomic_destroy_state = vmw_du_crtc_destroy_state,
235
- .set_config = vmw_kms_set_config,
237
+ .set_config = drm_atomic_helper_set_config,
238
+ .get_vblank_counter = vmw_get_vblank_counter,
239
+ .enable_vblank = vmw_enable_vblank,
240
+ .disable_vblank = vmw_disable_vblank,
236241 };
237242
238243
....@@ -262,18 +267,14 @@
262267 .dpms = vmw_du_connector_dpms,
263268 .detect = vmw_du_connector_detect,
264269 .fill_modes = vmw_du_connector_fill_modes,
265
- .set_property = vmw_du_connector_set_property,
266270 .destroy = vmw_ldu_connector_destroy,
267271 .reset = vmw_du_connector_reset,
268272 .atomic_duplicate_state = vmw_du_connector_duplicate_state,
269273 .atomic_destroy_state = vmw_du_connector_destroy_state,
270
- .atomic_set_property = vmw_du_connector_atomic_set_property,
271
- .atomic_get_property = vmw_du_connector_atomic_get_property,
272274 };
273275
274276 static const struct
275277 drm_connector_helper_funcs vmw_ldu_connector_helper_funcs = {
276
- .best_encoder = drm_atomic_helper_best_encoder,
277278 };
278279
279280 /*
....@@ -386,8 +387,6 @@
386387 ldu->base.is_implicit = true;
387388
388389 /* Initialize primary plane */
389
- vmw_du_plane_reset(primary);
390
-
391390 ret = drm_universal_plane_init(dev, &ldu->base.primary,
392391 0, &vmw_ldu_plane_funcs,
393392 vmw_primary_plane_formats,
....@@ -401,8 +400,6 @@
401400 drm_plane_helper_add(primary, &vmw_ldu_primary_plane_helper_funcs);
402401
403402 /* Initialize cursor plane */
404
- vmw_du_plane_reset(cursor);
405
-
406403 ret = drm_universal_plane_init(dev, &ldu->base.cursor,
407404 0, &vmw_ldu_cursor_funcs,
408405 vmw_cursor_plane_formats,
....@@ -416,8 +413,6 @@
416413
417414 drm_plane_helper_add(cursor, &vmw_ldu_cursor_plane_helper_funcs);
418415
419
-
420
- vmw_du_connector_reset(connector);
421416 ret = drm_connector_init(dev, connector, &vmw_legacy_connector_funcs,
422417 DRM_MODE_CONNECTOR_VIRTUAL);
423418 if (ret) {
....@@ -427,8 +422,6 @@
427422
428423 drm_connector_helper_add(connector, &vmw_ldu_connector_helper_funcs);
429424 connector->status = vmw_du_connector_detect(connector, true);
430
- vmw_connector_state_to_vcs(connector->state)->is_implicit = true;
431
-
432425
433426 ret = drm_encoder_init(dev, encoder, &vmw_legacy_encoder_funcs,
434427 DRM_MODE_ENCODER_VIRTUAL, NULL);
....@@ -447,8 +440,6 @@
447440 goto err_free_encoder;
448441 }
449442
450
-
451
- vmw_du_crtc_reset(crtc);
452443 ret = drm_crtc_init_with_planes(dev, crtc, &ldu->base.primary,
453444 &ldu->base.cursor,
454445 &vmw_legacy_crtc_funcs, NULL);
....@@ -513,7 +504,7 @@
513504 if (ret != 0)
514505 goto err_free;
515506
516
- vmw_kms_create_implicit_placement_property(dev_priv, true);
507
+ vmw_kms_create_implicit_placement_property(dev_priv);
517508
518509 if (dev_priv->capabilities & SVGA_CAP_MULTIMON)
519510 for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i)
....@@ -522,6 +513,8 @@
522513 vmw_ldu_init(dev_priv, 0);
523514
524515 dev_priv->active_display_unit = vmw_du_legacy;
516
+
517
+ drm_mode_config_reset(dev);
525518
526519 DRM_INFO("Legacy Display Unit initialized\n");
527520
....@@ -561,11 +554,9 @@
561554 } *cmd;
562555
563556 fifo_size = sizeof(*cmd) * num_clips;
564
- cmd = vmw_fifo_reserve(dev_priv, fifo_size);
565
- if (unlikely(cmd == NULL)) {
566
- DRM_ERROR("Fifo reserve failed.\n");
557
+ cmd = VMW_FIFO_RESERVE(dev_priv, fifo_size);
558
+ if (unlikely(cmd == NULL))
567559 return -ENOMEM;
568
- }
569560
570561 memset(cmd, 0, fifo_size);
571562 for (i = 0; i < num_clips; i++, clips += increment) {