ret = PTR_ERR(ctx->fh.m2m_ctx);
                goto err_ctrls;
        }
+       ctx->dst_fmt.pixelformat = V4L2_PIX_FMT_SUNXI_TILED_NV12;
+       cedrus_prepare_format(&ctx->dst_fmt);
+       ctx->src_fmt.pixelformat = V4L2_PIX_FMT_MPEG2_SLICE;
+       /*
+        * TILED_NV12 has more strict requirements, so copy the width and
+        * height to src_fmt to ensure that is matches the dst_fmt resolution.
+        */
+       ctx->src_fmt.width = ctx->dst_fmt.width;
+       ctx->src_fmt.height = ctx->dst_fmt.height;
+       cedrus_prepare_format(&ctx->src_fmt);
 
        v4l2_fh_add(&ctx->fh);
 
 
        return &cedrus_formats[i];
 }
 
-static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
+void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
 {
        unsigned int width = pix_fmt->width;
        unsigned int height = pix_fmt->height;
        case V4L2_PIX_FMT_H264_SLICE:
                /* Zero bytes per line for encoded source. */
                bytesperline = 0;
-
+               /* Choose some minimum size since this can't be 0 */
+               sizeimage = max_t(u32, SZ_1K, sizeimage);
                break;
 
        case V4L2_PIX_FMT_SUNXI_TILED_NV12:
 {
        struct cedrus_ctx *ctx = cedrus_file2ctx(file);
 
-       /* Fall back to dummy default by lack of hardware configuration. */
-       if (!ctx->dst_fmt.width || !ctx->dst_fmt.height) {
-               f->fmt.pix.pixelformat = V4L2_PIX_FMT_SUNXI_TILED_NV12;
-               cedrus_prepare_format(&f->fmt.pix);
-
-               return 0;
-       }
-
        f->fmt.pix = ctx->dst_fmt;
-
        return 0;
 }
 
 {
        struct cedrus_ctx *ctx = cedrus_file2ctx(file);
 
-       /* Fall back to dummy default by lack of hardware configuration. */
-       if (!ctx->dst_fmt.width || !ctx->dst_fmt.height) {
-               f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG2_SLICE;
-               f->fmt.pix.sizeimage = SZ_1K;
-               cedrus_prepare_format(&f->fmt.pix);
-
-               return 0;
-       }
-
        f->fmt.pix = ctx->src_fmt;
-
        return 0;
 }
 
        if (!fmt)
                return -EINVAL;
 
-       /* Source image size has to be provided by userspace. */
-       if (pix_fmt->sizeimage == 0)
-               return -EINVAL;
-
        pix_fmt->pixelformat = fmt->pixelformat;
        cedrus_prepare_format(pix_fmt);