From f7a1d19bf05797f130703673524356edbc822420 Mon Sep 17 00:00:00 2001 From: Tomasz Figa Date: Mon, 27 Jul 2015 16:07:30 +0900 Subject: [PATCH] CHROMIUM: [media] rk3288-vpu: Add helper to get context operating mode Currently there is only one place in the code checking whether given context is decoding or encoding. However as a prerequisite for further patch adding more such checks, this patch adds a common helper function which returns appropriate enum value depending on operating mode of given context. BUG=chrome-os-partner:41585 TEST=AppRTC loopback Signed-off-by: Tomasz Figa Reviewed-on: https://chromium-review.googlesource.com/288661 Reviewed-by: Pawel Osciak Change-Id: Ide145770ca77897ada3cb878c4b9c9787824a827 Signed-off-by: Jeffy Chen Signed-off-by: Yakir Yang --- drivers/media/platform/rk3288-vpu/rk3288_vpu_common.h | 5 +++++ drivers/media/platform/rk3288-vpu/rk3288_vpu_hw.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/rk3288-vpu/rk3288_vpu_common.h b/drivers/media/platform/rk3288-vpu/rk3288_vpu_common.h index 0082e2f57bfd..155693cb79e4 100644 --- a/drivers/media/platform/rk3288-vpu/rk3288_vpu_common.h +++ b/drivers/media/platform/rk3288-vpu/rk3288_vpu_common.h @@ -434,6 +434,11 @@ static inline struct rk3288_vpu_buf *vb_to_buf(struct vb2_buffer *vb) return container_of(vb, struct rk3288_vpu_buf, b); } +static inline bool rk3288_vpu_ctx_is_encoder(struct rk3288_vpu_ctx *ctx) +{ + return ctx->vpu_dst_fmt->codec_mode != RK_VPU_CODEC_NONE; +} + int rk3288_vpu_ctrls_setup(struct rk3288_vpu_ctx *ctx, const struct v4l2_ctrl_ops *ctrl_ops, struct rk3288_vpu_control *controls, diff --git a/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw.c b/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw.c index 7b7a79ff4cf6..8ca8b9abd548 100644 --- a/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw.c +++ b/drivers/media/platform/rk3288-vpu/rk3288_vpu_hw.c @@ -402,7 +402,7 @@ int rk3288_vpu_init(struct rk3288_vpu_ctx *ctx) { enum rk3288_vpu_codec_mode codec_mode; - if (ctx->vpu_dst_fmt->codec_mode != RK_VPU_CODEC_NONE) + if (rk3288_vpu_ctx_is_encoder(ctx)) codec_mode = ctx->vpu_dst_fmt->codec_mode; /* Encoder */ else codec_mode = ctx->vpu_src_fmt->codec_mode; /* Decoder */ -- 2.34.1