[PATCH 00/12] drm: Put drm_display_mode on diet

Ville Syrjala
2020-02-19T20:35:49Z

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

struct drm_display_mode is extremely fat. Put it on diet.

Some stats for the whole series:

64bit sizeof(struct drm_display_mode):
200 -> 136 bytes (-32%)

64bit bloat-o-meter -c drm.ko:
add/remove: 1/0 grow/shrink: 29/47 up/down: 893/-1544 (-651)
Function old new delta
...
Total: Before=189430, After=188779, chg -0.34%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Data old new delta
Total: Before=11667, After=11667, chg +0.00%
add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-16896 (-16896)
RO Data old new delta
edid_4k_modes 1000 680 -320
edid_est_modes 3400 2312 -1088
edid_cea_modes_193 5400 3672 -1728
drm_dmt_modes 17600 11968 -5632
edid_cea_modes_1 25400 17272 -8128
Total: Before=71239, After=54343, chg -23.72%

64bit bloat-o-meter drm.ko:
add/remove: 1/0 grow/shrink: 29/52 up/down: 893/-18440 (-17547)
...
Total: Before=272336, After=254789, chg -6.44%

32bit sizeof(struct drm_display_mode):
184 -> 120 bytes (-34%)

32bit bloat-o-meter -c drm.ko
add/remove: 1/0 grow/shrink: 19/21 up/down: 743/-1368 (-625)
Function old new delta
...
Total: Before=172359, After=171734, chg -0.36%
add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0 (0)
Data old new delta
Total: Before=4227, After=4227, chg +0.00%
add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-16896 (-16896)
RO Data old new delta
edid_4k_modes 920 600 -320
edid_est_modes 3128 2040 -1088
edid_cea_modes_193 4968 3240 -1728
drm_dmt_modes 16192 10560 -5632
edid_cea_modes_1 23368 15240 -8128
Total: Before=59230, After=42334, chg -28.53%

32bit bloat-o-meter drm.ko:
add/remove: 1/0 grow/shrink: 19/26 up/down: 743/-18264 (-17521)
...
Total: Before=235816, After=218295, chg -7.43%

