|
18 | 18 | #include <drm/drm_gem_dma_helper.h>
|
19 | 19 | #include <drm/drm_modeset_helper.h>
|
20 | 20 | #include <drm/drm_modeset_helper_vtables.h>
|
| 21 | +#include <drm/drm_plane_helper.h> |
21 | 22 | #include <drm/drm_probe_helper.h>
|
22 | 23 | #include <drm/drm_simple_kms_helper.h>
|
23 | 24 | #include <drm/drm_vblank.h>
|
@@ -478,16 +479,41 @@ static const struct drm_crtc_funcs crtc_funcs = {
|
478 | 479 | .disable_vblank = shmob_drm_disable_vblank,
|
479 | 480 | };
|
480 | 481 |
|
| 482 | +static const uint32_t modeset_formats[] = { |
| 483 | + DRM_FORMAT_RGB565, |
| 484 | + DRM_FORMAT_RGB888, |
| 485 | + DRM_FORMAT_ARGB8888, |
| 486 | + DRM_FORMAT_XRGB8888, |
| 487 | +}; |
| 488 | + |
| 489 | +static const struct drm_plane_funcs primary_plane_funcs = { |
| 490 | + DRM_PLANE_NON_ATOMIC_FUNCS, |
| 491 | +}; |
| 492 | + |
481 | 493 | int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
|
482 | 494 | {
|
483 | 495 | struct drm_crtc *crtc = &sdev->crtc.crtc;
|
| 496 | + struct drm_plane *primary; |
484 | 497 | int ret;
|
485 | 498 |
|
486 | 499 | sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
|
487 | 500 |
|
488 |
| - ret = drm_crtc_init(sdev->ddev, crtc, &crtc_funcs); |
489 |
| - if (ret < 0) |
| 501 | + primary = __drm_universal_plane_alloc(sdev->ddev, sizeof(*primary), 0, |
| 502 | + 0, &primary_plane_funcs, |
| 503 | + modeset_formats, |
| 504 | + ARRAY_SIZE(modeset_formats), |
| 505 | + NULL, DRM_PLANE_TYPE_PRIMARY, |
| 506 | + NULL); |
| 507 | + if (IS_ERR(primary)) |
| 508 | + return PTR_ERR(primary); |
| 509 | + |
| 510 | + ret = drm_crtc_init_with_planes(sdev->ddev, crtc, primary, NULL, |
| 511 | + &crtc_funcs, NULL); |
| 512 | + if (ret < 0) { |
| 513 | + drm_plane_cleanup(primary); |
| 514 | + kfree(primary); |
490 | 515 | return ret;
|
| 516 | + } |
491 | 517 |
|
492 | 518 | drm_crtc_helper_add(crtc, &crtc_helper_funcs);
|
493 | 519 |
|
|
0 commit comments