Skip to content

Commit 5afe823

Browse files
geertuThomas Zimmermann
authored andcommitted
drm: shmobile: Switch to drm_crtc_init_with_planes()
The SH-Mobile DRM driver uses the legacy drm_crtc_init(), which advertizes only the formats in safe_modeset_formats[] (XR24 and AR24) as being supported. Switch to drm_crtc_init_with_planes(), and advertize all supported (A)RGB modes, so we can use RGB565 as the default mode for the console. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/2098de3d33bc479a8569da7dcbafdb685ff0a13a.1684854992.git.geert+renesas@glider.be
1 parent 2a98bad commit 5afe823

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

drivers/gpu/drm/shmobile/shmob_drm_crtc.c

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <drm/drm_gem_dma_helper.h>
1919
#include <drm/drm_modeset_helper.h>
2020
#include <drm/drm_modeset_helper_vtables.h>
21+
#include <drm/drm_plane_helper.h>
2122
#include <drm/drm_probe_helper.h>
2223
#include <drm/drm_simple_kms_helper.h>
2324
#include <drm/drm_vblank.h>
@@ -478,16 +479,41 @@ static const struct drm_crtc_funcs crtc_funcs = {
478479
.disable_vblank = shmob_drm_disable_vblank,
479480
};
480481

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+
481493
int shmob_drm_crtc_create(struct shmob_drm_device *sdev)
482494
{
483495
struct drm_crtc *crtc = &sdev->crtc.crtc;
496+
struct drm_plane *primary;
484497
int ret;
485498

486499
sdev->crtc.dpms = DRM_MODE_DPMS_OFF;
487500

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);
490515
return ret;
516+
}
491517

492518
drm_crtc_helper_add(crtc, &crtc_helper_funcs);
493519

0 commit comments

Comments
 (0)