Some ideas for further reduction:
- Convert mode->name to a pointer (saves 24/28 bytes in the
struct but would often require a heap alloc for the name (though
typical mode name is <10 bytes so still overall win perhaps)
- Get rid of mode->name entirely? I guess setcrtc & co. is the only
place where we have to preserve the user provided name, elsewhere
could pehaps just generate on demand? Not sure how tricky this
would get.
- Eliminate the second list head somehow?

Pie in the sky idea:
- Eliminate the normal vs. crtc_ dual timings where not needed. Ie.
Just use two structs if necessary instead of packing both to the
same struct. Can't imagine this being an easy conversion.

Entire series available here:
git://github.com/vsyrjala/linux.git drm_mode_diet_4

Ville Syrjälä (12):
drm: Nuke mode->hsync
drm/exynos: Use mode->clock instead of reverse calculating it from the
vrefresh
drm/i915: Introduce some local intel_dp variables
drm: Nuke mode->vrefresh
drm/msm/dpu: Stop copying around mode->private_flags
drm: Shrink {width,height}_mm to u16
drm: Shrink mode->type to u8
drm: Make mode->flags u32
drm: Shrink drm_display_mode timings
drm: Flatten drm_mode_vrefresh()
drm: Shrink mode->private_flags
drm: pahole struct drm_display_mode

drivers/gpu/drm/bridge/sii902x.c | 2 +-
drivers/gpu/drm/drm_client_modeset.c | 2 +-
drivers/gpu/drm/drm_edid.c | 328 +++++++++---------
drivers/gpu/drm/drm_modes.c | 54 +--
drivers/gpu/drm/drm_probe_helper.c | 3 -
drivers/gpu/drm/exynos/exynos7_drm_decon.c | 2 +-
drivers/gpu/drm/exynos/exynos_hdmi.c | 5 +-
drivers/gpu/drm/exynos/exynos_mixer.c | 2 +-
drivers/gpu/drm/i2c/ch7006_mode.c | 1 -
drivers/gpu/drm/i915/display/intel_display.c | 2 -
.../drm/i915/display/intel_display_debugfs.c | 4 +-
drivers/gpu/drm/i915/display/intel_dp.c | 24 +-
drivers/gpu/drm/i915/display/intel_tv.c | 3 -
drivers/gpu/drm/mcde/mcde_dsi.c | 6 +-
drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 4 +-
drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +-
drivers/gpu/drm/meson/meson_venc_cvbs.c | 2 -
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 29 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h | 10 +-
drivers/gpu/drm/nouveau/nouveau_connector.c | 5 +-
drivers/gpu/drm/panel/panel-arm-versatile.c | 4 -
drivers/gpu/drm/panel/panel-boe-himax8279d.c | 3 +-
.../gpu/drm/panel/panel-boe-tv101wum-nl6.c | 6 +-
.../gpu/drm/panel/panel-feixin-k101-im2ba02.c | 3 +-
.../drm/panel/panel-feiyang-fy07024di26a30d.c | 3 +-
drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 7 -
drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 3 +-
drivers/gpu/drm/panel/panel-innolux-p079zca.c | 4 +-
.../gpu/drm/panel/panel-jdi-lt070me05000.c | 3 +-
.../drm/panel/panel-kingdisplay-kd097d04.c | 3 +-
.../drm/panel/panel-leadtek-ltk500hd1829.c | 3 +-
drivers/gpu/drm/panel/panel-lg-lb035q02.c | 1 -
drivers/gpu/drm/panel/panel-lg-lg4573.c | 3 +-
drivers/gpu/drm/panel/panel-nec-nl8048hl11.c | 1 -
drivers/gpu/drm/panel/panel-novatek-nt39016.c | 1 -
.../drm/panel/panel-olimex-lcd-olinuxino.c | 1 -
.../gpu/drm/panel/panel-orisetech-otm8009a.c | 3 +-
.../drm/panel/panel-osd-osd101t2587-53ts.c | 3 +-
.../drm/panel/panel-panasonic-vvx10f034n00.c | 3 +-
.../drm/panel/panel-raspberrypi-touchscreen.c | 4 +-
drivers/gpu/drm/panel/panel-raydium-rm67191.c | 3 +-
drivers/gpu/drm/panel/panel-raydium-rm68200.c | 3 +-
.../drm/panel/panel-rocktech-jh057n00900.c | 5 +-
drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 1 -
drivers/gpu/drm/panel/panel-samsung-s6d16d0.c | 6 -
drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c | 4 +-
.../gpu/drm/panel/panel-samsung-s6e63j0x03.c | 3 +-
drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 3 +-
.../panel/panel-samsung-s6e88a0-ams452ef01.c | 1 -
drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 3 +-
.../gpu/drm/panel/panel-sharp-lq101r1sx01.c | 3 +-
.../gpu/drm/panel/panel-sharp-ls037v7dw01.c | 1 -
.../gpu/drm/panel/panel-sharp-ls043t1le01.c | 3 +-
drivers/gpu/drm/panel/panel-simple.c | 85 +----
drivers/gpu/drm/panel/panel-sitronix-st7701.c | 2 +-
.../gpu/drm/panel/panel-sitronix-st7789v.c | 3 +-
drivers/gpu/drm/panel/panel-sony-acx424akp.c | 2 -
drivers/gpu/drm/panel/panel-sony-acx565akm.c | 1 -
drivers/gpu/drm/panel/panel-tpo-td028ttec1.c | 1 -
drivers/gpu/drm/panel/panel-tpo-td043mtea1.c | 1 -
drivers/gpu/drm/panel/panel-tpo-tpg110.c | 5 -
drivers/gpu/drm/panel/panel-truly-nt35597.c | 1 -
.../gpu/drm/panel/panel-xinpeng-xpp055c272.c | 3 +-
drivers/gpu/drm/sti/sti_hda.c | 1 -
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 -
include/drm/drm_modes.h | 211 +++++------
66 files changed, 341 insertions(+), 568 deletions(-)

--
2.24.1