Message ID | 20190903181711.7559-4-ezequiel@collabora.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Enable Hantro G1 post-processor | expand |
On Tue, 2019-09-03 at 15:17 -0300, Ezequiel Garcia wrote: > Introduce a helper to allow easier enablement of the post-processing > feature. No functional changes intended. > > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> > --- > drivers/staging/media/hantro/hantro.h | 6 ++++++ > drivers/staging/media/hantro/hantro_v4l2.c | 4 ++-- > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h > index deb90ae37859..e8872f24e351 100644 > --- a/drivers/staging/media/hantro/hantro.h > +++ b/drivers/staging/media/hantro/hantro.h > @@ -381,4 +381,10 @@ hantro_get_dst_buf(struct hantro_ctx *ctx) > return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); > } > > +static inline unsigned int > +hantro_h264_buffer_extra_size(unsigned int width, unsigned int height) > +{ > + return 128 * MB_WIDTH(width) * MB_HEIGHT(height); > +} This doesn't seem to be used or modified by patch 4 at all? > + > #endif /* HANTRO_H_ */ > diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c > index d48b548842cf..59adecba0e85 100644 > --- a/drivers/staging/media/hantro/hantro_v4l2.c > +++ b/drivers/staging/media/hantro/hantro_v4l2.c > @@ -246,8 +246,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f, > */ > if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE) > pix_mp->plane_fmt[0].sizeimage += > - 128 * DIV_ROUND_UP(pix_mp->width, 16) * > - DIV_ROUND_UP(pix_mp->height, 16); > + hantro_h264_buffer_extra_size(pix_mp->width, > + pix_mp->height); > } else if (!pix_mp->plane_fmt[0].sizeimage) { > /* > * For coded formats the application can specify regards Philipp
On Wed, 2019-09-04 at 12:17 +0200, Philipp Zabel wrote: > On Tue, 2019-09-03 at 15:17 -0300, Ezequiel Garcia wrote: > > Introduce a helper to allow easier enablement of the post-processing > > feature. No functional changes intended. > > > > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> > > --- > > drivers/staging/media/hantro/hantro.h | 6 ++++++ > > drivers/staging/media/hantro/hantro_v4l2.c | 4 ++-- > > 2 files changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h > > index deb90ae37859..e8872f24e351 100644 > > --- a/drivers/staging/media/hantro/hantro.h > > +++ b/drivers/staging/media/hantro/hantro.h > > @@ -381,4 +381,10 @@ hantro_get_dst_buf(struct hantro_ctx *ctx) > > return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); > > } > > > > +static inline unsigned int > > +hantro_h264_buffer_extra_size(unsigned int width, unsigned int height) > > + > > + return 128 * MB_WIDTH(width) * MB_HEIGHT(height); > > +} > > This doesn't seem to be used or modified by patch 4 at all? > Oh, thanks for spotting this. Indeed, this patch is superflous. The helper was used, but then after cleaning-up hantro_postproc.c I realized it wasn't needed. We can drop this one, but OTOH hiding the H264 extra size seems a nice cleanup. Perhaps Jonas can grab this patch as part of his improvements series. Thanks, Ezequiel
diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/hantro/hantro.h index deb90ae37859..e8872f24e351 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -381,4 +381,10 @@ hantro_get_dst_buf(struct hantro_ctx *ctx) return v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); } +static inline unsigned int +hantro_h264_buffer_extra_size(unsigned int width, unsigned int height) +{ + return 128 * MB_WIDTH(width) * MB_HEIGHT(height); +} + #endif /* HANTRO_H_ */ diff --git a/drivers/staging/media/hantro/hantro_v4l2.c b/drivers/staging/media/hantro/hantro_v4l2.c index d48b548842cf..59adecba0e85 100644 --- a/drivers/staging/media/hantro/hantro_v4l2.c +++ b/drivers/staging/media/hantro/hantro_v4l2.c @@ -246,8 +246,8 @@ static int vidioc_try_fmt(struct file *file, void *priv, struct v4l2_format *f, */ if (ctx->vpu_src_fmt->fourcc == V4L2_PIX_FMT_H264_SLICE) pix_mp->plane_fmt[0].sizeimage += - 128 * DIV_ROUND_UP(pix_mp->width, 16) * - DIV_ROUND_UP(pix_mp->height, 16); + hantro_h264_buffer_extra_size(pix_mp->width, + pix_mp->height); } else if (!pix_mp->plane_fmt[0].sizeimage) { /* * For coded formats the application can specify
Introduce a helper to allow easier enablement of the post-processing feature. No functional changes intended. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> --- drivers/staging/media/hantro/hantro.h | 6 ++++++ drivers/staging/media/hantro/hantro_v4l2.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-)