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 <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/288661
Reviewed-by: Pawel Osciak <posciak@chromium.org>

Change-Id: Ide145770ca77897ada3cb878c4b9c9787824a827
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
This commit is contained in:
Tomasz Figa 2015-07-27 16:07:30 +09:00 committed by Huang, Tao
parent 3e7faf0075
commit f7a1d19bf0
2 changed files with 6 additions and 1 deletions

View File

@ -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,

View File

@ -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 */