Re: [PATCH 3/7] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver

2016-04-17 Thread tiffany lin

snipped.

> > +
> > +void mtk_vcodec_dec_set_default_params(struct mtk_vcodec_ctx *ctx)
> > +{
> > +   struct mtk_q_data *q_data;
> > +
> > +   ctx->m2m_ctx->q_lock = >dev->dev_mutex;
> > +   ctx->fh.m2m_ctx = ctx->m2m_ctx;
> > +   ctx->fh.ctrl_handler = >ctrl_hdl;
> > +   INIT_WORK(>decode_work, mtk_vdec_worker);
> > +
> > +   q_data = >q_data[MTK_Q_DATA_SRC];
> > +   memset(q_data, 0, sizeof(struct mtk_q_data));
> > +   q_data->visible_width = DFT_CFG_WIDTH;
> > +   q_data->visible_height = DFT_CFG_HEIGHT;
> > +   q_data->fmt = _video_formats[OUT_FMT_IDX];
> > +   q_data->colorspace = V4L2_COLORSPACE_REC709;
> > +   q_data->field = V4L2_FIELD_NONE;
> > +   ctx->q_data[MTK_Q_DATA_DST].sizeimage[0] =
> > +   DFT_CFG_WIDTH * DFT_CFG_HEIGHT;
> > +   ctx->q_data[MTK_Q_DATA_DST].bytesperline[0] = 0;
> > +
> > +
> > +   q_data = >q_data[MTK_Q_DATA_DST];
> > +   memset(q_data, 0, sizeof(struct mtk_q_data));
> > +   q_data->visible_width = DFT_CFG_WIDTH;
> > +   q_data->visible_height = DFT_CFG_HEIGHT;
> > +   q_data->coded_width = DFT_CFG_WIDTH;
> > +   q_data->coded_height = DFT_CFG_HEIGHT;
> > +   q_data->colorspace = V4L2_COLORSPACE_REC709;
> > +   q_data->field = V4L2_FIELD_NONE;
> > +
> > +   q_data->fmt = _video_formats[CAP_FMT_IDX];
> > +
> > +   v4l_bound_align_image(_data->coded_width,
> > +   MTK_VDEC_MIN_W,
> > +   MTK_VDEC_MAX_W, 4,
> > +   _data->coded_height,
> > +   MTK_VDEC_MIN_H,
> > +   MTK_VDEC_MAX_H, 5, 6);
> > +
> > +   q_data->sizeimage[0] = q_data->coded_width * q_data->coded_height;
> > +   q_data->bytesperline[0] = q_data->coded_width;
> > +   q_data->sizeimage[1] = q_data->sizeimage[0] / 2;
> > +   q_data->bytesperline[1] = q_data->coded_width;
> > +
> > +}
> > +
> > +static int vidioc_vdec_streamon(struct file *file, void *priv,
> > +   enum v4l2_buf_type type)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
> > +
> > +   mtk_v4l2_debug(3, "[%d] (%d)", ctx->idx, type);
> > +
> > +   return v4l2_m2m_streamon(file, ctx->m2m_ctx, type);
> > +}
> > +
> > +static int vidioc_vdec_streamoff(struct file *file, void *priv,
> > +enum v4l2_buf_type type)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
> > +
> > +   mtk_v4l2_debug(3, "[%d] (%d)", ctx->idx, type);
> > +   return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type);
> > +}
> > +
> > +static int vidioc_vdec_reqbufs(struct file *file, void *priv,
> > +  struct v4l2_requestbuffers *reqbufs)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = fh_to_ctx(priv);
> > +   int ret;
> > +
> > +   mtk_v4l2_debug(3, "[%d] (%d) count=%d", ctx->idx,
> > +reqbufs->type, reqbufs->count);
> > +   ret = v4l2_m2m_reqbufs(file, ctx->m2m_ctx, reqbufs);
> > +
> > +   return ret;
> > +}
> 
> Please use the v4l2_m2m_ioctl_* helper functions were applicable.
> 



