On Fri, May 29, 2020 at 2:26 PM Jerry-ch Chen <Jerry-ch.Chen@xxxxxxxxxxxx> wrote: > > Hi Tomasz, > > I Appreciate your review comments, here's the reply. > > On Mon, 2020-05-25 at 14:24 +0200, Tomasz Figa wrote: > > r > > > > On Fri, May 22, 2020 at 4:11 PM Jerry-ch Chen > > <Jerry-ch.Chen@xxxxxxxxxxxx> wrote: > > > > > > Hi Tomasz, > > > > > > On Thu, 2020-05-21 at 18:28 +0000, Tomasz Figa wrote: > > > > Hi Jerry, > > > > > > > > On Wed, Dec 04, 2019 at 08:47:32PM +0800, Jerry-ch Chen wrote: [snip] > > Isn't still a need to clamp() width and height to min/max, though? > Yes, I'll add them back. > > This function will be refined as : > > static void mtk_fd_fill_pixfmt_mp(struct v4l2_pix_format_mplane *dfmt, > u32 pixfmt) > { > v4l2_fill_pixfmt_mp(dfmt, pixfmt, dfmt->width, dfmt->height); > > dfmt->field = V4L2_FIELD_NONE; > dfmt->colorspace = V4L2_COLORSPACE_BT2020; > dfmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; > dfmt->quantization = V4L2_QUANTIZATION_DEFAULT; > dfmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(dfmt->colorspace); > > /* Keep user setting as possible */ > dfmt->width = clamp(dfmt->width, > MTK_FD_OUTPUT_MIN_WIDTH, > MTK_FD_OUTPUT_MAX_WIDTH); > dfmt->height = clamp(dfmt->height, > MTK_FD_OUTPUT_MIN_HEIGHT, > MTK_FD_OUTPUT_MAX_HEIGHT); Note that this would cause the other fields of dfmt to be inconsistent with width and height. The correct way to do this would be to first clamp and then call v4l2_fill_pixfmt_mp(). Best regards, Tomasz