• Arnd Bergmann's avatar
    drm/exynos: g2d: use monotonic timestamps · a588a8bb
    Arnd Bergmann authored
    The exynos DRM driver uses real-time 'struct timeval' values
    for exporting its timestamps to user space. This has multiple
    problems:
    
    1. signed seconds overflow in y2038
    2. the 'struct timeval' definition is deprecated in the kernel
    3. time may jump or go backwards after a 'settimeofday()' syscall
    4. other DRM timestamps are in CLOCK_MONOTONIC domain, so they
       can't be compared
    5. exporting microseconds requires a division by 1000, which may
       be slow on some architectures.
    
    The code existed in two places before, but the IPP portion was
    removed in 8ded5941 ("drm/exynos: ipp: Remove Exynos DRM
    IPP subsystem"), so we no longer need to worry about it.
    
    Ideally timestamps should just use 64-bit nanoseconds instead, but
    of course we can't change that now. Instead, this tries to address
    the first four points above by using monotonic 'timespec' values.
    
    According to Tobias Jakobi, user space doesn't care about the
    timestamp at the moment, so we can change the format. Even if
    there is something looking at them, it will work just fine with
    monotonic times as long as the application only looks at the
    relative values between two events.
    
    Link: https://patchwork.kernel.org/patch/10038593/
    Cc: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
    Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
    Reviewed-by: default avatarTobias Jakobi <tjakobi@math.uni-bielefeld.de>
    Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
    a588a8bb
exynos_drm_g2d.c 40.4 KB