From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (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 771C213E88B for ; Thu, 18 Jul 2024 13:56:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721310978; cv=none; b=P+MfRfR8TntwAjkyErPu4WEHKH6DF5JZODLucJpdYWRMQX36sOxrcQs9xk4LGh1nFE+aJFXuMSpuZjK6USfLyAnrnKfQiaqjTELK/AtwD+suNF3FXfFBurnG2gH34Mz/rjyHoLrnGHVFuTh0vRNb9AtdL9zDkV92HZB9FZRPvMI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721310978; c=relaxed/simple; bh=FN9lQnWaRRboDIggzQ7mgKydoQ5EpPRR91UZWwuXo8s=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=qAwYD3yljDr1SU5RwW1CkAvrqCEWE0t01l1MI8MpJejXrOY8bA1p7MnTXypys+NqrSXL1DFPZUaPOpVdcoVh6YwPmHseuxhTZcNMBDlmjpFxm/9Sy52lWgYaYGeNqicwW2lg2gzfKyukDAIxvjeS6OOL/jgW/yLUxF2F84bsuT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ndufresne.ca; spf=none smtp.mailfrom=ndufresne.ca; dkim=pass (2048-bit key) header.d=ndufresne-ca.20230601.gappssmtp.com header.i=@ndufresne-ca.20230601.gappssmtp.com header.b=aIyDMbHA; arc=none smtp.client-ip=209.85.160.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ndufresne.ca Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ndufresne.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ndufresne-ca.20230601.gappssmtp.com header.i=@ndufresne-ca.20230601.gappssmtp.com header.b="aIyDMbHA" Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-44caaf77c7eso1652051cf.3 for ; Thu, 18 Jul 2024 06:56:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ndufresne-ca.20230601.gappssmtp.com; s=20230601; t=1721310974; x=1721915774; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=/9PgN2CWlwkAlyMyd9I5yTG/RODQPuF8I+fsHHELrjs=; b=aIyDMbHAc8DDvgSgmApo/q09ppsEl2CMHhu6BXJEOPHhYaooCZrAQYEcLH7t4Cgi2p HcoRSxhoLbP+1HXNezk8QENTVjxnq2NUzkhJGt2TwObQiUSvOyLEU2QIN5SbbKNhgV+x bPxhekQIR4qOmZIi5SYD0kx+TjT8IWwMzvkWwWwvLsgqODqYWGpcpiKR6KoWitvK6C+S utGZ+eZb07gMwvLbrNDHyuH+njazwfpjHsdI+EOGV4AqdAJKvdg+8X0Ojuv/eu16i19x eThl7PuFzdAOk7KCnlwOiutydnBnEYE/VNyr1dGS4Sn3IfLS7q1injJB+8X44cjWug3U eUfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721310974; x=1721915774; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/9PgN2CWlwkAlyMyd9I5yTG/RODQPuF8I+fsHHELrjs=; b=hu5/6P6clBVKq4FktBIhmGwd82s1tg/v2raKPZtYpRObgmplmaaN55TUJqVhfrLuqz Ro6X0vdesQmQvoSHl6CMlSC1YaIRYTTJD4zFeDISYSpM7gh6453axR+Du8YzUeGsRKKG x8dsl8wqthN7H9FB8Z5BszMIqAfdHBftHYNYmBtgBmIHP18JL5UiNejUH5YOff84dK52 hNaP1R5Wk1063nkBxAcI8k5kHk/peoX8ZJXZMVUXDyeq9+1Z7ttCAMi0nmmbJzpjMFab R1hPrRTaDf5JUalnThndRYZ9Cq/tOnIw4bnvn1p754xF71Jg+ZoEVbpOds43n5NMFHA/ /DOg== X-Forwarded-Encrypted: i=1; AJvYcCVecwwHjMNRJOBLmXtkCZ3t2vVUnq49zZdmbRJ8EHszH8T37sAUnFzpLnoNMol+yHHNduzrKPb6of3h4jaC/C7mENZQpZuqrI1OpLc3 X-Gm-Message-State: AOJu0Ywde3c8lwPVaj81wppB2bLxixBI7ZwRhBq37QcNfEEELZUlnJPP syad62GuzX4E06QkcDyV2cXmBa+wC62mhVcpQHJH54u+1IPh/8GTfRenXoEkHqSBNSbNif5DYKy i X-Google-Smtp-Source: AGHT+IH5MTKib9696k0vgo2HoX8hTJTXldqZABkNwBgCpERpaxYd5V6iPU264qEzfgN6WERm7Mn/6g== X-Received: by 2002:ac8:7d95:0:b0:447:ede4:c6fe with SMTP id d75a77b69052e-44f9696658emr11297251cf.9.1721310974303; Thu, 18 Jul 2024 06:56:14 -0700 (PDT) Received: from nicolas-tpx395.lan ([2606:6d00:15:6720::7a9]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-44f96acd157sm2521331cf.95.2024.07.18.06.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jul 2024 06:56:13 -0700 (PDT) Message-ID: <7113029e2e192d43523a1ea5dae041fb53ae5948.camel@ndufresne.ca> Subject: Re: [PATCH v4 1/2] media: videodev2: Add flags to unconditionnaly enumerate pixels formats From: Nicolas Dufresne To: Benjamin Gaignard , Jacopo Mondi Cc: mchehab@kernel.org, ezequiel@vanguardiasur.com.ar, hverkuil-cisco@xs4all.nl, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, kernel@collabora.com Date: Thu, 18 Jul 2024 09:56:12 -0400 In-Reply-To: <1faa7098-b108-480e-ae4b-ed25e0020e51@collabora.com> References: <20240717131430.159727-1-benjamin.gaignard@collabora.com> <20240717131430.159727-2-benjamin.gaignard@collabora.com> <2kbxr3hkjbcnaqescxmlcerziixg72icqpug6wa25eeggy2pnj@vqmxe4ojcwml> <1faa7098-b108-480e-ae4b-ed25e0020e51@collabora.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.2 (3.52.2-1.fc40) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Hi, Le jeudi 18 juillet 2024 =C3=A0 09:04 +0200, Benjamin Gaignard a =C3=A9crit= =C2=A0: > Le 17/07/2024 =C3=A0 19:50, Nicolas Dufresne a =C3=A9crit=C2=A0: > >=20 [...] > > > > > > @@ -1569,6 +1569,7 @@ static int v4l_enum_fmt(const struct v4l2= _ioctl_ops *ops, > > > > > > int ret =3D check_fmt(file, p->type); > > > > > > u32 mbus_code; > > > > > > u32 cap_mask; > > > > > > + u32 flags; > > > > > >=20 > > > > > > if (ret) > > > > > > return ret; > > > > > > @@ -1578,8 +1579,10 @@ static int v4l_enum_fmt(const struct v4l= 2_ioctl_ops *ops, > > > > > > p->mbus_code =3D 0; > > > > > >=20 > > > > > > mbus_code =3D p->mbus_code; > > > > > > + flags =3D p->flags & V4L2_FMT_FLAG_ENUM_ALL_FORMATS; > > > > > > memset_after(p, 0, type); > > > > > > p->mbus_code =3D mbus_code; > > > > > > + p->flags =3D flags; > > > > > Won't this set V4L2_FMT_FLAG_ENUM_ALL_FORMATS (if present) in the > > > > > flags returned to userspace ? Shouldn't be drivers to set > > > > > V4L2_FMT_FLAG_ALL_FORMATS instead ? > > > > memset_after zeroed flags field so we need this to send V4L2_FMT_FL= AG_ENUM_ALL_FORMATS > > > > flag to drivers. Return it to userspace is a side effect but I don'= t that is problem > > > > since it set it anyway. > > > >=20 > > > Ok, if the expectation is that the flag is preserved through the ioct= l > > > call, this is fine with me > > I might be missing something other similar features are explicitly adve= rtised by > > drivers. This way, the generic layer can keep or clear the flag based o= f if its > > supported. The fact the flag persist the ioctl() or not endup having a = useful > > semantic. > >=20 > > Could we do the same? >=20 > It is the only flag set by userspace when calling the ioctl(), all others > are set by the drivers. > I can clean it from the ioctl() structure after driver call but that won'= t change anything. This does not answer my question. In other similar feature, we have an **internal** flag set by drivers to tell the framework that such feature is abled. Using that, the framework can keep or remove that flag based on if i= ts supported or not. This way, userspace have a clue if the driver do have thi= s support or if the returned result (in that case) is just a subset matching = the configuration. We don't seem to have done the same level of effort here. Nicolas >=20 > >=20 > > > Reviewed-by: Jacopo Mondi > > >=20 > > > > > > switch (p->type) { > > > > > > case V4L2_BUF_TYPE_VIDEO_CAPTURE: > > > > > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linu= x/videodev2.h > > > > > > index fe6b67e83751..b6a5da79ba21 100644 > > > > > > --- a/include/uapi/linux/videodev2.h > > > > > > +++ b/include/uapi/linux/videodev2.h > > > > > > @@ -886,6 +886,8 @@ struct v4l2_fmtdesc { > > > > > > #define V4L2_FMT_FLAG_CSC_HSV_ENC V4L2_FMT_FLAG_CSC_YCBCR_E= NC > > > > > > #define V4L2_FMT_FLAG_CSC_QUANTIZATION 0x0100 > > > > > > #define V4L2_FMT_FLAG_META_LINE_BASED 0x0200 > > > > > > +#define V4L2_FMT_FLAG_ENUM_ALL_FORMATS 0x0400 > > > > > > +#define V4L2_FMT_FLAG_ALL_FORMATS 0x0800 > > > > > >=20 > > > > > > /* Frame Size and frame rate enumeration */ > > > > > > /* > > > > > > -- > > > > > > 2.43.0 > > > > > >=20 > > > > > >=20 > > > > > _______________________________________________ > > > > > Kernel mailing list -- kernel@mailman.collabora.com > > > > > To unsubscribe send an email to kernel-leave@mailman.collabora.co= m > > > > > This list is managed by https://mailman.collabora.com > >=20 > _______________________________________________ > Kernel mailing list -- kernel@mailman.collabora.com > To unsubscribe send an email to kernel-leave@mailman.collabora.com > This list is managed by https://mailman.collabora.com