Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp603720ima; Fri, 15 Mar 2019 09:46:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzRO7Fjfl/IIFdMMHU1yNBtLKUoBAN2D+rdry3UcXZeqMRmZzawYBVaAsOxbwki9x95ni3 X-Received: by 2002:a62:3107:: with SMTP id x7mr4934684pfx.191.1552668410829; Fri, 15 Mar 2019 09:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552668410; cv=none; d=google.com; s=arc-20160816; b=HoUdezPwfvMQgf5De2I79x+UWJhvoFvGQAvla9ZMS7XRX1mR9i5lzNht6xB6qab78L Ig9LY2bd7KFodwm5BzLQb4AVX0dWzkDiUzsShGPPq4+0ewL033imE9mxkYY3kTrkQuHx HSIxIS1onoz9VWpXbzEGCQrYSwABsxQlbWD3CSQQc3SJmEUSTok3EtOFTYPsqMVd7LuK M49FyZF8to/8RJL1CvF9bQvA/ggXq8VbJ9ym5XeVcBEZ8apVSZi8LubPLnfFOWl9B3JJ X2+JwpjLQMyAIZLU9k/+SMDijQ+TGvwRPRBH+gQCJ+XhWR/TfJETYt7zDQBP9YBtA0cj n5BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MKeZ3r7U2Sc0zDSsO7YumfomYeoYr4L+ho67yi2U67E=; b=LvnOPg/q9zL7Idn/tnZVEYl4eF7NqI8JFsLHpGk0PeOzxOOfhYnmJyB/zMbm/+2Vbo I86S9kFFhyeHuoQIrv88f0MikXOZj6eRqw9bikVs6QAYMIhWl/dITjChl4CqAjoxNceK KJakNi6n6NtemvEvPhLU8QmUeHNCOcv4Zs2xn1cfyw3Q97UBY9Il/EnnTOauFLPLupX9 5fcFHBVQqgVDyyso6koAs8Uq14EawJ+UvaUY3wBtyApOnGZ1gYzECTpar0j6tyoskRb5 K+EMIe6PaE6YcP62pg76c9sz8T3X9LV/FEc9aHry4Z9rVujfgwqKYadVQHdmb9e5e3b5 8N7A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l65si2314202plb.338.2019.03.15.09.46.35; Fri, 15 Mar 2019 09:46:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729810AbfCOQpf (ORCPT + 99 others); Fri, 15 Mar 2019 12:45:35 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:49042 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729783AbfCOQpd (ORCPT ); Fri, 15 Mar 2019 12:45:33 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 3A20D260215 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, hverkuil@xs4all.nl, helen.koike@collabora.com, lucmaga@gmail.com, linux-kernel@vger.kernel.org, kernel@collabora.com Subject: [PATCH 10/16] media: vimc: cap: Add multiplanar default format Date: Fri, 15 Mar 2019 13:43:53 -0300 Message-Id: <20190315164359.626-11-andrealmeid@collabora.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190315164359.626-1-andrealmeid@collabora.com> References: <20190315164359.626-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vimc already have a default single planar default format. Add a multiplanar default pixel format to perfom those same actions. Signed-off-by: André Almeida --- drivers/media/platform/vimc/vimc-capture.c | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index 2d668012e9e9..24052f15c4cf 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -96,6 +96,15 @@ static const struct v4l2_format fmt_default = { .fmt.pix.colorspace = V4L2_COLORSPACE_DEFAULT, }; +static const struct v4l2_format fmt_default_mp = { + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, + .fmt.pix_mp.width = 640, + .fmt.pix_mp.height = 480, + .fmt.pix_mp.pixelformat = V4L2_PIX_FMT_YVU420M, + .fmt.pix_mp.field = V4L2_FIELD_NONE, + .fmt.pix_mp.colorspace = V4L2_COLORSPACE_DEFAULT, +}; + struct vimc_cap_buffer { /* * struct vb2_v4l2_buffer must be the first element @@ -160,7 +169,9 @@ static int vimc_cap_try_fmt_vid_cap(struct file *file, void *priv, /* Don't accept a pixelformat that is not on the table */ if (!v4l2_format_info(format->pixelformat)) - format->pixelformat = fmt_default.fmt.pix.pixelformat; + format->pixelformat = multiplanar ? + fmt_default_mp.fmt.pix_mp.pixelformat : + fmt_default.fmt.pix.pixelformat; return v4l2_fill_pixfmt_mp(format, format->pixelformat, format->width, format->height); @@ -627,11 +638,19 @@ static int vimc_cap_comp_bind(struct device *comp, struct device *master, spin_lock_init(&vcap->qlock); /* Set default frame format */ - vcap->format = fmt_default; - v4l2_fill_pixfmt(&vcap->format.fmt.pix, - vcap->format.fmt.pix.pixelformat, - vcap->format.fmt.pix.width, - vcap->format.fmt.pix.height); + if (multiplanar) { + vcap->format = fmt_default_mp; + v4l2_fill_pixfmt_mp(&vcap->format.fmt.pix_mp, + vcap->format.fmt.pix_mp.pixelformat, + vcap->format.fmt.pix_mp.width, + vcap->format.fmt.pix_mp.height); + } else { + vcap->format = fmt_default; + v4l2_fill_pixfmt(&vcap->format.fmt.pix, + vcap->format.fmt.pix.pixelformat, + vcap->format.fmt.pix.width, + vcap->format.fmt.pix.height); + } /* Fill the vimc_ent_device struct */ vcap->ved.ent = &vcap->vdev.entity; -- 2.21.0