Message ID | 1507276303-19660-1-git-send-email-jorge.ramirez-ortiz@linaro.org |
---|---|
State | Accepted |
Commit | 2a31ad7d60632cca0f43986b6a5b135848088b14 |
Headers | show |
On 10/06/2017 09:51 AM, Jorge Ramirez-Ortiz wrote: > --- > libavcodec/v4l2_buffers.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) bug fix. needed in 3.4 > > diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c > index ef7d040..ba70c5d 100644 > --- a/libavcodec/v4l2_buffers.c > +++ b/libavcodec/v4l2_buffers.c > @@ -244,13 +244,23 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf) > > static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, AVBufferRef* bref) > { > + unsigned int bytesused, length; > + > if (plane >= out->num_planes) > return AVERROR(EINVAL); > > + bytesused = FFMIN(size, out->plane_info[plane].length); > + length = out->plane_info[plane].length; > + > memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); > > - out->planes[plane].bytesused = FFMIN(size, out->plane_info[plane].length); > - out->planes[plane].length = out->plane_info[plane].length; > + if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { > + out->planes[plane].bytesused = bytesused; > + out->planes[plane].length = length; > + } else { > + out->buf.bytesused = bytesused; > + out->buf.length = length; > + } > > return 0; > }
On 06/10/17 08:51, Jorge Ramirez-Ortiz wrote: > --- > libavcodec/v4l2_buffers.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c > index ef7d040..ba70c5d 100644 > --- a/libavcodec/v4l2_buffers.c > +++ b/libavcodec/v4l2_buffers.c > @@ -244,13 +244,23 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf) > > static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, AVBufferRef* bref) > { > + unsigned int bytesused, length; > + > if (plane >= out->num_planes) > return AVERROR(EINVAL); > > + bytesused = FFMIN(size, out->plane_info[plane].length); > + length = out->plane_info[plane].length; > + > memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); > > - out->planes[plane].bytesused = FFMIN(size, out->plane_info[plane].length); > - out->planes[plane].length = out->plane_info[plane].length; > + if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { > + out->planes[plane].bytesused = bytesused; > + out->planes[plane].length = length; > + } else { > + out->buf.bytesused = bytesused; > + out->buf.length = length; > + } > > return 0; > } > Can you clarify what devices are being fixed here? I believe there are two modes (single-plane, multi-plane) - of the devices known to work, do we know which modes they use? - Mark
On 10/06/2017 09:47 PM, Mark Thompson wrote: > On 06/10/17 08:51, Jorge Ramirez-Ortiz wrote: >> --- >> libavcodec/v4l2_buffers.c | 14 ++++++++++++-- >> 1 file changed, 12 insertions(+), 2 deletions(-) >> >> diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c >> index ef7d040..ba70c5d 100644 >> --- a/libavcodec/v4l2_buffers.c >> +++ b/libavcodec/v4l2_buffers.c >> @@ -244,13 +244,23 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf) >> >> static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, AVBufferRef* bref) >> { >> + unsigned int bytesused, length; >> + >> if (plane >= out->num_planes) >> return AVERROR(EINVAL); >> >> + bytesused = FFMIN(size, out->plane_info[plane].length); >> + length = out->plane_info[plane].length; >> + >> memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); >> >> - out->planes[plane].bytesused = FFMIN(size, out->plane_info[plane].length); >> - out->planes[plane].length = out->plane_info[plane].length; >> + if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { >> + out->planes[plane].bytesused = bytesused; >> + out->planes[plane].length = length; >> + } else { >> + out->buf.bytesused = bytesused; >> + out->buf.length = length; >> + } >> >> return 0; >> } >> > Can you clarify what devices are being fixed here? I believe there are two modes (single-plane, multi-plane) - of the devices known to work, do we know which modes they use? venus driver in Qualcomm SoC - 96Bords db410c[1] - > multiplanar coda driver for Imx6 - cubox[2] -> single plane [1] https://www.96boards.org/product/dragonboard410c/ [2] https://www.solid-run.com/freescale-imx6-family/cubox-i/ the patch above fixes single plan decoding > > - Mark > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On 06/10/17 22:25, Jorge Ramirez-Ortiz wrote: > On 10/06/2017 09:47 PM, Mark Thompson wrote: >> On 06/10/17 08:51, Jorge Ramirez-Ortiz wrote: >>> --- >>> libavcodec/v4l2_buffers.c | 14 ++++++++++++-- >>> 1 file changed, 12 insertions(+), 2 deletions(-) >>> >>> diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c >>> index ef7d040..ba70c5d 100644 >>> --- a/libavcodec/v4l2_buffers.c >>> +++ b/libavcodec/v4l2_buffers.c >>> @@ -244,13 +244,23 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf) >>> static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, AVBufferRef* bref) >>> { >>> + unsigned int bytesused, length; >>> + >>> if (plane >= out->num_planes) >>> return AVERROR(EINVAL); >>> + bytesused = FFMIN(size, out->plane_info[plane].length); >>> + length = out->plane_info[plane].length; >>> + >>> memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); >>> - out->planes[plane].bytesused = FFMIN(size, out->plane_info[plane].length); >>> - out->planes[plane].length = out->plane_info[plane].length; >>> + if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { >>> + out->planes[plane].bytesused = bytesused; >>> + out->planes[plane].length = length; >>> + } else { >>> + out->buf.bytesused = bytesused; >>> + out->buf.length = length; >>> + } >>> return 0; >>> } >>> >> Can you clarify what devices are being fixed here? I believe there are two modes (single-plane, multi-plane) - of the devices known to work, do we know which modes they use? > > venus driver in Qualcomm SoC - 96Bords db410c[1] - > multiplanar > coda driver for Imx6 - cubox[2] -> single plane > > [1] https://www.96boards.org/product/dragonboard410c/ > [2] https://www.solid-run.com/freescale-imx6-family/cubox-i/ > > the patch above fixes single plan decoding Ok, good to know that this case is now tested. LGTM, and applied. Thanks, - Mark
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c index ef7d040..ba70c5d 100644 --- a/libavcodec/v4l2_buffers.c +++ b/libavcodec/v4l2_buffers.c @@ -244,13 +244,23 @@ static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf) static int v4l2_bufref_to_buf(V4L2Buffer *out, int plane, const uint8_t* data, int size, AVBufferRef* bref) { + unsigned int bytesused, length; + if (plane >= out->num_planes) return AVERROR(EINVAL); + bytesused = FFMIN(size, out->plane_info[plane].length); + length = out->plane_info[plane].length; + memcpy(out->plane_info[plane].mm_addr, data, FFMIN(size, out->plane_info[plane].length)); - out->planes[plane].bytesused = FFMIN(size, out->plane_info[plane].length); - out->planes[plane].length = out->plane_info[plane].length; + if (V4L2_TYPE_IS_MULTIPLANAR(out->buf.type)) { + out->planes[plane].bytesused = bytesused; + out->planes[plane].length = length; + } else { + out->buf.bytesused = bytesused; + out->buf.length = length; + } return 0; }