Commit 9f84310d authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab
Browse files

media: coda: fix reorder detection for unknown levels



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: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 42a68012
Loading
Loading
Loading
Loading
+4 −21
Original line number Diff line number Diff line
@@ -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",
	if (profile < 0)
		v4l2_warn(&dev->v4l2_dev, "Unknown H264 Profile: %u\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]);

	/* Baseline profile does not support reordering */
	return profile > V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE;