| .. | .. |
|---|
| 25 | 25 | * |
|---|
| 26 | 26 | **************************************************************************/ |
|---|
| 27 | 27 | |
|---|
| 28 | | -#include "vmwgfx_kms.h" |
|---|
| 29 | | -#include <drm/drm_plane_helper.h> |
|---|
| 30 | 28 | #include <drm/drm_atomic.h> |
|---|
| 31 | 29 | #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> |
|---|
| 32 | 33 | |
|---|
| 34 | +#include "vmwgfx_kms.h" |
|---|
| 33 | 35 | |
|---|
| 34 | 36 | #define vmw_crtc_to_ldu(x) \ |
|---|
| 35 | 37 | container_of(x, struct vmw_legacy_display_unit, base.crtc) |
|---|
| .. | .. |
|---|
| 232 | 234 | .reset = vmw_du_crtc_reset, |
|---|
| 233 | 235 | .atomic_duplicate_state = vmw_du_crtc_duplicate_state, |
|---|
| 234 | 236 | .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, |
|---|
| 236 | 241 | }; |
|---|
| 237 | 242 | |
|---|
| 238 | 243 | |
|---|
| .. | .. |
|---|
| 262 | 267 | .dpms = vmw_du_connector_dpms, |
|---|
| 263 | 268 | .detect = vmw_du_connector_detect, |
|---|
| 264 | 269 | .fill_modes = vmw_du_connector_fill_modes, |
|---|
| 265 | | - .set_property = vmw_du_connector_set_property, |
|---|
| 266 | 270 | .destroy = vmw_ldu_connector_destroy, |
|---|
| 267 | 271 | .reset = vmw_du_connector_reset, |
|---|
| 268 | 272 | .atomic_duplicate_state = vmw_du_connector_duplicate_state, |
|---|
| 269 | 273 | .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, |
|---|
| 272 | 274 | }; |
|---|
| 273 | 275 | |
|---|
| 274 | 276 | static const struct |
|---|
| 275 | 277 | drm_connector_helper_funcs vmw_ldu_connector_helper_funcs = { |
|---|
| 276 | | - .best_encoder = drm_atomic_helper_best_encoder, |
|---|
| 277 | 278 | }; |
|---|
| 278 | 279 | |
|---|
| 279 | 280 | /* |
|---|
| .. | .. |
|---|
| 386 | 387 | ldu->base.is_implicit = true; |
|---|
| 387 | 388 | |
|---|
| 388 | 389 | /* Initialize primary plane */ |
|---|
| 389 | | - vmw_du_plane_reset(primary); |
|---|
| 390 | | - |
|---|
| 391 | 390 | ret = drm_universal_plane_init(dev, &ldu->base.primary, |
|---|
| 392 | 391 | 0, &vmw_ldu_plane_funcs, |
|---|
| 393 | 392 | vmw_primary_plane_formats, |
|---|
| .. | .. |
|---|
| 401 | 400 | drm_plane_helper_add(primary, &vmw_ldu_primary_plane_helper_funcs); |
|---|
| 402 | 401 | |
|---|
| 403 | 402 | /* Initialize cursor plane */ |
|---|
| 404 | | - vmw_du_plane_reset(cursor); |
|---|
| 405 | | - |
|---|
| 406 | 403 | ret = drm_universal_plane_init(dev, &ldu->base.cursor, |
|---|
| 407 | 404 | 0, &vmw_ldu_cursor_funcs, |
|---|
| 408 | 405 | vmw_cursor_plane_formats, |
|---|
| .. | .. |
|---|
| 416 | 413 | |
|---|
| 417 | 414 | drm_plane_helper_add(cursor, &vmw_ldu_cursor_plane_helper_funcs); |
|---|
| 418 | 415 | |
|---|
| 419 | | - |
|---|
| 420 | | - vmw_du_connector_reset(connector); |
|---|
| 421 | 416 | ret = drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, |
|---|
| 422 | 417 | DRM_MODE_CONNECTOR_VIRTUAL); |
|---|
| 423 | 418 | if (ret) { |
|---|
| .. | .. |
|---|
| 427 | 422 | |
|---|
| 428 | 423 | drm_connector_helper_add(connector, &vmw_ldu_connector_helper_funcs); |
|---|
| 429 | 424 | connector->status = vmw_du_connector_detect(connector, true); |
|---|
| 430 | | - vmw_connector_state_to_vcs(connector->state)->is_implicit = true; |
|---|
| 431 | | - |
|---|
| 432 | 425 | |
|---|
| 433 | 426 | ret = drm_encoder_init(dev, encoder, &vmw_legacy_encoder_funcs, |
|---|
| 434 | 427 | DRM_MODE_ENCODER_VIRTUAL, NULL); |
|---|
| .. | .. |
|---|
| 447 | 440 | goto err_free_encoder; |
|---|
| 448 | 441 | } |
|---|
| 449 | 442 | |
|---|
| 450 | | - |
|---|
| 451 | | - vmw_du_crtc_reset(crtc); |
|---|
| 452 | 443 | ret = drm_crtc_init_with_planes(dev, crtc, &ldu->base.primary, |
|---|
| 453 | 444 | &ldu->base.cursor, |
|---|
| 454 | 445 | &vmw_legacy_crtc_funcs, NULL); |
|---|
| .. | .. |
|---|
| 513 | 504 | if (ret != 0) |
|---|
| 514 | 505 | goto err_free; |
|---|
| 515 | 506 | |
|---|
| 516 | | - vmw_kms_create_implicit_placement_property(dev_priv, true); |
|---|
| 507 | + vmw_kms_create_implicit_placement_property(dev_priv); |
|---|
| 517 | 508 | |
|---|
| 518 | 509 | if (dev_priv->capabilities & SVGA_CAP_MULTIMON) |
|---|
| 519 | 510 | for (i = 0; i < VMWGFX_NUM_DISPLAY_UNITS; ++i) |
|---|
| .. | .. |
|---|
| 522 | 513 | vmw_ldu_init(dev_priv, 0); |
|---|
| 523 | 514 | |
|---|
| 524 | 515 | dev_priv->active_display_unit = vmw_du_legacy; |
|---|
| 516 | + |
|---|
| 517 | + drm_mode_config_reset(dev); |
|---|
| 525 | 518 | |
|---|
| 526 | 519 | DRM_INFO("Legacy Display Unit initialized\n"); |
|---|
| 527 | 520 | |
|---|
| .. | .. |
|---|
| 561 | 554 | } *cmd; |
|---|
| 562 | 555 | |
|---|
| 563 | 556 | 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)) |
|---|
| 567 | 559 | return -ENOMEM; |
|---|
| 568 | | - } |
|---|
| 569 | 560 | |
|---|
| 570 | 561 | memset(cmd, 0, fifo_size); |
|---|
| 571 | 562 | for (i = 0; i < num_clips; i++, clips += increment) { |
|---|