Re: v4l2: Enhancement to send video alignment info for padding requirements in propose allocation
Nicolas Dufresne via gstreamer-devel <[email protected]> Tue, 06 May 2025 11:18:07 -0400
| Newsgroups | gmane.comp.video.gstreamer.devel |
|---|---|
| Message-ID | <[email protected]> |
--=-j8R1WhxmUejtfOXsLTIX
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi,
Le mardi 06 mai 2025 =C3=A0 09:54 +0000, Pratik Pachange (QUIC) a =C3=A9cri=
t=C2=A0:
>=20
>=20
> Hi
>=20
> Our video driver expects buffer size to be aligned to 4096 bytes (4 KB). =
The expected sizeimage is returned in S_FMT
> ioctl call by the driver. But in gst_v4l2_object_extrapolate_info (), the=
info->size value is updated as per the width
> and height returned by driver=C2=A0
Apparently that was to work around a bug on the Pi (in 2017). I don't remem=
ber much, its related to this archived issue
report:
https://bugzilla.gnome.org/show_bug.cgi?id=3D775564
The driver would report what was "probably" aligned size, but then in bytes=
used, it would report the actual pixel data
surface. Feel free to propose a patch. You can't just revert that old chang=
e, since otherwise the pool will consider
your raw frames truncated and will drop them. This probably need a proper s=
plit so that we correctly populate maxsize vs
size in GstMemory.
regards,
Nicolas
>=20
> For a particular resolution and format (mostly NV12), we expect that the =
difference in actual buffer size and the size
> expected by the video driver be provided as padding in propose allocation=
, so that the upstream plugin can allocate
> buffer as per the driver requirement.=20
>=20
> For example, for resolution 1920x540, driver returns width and height as =
1920x544 =C2=A0(height is 32 bytes aligned) and
> sizeimage as 1568768.
> As per NV12 format, the actual buffer size for this resolution is 1920x54=
4x3/2 =3D 1566720. But driver expects buffer
> size of 1568768 (4KB alignment of 1566720).
> So, this difference of the expected buffer size and actual buffer size sh=
ould be provided as padding requirement in
> propose allocation.
> =C2=A0
> =C2=A0
> Thanks
> Pratik
> =C2=A0
--=-j8R1WhxmUejtfOXsLTIX
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
<html><head>
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:12.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
<style>pre,code,address {
margin: 0px;
}
h1,h2,h3,h4,h5,h6 {
margin-top: 0.2em;
margin-bottom: 0.2em;
}
ol,ul {
margin-top: 0em;
margin-bottom: 0em;
}
blockquote {
margin-top: 0em;
margin-bottom: 0em;
}
</style></head>
<body lang=3D"EN-US" link=3D"#467886" vlink=3D"#96607D" style=3D"word-wrap:=
break-word"><div>Hi,</div><div><br></div><div>Le mardi 06 mai 2025 =C3=A0 0=
9:54 +0000, Pratik Pachange (QUIC) a =C3=A9crit :</div><blockquote typ=
e=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #729fcf solid;paddin=
g-left:1ex">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Hi<br><br>Our video=
driver expects buffer size to be aligned to 4096 bytes (4 KB). The expecte=
d sizeimage is returned in S_FMT ioctl call by the driver. But in gst_v4l2_=
object_extrapolate_info (), the info->size value is updated as per the w=
idth and height returned by driver </span></p><p class=3D"MsoNormal"><=
/p></div></blockquote><div><br></div><div>Apparently that was to work aroun=
d a bug on the Pi (in 2017). I don't remember much, its related to this arc=
hived issue report:<br><br><a href=3D"https://bugzilla.gnome.org/show_bug.c=
gi?id=3D775564">https://bugzilla.gnome.org/show_bug.cgi?id=3D775564</a></di=
v><div><br></div><div>The driver would report what was "probably" aligned s=
ize, but then in bytesused, it would report the actual pixel data surface. =
Feel free to propose a patch. You can't just revert that old change, since =
otherwise the pool will consider your raw frames truncated and will drop th=
em. This probably need a proper split so that we correctly populate maxsize=
vs size in GstMemory.</div><div><br></div><div>regards,</div><div>Nicolas<=
/div><div><br></div><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; b=
order-left:2px #729fcf solid;padding-left:1ex"><div class=3D"WordSection1">=
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt"><br>For a particula=
r resolution and format (mostly NV12), we expect that the difference in act=
ual buffer size and the size expected by the video driver be provided as pa=
dding in propose allocation, so that the upstream plugin can allocate buffe=
r as per the driver requirement. <br><br>For example, for resolution 1920x5=
40, driver returns width and height as 1920x544 (height is 32 bytes a=
ligned) and sizeimage as 1568768.<br>As per NV12 format, the actual buffer =
size for this resolution is 1920x544x3/2 =3D 1566720. But driver expects bu=
ffer size of 1568768 (4KB alignment of 1566720).<br>So, this difference of =
the expected buffer size and actual buffer size should be provided as paddi=
ng requirement in propose allocation.<o:p></o:p></span></p><p class=3D"MsoN=
ormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></span></p><p clas=
s=3D"MsoNormal"><span style=3D"font-size:11.0pt"><o:p> </o:p></span></=
p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt">Thanks<br>Pratik<=
o:p></o:p></span></p><p class=3D"MsoNormal"><span style=3D"font-size:11.0pt=
"><o:p> </o:p></span></p></div></blockquote><div><br></div><div><span>=
</span></div></body></html>
--=-j8R1WhxmUejtfOXsLTIX--