snipped.
> > +static unsigned int fops_vcodec_poll(struct file *file,
> > +struct poll_table_struct *wait)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = fh_to_ctx(file->private_data);
> > +   struct mtk_vcodec_dev *dev = ctx->dev;
> > +   int ret;
> > +
> > +   mutex_lock(>dev_mutex);
> > +   ret = v4l2_m2m_poll(file, ctx->m2m_ctx, wait);
> > +   mutex_unlock(>dev_mutex);
> > +
> > +   return ret;
> > +}
> > +
> > +static int fops_vcodec_mmap(struct file *file, struct vm_area_struct *vma)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = fh_to_ctx(file->private_data);
> > +
> > +   return v4l2_m2m_mmap(file, ctx->m2m_ctx, vma);
> > +}
> > +
> > +static const struct v4l2_file_operations mtk_vcodec_fops = {
> > +   .owner  = THIS_MODULE,
> > +   .open   = fops_vcodec_open,
> > +   .release= fops_vcodec_release,
> > +   .poll   = fops_vcodec_poll,
> > +   .unlocked_ioctl = video_ioctl2,
> > +   .mmap   = fops_vcodec_mmap,
> 
> You should be able to use the v4l2_m2m_fop helper functions for poll and mmap.
> 

Hi Hans,

We are plaining to remove m2m framework in th feature, although we think
it is easy to use and could save a lot of code similar to what m2m
framework implemented and reduce code size.
The main reason is that in v4l2_m2m_try_schedule, it required that at
least one output buffer and one capture buffer to run device_run.
We want to start device_run without capture buffer queued.
Is there any suggestion that we could use m2m framework but trigger
device_run with only output buffer.
Or we need to remove m2m and write our own implementation.



snipped.


best regards,
Tiffany

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

Re: [PATCH 3/7] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Decoder Driver

2016-04-17 Thread tiffany lin
Hi Hans,

On Fri, 2016-04-15 at 16:27 +0200, Hans Verkuil wrote:
> On 04/13/2016 02:01 PM, Tiffany Lin wrote:
> > Add v4l2 layer decoder driver for MT8173
> > 
> > Signed-off-by: Tiffany Lin 
> > ---
> >  drivers/media/platform/mtk-vcodec/Makefile |   10 +-
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 1429 
> > 
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h |   81 ++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c |  469 +++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c  |  153 +++
> >  .../media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h  |   28 +
> >  drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |   98 +-
> >  drivers/media/platform/mtk-vcodec/vdec_drv_base.h  |   56 +
> >  drivers/media/platform/mtk-vcodec/vdec_drv_if.c|  113 ++
> >  drivers/media/platform/mtk-vcodec/vdec_drv_if.h|   93 ++
> >  drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h   |   86 ++
> >  11 files changed, 2596 insertions(+), 20 deletions(-)
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/vdec_drv_base.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/vdec_drv_if.c
> >  create mode 100644 drivers/media/platform/mtk-vcodec/vdec_drv_if.h
> >  create mode 100644 drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h
> > 
> > diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
> > b/drivers/media/platform/mtk-vcodec/Makefile
> > index dc5cb00..4c8ed2f 100644
> > --- a/drivers/media/platform/mtk-vcodec/Makefile
> > +++ b/drivers/media/platform/mtk-vcodec/Makefile
> > @@ -1,7 +1,13 @@
> >  
> >  
> > -obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o mtk-vcodec-common.o
> > -
> > +obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
> > +  mtk-vcodec-enc.o \
> > +  mtk-vcodec-common.o
> > +
> > +mtk-vcodec-dec-y := mtk_vcodec_dec_drv.o \
> > +   vdec_drv_if.o \
> > +   mtk_vcodec_dec.o \
> > +   mtk_vcodec_dec_pm.o \
> >  
> >  
> >  mtk-vcodec-enc-y := venc/venc_vp8_if.o \
> > diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c 
> > b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
> > new file mode 100644
> > index 000..0499413
> > --- /dev/null
> > +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c
> > @@ -0,0 +1,1429 @@
> > +/*
> > +* Copyright (c) 2016 MediaTek Inc.
> > +* Author: PC Chen 
> > +* Tiffany Lin 
> > +*
> > +* This program is free software; you can redistribute it and/or modify
> > +* it under the terms of the GNU General Public License version 2 as
> > +* published by the Free Software Foundation.
> > +*
> > +* This program is distributed in the hope that it will be useful,
> > +* but WITHOUT ANY WARRANTY; without even the implied warranty of
> > +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > +* GNU General Public License for more details.
> > +*/
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "mtk_vcodec_drv.h"
> > +#include "mtk_vcodec_dec.h"
> > +#include "mtk_vcodec_intr.h"
> > +#include "mtk_vcodec_util.h"
> > +#include "vdec_drv_if.h"
> > +#include "mtk_vcodec_dec_pm.h"
> > +
> > +static struct mtk_video_fmt mtk_video_formats[] = {
> > +   {
> > +   .fourcc = V4L2_PIX_FMT_H264,
> > +   .type = MTK_FMT_DEC,
> > +   .num_planes = 1,
> > +   },
> > +   {
> > +   .fourcc = V4L2_PIX_FMT_VP8,
> > +   .type = MTK_FMT_DEC,
> > +   .num_planes = 1,
> > +   },
> > +   {
> > +   .fourcc = V4L2_PIX_FMT_VP9,
> > +   .type = MTK_FMT_DEC,
> > +   .num_planes = 1,
> > +   },
> > +   {
> > +   .fourcc = V4L2_PIX_FMT_MT21,
> > +   .type = MTK_FMT_FRAME,
> > +   .num_planes = 2,
> > +   },
> > +};
> > +#define OUT_FMT_IDX0
> > +#define CAP_FMT_IDX3
> > +
> > +#define VCODEC_CAPABILITY_4K_DISABLED  0x10
> > +#define VCODEC_DEC_4K_CODED_WIDTH  4096U
> > +#define VCODEC_DEC_4K_CODED_HEIGHT 2304U
> > +
> > +#define MTK_VDEC_MIN_W 64U
> > +#define MTK_VDEC_MIN_H 64U
> > +#define MTK_VDEC_MAX_W 2048U
> > +#define MTK_VDEC_MAX_H 1088U
> > +#define DFT_CFG_WIDTH  MTK_VDEC_MIN_W
> > +#define DFT_CFG_HEIGHT MTK_VDEC_MIN_H
> > +
> > +static const struct mtk_codec_framesizes mtk_vdec_framesizes[] = {
> > +   {
> > +   .fourcc = V4L2_PIX_FMT_H264,
> > +   .stepwise = {  MTK_VDEC_MIN_W, MTK_VDEC_MAX_W, 16,
> > +   

Re: [PATCH v6 5/8] [Media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2016-04-17 Thread tiffany lin
Hi Hans,

On Fri, 2016-04-15 at 16:02 +0200, Hans Verkuil wrote:
> Hi Tiffany,
> 
> Some more comments, most are trivial but I realized that you were basing this
> patch on an older kernel and not the latest media_tree master branch.
> 
> That's a bit of a killer because otherwise I am very close to merging this.
> 
Got it. I will rebase this patch series to latest media_tree.

> > +static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)
> > +{
> > +   struct mtk_vcodec_ctx *ctx = ctrl_to_ctx(ctrl);
> > +   struct mtk_enc_params *p = >enc_params;
> > +   int ret = 0;
> > +
> > +   switch (ctrl->id) {
> > +   case V4L2_CID_MPEG_VIDEO_BITRATE:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_BITRATE val = %d",
> > +   ctrl->val);
> > +   p->bitrate = ctrl->val;
> > +   ctx->param_change |= MTK_ENCODE_PARAM_BITRATE;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_B_FRAMES:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_B_FRAMES val = %d",
> > +   ctrl->val);
> > +   p->num_b_frame = ctrl->val;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE val = 
> > %d",
> > +   ctrl->val);
> > +   p->rc_frame = ctrl->val;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_H264_MAX_QP:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_MAX_QP val = %d",
> > +   ctrl->val);
> > +   p->h264_max_qp = ctrl->val;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_HEADER_MODE val = %d",
> > +   ctrl->val);
> > +   p->seq_hdr_mode = ctrl->val;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE val = %d",
> > +   ctrl->val);
> > +   p->rc_mb = ctrl->val;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_H264_PROFILE:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_PROFILE val = %d",
> > +   ctrl->val);
> > +   p->h264_profile = ctrl->val;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_H264_LEVEL:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_LEVEL val = %d",
> > +   ctrl->val);
> > +   p->h264_level = ctrl->val;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_H264_I_PERIOD val = %d",
> > +  ctrl->val);
> > +   p->intra_period = ctrl->val;
> > +   ctx->param_change |= MTK_ENCODE_PARAM_INTRA_PERIOD;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_GOP_SIZE:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_GOP_SIZE val = %d",
> > +  ctrl->val);
> > +   p->gop_size = ctrl->val;
> > +   ctx->param_change |= MTK_ENCODE_PARAM_GOP_SIZE;
> > +   break;
> > +   case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME:
> > +   mtk_v4l2_debug(2, "V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME");
> > +   p->force_intra = 1;
> > +   ctx->param_change |= MTK_ENCODE_PARAM_FORCE_INTRA;
> > +   break;
> > +   default:
> > +   mtk_v4l2_err("Unspport CID %d", ctrl->id);
> 
> Unspport -> Unsupported
> 
> But either remove this or make it a debug message.
> 
> I would just remove it.
Got it. I will remove this.

