Message ID | 20190116120117.115497-1-hverkuil-cisco@xs4all.nl (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-media-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67C5E13B4 for <patchwork-linux-media@patchwork.kernel.org>; Wed, 16 Jan 2019 12:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 566C82CF60 for <patchwork-linux-media@patchwork.kernel.org>; Wed, 16 Jan 2019 12:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 545CE2DE0F; Wed, 16 Jan 2019 12:01:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFDE22CF60 for <patchwork-linux-media@patchwork.kernel.org>; Wed, 16 Jan 2019 12:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391763AbfAPMBV (ORCPT <rfc822;patchwork-linux-media@patchwork.kernel.org>); Wed, 16 Jan 2019 07:01:21 -0500 Received: from lb2-smtp-cloud7.xs4all.net ([194.109.24.28]:35357 "EHLO lb2-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732739AbfAPMBU (ORCPT <rfc822;linux-media@vger.kernel.org>); Wed, 16 Jan 2019 07:01:20 -0500 Received: from marune.fritz.box ([IPv6:2001:983:e9a7:1:74b9:e8d0:a90b:6427]) by smtp-cloud7.xs4all.net with ESMTPA id jjsjgM1cgBDyIjjskg25EF; Wed, 16 Jan 2019 13:01:18 +0100 From: hverkuil-cisco@xs4all.nl To: linux-media@vger.kernel.org Cc: Sakari Ailus <sakari.ailus@linux.intel.com>, Paul Kocialkowski <paul.kocialkowski@bootlin.com> Subject: [PATCHv4 0/5] vb2: add buf_out_validate callback Date: Wed, 16 Jan 2019 13:01:12 +0100 Message-Id: <20190116120117.115497-1-hverkuil-cisco@xs4all.nl> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfBj8lAB0oiU2KUkh3EW3EDB3KSZYkuyY+QTIamDtCj+ZAvkhTG2KB1Xvp/nnp1waQUxHrhHoSUODVOyzW/u0YuItTYVUZc9RvAiOCvigq6i18+DRjsbd fi5SthN7q0hxFo2l3/Hu4v7iQrI9LT6yTXbd3+HNlJbzaD432opb2xOEqOoU31iw+C6CWCIMwCj4xUdnbhMHmXFqwU+WC8wy0yeOIFGcQ7Bg5q6XzSTk7AhI /prHJetH/DnFI6s27uoroCNs8kURJctglfG8T1+D7ODR7twaU+jiLQ2aB88Lk6QI2pU/tWcCvsydKk1FPDg0xhft5YQiZTI3sfehrm3LOnA= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
vb2: add buf_out_validate callback
|
expand
|
From: Hans Verkuil <hverkuil-cisco@xs4all.nl> When queueing a buffer to a request the 'field' value is not validated. That field is only validated when the _buf_prepare() is called, which happens when the request is queued. However, this validation should happen at QBUF time, since you want to know about this as soon as possible. Also, the spec requires that the 'field' value is validated at QBUF time. This patch adds a new buf_out_validate callback to validate the output buffer at buf_prepare time or when QBUF queues an unprepared buffer to a request. This callback is mandatory for output queues that support requests. This issue was found by v4l2-compliance since it failed to replace V4L2_FIELD_ANY by a proper field value when testing the vivid video output in combination with requests. This patch series adds a new buf_out_validate callback and implements it for the three drivers that support requests for output queues: vivid, vim2m and cedrus. The final patch adds a check that this new callback is implemented for output queues supporting requests since it is easy to forget. Regards, Hans Changes since v3: - Implement the callback for the cedrus driver, add check that the callback is implemented when it is required. - Previous versions claimed that there was also a problem when requests are not in use, but that turned out to be wrong. This is request specific. - Call the new callback as well when preparing a buffer. - When calling it from qbuf, only call it when queueing an unprepared buffer to a request. This is the actual fix. Changes since v2: - drop test whether the queue is an output queue. This callback is only called for output queues, so this test is not needed anymore. Changes since v1: - Renamed buf_validate to buf_out_validate since this is output specific. - Clarify in the commit log of the first patch that this isn't request API specific, but fixes a long standing problem that just wasn't noticed until now. Hans Verkuil (5): vb2: add buf_out_validate callback vim2m: add buf_out_validate callback vivid: add buf_out_validate callback cedrus: add buf_out_validate callback vb2: check that buf_out_validate is present .../media/common/videobuf2/videobuf2-core.c | 22 ++++++++++++--- .../media/common/videobuf2/videobuf2-v4l2.c | 7 +++++ drivers/media/platform/vim2m.c | 27 +++++++++++-------- drivers/media/platform/vivid/vivid-vid-out.c | 23 +++++++++++----- .../staging/media/sunxi/cedrus/cedrus_video.c | 9 +++++++ include/media/videobuf2-core.h | 5 ++++ 6 files changed, 72 insertions(+), 21 deletions(-)