From patchwork Sat Oct 12 12:31:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylwester Nawrocki X-Patchwork-Id: 3031431 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id F2109BF924 for ; Sat, 12 Oct 2013 12:32:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2150B20397 for ; Sat, 12 Oct 2013 12:32:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40B5C20379 for ; Sat, 12 Oct 2013 12:32:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752816Ab3JLMcg (ORCPT ); Sat, 12 Oct 2013 08:32:36 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:48257 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566Ab3JLMc0 (ORCPT ); Sat, 12 Oct 2013 08:32:26 -0400 Received: by mail-wi0-f171.google.com with SMTP id hq4so270596wib.4 for ; Sat, 12 Oct 2013 05:32:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fB6uuj011EFdtFFLhSvXPiTYB4Ju+x6U1f/5C22m2lg=; b=RNoBElbuzNKgGS0+m0KwTfyfUW3AICLGHGM0v3GuFdnWVUZrmbSfOw8oMZb2OAwPz9 OFFFrhVKe/v6b4RuyFqxMT4Ie/clGO2JNGezZfjZlE+VfttGOEJrSKnc6u7LA7Pv+Sgr q/HWTU3LFiqmdeXsyEg7UHzfDlsEP/BAAgS5Qr1RwtBfQ2/15tLrCqmfU917GzpCVeDQ FDWKpnWITBvMHyrUHJGjgdfrgFIPEWQrs5mK52N9L5kcFeHWg6uOVllBDBtxEidS72KY H9EbSQ8xOTm5pg9VzT8Kfy8dsmIVumyBJeekSvinJZINQcfAn6A3rfDT2F8pQtPWsWXE Bgaw== X-Received: by 10.180.10.8 with SMTP id e8mr7100979wib.65.1381581144878; Sat, 12 Oct 2013 05:32:24 -0700 (PDT) Received: from localhost.localdomain (093105185086.warszawa.vectranet.pl. [93.105.185.86]) by mx.google.com with ESMTPSA id q17sm14747025wiv.10.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 12 Oct 2013 05:32:24 -0700 (PDT) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: hverkuil@xs4all.nl, pawel@osciak.com, javier.martin@vista-silicon.com, m.szyprowski@samsung.com, shaik.ameer@samsung.com, arun.kk@samsung.com, k.debski@samsung.com, p.zabel@pengutronix.de, kyungmin.park@samsung.com, linux-samsung-soc@vger.kernel.org, Sylwester Nawrocki Subject: [PATCH RFC v2 07/10] exynos-gsc: Configure default image format at device open() Date: Sat, 12 Oct 2013 14:31:57 +0200 Message-Id: <1381581120-26883-8-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1381581120-26883-1-git-send-email-s.nawrocki@samsung.com> References: <1381581120-26883-1-git-send-email-s.nawrocki@samsung.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, KHOP_BIG_TO_CC, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There should be always some valid image format set on a video device. Signed-off-by: Sylwester Nawrocki --- drivers/media/platform/exynos-gsc/gsc-m2m.c | 34 ++++++++++++++++++++++++++- 1 files changed, 33 insertions(+), 1 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-m2m.c b/drivers/media/platform/exynos-gsc/gsc-m2m.c index e576ff2..48e1c34 100644 --- a/drivers/media/platform/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/exynos-gsc/gsc-m2m.c @@ -605,6 +605,32 @@ static int queue_init(void *priv, struct vb2_queue *src_vq, return vb2_queue_init(dst_vq); } +static int gsc_m2m_set_default_format(struct gsc_ctx *ctx) +{ + struct v4l2_pix_format_mplane pixm = { + .pixelformat = V4L2_PIX_FMT_RGB32, + .width = 800, + .height = 600, + .plane_fmt[0] = { + .bytesperline = 800 * 4, + .sizeimage = 800 * 4 * 600, + }, + }; + const struct gsc_fmt *fmt; + + fmt = find_fmt(&pixm.pixelformat, NULL, 0); + if (!fmt) + return -EINVAL; + + gsc_set_frame_size(&ctx->s_frame, pixm.width, pixm.height); + ctx->s_frame.payload[0] = pixm.plane_fmt[0].sizeimage; + + gsc_set_frame_size(&ctx->d_frame, pixm.width, pixm.height); + ctx->d_frame.payload[0] = pixm.plane_fmt[0].sizeimage; + + return 0; +} + static int gsc_m2m_open(struct file *file) { struct gsc_dev *gsc = video_drvdata(file); @@ -638,7 +664,7 @@ static int gsc_m2m_open(struct file *file) ctx->d_frame.fmt = get_format(0); /* Setup the device context for mem2mem mode. */ ctx->state = GSC_CTX_M2M; - ctx->flags = 0; + ctx->flags = GSC_PARAMS; ctx->in_path = GSC_DMA; ctx->out_path = GSC_DMA; @@ -652,11 +678,17 @@ static int gsc_m2m_open(struct file *file) if (gsc->m2m.refcnt++ == 0) set_bit(ST_M2M_OPEN, &gsc->state); + ret = gsc_m2m_set_default_format(ctx); + if (ret) + goto error_m2m_rel; + pr_debug("gsc m2m driver is opened, ctx(0x%p)", ctx); mutex_unlock(&gsc->lock); return 0; +error_m2m_rel: + v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); error_ctrls: gsc_ctrls_delete(ctx); error_fh: