From patchwork Tue Sep 16 10:28:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hans Verkuil (hansverk)" X-Patchwork-Id: 4916041 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 234EB9F2EC for ; Tue, 16 Sep 2014 10:26:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A9B42018B for ; Tue, 16 Sep 2014 10:29:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 39B4A2017D for ; Tue, 16 Sep 2014 10:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753000AbaIPK2z (ORCPT ); Tue, 16 Sep 2014 06:28:55 -0400 Received: from aer-iport-1.cisco.com ([173.38.203.51]:17571 "EHLO aer-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752825AbaIPK2y (ORCPT ); Tue, 16 Sep 2014 06:28:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1329; q=dns/txt; s=iport; t=1410863334; x=1412072934; h=message-id:date:from:mime-version:to:subject: content-transfer-encoding; bh=jnp1z6KLhqVtCYvY94LuZXH29pAlD30c2iRzPUV8Z/I=; b=FUaI9nILiHpcITQpiHJe57rOgiw6OhRGLHNzR/Q0BDFzJ+VRBOtvS1Td uv+bFc5DGjNe2n71lRwTm5RnDpYXgN2k6zmTmKUBa7Z20eaixm6M//fZF zu6QstwBdDuIUdgkEFh83hnv8FY0lYx4ah43QqNorq4sf19cBMkI7NKUf 8=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUHAMkPGFStJssW/2dsb2JhbABghDfSXgOBKwF5hDFRPRYYAwIBAgFLAQwGAgKIOrtCAReMHQGHfwEEnQqHR419g2A7L4JKAQEB X-IronPort-AV: E=Sophos;i="5.04,534,1406592000"; d="scan'208";a="179955085" Received: from aer-iport-nat.cisco.com (HELO aer-core-4.cisco.com) ([173.38.203.22]) by aer-iport-1.cisco.com with ESMTP; 16 Sep 2014 10:28:52 +0000 Received: from [10.54.92.107] (dhcp-10-54-92-107.cisco.com [10.54.92.107]) (authenticated bits=0) by aer-core-4.cisco.com (8.14.5/8.14.5) with ESMTP id s8GASoM6006500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Tue, 16 Sep 2014 10:28:52 GMT Message-ID: <541810E2.4040509@cisco.com> Date: Tue, 16 Sep 2014 12:28:50 +0200 From: Hans Verkuil User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: linux-media , Mauro Carvalho Chehab , Laurent Pinchart , Pawel Osciak , Nicolas Dufresne Subject: [RFC PATCH] vb2: regression fix for vbi capture & poll X-Authenticated-User: hansverk Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-15.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_DEF_DKIM_WL 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 (My proposal to fix this. Note that it is untested, I plan to do that this evening) Commit 9241650d62f7 broke vbi capture applications that expect POLLERR to be returned if STREAMON wasn't called. Rather than checking whether buffers were queued AND vb2 was not yet streaming, just check whether streaming is in progress and return POLLERR if not. This change makes it impossible to poll in one thread and call STREAMON in another, but doing that breaks existing applications and is also not according to the spec. So be it. Signed-off-by: Hans Verkuil --- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c index 7e6aff6..0452fb2 100644 --- a/drivers/media/v4l2-core/videobuf2-core.c +++ b/drivers/media/v4l2-core/videobuf2-core.c @@ -2583,10 +2583,10 @@ unsigned int vb2_poll(struct vb2_queue *q, struct file *file, poll_table *wait) } /* - * There is nothing to wait for if no buffer has been queued and the - * queue isn't streaming, or if the error flag is set. + * There is nothing to wait for if the queue isn't streaming, or if + * the error flag is set. */ - if ((list_empty(&q->queued_list) && !vb2_is_streaming(q)) || q->error) + if (!vb2_is_streaming(q) || q->error) return res | POLLERR; /*