• Michael Tretter's avatar
    media: verisilicon: Fix TRY_FMT on encoder OUTPUT · b3b4c9d3
    Michael Tretter authored
    Commit f100ce3b ("media: verisilicon: Fix crash when probing
    encoder") removed vpu_fmt from hantro_try_fmt(), since it was
    initialized from vpu_dst_fmt, which may not be initialized, when TRY_FMT
    is called. It was replaced by fmt, which is found using the pixelformat.
    
    For the encoder, this changed the fmt to contain the raw format instead
    of the coded format. The format constraints as of fmt->frmsize are only
    valid for the coded format and are 0 for the raw formats. Therefore, the
    size of a encoder OUTPUT device is constrained to 0 and the
    v4l2-compliance tests for G_FMT, TRY_FMT, and SET_FMT fail.
    
    Bring back vpu_fmt to use the coded format on an encoder OUTPUT device,
    but initialize it using the currently set pixelformat on dst_fmt, which
    is the coded format on an encoder.
    
    Fixes: f100ce3b ("media: verisilicon: Fix crash when probing encoder")
    Signed-off-by: default avatarMichael Tretter <m.tretter@pengutronix.de>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    b3b4c9d3
hantro_v4l2.c 26.6 KB