• Ville Syrjälä's avatar
    drm: Replace mode->export_head with a boolean · 8445e2c5
    Ville Syrjälä authored
    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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20200428171940.19552-17-ville.syrjala@linux.intel.comReviewed-by: default avatarEmil Velikov <emil.velikov@collabora.com>
    8445e2c5
drm_modes.h 17.9 KB