[PATCH libdrm v2 20/25] tests: tegra: Add VIC 4.0 support
Thierry Reding
thierry.reding at gmail.com
Wed Feb 23 14:46:01 UTC 2022
On Fri, Feb 18, 2022 at 11:29:34AM +0200, Mikko Perttunen wrote:
> On 2/17/22 21:19, Thierry Reding wrote:
> > From: Thierry Reding <treding at nvidia.com>
> >
> > The Video Image Composer (VIC) 4.0 can be found on NVIDIA Tegra210 SoCs.
> > It uses a different class (B0B6) that is slightly incompatible with the
> > class found on earlier generations.
> >
> > Signed-off-by: Thierry Reding <treding at nvidia.com>
> > ---
> > tests/tegra/meson.build | 2 +
> > tests/tegra/vic.c | 7 +
> > tests/tegra/vic40.c | 370 ++++++++++++++++++++++++++++++++++++++++
> > tests/tegra/vic40.h | 285 +++++++++++++++++++++++++++++++
> > 4 files changed, 664 insertions(+)
> > create mode 100644 tests/tegra/vic40.c
> > create mode 100644 tests/tegra/vic40.h
> >
> > diff --git a/tests/tegra/meson.build b/tests/tegra/meson.build
> > index 1ee29d0afe1b..e9c2bc875a01 100644
> > --- a/tests/tegra/meson.build
> > +++ b/tests/tegra/meson.build
> > @@ -36,6 +36,8 @@ libdrm_test_tegra = static_library(
> > 'vic.h',
> > 'vic30.c',
> > 'vic30.h',
> > + 'vic40.c',
> > + 'vic40.h',
> > ), config_file ],
> > include_directories : [inc_root, inc_drm, inc_tegra],
> > link_with : libdrm,
> > diff --git a/tests/tegra/vic.c b/tests/tegra/vic.c
> > index f24961ac5c6d..e0a97c059eca 100644
> > --- a/tests/tegra/vic.c
> > +++ b/tests/tegra/vic.c
> > @@ -134,6 +134,10 @@ void vic_image_dump(struct vic_image *image, FILE *fp)
> > int vic30_new(struct drm_tegra *drm, struct drm_tegra_channel *channel,
> > struct vic **vicp);
> > +/* from vic40.c */
> > +int vic40_new(struct drm_tegra *drm, struct drm_tegra_channel *channel,
> > + struct vic **vicp);
> > +
> > int vic_new(struct drm_tegra *drm, struct drm_tegra_channel *channel,
> > struct vic **vicp)
> > {
> > @@ -144,6 +148,9 @@ int vic_new(struct drm_tegra *drm, struct drm_tegra_channel *channel,
> > switch (version) {
> > case 0x40:
> > return vic30_new(drm, channel, vicp);
> > +
> > + case 0x21:
> > + return vic40_new(drm, channel, vicp);
> > }
> > return -ENOTSUP;
> > diff --git a/tests/tegra/vic40.c b/tests/tegra/vic40.c
> > new file mode 100644
> > index 000000000000..1a5d2af6b0b6
> > --- /dev/null
> > +++ b/tests/tegra/vic40.c
> > @@ -0,0 +1,370 @@
> > +/*
> > + * Copyright © 2018 NVIDIA Corporation
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a
> > + * copy of this software and associated documentation files (the "Software"),
> > + * to deal in the Software without restriction, including without limitation
> > + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> > + * and/or sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice shall be included in
> > + * all copies or substantial portions of the Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
> > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > + * OTHER DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +#include <errno.h>
> > +#include <string.h>
> > +
> > +#include "private.h"
> > +#include "tegra.h"
> > +#include "vic.h"
> > +#include "vic40.h"
> > +
> > +struct vic40 {
> > + struct vic base;
> > +
> > + struct {
> > + struct drm_tegra_mapping *map;
> > + struct drm_tegra_bo *bo;
> > + } config;
> > +
> > + struct {
> > + struct drm_tegra_mapping *map;
> > + struct drm_tegra_bo *bo;
> > + } filter;
> > +
> > + struct {
> > + struct drm_tegra_mapping *map;
> > + struct drm_tegra_bo *bo;
> > + } hist;
> > +};
>
> Histogram buffer not necessary at least on VIC4.0 and later. (Same applies
> to VIC4.1 and VIC4.2 patches).
I'm pretty sure that I saw SMMU faults without this on all of Tegra210,
Tegra186 and Tegra194. I'll go and test this once more.
> Also not sure if it's worth duplicating all this for the very minor
> differences between VIC4.0/4.1/4.2?
In practice you would likely want to compress this a bit. However, as I
mentioned before this is meant to serve as a reference implementation
and therefore it's a bit more verbose than it would be in a more
practical use-case.
Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20220223/1e718c52/attachment-0001.sig>
More information about the dri-devel
mailing list