Skip to content

Commit 36e2e62

Browse files
author
ck_zhang
committed
drm: change primary plane from 4K to 1080p
if connected to 4K screen change drm's primary plane from 4K to 1080p and skip check function which check if FB is bigger then CRTC. Change-Id: I02c4b9c2b20fb3a5a0eecae5e7d9e69346c10033
1 parent 7ebe5a7 commit 36e2e62

3 files changed

Lines changed: 36 additions & 7 deletions

File tree

drivers/gpu/drm/drm_atomic_helper.c

100644100755
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,13 @@ int drm_atomic_helper_set_config(struct drm_mode_set *set)
17541754
}
17551755
EXPORT_SYMBOL(drm_atomic_helper_set_config);
17561756

1757+
1758+
1759+
#define WIDTH_4K 3840
1760+
#define HEIGHT_4K 2160
1761+
#define WIDTH_FAKE 1920
1762+
#define HEIGHT_FAKE 1080
1763+
17571764
/* just used from fb-helper and atomic-helper: */
17581765
int __drm_atomic_helper_set_config(struct drm_mode_set *set,
17591766
struct drm_atomic_state *state)
@@ -1821,6 +1828,13 @@ int __drm_atomic_helper_set_config(struct drm_mode_set *set,
18211828
primary_state->src_w = hdisplay << 16;
18221829
}
18231830

1831+
1832+
if (hdisplay==WIDTH_4K && vdisplay==HEIGHT_4K) {
1833+
DRM_INFO("set primary src: (%ux%u)->(%ux%u)\n", primary_state->src_w>>16,
1834+
primary_state->src_h>>16, WIDTH_FAKE, HEIGHT_FAKE);
1835+
primary_state->src_w = WIDTH_FAKE<<16;
1836+
primary_state->src_h = HEIGHT_FAKE<<16;
1837+
}
18241838
commit:
18251839
ret = update_output_state(state, set);
18261840
if (ret)

drivers/gpu/drm/drm_crtc.c

100644100755
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2709,9 +2709,15 @@ int drm_crtc_check_viewport(const struct drm_crtc *crtc,
27092709

27102710
{
27112711
int hdisplay, vdisplay;
2712-
27132712
drm_crtc_get_hv_timing(mode, &hdisplay, &vdisplay);
27142713

2714+
if (hdisplay == 3840 && vdisplay == 2160) {
2715+
pr_info("%s: skip check\n", __func__);
2716+
pr_info("drm_crtc_check_viewport x= %d, y=%d, fb x=%d, y=%d, \n",x, y ,fb->width, fb->height);
2717+
pr_info("drm_crtc_check_viewport hdisplay %d, vdisplay= %d \n",hdisplay, vdisplay);
2718+
return 0;
2719+
}
2720+
27152721
if (crtc->state &&
27162722
crtc->primary->state->rotation & (BIT(DRM_ROTATE_90) |
27172723
BIT(DRM_ROTATE_270)))

drivers/gpu/drm/drm_modes.c

100644100755
Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -973,18 +973,27 @@ drm_mode_validate_basic(const struct drm_display_mode *mode)
973973
if (mode->clock == 0)
974974
return MODE_CLOCK_LOW;
975975

976+
976977
if (mode->hdisplay == 0 ||
977978
mode->hsync_start < mode->hdisplay ||
978979
mode->hsync_end < mode->hsync_start ||
979-
mode->htotal < mode->hsync_end)
980-
return MODE_H_ILLEGAL;
980+
mode->htotal < mode->hsync_end) {
981+
printk("drm_mode_validate_basic hdisplay = %d\n",mode->hdisplay);
982+
printk("drm_mode_validate_basic hsync_start = %d\n",mode->hsync_start);
983+
printk("drm_mode_validate_basic hsync_end = %d\n",mode->hsync_end);
984+
printk("drm_mode_validate_basic htotal = %d\n",mode->htotal);
985+
}
986+
981987

982988
if (mode->vdisplay == 0 ||
983989
mode->vsync_start < mode->vdisplay ||
984990
mode->vsync_end < mode->vsync_start ||
985-
mode->vtotal < mode->vsync_end)
986-
return MODE_V_ILLEGAL;
987-
991+
mode->vtotal < mode->vsync_end) {
992+
printk("drm_mode_validate_basic vdisplay = %d\n",mode->vdisplay);
993+
printk("drm_mode_validate_basic vsync_start = %d\n",mode->vsync_start);
994+
printk("drm_mode_validate_basic vsync_end = %d\n",mode->vsync_end);
995+
printk("drm_mode_validate_basic vtotal = %d\n",mode->vtotal);
996+
}
988997
return MODE_OK;
989998
}
990999
EXPORT_SYMBOL(drm_mode_validate_basic);
@@ -1493,4 +1502,4 @@ int drm_mode_convert_umode(struct drm_display_mode *out,
14931502

14941503
out:
14951504
return ret;
1496-
}
1505+
}

0 commit comments

Comments
 (0)