Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 223556
b: refs/heads/master
c: e004e02
h: refs/heads/master
v: v3
  • Loading branch information
Sylwester Nawrocki authored and Mauro Carvalho Chehab committed Dec 20, 2010
1 parent 41c8a4d commit 36a5a8c
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09b693f0bdf360b6a8e099f26c771c9fca4c3447
refs/heads/master: e004e02f3a121e5293ef56eaca6ee6d4ad60bc64
48 changes: 46 additions & 2 deletions trunk/drivers/media/video/s5p-fimc/fimc-capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,50 @@ static int fimc_cap_s_ctrl(struct file *file, void *priv,
return ret;
}

static int fimc_cap_cropcap(struct file *file, void *fh,
struct v4l2_cropcap *cr)
{
struct fimc_frame *f;
struct fimc_ctx *ctx = fh;
struct fimc_dev *fimc = ctx->fimc_dev;

if (cr->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;

if (mutex_lock_interruptible(&fimc->lock))
return -ERESTARTSYS;

f = &ctx->s_frame;
cr->bounds.left = 0;
cr->bounds.top = 0;
cr->bounds.width = f->o_width;
cr->bounds.height = f->o_height;
cr->defrect = cr->bounds;

mutex_unlock(&fimc->lock);
return 0;
}

static int fimc_cap_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
{
struct fimc_frame *f;
struct fimc_ctx *ctx = file->private_data;
struct fimc_dev *fimc = ctx->fimc_dev;


if (mutex_lock_interruptible(&fimc->lock))
return -ERESTARTSYS;

f = &ctx->s_frame;
cr->c.left = f->offs_h;
cr->c.top = f->offs_v;
cr->c.width = f->width;
cr->c.height = f->height;

mutex_unlock(&fimc->lock);
return 0;
}

static int fimc_cap_s_crop(struct file *file, void *fh,
struct v4l2_crop *cr)
{
Expand Down Expand Up @@ -716,9 +760,9 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = {
.vidioc_g_ctrl = fimc_vidioc_g_ctrl,
.vidioc_s_ctrl = fimc_cap_s_ctrl,

.vidioc_g_crop = fimc_vidioc_g_crop,
.vidioc_g_crop = fimc_cap_g_crop,
.vidioc_s_crop = fimc_cap_s_crop,
.vidioc_cropcap = fimc_vidioc_cropcap,
.vidioc_cropcap = fimc_cap_cropcap,

.vidioc_enum_input = fimc_cap_enum_input,
.vidioc_s_input = fimc_cap_s_input,
Expand Down
26 changes: 13 additions & 13 deletions trunk/drivers/media/video/s5p-fimc/fimc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ static int fimc_m2m_s_ctrl(struct file *file, void *priv,
return 0;
}

int fimc_vidioc_cropcap(struct file *file, void *fh,
static int fimc_m2m_cropcap(struct file *file, void *fh,
struct v4l2_cropcap *cr)
{
struct fimc_frame *frame;
Expand All @@ -1139,7 +1139,7 @@ int fimc_vidioc_cropcap(struct file *file, void *fh,
return 0;
}

int fimc_vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
{
struct fimc_frame *frame;
struct fimc_ctx *ctx = file->private_data;
Expand Down Expand Up @@ -1167,22 +1167,22 @@ int fimc_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr)
struct fimc_frame *f;
u32 min_size, halign;

f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ?
&ctx->s_frame : &ctx->d_frame;

if (cr->c.top < 0 || cr->c.left < 0) {
v4l2_err(&fimc->m2m.v4l2_dev,
"doesn't support negative values for top & left\n");
return -EINVAL;
}

f = ctx_get_frame(ctx, cr->type);
if (IS_ERR(f))
return PTR_ERR(f);
if (cr->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
f = (ctx->state & FIMC_CTX_CAP) ? &ctx->s_frame : &ctx->d_frame;
else if (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT &&
ctx->state & FIMC_CTX_M2M)
f = &ctx->s_frame;
else
return -EINVAL;

min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
? fimc->variant->min_inp_pixsize
: fimc->variant->min_out_pixsize;
min_size = (f == &ctx->s_frame) ?
fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize;

if (ctx->state & FIMC_CTX_M2M) {
if (fimc->id == 1 && fimc->variant->pix_hoff)
Expand Down Expand Up @@ -1285,9 +1285,9 @@ static const struct v4l2_ioctl_ops fimc_m2m_ioctl_ops = {
.vidioc_g_ctrl = fimc_vidioc_g_ctrl,
.vidioc_s_ctrl = fimc_m2m_s_ctrl,

.vidioc_g_crop = fimc_vidioc_g_crop,
.vidioc_g_crop = fimc_m2m_g_crop,
.vidioc_s_crop = fimc_m2m_s_crop,
.vidioc_cropcap = fimc_vidioc_cropcap
.vidioc_cropcap = fimc_m2m_cropcap

};

Expand Down
4 changes: 0 additions & 4 deletions trunk/drivers/media/video/s5p-fimc/fimc-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,6 @@ int fimc_vidioc_g_fmt(struct file *file, void *priv,
struct v4l2_format *f);
int fimc_vidioc_try_fmt(struct file *file, void *priv,
struct v4l2_format *f);
int fimc_vidioc_g_crop(struct file *file, void *fh,
struct v4l2_crop *cr);
int fimc_vidioc_cropcap(struct file *file, void *fh,
struct v4l2_cropcap *cr);
int fimc_vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc);
int fimc_vidioc_g_ctrl(struct file *file, void *priv,
Expand Down

0 comments on commit 36a5a8c

Please sign in to comment.