> 
> > +   ret = -EINVAL;
> > +   break;
> > +   }
> > +
> > +   return ret;
> > +}
> > +
> > +static const struct v4l2_ctrl_ops mtk_vcodec_enc_ctrl_ops = {
> > +   .s_ctrl = vidioc_venc_s_ctrl,
> > +};
> > +
> > +static int vidioc_enum_fmt(struct v4l2_fmtdesc *f, bool output_queue)
> > +{
> > +   struct mtk_video_fmt *fmt;
> > +   int i, j = 0;
> > +
> > +   for (i = 0; i < NUM_FORMATS; ++i) {
> > +   if (output_queue && mtk_video_formats[i].type != MTK_FMT_FRAME)
> > +   continue;
> > +   if (!output_queue && mtk_video_formats[i].type != MTK_FMT_ENC)
> > +   continue;
> > +
> > +   if (j == f->index) {
> > +   fmt = _video_formats[i];
> > +   f->pixelformat = fmt->fourcc;
> > +   memset(f->reserved, 0, sizeof(f->reserved));
> > +   return 0;
> > +   }
> > +   ++j;
> > +   }
> > +
> > +   return -EINVAL;
> > +}
> > +
> > +static int vidioc_enum_framesizes(struct file *file, void *fh,
> > + struct v4l2_frmsizeenum *fsize)
> > +{
> > +   int i = 0;
> > +
> > +   if (fsize->index != 0)
> > +   return -EINVAL;
> > +
> > +   for (i = 0; i < NUM_SUPPORTED_FRAMESIZE; ++i) {
> > +   if (fsize->pixel_format != mtk_venc_framesizes[i].fourcc)
> > +   continue;
> > +
> > +   fsize->type = V4L2_FRMSIZE_TYPE_STEPWISE;
> > +  

cron job: media_tree daily build: OK

2016-04-17 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Mon Apr 18 04:00:17 CEST 2016
git branch: test
git hash:   ecb7b0183a89613c154d1bea48b494907efbf8f9
gcc version:i686-linux-gcc (GCC) 5.3.0
sparse version: v0.5.0-56-g7647c77
smatch version: v0.5.0-3413-g618cd5c
host hardware:  x86_64
host os:4.4.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-i686: OK
linux-4.3-i686: OK
linux-4.4-i686: OK
linux-4.5-i686: OK
linux-4.6-rc1-i686: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-x86_64: OK
linux-4.4-x86_64: OK
linux-4.5-x86_64: OK
linux-4.6-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Monday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] smiapp: provide g_skip_top_lines method in sensor ops

2016-04-17 Thread Sakari Ailus
Hi Ivaylo,

On Sat, Apr 16, 2016 at 11:12:20AM +0300, Ivaylo Dimitrov wrote:
> Some sensors (like the one in Nokia N900) provide metadata in the first
> couple of lines. Make that information information available to the
> pipeline.
> 
> Signed-off-by: Ivaylo Dimitrov 
> ---
>  drivers/media/i2c/smiapp/smiapp-core.c | 12 
>  drivers/media/i2c/smiapp/smiapp.h  |  1 +
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/media/i2c/smiapp/smiapp-core.c 
> b/drivers/media/i2c/smiapp/smiapp-core.c
> index a215efe..3dfe387 100644
> --- a/drivers/media/i2c/smiapp/smiapp-core.c
> +++ b/drivers/media/i2c/smiapp/smiapp-core.c
> @@ -188,6 +188,8 @@ static int smiapp_read_frame_fmt(struct smiapp_sensor 
> *sensor)
>   embedded_end = 0;
>   }
>  
> + sensor->image_start = image_start;
> +
>   dev_dbg(>dev, "embedded data from lines %d to %d\n",
>   embedded_start, embedded_end);
>   dev_dbg(>dev, "image data starts at line %d\n", image_start);
> @@ -2280,6 +2282,15 @@ static int smiapp_get_skip_frames(struct v4l2_subdev 
> *subdev, u32 *frames)
>   return 0;
>  }
>  
> +static int smiapp_get_skip_top_lines(struct v4l2_subdev *subdev, u32 *lines)
> +{
> + struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
> +
> + *lines = sensor->image_start;
> +
> + return 0;
> +}
> +
>  /* 
> -
>   * sysfs attributes
>   */
> @@ -2890,6 +2901,7 @@ static const struct v4l2_subdev_pad_ops smiapp_pad_ops 
> = {
>  
>  static const struct v4l2_subdev_sensor_ops smiapp_sensor_ops = {
>   .g_skip_frames = smiapp_get_skip_frames,
> + .g_skip_top_lines = smiapp_get_skip_top_lines,
>  };
>  
>  static const struct v4l2_subdev_ops smiapp_ops = {
> diff --git a/drivers/media/i2c/smiapp/smiapp.h 
> b/drivers/media/i2c/smiapp/smiapp.h
> index f6af0cc..c8b4ca0 100644
> --- a/drivers/media/i2c/smiapp/smiapp.h
> +++ b/drivers/media/i2c/smiapp/smiapp.h
> @@ -217,6 +217,7 @@ struct smiapp_sensor {
>  
>   u8 hvflip_inv_mask; /* H/VFLIP inversion due to sensor orientation */
>   u8 frame_skip;
> + u32 image_start;/* Offset to first line after metadata lines */
>  
>   int power_count;
>  

I'm afraid I think this is not exactly the best way to approach the issue.
It'd work, somehow, yes, but ---

1. A compliant sensor (at least in theory) is able to tell this information
itself. The number of metadata lines is present in the sensor frame format
descriptors.

2. The more generic problem of describing the frame layout should be solved.
Sensor metadata is just a special case of this. I've proposed frame
descriptors (see an old RFC
), but this is
just a partial solution as well; the APIs would need to be extended to
support metadata capture (I think Laurent has been working on that).

So a proper solution will require a little bit of time still.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fwd: [Bug 116551] media_gobj_create NULL pointer dereference

2016-04-17 Thread Antti Palosaari

Can you look that bug as I think it is media controller related.

regards
Antti


 Forwarded Message 
Subject: [Bug 116551] media_gobj_create NULL pointer dereference
Date: Sat, 16 Apr 2016 20:40:18 +
From: bugzilla-dae...@bugzilla.kernel.org
To: cr...@iki.fi

https://bugzilla.kernel.org/show_bug.cgi?id=116551

Konstantin Nikiforov  changed:

   What|Removed |Added

 CC||cr...@iki.fi

--
You are receiving this mail because:
You are on the CC list for the bug.


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html