OSDN Git Service

drm: Replace mode->export_head with a boolean
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 28 Apr 2020 17:19:40 +0000 (20:19 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 1 Sep 2020 10:38:34 +0000 (13:38 +0300)
commit8445e2c54c257e92084a451a0f20d6a7f3f9fa34
tree0adb1fa4c33305ec7aa79747402605fc31a3c191
parent0e09c4fa72f9837ea8d78cb40ab0b52ff3252ea2
drm: Replace mode->export_head with a boolean

In order to shrink drm_display_mode below the magic two cacheline
mark in 64bit we need to shrink it by another 8 bytes. The easiest
thing to eliminate is the 'export_head' list head which is only
used during the getconnector ioctl to temporarly track which modes
on the connector's mode list are to be exposed and which are to
remain hidden.

We can simply replace the list head with a boolean which we use
to tag the modes that are to be exposed. If we make sure to clear
the tags after we're done with them we don't even need an extra
loop over the modes to reset the tags at the start of the
getconnector ioctl.

Conveniently we already have a hole for the boolean left
behind by the removal of mode->private_flags. The final size
of the struct is now 112 bytes on 32bit and 120 bytes on 64bit.

Another alternative would be a temp bitmask so we wouldn't have
to have anything in the mode struct itself. The main issue is
how large of a bitmask do we need? I guess we could allocate
it dynamically but that means an extra kcalloc() and an extra
loop through the modes to count them first (or grow the bitmask
with krealloc() as needed).

CC: Sam Ravnborg <sam@ravnborg.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200428171940.19552-17-ville.syrjala@linux.intel.com
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
drivers/gpu/drm/drm_connector.c
include/drm/drm_modes.h