media: coda: fix reorder detection for unknown levels
authorPhilipp Zabel <p.zabel@pengutronix.de>
Thu, 28 Jun 2018 15:47:09 +0000 (11:47 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 4 Jul 2018 12:07:21 +0000 (08:07 -0400)
Whether reordering should be enabled only depends on the h.264 profile.
Stop parsing the level and drop the debug message, profile and level
can now be determined via read-only decoder controls.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/coda/coda-bit.c

index a585b80..36c1998 100644 (file)
@@ -1583,10 +1583,8 @@ static int coda_decoder_reqbufs(struct coda_ctx *ctx,
 
 static bool coda_reorder_enable(struct coda_ctx *ctx)
 {
-       const char * const *profile_names;
-       const char * const *level_names;
        struct coda_dev *dev = ctx->dev;
-       int profile, level;
+       int profile;
 
        if (dev->devtype->product != CODA_HX4 &&
            dev->devtype->product != CODA_7541 &&
@@ -1600,24 +1598,9 @@ static bool coda_reorder_enable(struct coda_ctx *ctx)
                return true;
 
        profile = coda_h264_profile(ctx->params.h264_profile_idc);
-       if (profile < 0) {
-               v4l2_warn(&dev->v4l2_dev, "Invalid H264 Profile: %d\n",
-                        ctx->params.h264_profile_idc);
-               return false;
-       }
-
-       level = coda_h264_level(ctx->params.h264_level_idc);
-       if (level < 0) {
-               v4l2_warn(&dev->v4l2_dev, "Invalid H264 Level: %d\n",
-                        ctx->params.h264_level_idc);
-               return false;
-       }
-
-       profile_names = v4l2_ctrl_get_menu(V4L2_CID_MPEG_VIDEO_H264_PROFILE);
-       level_names = v4l2_ctrl_get_menu(V4L2_CID_MPEG_VIDEO_H264_LEVEL);
-
-       v4l2_dbg(1, coda_debug, &dev->v4l2_dev, "H264 Profile/Level: %s L%s\n",
-                profile_names[profile], level_names[level]);
+       if (profile < 0)
+               v4l2_warn(&dev->v4l2_dev, "Unknown H264 Profile: %u\n",
+                         ctx->params.h264_profile_idc);
 
        /* Baseline profile does not support reordering */
        return profile > V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE;