From patchwork Wed Dec 18 21:39:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13914171 Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EE2C1FDE2C for ; Wed, 18 Dec 2024 21:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557970; cv=none; b=WzmGaqS69QT0nWWSBK2XUIJM8Ujit7+b9XE+G/vhKZu88PDuoc18gzgDBS5sSSWoeCe2AZQbkVPEEzqVd/ss3guWw+Am1MdnGNagsxX1b8G6dnAjSfAbT7Pju4CMfCn+ANc9Vo1P7Sb7/IglhwLpeyurO25+5t7z07gppAKcZrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557970; c=relaxed/simple; bh=qyRuVIeUYyOK0Q3PlRcwjQXuqSyYOCeaRPkUH3obUhU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pGIiMgER+tUVT9fUQDE+OWZ3lEG5e7nG6BOVK7MbjkGW5u4xBb3XgSgtszCDfWjWPPDdF7bOui1XaoFEsKlgxOpZUMGACUIXp4I16NPh8jZWuSSefKSe2djc9uQeezkCHWNarvIoF9sWeDzXCKcGc1ySMH9nMnMnxn4vopp1GHw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=oS/MOZa5; arc=none smtp.client-ip=209.85.160.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="oS/MOZa5" Received: by mail-qt1-f178.google.com with SMTP id d75a77b69052e-46772a0f85bso395371cf.3 for ; Wed, 18 Dec 2024 13:39:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734557967; x=1735162767; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Xf/EiHgc9x+QegkQdQE1ivkIRei7ICvkT+RDLhyzgnI=; b=oS/MOZa5afkdSu7++ElAHkZX5yAWwbJnFC7zQPogl97LjcmlMYLcdHsRR5Y39oJ3rr zzgRoFjaAYSlxEFx3zoYpe6AyCksEIC3pqtXqffoC943/cZGukA9K/3ifcQQyAgt09IV XLE5Ki+TF16YFp/YNXnC4sKTPCRdTfhnxzY4s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734557967; x=1735162767; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xf/EiHgc9x+QegkQdQE1ivkIRei7ICvkT+RDLhyzgnI=; b=FXwJBn4TsaYmKf1PBLM7UkDjiAC8h+594L+8QdWqa0vvy6bBr+m1hI2X0qPf7iYKdo qymBDyBpjCQkPYonKziNZbBUxv5ft+U8DeIKN+D11Z9oPsZ1RN2HlUYkVWIpgf4Ja1Vr hhHG1lc547AkjY21MW/YTDHxDUZQ4RmsRaqmuc06xq7Hl8QAl/c+S+5xEp+OnmpcqF/d 597ETZ+q1KNjfSnKrZezWl8RrWyhfsTwTmLD47wGt+nFRhT0PG2Ch4mMmmOHaedB4lgC kU1es9VBJv7e+Ua/Qs7y9aRqm93iasEOP+0JDpL7ZubCwH2RH+18CMOKNDay0C/dAtUY BZFA== X-Gm-Message-State: AOJu0YwgXvXdh6De44tjCVxjWFk/WbnhjzONw+P+ZTJ5QZObLmC23zJ7 JYbqmKp0wXQCPLbQyeV9D/TDfdY7gyGih9TgHbnoR6LXlWLipRRJCGQ96wCJJjXRXMwx/wO6h3I = X-Gm-Gg: ASbGncsnc34Oh//TUaoDA6EAgupz8YTcPmWe6jDT/cn2FWTxYqt4uKeTzOEt7A1Kwws Mg0s0T9nbiv7bY47udUflbHEKyz8qI90ibbY+PT44dMnsqiUJMzihbnPJtaspKGORPgBcxwhiI7 aj1WJKbYKY0oYZb5/QQ2xr6hdv+A5ovDSOhp5pEmlJGvSKfR/7/KI6gmbYMVrMSuEkhjXS77AnQ 6ZzRPxM5djGDdeDEo35MB/PysWrJauE+g5+dmivxHxUjFfAyhVZruD17rbJEb7ZdJ2iXU4sDY/a tz8LUiOxCroRVRNWJ0xbSpDVVlWv5xo= X-Google-Smtp-Source: AGHT+IGkLS9CMqZYLYYP5mdA8pjf23N/QyaWNYPecd0D7EIeWJo2+DJRQufGdZrMAa+2pzD2K1+kHg== X-Received: by 2002:ac8:5782:0:b0:467:5ea8:83df with SMTP id d75a77b69052e-46908e03aeamr61025111cf.30.1734557967098; Wed, 18 Dec 2024 13:39:27 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2c6e312sm55176651cf.8.2024.12.18.13.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 13:39:25 -0800 (PST) From: Ricardo Ribalda Date: Wed, 18 Dec 2024 21:39:08 +0000 Subject: [PATCH v2 1/4] media: uvcvideo: Propagate buf->error to userspace Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241218-uvc-deprecate-v2-1-ab814139e983@chromium.org> References: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> In-Reply-To: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 Now we return VB2_BUF_STATE_DONE for valid and invalid frames. Propagate the correct value, so the user can know if the frame is valid or not via struct v4l2_buffer->flags. Reported-by: Hans de Goede Closes: https://lore.kernel.org/linux-media/84b0f212-cd88-46bb-8e6f-b94ec3eccba6@redhat.com Fixes: 6998b6fb4b1c ("[media] uvcvideo: Use videobuf2-vmalloc") Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index 26ee85657fc8..f8464f0aae1b 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -479,7 +479,8 @@ static void uvc_queue_buffer_complete(struct kref *ref) buf->state = buf->error ? UVC_BUF_STATE_ERROR : UVC_BUF_STATE_DONE; vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused); - vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_DONE); + vb2_buffer_done(&buf->buf.vb2_buf, buf->error ? VB2_BUF_STATE_ERROR : + VB2_BUF_STATE_DONE); } /* From patchwork Wed Dec 18 21:39:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13914172 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 339501FE44D for ; Wed, 18 Dec 2024 21:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557971; cv=none; b=MRpjGMVkCIehuewuxRc2sDq6edlsqlSmO/MZZhb4RB9mXoGW7gxrNuS+XTYolp/nsxrMS39j7IvyXV9GVxeVB2jOYwHJBJg+npgO9PDY5SHurd3wDc1AHQhkGUIaSlYWrGgnwU3fRiVNc/UUdNuqe5l2T/JWbMDui6LX5jXN2rA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557971; c=relaxed/simple; bh=DhBuuSW9MUIQpcqfUsKuLLo1g4KmmcRnk8ucnEiFIdI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S5SIbJN5Qaw0f6HpBSwga2XCxvg9mxSfKp16cCo6YblfKkfvwlnpW+11dA7WMGIXp8M9IUplnSZ4NPF2xIykyxCZoHUYRoWT4V2FayzRcdbiPxu5cXclUuieY8jJ2bZq7kx9L49yp1MMvEXwyNbG5/T28i3odTAKKI4Zq8s2cxo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ZSnYYNwd; arc=none smtp.client-ip=209.85.160.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZSnYYNwd" Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-467918c360aso704551cf.0 for ; Wed, 18 Dec 2024 13:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734557969; x=1735162769; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vcx11cNcczSAZshcCeyKTXI0xmNNHV+eiS3phSI5Ghw=; b=ZSnYYNwdPIr4Wmj3UL1BsGELGijOmIV5DfmbfAL2LpOdRlpVDw/f73fVXd5YzJzC6x kIBNzFdmLgMgzO0rVEho+O0vHrLbebcNiFlLl+gS/wLoBD1psCPZ8Ob26ZDxqn7BEvAu EGgNfp6hLWBUYm+PjU/bpSwSi8UQF6Pn6L5hw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734557969; x=1735162769; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vcx11cNcczSAZshcCeyKTXI0xmNNHV+eiS3phSI5Ghw=; b=dlK5Ggbj9MLRiBjmqXp3oIR33EGe/DNVLfzxJE8FVBEnoXqiMQuipDqAMJB9nIKRoH SaUgBYQpIAZJmIs5csLUKBkMRaUBEtVC8aeO18kzCYrzkyxHTnXZKti13uhRIzJyn9ca n4leNX86R8ptVcXOKdxhVnwa+WDKQXZb1NH8VMXoD7qzaI9f6AOozxLqJM3J2DPApIo7 /Zmztp9KKfj0BgsrCyTHcyr4YG2bzprsbmYLQrVEBpYgFizN9//KkSpAsKnrvJW62eQ7 /P5slsdJly3sRmJkZrcbiBIL4CwDLF5PZFivtbCT020nTbAOt1NSF38lyGrkNVh7zakV mN3w== X-Gm-Message-State: AOJu0YyL9vGJbFi2DS2/wpxnMWsPjiMgmmPfM2/vExa867fLJVu9hj3P U/U8Eq5m/uziEwyqX/JjCW9HneFdN+N7i/0bPq6e3BeX9YLUzFMF3KmC+tUnEAgp4wUU26V329E = X-Gm-Gg: ASbGncuhtGJIq0xTA4pWWlTWdEeim5pdDYELjeU9V6/MRz8oOow/s+yl/rZr60l5RE2 atTre5kIs0zAuMbFXroIdh0yOX9simpe3aCerVaAj/3VXJaueez04rncm0ufTfNTWRMbJoR8eYl KXAFrRUgC6xQtXqi3eOdsAgVH/u3kHKSimwe0x5fdIJ8VfJct0K5Y0DCLQoN49TjNbORlsTCmrQ OL8Geu7XoJSXGCV7tFp9D7lWhkRnLDxecwDvHGmMEii1yTohksl6hIIiuG/TDMxxz6yNGi1TSIN UW34ffBtwTXS0e1CDcTL9XqhF7OWDMw= X-Google-Smtp-Source: AGHT+IHAFG2tbIFDyqlrvTJzXNQ7OmWJs8w6/+hb962JqnaH0dxvvp85RBnT6p4L5Azr1IBWby2OuQ== X-Received: by 2002:a05:622a:309:b0:467:54f4:737b with SMTP id d75a77b69052e-46908e1ed90mr61838381cf.25.1734557968851; Wed, 18 Dec 2024 13:39:28 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2c6e312sm55176651cf.8.2024.12.18.13.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 13:39:27 -0800 (PST) From: Ricardo Ribalda Date: Wed, 18 Dec 2024 21:39:09 +0000 Subject: [PATCH v2 2/4] media: uvcvideo: Invert default value for nodrop module param Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241218-uvc-deprecate-v2-2-ab814139e983@chromium.org> References: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> In-Reply-To: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 The module param `nodrop` defines what to do with frames that contain an error: drop them or sending them to userspace. The default in the rest of the media subsystem is to return buffers with an error to userspace with V4L2_BUF_FLAG_ERROR set in v4l2_buffer.flags. In UVC we drop buffers with errors by default. Change the default behaviour of uvcvideo to match the rest of the drivers and maybe get rid of the module parameter in the future. Suggested-by: Laurent Pinchart Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index b3c8411dc05c..091145743872 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -32,7 +32,7 @@ unsigned int uvc_clock_param = CLOCK_MONOTONIC; unsigned int uvc_hw_timestamps_param; -unsigned int uvc_no_drop_param; +unsigned int uvc_no_drop_param = 1; static unsigned int uvc_quirks_param = -1; unsigned int uvc_dbg_param; unsigned int uvc_timeout_param = UVC_CTRL_STREAMING_TIMEOUT; From patchwork Wed Dec 18 21:39:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13914173 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7147D1FE47D for ; Wed, 18 Dec 2024 21:39:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557974; cv=none; b=X/8Ck3dEK3CrMo5bqiOQAU9sZpR/quwNSRg+NWQxiXgISmNOIWHeuRe7u0mUVpOvYeNoQ0IAIxrITFKxKNH9qnu6NGSnFwg+XWVC4BVd4gnvIcbYhlyRPV8427DvfE0O+gdvBYFGKYByLDnzxaqRGqLPebTAYD/1NyhwhesIfU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557974; c=relaxed/simple; bh=CBYJz7xst02f+rvRo7Dg+NiYrgBua5RnvZLDBzVCnsY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZynSl2WzSMqdrWRJe/SwXhmnNmTFGI4AxSFEqIAHqRHIoorfHNR/HAU9IqMH1TY+Z16Li3sMzYCdWKnb6LwG8mjQqOGEzDzuMnhDqGeBVbjyAKxEU+Ju9CEy4ODpe/e+4PcxoqGePBG45GCK+pc9PRqvIRbnuwhK2/CwI882tHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=eKE19M5v; arc=none smtp.client-ip=209.85.160.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="eKE19M5v" Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-46792996074so586051cf.0 for ; Wed, 18 Dec 2024 13:39:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734557971; x=1735162771; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gFJSV2Tib3aXPFdC1dC52bGWx6Vk7zubK7d/mVN0uIk=; b=eKE19M5vqMTzEbVuvMxrnLk6OB2M3swkonkIeHObHlNtfEcCdWUOFKXE3pRZUmZBxi 5x3fyig7K1mxfUT5hsE9RHFrJK45XBgoIkJByEVTq8gwFExiCrmY2t+zaG/YkFx2S/uG QN177wtmc6FxfEz3tRoswYhegaufUsVnBINQY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734557971; x=1735162771; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFJSV2Tib3aXPFdC1dC52bGWx6Vk7zubK7d/mVN0uIk=; b=VxWzHKNeX8eJ9fXCZ84ufw5nOHmd5hwmFZT97N1ux8s19GWzjG2e/vTewjd21Db43r OtOtw62sIs6t05cdMjNRQDqzQEOhvy7ZJXsY+YIARKY/fxhbRC+pFii3CZs/EJK8gK/C wvtONXT+ZbxoEavyI58+Dh4/23VGidHlxWBv0PlEkKXonuXoqOPhbYczqmqeFdsaw0DH 4EQuxiJ4OZBetLEe+Tx3fXVkV6QuMxG8CChBl5j7gFXyLK1mwB8q4PJPOBXZ632/ojUQ Iy5Mn/d7mljtu/BBKeRyVj1zfuwyfs1gF/S68YOVQpfT3wy+diWDA7QIXbwpGCpSxK2j HFLQ== X-Gm-Message-State: AOJu0YyiAildM48eEffFT37WT4Ta/4dRmV9GXspUwoc+V8InMGXxI1cS iwJ0xFkLsEa2O3ImugMBG6xinE+pOhsfx0oM35ebTzJdouDRDbx45Zqif/7mYzueBGqYH43rPxw = X-Gm-Gg: ASbGncsxA7B/rEU8oVTrEEoi44iRkTeEP2Z/nzSWEexKm5OXSSTmFK2eT4U1H62yivI /nxZFUmMTRYbFPeQRN4Q78O6DucqrbEXHmzIQ2XknjcBQnD94hmAucXnhgEhkofgRrxGl5k0f47 sLfpfOzFtHa/TPWEw91XD/7PVMWrLuaCDU2LVNR2hhnKJLP+QAk6jharYWFNzk5haFVSAB3KZtw wJV2ytk9WiRUFG+nsV24+6vttn1Y4LrBZmUkwIR3B9g9ZrteyU+e2jGjhgGHmtTSYiw8/JyKHRN RoiBDqRGWciH5yoqNzn5SiQqvAo5A90= X-Google-Smtp-Source: AGHT+IGrn06yZu7HqtlYKmaZmmEmMaEPVMY2NFIICkHpbTjFlQfDl6+x6KRZsyqz7MRrefukf9NQGQ== X-Received: by 2002:a05:622a:58a:b0:467:6617:2ed4 with SMTP id d75a77b69052e-46908e74d07mr76408991cf.40.1734557971105; Wed, 18 Dec 2024 13:39:31 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2c6e312sm55176651cf.8.2024.12.18.13.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 13:39:29 -0800 (PST) From: Ricardo Ribalda Date: Wed, 18 Dec 2024 21:39:10 +0000 Subject: [PATCH v2 3/4] media: uvcvideo: Allow changing noparam on the fly Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241218-uvc-deprecate-v2-3-ab814139e983@chromium.org> References: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> In-Reply-To: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 Right now the parameter value is read during video_registration and cannot be changed afterwards, despite its permissions 0644, that makes the user believe that the value can be written. The parameter only affects the beviour of uvc_queue_buffer_complete(), with only one check per buffer. We can read the value directly from uvc_queue_buffer_complete() and therefore allowing changing it with sysfs on the fly. Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 2 +- drivers/media/usb/uvc/uvc_queue.c | 6 ++---- drivers/media/usb/uvc/uvcvideo.h | 4 +--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 091145743872..10812a841587 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -1995,7 +1995,7 @@ int uvc_register_video_device(struct uvc_device *dev, int ret; /* Initialize the video buffers queue. */ - ret = uvc_queue_init(queue, type, !uvc_no_drop_param); + ret = uvc_queue_init(queue, type); if (ret) return ret; diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index f8464f0aae1b..2ee142621042 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -208,8 +208,7 @@ static const struct vb2_ops uvc_meta_queue_qops = { .stop_streaming = uvc_stop_streaming, }; -int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, - int drop_corrupted) +int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type) { int ret; @@ -239,7 +238,6 @@ int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, mutex_init(&queue->mutex); spin_lock_init(&queue->irqlock); INIT_LIST_HEAD(&queue->irqqueue); - queue->flags = drop_corrupted ? UVC_QUEUE_DROP_CORRUPTED : 0; return 0; } @@ -472,7 +470,7 @@ static void uvc_queue_buffer_complete(struct kref *ref) struct vb2_buffer *vb = &buf->buf.vb2_buf; struct uvc_video_queue *queue = vb2_get_drv_priv(vb->vb2_queue); - if ((queue->flags & UVC_QUEUE_DROP_CORRUPTED) && buf->error) { + if (buf->error && !uvc_no_drop_param) { uvc_queue_buffer_requeue(queue, buf); return; } diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 07f9921d83f2..ebbd8afcf136 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h @@ -316,7 +316,6 @@ struct uvc_buffer { }; #define UVC_QUEUE_DISCONNECTED (1 << 0) -#define UVC_QUEUE_DROP_CORRUPTED (1 << 1) struct uvc_video_queue { struct vb2_queue queue; @@ -674,8 +673,7 @@ extern struct uvc_driver uvc_driver; struct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id); /* Video buffers queue management. */ -int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, - int drop_corrupted); +int uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type); void uvc_queue_release(struct uvc_video_queue *queue); int uvc_request_buffers(struct uvc_video_queue *queue, struct v4l2_requestbuffers *rb); From patchwork Wed Dec 18 21:39:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13914174 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D74021FD7A2 for ; Wed, 18 Dec 2024 21:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557975; cv=none; b=SVrVJth/Ms76CqdiB/J9iW3sSNFlj+1EMzIU1yx4GdE5fUOgswR14CFxO9BggtDlCFg5wCwavrFRSY2e8rEIRAB2JvwU4oLZ//gix6WxI3AW2jTsRrx7BaByr15SBzic4T4Mboum6I5oCMYl6TUJR6efdlfaB6GDxCdcebUPWyk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734557975; c=relaxed/simple; bh=pXhSac2AzuqQbkJM9ihbaOkti5PzZszZwkRhNKmkfJA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fkBSIy+kcmcHTwHYH3X6Gwku7LLAKH06yyNEPDz/TEmhZfxyj4HYP4H3pTg/KSpkHYSQxLxxMV/orZOL6YONF45vpwEMQS8yxuXm2SCRxZg6gTJ3khgJWD1dwnNFAtL+yhNQLg0MbTPSeKHC9LBwvcA3GC/5p1KTePIrsZstPGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=cvya7/Xl; arc=none smtp.client-ip=209.85.160.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="cvya7/Xl" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-46741855f9bso521241cf.2 for ; Wed, 18 Dec 2024 13:39:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734557972; x=1735162772; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=wfZU82nxRgI9tSG07OHwYJOWywb24ZmTcs3vC8hLPzc=; b=cvya7/XldWw0nIYQfxM6UFMIl2tNFOAFlSPDFBSqRJiEtjEh8W0cTHfqsOvbJZsXAz KZ6eZFnOha2TOOQgQ2GApZxE7IKqgCBt7DLLChE9fnLCUHK2gNWrANIFQ8bnjatk1E4F IUPcAtFNu6DTw1EBUGLG5E259Yu/9WZOYuu6U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734557972; x=1735162772; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wfZU82nxRgI9tSG07OHwYJOWywb24ZmTcs3vC8hLPzc=; b=JVMLarYvfUOEhp2WHdS6VR3fFTjMc/VhBe9LpYj+0TrD1oEJMPdenwWpvY07PF+1Fe 8u1H4lkBQAQ4GgTuUPUBDE6DZVr9pIJiKMN/ienvE19hefgq7cLOqEFgGzZK9kOBYqeZ NIOqHrX7Cu4E26bTACleV/1Rs+AhdEVvqmT8gNsTUdGjO9JEPBnkoWdpxgXmkr9PIkGb p5qO0HfwqDG1KXjdQMhEKLytUp4J4C6W98rPOZ/JluDWWZPtJF7wSdpXyuLk1bLT3cuV VN/x2pynTXWmzWhozqJdgZa1IyusnrZLyhEVrB9GSnIlQS8OuiYmidJAFMOpk13AHGOE xsFQ== X-Gm-Message-State: AOJu0YwT+AahsD7XlOwEtAVpZgJPrDk1Is3385iszCm60GroMaJMhaa0 8MqpNN7mI8HN0EDHNdPIfTjNXl0FU6atsuHihChs5qZPFipFo4yzPj/nlBiPPLdrusV4tA0Xnl4 = X-Gm-Gg: ASbGncu04huWXAu6eCHKmodXb6kjCsdKWIKktVU/urrpoOShax5zA14EbxQ1ClcN6xt JPOdXaPgOAz9WrqfESlnIn7jSNlXOfohWknMnOuo2aO1JcZnw4jIpLTSF86vevy+VeWoUwKrlrU vM3JsRiL6duPgT7KsVJIrnWR3rzf6gYXU9yrCUur1uwGmHh0yb+No1GmbBPiHvoFZ1J6D+6F9O3 mBzy4aH1Pvv1xXcRN3W2I/sTGmbM4E1z2nLzJgsY2OLZFfg04nnx1fSeTrsn7f4QllLa+I7200/ 0+KpeRjA2IgmFAztvJzzj4MCKFubFp8= X-Google-Smtp-Source: AGHT+IH5B8CT5caGaubN47m+0nYzaaz42CsMyo9uKk36qPmU+8yT3pOqMjCCVmoaCdVWIT3yoeoM3A== X-Received: by 2002:a05:622a:18a7:b0:467:681a:69f4 with SMTP id d75a77b69052e-46908e7fe14mr84435261cf.39.1734557972590; Wed, 18 Dec 2024 13:39:32 -0800 (PST) Received: from denia.c.googlers.com (5.236.236.35.bc.googleusercontent.com. [35.236.236.5]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467b2c6e312sm55176651cf.8.2024.12.18.13.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 13:39:31 -0800 (PST) From: Ricardo Ribalda Date: Wed, 18 Dec 2024 21:39:11 +0000 Subject: [PATCH v2 4/4] media: uvcvideo: Announce the user our deprecation intentions Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241218-uvc-deprecate-v2-4-ab814139e983@chromium.org> References: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> In-Reply-To: <20241218-uvc-deprecate-v2-0-ab814139e983@chromium.org> To: Laurent Pinchart , Hans de Goede , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.13.0 If the user sets the nodrop parameter, print a deprecation warning once. Hopefully they will come to the mailing list if it is an ABI change. Now that we have a callback, take this chance to parse the parameter as a boolean. We still say to userspace that it is a uint to avoid ABI changes. Signed-off-by: Ricardo Ribalda Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index 10812a841587..d8e8675dd2cd 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -2424,8 +2424,25 @@ module_param_call(clock, uvc_clock_param_set, uvc_clock_param_get, MODULE_PARM_DESC(clock, "Video buffers timestamp clock"); module_param_named(hwtimestamps, uvc_hw_timestamps_param, uint, 0644); MODULE_PARM_DESC(hwtimestamps, "Use hardware timestamps"); -module_param_named(nodrop, uvc_no_drop_param, uint, 0644); + +static int param_set_nodrop(const char *val, const struct kernel_param *kp) +{ + pr_warn_once("uvcvideo: " + DEPRECATED + "nodrop parameter will be eventually removed.\n"); + return param_set_bool(val, kp); +} + +static const struct kernel_param_ops param_ops_nodrop = { + .set = param_set_nodrop, + .get = param_get_uint, +}; + +param_check_uint(nodrop, &uvc_no_drop_param); +module_param_cb(nodrop, ¶m_ops_nodrop, &uvc_no_drop_param, 0644); +__MODULE_PARM_TYPE(nodrop, "uint"); MODULE_PARM_DESC(nodrop, "Don't drop incomplete frames"); + module_param_named(quirks, uvc_quirks_param, uint, 0644); MODULE_PARM_DESC(quirks, "Forced device quirks"); module_param_named(trace, uvc_dbg_param, uint, 0644);