struct v4l2_format *f)
{
struct mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- struct mfc_dec *dec;
+ struct mfc_dec *dec = ctx->dec_priv;
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
struct mfc_raw_info *raw;
int i;
mfc_debug_enter();
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
mfc_debug(2, "dec dst g_fmt, state: %d\n", ctx->state);
if (ctx->state == MFCINST_GOT_INST ||
struct v4l2_format *f)
{
struct mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- struct mfc_dec *dec;
+ struct mfc_dec *dec = ctx->dec_priv;
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
mfc_debug_enter();
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
mfc_debug(4, "dec src g_fmt, state: %d\n", ctx->state);
/* This is run on OUTPUT
{
struct mfc_dev *dev = video_drvdata(file);
struct mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- struct mfc_dec *dec;
+ struct mfc_dec *dec = ctx->dec_priv;
+
int ret = 0;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
if (reqbufs->memory == V4L2_MEMORY_MMAP) {
mfc_err_ctx("Not supported memory type (%d)\n", reqbufs->memory);
return -EINVAL;
/* Get ctrl */
static int __mfc_dec_get_ctrl_val(struct mfc_ctx *ctx, struct v4l2_control *ctrl)
{
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_ctx_ctrl *ctx_ctrl;
int found = 0;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
switch (ctrl->id) {
case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER:
ctrl->value = dec->loop_filter_mpeg4;
{
struct mfc_dev *dev = video_drvdata(file);
struct mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
- struct mfc_dec *dec;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_ctx_ctrl *ctx_ctrl;
int ret = 0;
int found = 0;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
ret = __mfc_dec_check_ctrl_val(ctx, ctrl);
if (ret)
return ret;
unsigned int *buf_count, unsigned int *plane_count,
unsigned int psize[], struct device *alloc_devs[])
{
- struct mfc_ctx *ctx;
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_ctx *ctx = vq->drv_priv;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_raw_info *raw;
int i;
mfc_debug_enter();
- if (!vq) {
- mfc_err_dev("no vb2_queue info\n");
- return -EINVAL;
- }
-
- ctx = vq->drv_priv;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
raw = &ctx->raw_buf;
/* Video output for decoding (source)
static void mfc_dec_unlock(struct vb2_queue *q)
{
struct mfc_ctx *ctx = q->drv_priv;
- struct mfc_dev *dev;
-
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
+ struct mfc_dev *dev = ctx->dev;
mutex_unlock(&dev->mfc_mutex);
}
static void mfc_dec_lock(struct vb2_queue *q)
{
struct mfc_ctx *ctx = q->drv_priv;
- struct mfc_dev *dev;
-
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
+ struct mfc_dev *dev = ctx->dev;
mutex_lock(&dev->mfc_mutex);
}
{
struct vb2_queue *vq = vb->vb2_queue;
struct mfc_ctx *ctx = vq->drv_priv;
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_buf *buf = vb_to_mfc_buf(vb);
dma_addr_t start_raw;
int i, ret;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
ret = mfc_check_vb_with_fmt(ctx->dst_fmt, vb);
{
struct vb2_queue *vq = vb->vb2_queue;
struct mfc_ctx *ctx = vq->drv_priv;
- struct mfc_dec *dec;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_raw_info *raw;
unsigned int index = vb->index;
size_t buf_size;
int i;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
raw = &ctx->raw_buf;
/* check the size per plane */
struct mfc_ctx *ctx = vq->drv_priv;
unsigned int index = vb->index;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
if (call_cop(ctx, to_ctx_ctrls, ctx, &ctx->dst_ctrls[index]) < 0)
mfc_err_ctx("failed in to_ctx_ctrls\n");
unsigned int index = vb->index;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
if (call_cop(ctx, cleanup_buf_ctrls, ctx,
static int mfc_dec_start_streaming(struct vb2_queue *q, unsigned int count)
{
struct mfc_ctx *ctx = q->drv_priv;
- struct mfc_dev *dev;
-
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
+ struct mfc_dev *dev = ctx->dev;
if (ctx->state == MFCINST_FINISHING)
mfc_change_state(ctx, MFCINST_RUNNING);
static void __mfc_dec_src_stop_streaming(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_buf *src_mb;
int index, csd, condition = 0;
int ret = 0;
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return;
- }
-
while (1) {
csd = mfc_check_buf_vb_flag(ctx, MFC_FLAG_CSD);
static void __mfc_dec_dst_stop_streaming(struct mfc_ctx *ctx)
{
- struct mfc_dec *dec;
+ struct mfc_dec *dec = ctx->dec_priv;
int index = 0;
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return;
- }
-
mfc_cleanup_assigned_fd(ctx);
mfc_cleanup_queue(&ctx->buf_queue_lock, &ctx->ref_buf_queue);
static void mfc_dec_stop_streaming(struct vb2_queue *q)
{
struct mfc_ctx *ctx = q->drv_priv;
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
int ret = 0;
int prev_state;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
mfc_info_ctx("dec stop_streaming is called, hwlock : %d, type : %d\n",
test_bit(ctx->num, &dev->hwlock.bits), q->type);
MFC_TRACE_CTX("** DEC streamoff(type:%d)\n", q->type);
{
struct vb2_queue *vq = vb->vb2_queue;
struct mfc_ctx *ctx = vq->drv_priv;
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_buf *buf = vb_to_mfc_buf(vb);
int i;
unsigned char *stream_vir = NULL;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return;
- }
if (vq->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
mfc_debug(2, "[BUFINFO] ctx[%d] add src index:%d, addr: 0x%08llx\n",
unsigned int *buf_count, unsigned int *plane_count,
unsigned int psize[], struct device *alloc_devs[])
{
- struct mfc_dev *dev;
struct mfc_ctx *ctx = vq->drv_priv;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_enc *enc = ctx->enc_priv;
struct mfc_raw_info *raw;
int i;
mfc_debug_enter();
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
if (ctx->state != MFCINST_GOT_INST &&
vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
mfc_err_ctx("invalid state: %d\n", ctx->state);
{
unsigned long flags;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
spin_lock_init(&dev->hwlock.lock);
spin_lock_irqsave(&dev->hwlock.lock, flags);
spin_unlock_irqrestore(&dev->hwlock.lock, flags);
}
-static int __mfc_remove_listable_wq_dev(struct mfc_dev *dev)
+static void __mfc_remove_listable_wq_dev(struct mfc_dev *dev)
{
struct mfc_listable_wq *listable_wq;
unsigned long flags;
- int ret = -1;
-
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
spin_lock_irqsave(&dev->hwlock.lock, flags);
__mfc_print_hwlock(dev);
list_del(&listable_wq->list);
dev->hwlock.wl_count--;
- ret = 0;
break;
}
__mfc_print_hwlock(dev);
spin_unlock_irqrestore(&dev->hwlock.lock, flags);
-
- return ret;
}
-static int __mfc_remove_listable_wq_ctx(struct mfc_ctx *curr_ctx)
+static void __mfc_remove_listable_wq_ctx(struct mfc_ctx *curr_ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = curr_ctx->dev;
struct mfc_listable_wq *listable_wq;
unsigned long flags;
- int ret = -1;
-
- if (!curr_ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
-
- dev = curr_ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
spin_lock_irqsave(&dev->hwlock.lock, flags);
__mfc_print_hwlock(dev);
list_del(&listable_wq->list);
dev->hwlock.wl_count--;
- ret = 0;
break;
}
}
__mfc_print_hwlock(dev);
spin_unlock_irqrestore(&dev->hwlock.lock, flags);
-
- return ret;
}
/*
int ret = 0;
unsigned long flags;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
mutex_lock(&dev->hwlock_wq.wait_mutex);
spin_lock_irqsave(&dev->hwlock.lock, flags);
*/
int mfc_get_hwlock_ctx(struct mfc_ctx *curr_ctx)
{
- struct mfc_dev *dev;
struct mfc_ctx *ctx = curr_ctx;
+ struct mfc_dev *dev = curr_ctx->dev;
int ret = 0;
unsigned long flags;
- if (!curr_ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
-
- dev = curr_ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
mutex_lock(&curr_ctx->hwlock_wq.wait_mutex);
spin_lock_irqsave(&dev->hwlock.lock, flags);
* 1: succeeded to release hwlock, hwlock is captured by another module
* -1: error since device is waiting again.
*/
-int mfc_release_hwlock_dev(struct mfc_dev *dev)
+void mfc_release_hwlock_dev(struct mfc_dev *dev)
{
struct mfc_listable_wq *listable_wq;
unsigned long flags;
- int ret = -1;
-
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
spin_lock_irqsave(&dev->hwlock.lock, flags);
__mfc_print_hwlock(dev);
if (dev->shutdown) {
mfc_debug(2, "Couldn't wakeup module. Shutdown was called\n");
- ret = 0;
} else if (list_empty(&dev->hwlock.waiting_list)) {
mfc_debug(2, "No waiting module\n");
- ret = 0;
} else {
mfc_debug(2, "There is a waiting module\n");
listable_wq = list_entry(dev->hwlock.waiting_list.next, struct mfc_listable_wq, list);
dev->hwlock.wl_count, dev->hwlock.transfer_owner);
wake_up(&listable_wq->wait_queue);
- ret = 1;
}
__mfc_print_hwlock(dev);
spin_unlock_irqrestore(&dev->hwlock.lock, flags);
- return ret;
}
/*
* 0: succeeded to release hwlock
* 1: succeeded to release hwlock, hwlock is captured by another module
*/
-static int __mfc_release_hwlock_ctx_protected(struct mfc_ctx *curr_ctx)
+static void __mfc_release_hwlock_ctx_protected(struct mfc_ctx *curr_ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = curr_ctx->dev;
struct mfc_ctx *ctx = curr_ctx;
struct mfc_listable_wq *listable_wq;
- int ret = -1;
-
- if (!curr_ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
-
- dev = curr_ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
__mfc_print_hwlock(dev);
clear_bit(curr_ctx->num, &dev->hwlock.bits);
if (dev->shutdown) {
mfc_debug(2, "Couldn't wakeup module. Shutdown was called\n");
- ret = 0;
} else if (list_empty(&dev->hwlock.waiting_list)) {
mfc_debug(2, "No waiting module\n");
- ret = 0;
} else {
mfc_debug(2, "There is a waiting module\n");
listable_wq = list_entry(dev->hwlock.waiting_list.next, struct mfc_listable_wq, list);
dev->hwlock.wl_count, dev->hwlock.transfer_owner);
wake_up(&listable_wq->wait_queue);
- ret = 1;
}
__mfc_print_hwlock(dev);
- return ret;
}
/*
* 0: succeeded to release hwlock
* 1: succeeded to release hwlock, hwlock is captured by another module
*/
-int mfc_release_hwlock_ctx(struct mfc_ctx *curr_ctx)
+void mfc_release_hwlock_ctx(struct mfc_ctx *curr_ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = curr_ctx->dev;
unsigned long flags;
- int ret = -1;
-
- if (!curr_ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
-
- dev = curr_ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
spin_lock_irqsave(&dev->hwlock.lock, flags);
- ret = __mfc_release_hwlock_ctx_protected(curr_ctx);
+ __mfc_release_hwlock_ctx_protected(curr_ctx);
spin_unlock_irqrestore(&dev->hwlock.lock, flags);
- return ret;
}
-static inline int __mfc_yield_hwlock(struct mfc_dev *dev, struct mfc_ctx *curr_ctx)
+static inline void __mfc_yield_hwlock(struct mfc_dev *dev, struct mfc_ctx *curr_ctx)
{
unsigned long flags;
- if (!curr_ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
-
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
spin_lock_irqsave(&dev->hwlock.lock, flags);
__mfc_release_hwlock_ctx_protected(curr_ctx);
/* Trigger again if other instance's work is waiting */
if (mfc_is_work_to_do(dev))
queue_work(dev->butler_wq, &dev->butler_work);
-
- return 0;
}
/*
int index;
struct mfc_ctx *new_ctx;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
if (dev->shutdown) {
mfc_info_dev("Couldn't lock HW. Shutdown was called\n");
return -EINVAL;
int ret;
unsigned long flags;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
spin_lock_irqsave(&dev->hwlock.lock, flags);
__mfc_print_hwlock(dev);
*/
void mfc_cleanup_work_bit_and_try_run(struct mfc_ctx *curr_ctx)
{
- struct mfc_dev *dev;
-
- if (!curr_ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
- dev = curr_ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
+ struct mfc_dev *dev = curr_ctx->dev;
mfc_clear_bit(curr_ctx->num, &dev->work_bits);
unsigned int ret = 0;
int need_cache_flush = 0;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
ctx = dev->ctx[new_ctx_index];
if (!ctx) {
mfc_err_dev("no mfc context to run\n");
unsigned long flags;
int ret;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
- if (!curr_ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
spin_lock_irqsave(&dev->hwlock.lock, flags);
__mfc_print_hwlock(dev);
int mfc_get_hwlock_dev(struct mfc_dev *dev);
int mfc_get_hwlock_ctx(struct mfc_ctx *curr_ctx);
-int mfc_release_hwlock_dev(struct mfc_dev *dev);
-int mfc_release_hwlock_ctx(struct mfc_ctx *curr_ctx);
+void mfc_release_hwlock_dev(struct mfc_dev *dev);
+void mfc_release_hwlock_ctx(struct mfc_ctx *curr_ctx);
void mfc_cache_flush(struct mfc_dev *dev, int is_drm);
static void __mfc_handle_stream_copy_timestamp(struct mfc_ctx *ctx, struct mfc_buf *src_mb)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_enc *enc = ctx->enc_priv;
struct mfc_enc_params *p = &enc->params;
struct mfc_buf *dst_mb;
u64 start_timestamp;
u64 new_timestamp;
- if (!ctx) {
- mfc_err_dev("[BUFCON][TS] no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("[BUFCON][TS] no device to run\n");
- return;
- }
-
start_timestamp = src_mb->vb.vb2_buf.timestamp;
interval = NSEC_PER_SEC / p->rc_framerate;
if (debug_ts == 1)
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
if (nal_q_disable)
return 0;
{
int i;
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return -EINVAL;
- }
-
for(i = 0; i < MFC_NUM_CONTEXTS; i++) {
if (dev->ctx[i] && dev->ctx[i]->inst_no == pOutputStr->InstanceId)
return i;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return NULL;
- }
-
nal_q_in_handle = kzalloc(sizeof(*nal_q_in_handle), GFP_KERNEL);
if (!nal_q_in_handle) {
mfc_err_dev("[NALQ] Failed to get memory for nal_queue_in_handle\n");
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return NULL;
- }
-
nal_q_out_handle = kzalloc(sizeof(*nal_q_out_handle), GFP_KERNEL);
if (!nal_q_out_handle) {
mfc_err_dev("[NALQ] failed to get memory for nal_queue_out_handle\n");
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return NULL;
- }
-
nal_q_handle = kzalloc(sizeof(*nal_q_handle), GFP_KERNEL);
if (!nal_q_handle) {
mfc_err_dev("[NALQ] no nal_q_handle\n");
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return -EINVAL;
- }
-
if (!nal_q_handle) {
mfc_err_dev("[NALQ] there isn't nal_q_handle\n");
return -EINVAL;
{
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return;
- }
-
if (!nal_q_handle) {
mfc_err_dev("[NALQ] There is no nal_q_handle\n");
return;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return;
- }
-
if (!nal_q_handle) {
mfc_err_dev("[NALQ] There is no nal_q_handle\n");
return;
{
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return;
- }
-
if (!nal_q_handle) {
mfc_err_dev("[NALQ] There is no nal_q_handle\n");
return;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return;
- }
-
nal_q_handle = dev->nal_q_handle;
if (!nal_q_handle) {
mfc_err_dev("[NALQ] There is no nal_q_handle\n");
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return;
- }
-
for(i = 0; i < MFC_NUM_CONTEXTS; i++) {
ctx = dev->ctx[i];
if (ctx) {
static int __mfc_nal_q_run_in_buf_enc(struct mfc_ctx *ctx, EncoderInputStr *pInStr)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_buf *src_mb, *dst_mb;
struct mfc_raw_info *raw = NULL;
dma_addr_t src_addr[3] = {0, 0, 0};
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("[NALQ] no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return -EINVAL;
- }
-
pInStr->StartCode = 0xBBBBBBBB;
pInStr->CommandId = mfc_get_nal_q_input_count();
pInStr->InstanceId = ctx->inst_no;
static int __mfc_nal_q_run_in_buf_dec(struct mfc_ctx *ctx, DecoderInputStr *pInStr)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_buf *src_mb, *dst_mb;
- struct mfc_dec *dec;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_raw_info *raw = &ctx->raw_buf;
dma_addr_t buf_addr;
unsigned int strm_size;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("[NALQ] no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return -EINVAL;
- }
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("[NALQ] no mfc decoder to run\n");
- return -EINVAL;
- }
-
if (mfc_is_queue_count_same(&ctx->buf_queue_lock, &ctx->dst_buf_queue, 0) &&
mfc_is_queue_count_smaller(&ctx->buf_queue_lock,
&ctx->ref_buf_queue, (ctx->dpb_count + 5))) {
static void __mfc_nal_q_handle_stream_copy_timestamp(struct mfc_ctx *ctx, struct mfc_buf *src_mb)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_enc *enc = ctx->enc_priv;
struct mfc_enc_params *p = &enc->params;
struct mfc_buf *dst_mb;
u64 start_timestamp;
u64 new_timestamp;
- if (!ctx) {
- mfc_err_dev("[NALQ][BUFCON][TS] no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("[NALQ][BUFCON][TS] no device to run\n");
- return;
- }
-
start_timestamp = src_mb->vb.vb2_buf.timestamp;
interval = NSEC_PER_SEC / p->rc_framerate;
if (debug_ts == 1)
static void __mfc_nal_q_handle_frame_copy_timestamp(struct mfc_ctx *ctx, DecoderOutputStr *pOutStr)
{
- struct mfc_dec *dec;
- struct mfc_dev *dev;
+ struct mfc_dec *dec = ctx->dec_priv;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_buf *ref_mb, *src_mb;
dma_addr_t dec_y_addr;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("[NALQ][TS] no mfc context to run\n");
- return;
- }
-
- dec = ctx->dec_priv;
- dev = ctx->dev;
-
dec_y_addr = pOutStr->DecodedAddr[0];
/* Get the next source buffer */
int __mfc_nal_q_handle_error(struct mfc_ctx *ctx, EncoderOutputStr *pOutStr, int err)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_dec *dec;
struct mfc_enc *enc;
struct mfc_buf *src_mb;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("[NALQ] no mfc context to run\n");
- goto end;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- goto end;
- }
-
mfc_err_ctx("[NALQ] Interrupt Error: %d\n", pOutStr->ErrorCode);
dev->nal_q_handle->nal_q_exception = 1;
mfc_debug_enter();
- if (!dev) {
- mfc_err_dev("[NALQ] no mfc device to run\n");
- return -EINVAL;
- }
-
ctx_num = dev->nal_q_handle->nal_q_out_handle->nal_q_ctx;
if (ctx_num < 0) {
mfc_err_dev("[NALQ] Can't find ctx in nal q\n");
int mfc_otf_create(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
int i;
- mfc_debug_enter();
-
- if (!ctx) {
- mfc_err_dev("[OTF] no mfc context to run\n");
- return -EINVAL;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("[OTF] no mfc device to run\n");
- return -EINVAL;
- }
-
for (i = 0; i < MFC_NUM_CONTEXTS; i++) {
if (dev->ctx[i] && dev->ctx[i]->otf_handle) {
mfc_err_dev("[OTF] otf_handle is already created, ctx: %d\n", i);
/* Set decoding frame buffer */
int mfc_set_dec_codec_buffers(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
unsigned int i;
size_t frame_size_mv;
dma_addr_t buf_addr;
struct mfc_raw_info *raw;
unsigned int reg = 0;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
-
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
-
raw = &ctx->raw_buf;
buf_addr = ctx->codec_buf.daddr;
buf_size = ctx->codec_buf.size;
int mfc_set_dec_stream_buffer(struct mfc_ctx *ctx, struct mfc_buf *mfc_buf,
unsigned int start_num_byte, unsigned int strm_size)
{
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
unsigned int cpb_buf_size;
dma_addr_t addr;
int index = -1;
mfc_debug_enter();
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return -EINVAL;
- }
- dev = ctx->dev;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
- dec = ctx->dec_priv;
- if (!dec) {
- mfc_err_dev("no mfc decoder to run\n");
- return -EINVAL;
- }
cpb_buf_size = ALIGN(dec->src_buf_size, STREAM_BUF_ALIGN);
void mfc_wake_up_dev(struct mfc_dev *dev, unsigned int reason,
unsigned int err)
{
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
dev->int_condition = 1;
dev->int_reason = reason;
dev->int_err = err;
void mfc_wake_up_ctx(struct mfc_ctx *ctx, unsigned int reason,
unsigned int err)
{
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
ctx->int_condition = 1;
ctx->int_reason = reason;
ctx->int_err = err;
int cnt = 0;
int i;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return -EINVAL;
- }
-
spin_lock_irqsave(&dev->work_bits.lock, wflags);
mfc_debug(2, "Previous context: %d (bits %08lx)\n", dev->curr_ctx,
void mfc_dec_calc_dpb_size(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
- struct mfc_dec *dec;
+ struct mfc_dev *dev = ctx->dev;
+ struct mfc_dec *dec = ctx->dec_priv;
struct mfc_raw_info *raw;
int i;
int extra = MFC_LINEAR_BUF_SIZE;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
raw = &ctx->raw_buf;
raw->total_plane_size = 0;
- dec = ctx->dec_priv;
-
for (i = 0; i < raw->num_planes; i++) {
raw->plane_size[i] = 0;
raw->plane_size_2bits[i] = 0;
void mfc_enc_calc_src_size(struct mfc_ctx *ctx)
{
- struct mfc_dev *dev;
+ struct mfc_dev *dev = ctx->dev;
struct mfc_raw_info *raw;
unsigned int mb_width, mb_height, default_size;
int i, extra;
- if (!ctx) {
- mfc_err_dev("no mfc context to run\n");
- return;
- }
-
- dev = ctx->dev;
raw = &ctx->raw_buf;
raw->total_plane_size = 0;
mb_width = WIDTH_MB(ctx->img_width);
{
struct mfc_dev *dev = (struct mfc_dev *)arg;
- if (!dev) {
- mfc_err_dev("no mfc device to run\n");
- return;
- }
-
mfc_debug(5, "watchdog is ticking!\n");
if (atomic_read(&dev->watchdog_tick_running))