From patchwork Tue Nov 24 18:09:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Farnsworth X-Patchwork-Id: 7692801 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1F5BDBF90C for ; Tue, 24 Nov 2015 18:46:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 342D320891 for ; Tue, 24 Nov 2015 18:46:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C3F01207C0 for ; Tue, 24 Nov 2015 18:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752339AbbKXSqq (ORCPT ); Tue, 24 Nov 2015 13:46:46 -0500 Received: from claranet-outbound-smtp04.uk.clara.net ([195.8.89.37]:34446 "EHLO claranet-outbound-smtp04.uk.clara.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751702AbbKXSqp (ORCPT ); Tue, 24 Nov 2015 13:46:45 -0500 X-Greylist: delayed 2217 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Nov 2015 13:46:45 EST Received: from 110.100.155.90.in-addr.arpa ([90.155.100.110]:5792 helo=f19simon.office.onelan.co.uk) by relay04.mail.eu.clara.net (relay.clara.net [81.171.239.34]:1025) with esmtpa (authdaemon_plain:simon.farnsworth@onelan.co.uk) id 1a1I2C-0008IO-DW (return-path ); Tue, 24 Nov 2015 18:09:44 +0000 From: Simon Farnsworth To: linux-media@vger.kernel.org Cc: Simon Farnsworth Subject: [PATCH] cx18: Fix VIDIOC_TRY_FMT to fill in sizeimage and bytesperline Date: Tue, 24 Nov 2015 18:09:40 +0000 Message-Id: <1448388580-22082-1-git-send-email-simon.farnsworth@onelan.co.uk> X-Mailer: git-send-email 2.1.0 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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 I was having trouble capturing raw video from GStreamer; turns out that I now need VIDIOC_TRY_FMT to fill in sizeimage and bytesperline to make it work. Signed-off-by: Simon Farnsworth --- I'm leaving ONELAN on Friday, so this is a drive-by patch being sent for the benefit of anyone else trying to use raw capture from a cx18 card. If it's not suitable for applying as-is, please feel free to just leave it in the archives so that someone else hitting the same problem can find my fix. drivers/media/pci/cx18/cx18-ioctl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index 55525af..1c9924a 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -234,6 +234,13 @@ static int cx18_try_fmt_vid_cap(struct file *file, void *fh, fmt->fmt.pix.width = w; fmt->fmt.pix.height = h; + if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_HM12) { + fmt->fmt.pix.sizeimage = h * 720 * 3 / 2; + fmt->fmt.pix.bytesperline = 720; /* First plane */ + } else { + fmt->fmt.pix.sizeimage = h * 720 * 2; + fmt->fmt.pix.bytesperline = 1440; /* Packed */ + } return 0; }