• Alexandre Courbot's avatar
    media/gpu/v4l2vea: allocate as many buffers as possible in DMABUF mode · 414e7336
    Alexandre Courbot authored
    If we are operating in DMABUF mode, then we will try to keep the same
    frame assigned to the same V4L2 buffer. However we don't know in advance
    how many different frames the encoder will use, only that it is probably
    larger than the default 2 we are currently allocating. If we undershoot
    then we will spend a lot of time in-kernel unmapping/remapping DMABUFs.
    
    Try to prevent this by allocating as many buffers as allowed by the V4L2
    API (32) when operating in DMABUF mode. Since these buffers won't have
    backing memory unless we attach a DMABUF to them, they are virtually
    free if unused.
    
    BUG=b:159688625
    BUG=b:167412992
    TEST=video.EncodeAccel.h264_360p_i420 passes on Kukui.
    
    Change-Id: Ia24a6bd8574f5d3894237ca0e563ea4cbff3a631
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2415911
    Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
    Reviewed-by: default avatarFritz Koenig <frkoenig@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#813545}
    414e7336
v4l2_video_encode_accelerator.cc 66.6 KB