dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 00/12] drm: Put drm_display_mode on diet
Date: Thu, 20 Feb 2020 17:01:58 +0000	[thread overview]
Message-ID: <CACvgo53R9aZcznHbBcmeocPJdoLW=jNrNdfY8A8g0uFEdBKJ6g@mail.gmail.com> (raw)
In-Reply-To: <20200220142759.GA13686@intel.com>

On Thu, 20 Feb 2020 at 14:28, Ville Syrjälä
<ville.syrjala@linux.intel.com> wrote:
>
> On Thu, Feb 20, 2020 at 01:21:03PM +0000, Emil Velikov wrote:
> > On Wed, 19 Feb 2020 at 20:35, Ville Syrjala
> > <ville.syrjala@linux.intel.com> wrote:
> > >
> > > 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.
> >
> > The series does some great work, with future work reaching the cache
> > line for 64bit.
> > Doing much more than that might be an overkill IMHO.
> >
> > In particular, if we change DRM_DISPLAY_MODE_LEN to 24 we get there,
> > avoiding the heap alloc/calc on demand fun.
> > While also ensuring the name is sufficiently large for the next decade or so.
>
> Unfortunately it's part of the uabi. So can't change it without some
> risk of userspace breakage.
>
Right the define is in the uABI. More importantly userspace can
provide a drm_mode_modeinfo blob, with a name[32], which we cannot
store in the kernel drm_display_mode::name[24].

One might get away with returning -EINVAL if the actual name given by
the user is > 24.
Since you've found a better way, there's on point in risking it.

-Emil
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2020-02-20 17:02 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 20:35 [PATCH 00/12] drm: Put drm_display_mode on diet Ville Syrjala
2020-02-19 20:35 ` [PATCH 01/12] drm: Nuke mode->hsync Ville Syrjala
2020-02-20 10:55   ` [Intel-gfx] " Emil Velikov
2020-02-21 16:04     ` Ville Syrjälä
2020-02-21 16:55       ` Emil Velikov
2020-02-19 20:35 ` [PATCH 02/12] drm/exynos: Use mode->clock instead of reverse calculating it from the vrefresh Ville Syrjala
2020-02-20 10:56   ` Emil Velikov
2020-02-25  0:49     ` Inki Dae
2020-02-19 20:35 ` [PATCH 03/12] drm/i915: Introduce some local intel_dp variables Ville Syrjala
2020-02-20 11:13   ` [Intel-gfx] " Emil Velikov
2020-02-19 20:35 ` [PATCH 04/12] drm: Nuke mode->vrefresh Ville Syrjala
2020-02-20 12:00   ` Emil Velikov
2020-02-22 12:32   ` Sam Ravnborg
2020-02-24 13:14     ` Ville Syrjälä
2020-02-24 14:14   ` Andrzej Hajda
2020-02-25 11:21     ` Ville Syrjälä
2020-02-25 15:19       ` Andrzej Hajda
2020-02-25 15:45         ` Ville Syrjälä
2020-02-25 19:27           ` Ville Syrjälä
2020-02-25 21:52             ` Linus Walleij
2020-02-19 20:35 ` [PATCH 05/12] drm/msm/dpu: Stop copying around mode->private_flags Ville Syrjala
2020-02-20 11:24   ` Emil Velikov
2020-02-20 15:33     ` Ville Syrjälä
2020-02-20 18:14       ` Daniel Vetter
2020-02-19 20:35 ` [PATCH 06/12] drm: Shrink {width,height}_mm to u16 Ville Syrjala
2020-02-20 12:48   ` [Intel-gfx] " Emil Velikov
2020-02-19 20:35 ` [PATCH 07/12] drm: Shrink mode->type to u8 Ville Syrjala
2020-02-20 18:17   ` [Intel-gfx] " Daniel Vetter
2020-02-19 20:35 ` [PATCH 08/12] drm: Make mode->flags u32 Ville Syrjala
2020-02-19 20:35 ` [PATCH 09/12] drm: Shrink drm_display_mode timings Ville Syrjala
2020-02-20 18:19   ` [Intel-gfx] " Daniel Vetter
2020-02-20 18:47     ` Ville Syrjälä
2020-02-21 16:13   ` Sam Ravnborg
2020-02-21 17:27   ` Sam Ravnborg
2020-02-24 13:06     ` Ville Syrjälä
2020-02-19 20:35 ` [PATCH 10/12] drm: Flatten drm_mode_vrefresh() Ville Syrjala
2020-02-19 20:35 ` [PATCH 11/12] drm: Shrink mode->private_flags Ville Syrjala
2020-02-21 16:15   ` Sam Ravnborg
2020-02-24 13:23     ` Ville Syrjälä
2020-02-19 20:35 ` [PATCH 12/12] drm: pahole struct drm_display_mode Ville Syrjala
2020-02-20 12:53   ` Emil Velikov
2020-02-19 21:18 ` [PATCH 00/12] drm: Put drm_display_mode on diet Ville Syrjälä
2020-02-20 13:21 ` Emil Velikov
2020-02-20 14:27   ` Ville Syrjälä
2020-02-20 15:34     ` [Intel-gfx] " Ville Syrjälä
2020-02-21 11:32       ` Jani Nikula
2020-02-21 11:43         ` Ville Syrjälä
2020-02-21 14:42           ` Daniel Vetter
2020-02-21 15:40             ` Ville Syrjälä
2020-02-21 16:09               ` Ville Syrjälä
2020-02-21 17:16                 ` Daniel Vetter
2020-02-21 17:49                   ` Ville Syrjälä
2020-02-20 17:01     ` Emil Velikov [this message]
2020-02-21 15:09 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACvgo53R9aZcznHbBcmeocPJdoLW=jNrNdfY8A8g0uFEdBKJ6g@mail.gmail.com' \
    --to=emil.l.velikov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).