Skip to content
Permalink
Browse files Browse the repository at this point in the history
HACK: drm/msm/dpu: Give each CRTC a dedicated cursor and primary
Some DE compositors like GNOME's mutter can't handle way too good msm
driver. Handicap it to meet the mistaken expectations of the userspace.

This patch is taken from CROS with minor modifications.

Link: https://chromium.googlesource.com/chromiumos/third_party/kernel/+/30aef5779b6108baaea00750064338bf0ed145c2%5E%21/
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
  • Loading branch information
TravMurav authored and 0x011011110 committed May 15, 2023
1 parent 514850c commit 2b0cc2e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
17 changes: 13 additions & 4 deletions drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
Expand Up @@ -726,6 +726,8 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
struct drm_crtc *crtc;
struct drm_encoder *encoder;
unsigned int num_encoders;
unsigned primary_idx = 0;
unsigned cursor_idx = 0;

struct msm_drm_private *priv;
const struct dpu_mdss_cfg *catalog;
Expand Down Expand Up @@ -753,21 +755,28 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
/* Create the planes, keeping track of one primary/cursor per crtc */
for (i = 0; i < catalog->sspp_count; i++) {
enum drm_plane_type type;
unsigned possible_crtcs;

if ((catalog->sspp[i].features & BIT(DPU_SSPP_CURSOR))
&& cursor_planes_idx < max_crtc_count)
&& cursor_planes_idx < max_crtc_count) {
type = DRM_PLANE_TYPE_CURSOR;
else if (primary_planes_idx < max_crtc_count)
possible_crtcs = BIT(cursor_idx);
cursor_idx++;
} else if (primary_planes_idx < max_crtc_count) {
type = DRM_PLANE_TYPE_PRIMARY;
else
possible_crtcs = BIT(primary_idx);
primary_idx++;
} else {
type = DRM_PLANE_TYPE_OVERLAY;
possible_crtcs = (1UL << max_crtc_count) - 1;
}

DPU_DEBUG("Create plane type %d with features %lx (cur %lx)\n",
type, catalog->sspp[i].features,
catalog->sspp[i].features & BIT(DPU_SSPP_CURSOR));

plane = dpu_plane_init(dev, catalog->sspp[i].id, type,
(1UL << max_crtc_count) - 1);
possible_crtcs);
if (IS_ERR(plane)) {
DPU_ERROR("dpu_plane_init failed\n");
ret = PTR_ERR(plane);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
Expand Up @@ -1496,7 +1496,7 @@ struct drm_plane *dpu_plane_init(struct drm_device *dev,
format_list = pdpu->pipe_hw->cap->sblk->format_list;
num_formats = pdpu->pipe_hw->cap->sblk->num_formats;

ret = drm_universal_plane_init(dev, plane, 0xff, &dpu_plane_funcs,
ret = drm_universal_plane_init(dev, plane, possible_crtcs, &dpu_plane_funcs,
format_list, num_formats,
supported_format_modifiers, type, NULL);
if (ret)
Expand Down

0 comments on commit 2b0cc2e

Please sign in to comment.