Re: [Nouveau] [igt-dev] [PATCH i-g-t] lib: Introduce the igt_nouveau library

2021-03-25 Thread Petri Latvala
On Wed, Mar 24, 2021 at 06:24:54PM -0400, Lyude Paul wrote:
> On Thu, 2021-03-18 at 11:17 +0200, Petri Latvala wrote:
> > On Wed, Mar 17, 2021 at 06:38:27PM -0400, Lyude wrote:
> > > From: Lyude Paul 
> > > 
> > > This introduces the igt_nouveau library, which enables support for tiling
> > > formats on nouveau, along with accelerated clears for allocated bos in 
> > > VRAM
> > > using the dma-copy engine present on Nvidia hardware since Tesla. 
> > > Typically
> > > the latter would be handled by the kernel automatically, which is the
> > > long-term plan for nouveau, but since the kernel doesn't yet support that
> > > we implement this in igt in order to fulfill the expectation that most of
> > > igt has in which newly allocated fbs are expected to be zero-filled by
> > > default.
> > > 
> > > The dma-copy engine is capable of fast blitting, and is also able to
> > > perform tiling/untiling at the same time. This is worth mentioning because
> > > unlike many of the other drivers supported in igt, we go out of our way to
> > > avoid using mmap() in order to perform CPU rendering wherever possible.
> > > Instead of mmap()ing an fb that we want to draw to on the CPU (whether it
> > > be for converting formats, or just normal rendering), we instead use
> > > dma-copy to blit linear/tiled fbs over to linear system memory which we
> > > mmap() instead. This is primarily because while mmap() is typically
> > > painfully slow for vram, it's even slower on nouveau due to the current
> > > lack of dynamic reclocking in our driver. Furthermore, using the dma-copy
> > > engine for copying things over to system ram is also dramatically faster
> > > than using igt's memcpy wc helpers even when no tiling is involved. Such
> > > speed improvements are both quite nice, but also very necessary for 
> > > certain
> > > tests like kms_plane that are rather sensitive when it comes to slow
> > > rendering with drivers.
> > > 
> > > This doesn't mean we won't want to provide a way of using mmap() for
> > > rendering in the future however, as at least basic testing of mmap() is
> > > certainly something we eventually want for nouveau. However, I think the
> > > best way for us to do this in the future will be to adapt the igt_draw API
> > > to work with nouveau so we can explicitly request using mmap() in tests
> > > which need it.
> > > 
> > > Finally, this code also adds a hard dependency on libdrm support for
> > > nouveau tests. The main reason for this is currently there are no real
> > > applications that use nouveau's ioctls directly (mesa for instance, uses
> > > libdrm as well) and also that nouveau's ioctls are currently a bit
> > > complicated to use by hand. This will likely be temporary however, as Ben
> > > Skeggs is planning on revamping a lot of nouveau's APIs to simplify them
> > > and make libdrm support for nouveau obsolete in the future. Note that we
> > > take care to make sure that users can still disable libdrm support for
> > > nouveau if needed, with the only caveat being that any tests using
> > > igt_nouveau will be disabled, along with any tiling support for
> > > nvidia-specific tiling formats.
> > > 
> > > This should enable igt tests which test tiling formats to run on nouveau,
> > > and fix some seemingly random test failures as a result of not having
> > > zero-filled buffers in a few other tests like kms_cursor_crc.
> > > 
> > > Signed-off-by: Lyude Paul 
> > > Cc: Martin Peres 
> > > Cc: Ben Skeggs 
> > > Cc: Jeremy Cline 
> > > ---
> > >  .gitlab-ci.yml  |   7 +
> > >  include/drm-uapi/drm_fourcc.h   |   2 +-
> > >  lib/drmtest.c   |   5 +
> > >  lib/igt_fb.c    |  98 +++--
> > >  lib/igt_fb.h    |   2 +
> > >  lib/igt_nouveau.c   | 281 ++
> > >  lib/igt_nouveau.h   |  65 ++
> > >  lib/meson.build |   8 +
> > >  lib/nouveau/cea0b5.c    | 252 +++
> > >  lib/nouveau/nvhw/class/cl906f.h | 103 ++
> > >  lib/nouveau/nvhw/class/cla0b5.h | 250 +++
> > >  lib/nouveau/nvhw/drf.h  | 209 +++
> > >  lib/nouveau/nvif/push.h | 345 
> > >  lib/nouveau/nvif/push906f.h  

Re: [Nouveau] [igt-dev] [PATCH i-g-t v3] tests/kms_cursor_crc: Probe kernel for cursor size support

2021-03-24 Thread Petri Latvala
On Tue, Mar 23, 2021 at 01:25:13PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> Currently we just assume that every cursor size up to data->cursor_max_w/h 
> will
> be supported by the driver, and check for support of nonsquare cursors by
> checking if we're running on u815 and if so, which variant of intel hardware

The right side of your keyboard dodged your fingers when writing "i915" here.

-- 
Petri Latvala



> we're running on. This isn't really ideal as we're about to enable 32x32 
> cursor
> size tests for nouveau, and Intel hardware doesn't support cursor sizes that
> small.
> 
> So, fix this by removing has_nonsquare_cursors() and replacing it with a more
> generic require_cursor_size() function which checks whether or not the driver
> we're using supports a given cursor size by attempting a test-only atomic
> commit.
> 
> v3:
> * Also probe for cursor support on systems without atomic support
> 
> Signed-off-by: Lyude Paul 
> Cc: Martin Peres 
> Cc: Ben Skeggs 
> Cc: Jeremy Cline 
> ---
>  tests/kms_cursor_crc.c | 133 -
>  1 file changed, 78 insertions(+), 55 deletions(-)
> 
> diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> index 3541ea06..529e2171 100644
> --- a/tests/kms_cursor_crc.c
> +++ b/tests/kms_cursor_crc.c
> @@ -523,26 +523,45 @@ static void create_cursor_fb(data_t *data, int cur_w, 
> int cur_h)
>   igt_put_cairo_ctx(cr);
>  }
>  
> -static bool has_nonsquare_cursors(data_t *data)
> +static void require_cursor_size(data_t *data, int w, int h)
>  {
> - uint32_t devid;
> + igt_fb_t primary_fb;
> + drmModeModeInfo *mode;
> + igt_display_t *display = &data->display;
> + igt_output_t *output = data->output;
> + igt_plane_t *primary, *cursor;
> + int ret;
>  
> - if (!is_i915_device(data->drm_fd))
> - return false;
> + igt_output_set_pipe(output, data->pipe);
>  
> - devid = intel_get_drm_devid(data->drm_fd);
> + mode = igt_output_get_mode(output);
> + primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
> + cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
> +
> + /* Create temporary primary fb for testing */
> + igt_assert(igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, 
> DRM_FORMAT_XRGB,
> +  LOCAL_DRM_FORMAT_MOD_NONE, &primary_fb));
> +
> + igt_plane_set_fb(primary, &primary_fb);
> + igt_plane_set_fb(cursor, &data->fb);
> + igt_plane_set_size(cursor, w, h);
> + igt_fb_set_size(&data->fb, cursor, w, h);
> +
> + /* Test if the kernel supports the given cursor size or not */
> + if (display->is_atomic)
> + ret = igt_display_try_commit_atomic(display,
> + DRM_MODE_ATOMIC_TEST_ONLY |
> + 
> DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
> + else
> + ret = igt_display_try_commit2(display, COMMIT_LEGACY);
>  
> - /*
> -  * Test non-square cursors a bit on the platforms
> -  * that support such things.
> -  */
> - if (devid == PCI_CHIP_845_G || devid == PCI_CHIP_I865_G)
> - return true;
> + igt_plane_set_fb(primary, NULL);
> + igt_plane_set_fb(cursor, NULL);
>  
> - if (IS_VALLEYVIEW(devid) || IS_CHERRYVIEW(devid))
> - return false;
> + igt_remove_fb(data->drm_fd, &primary_fb);
> + igt_output_set_pipe(output, PIPE_NONE);
>  
> - return intel_gen(devid) >= 7;
> + igt_skip_on_f(ret, "Cursor size %dx%d not supported by driver\n", w, h);
>  }
>  
>  static void test_cursor_size(data_t *data)
> @@ -697,27 +716,33 @@ static void run_tests_on_pipe(data_t *data, enum pipe 
> pipe)
>   create_cursor_fb(data, w, h);
>   }
>  
> - /* Using created cursor FBs to test cursor support */
> - igt_describe("Check if a given-size cursor is well-positioned 
> inside the screen.");
> - igt_subtest_f("pipe-%s-cursor-%dx%d-onscreen", 
> kmstest_pipe_name(pipe), w, h)
> - run_test(data, test_crc_onscreen, w, h);
> -
> - igt_describe("Check if a given-size cursor is well-positioned 
> outside the screen.");
> - igt_subtest_f("pipe-%s-cursor-%dx%d-offscreen", 
> kmstest_pipe_name(pipe), w, h)
> - run_test(data, test_crc_offscreen, w, h);
> -
> - igt

Re: [Nouveau] [igt-dev] [PATCH i-g-t] lib: Introduce the igt_nouveau library

2021-03-19 Thread Petri Latvala
On Thu, Mar 18, 2021 at 12:49:13PM -0400, Lyude Paul wrote:
> On Thu, 2021-03-18 at 11:15 +0200, Petri Latvala wrote:
> > On Thu, Mar 18, 2021 at 09:06:29AM +0200, Martin Peres wrote:
> > > On 18/03/2021 00:38, Lyude wrote:
> > > > diff --git a/include/drm-uapi/drm_fourcc.h 
> > > > b/include/drm-uapi/drm_fourcc.h
> > > > index a7bc058c..87c87485 100644
> > > > --- a/include/drm-uapi/drm_fourcc.h
> > > > +++ b/include/drm-uapi/drm_fourcc.h
> > > > @@ -681,7 +681,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64
> > > > modifier)
> > > >   }
> > > >   /*
> > > > - * 16Bx2 Block Linear layout, used by Tegra K1 and later
> > > > + * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and
> > > > later
> > > 
> > > Maybe remove one of the "and"s?
> > > 
> > > 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1+
> > 
> > drm_fourcc.h is copied from the kernel, no hand-editing in IGT.
> 
> These additions are all copied from the drm_fourcc.h file in the kernel 
> though,
> do you want me to just update the whole file instead?

It was more of a response to Martin's suggestion that would need to go
through the kernel.

As for this patch to IGT, yes please, copy the file from the kernel
as-is. As a separate commit, commit message stating which SHA in
kernel it's from.


-- 
Petri Latvala



> 
> > 
> > 
> 
> -- 
> Sincerely,
>Lyude Paul (she/her)
>Software Engineer at Red Hat
>
> Note: I deal with a lot of emails and have a lot of bugs on my plate. If 
> you've
> asked me a question, are waiting for a review/merge on a patch, etc. and I
> haven't responded in a while, please feel free to send me another email to 
> check
> on my status. I don't bite!
> 
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t 0/7] lib: Miscellaneous cleanups from nouveau work

2021-03-18 Thread Petri Latvala
On Wed, Mar 17, 2021 at 06:49:42PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> These are just a couple of small fixes that didn't seem important
> enough to stick in their own patch series, but were various issues with
> igt that I found along the way during my recent nouveau igt work.
> 
> Cc: Martin Peres 
> Cc: Jeremy Cline 
> 
> Lyude Paul (7):
>   lib/drmtest: Use igt_assert_eq() for do_or_die()
>   lib/drmtest: And use do_or_die() in do_ioctl()
>   lib/drmtest: Remove i915 refs in do_ioctl*() docs
>   lib/igt_fb: Remove domain from igt_fb
>   lib/debugfs: Fix igt_crc_t docs to mention has_valid_frame
>   lib/igt_aux: Print name of debug var in igt_debug_wait_for_keypress()
>   lib/debugfs: Fix function name in igt_pipe_crc_get_for_frame() docs
> 
>  lib/drmtest.h | 8 
>  lib/igt_aux.c | 2 +-
>  lib/igt_debugfs.c | 2 +-
>  lib/igt_debugfs.h | 3 ++-
>  lib/igt_fb.c  | 3 ---
>  lib/igt_fb.h  | 2 --
>  6 files changed, 8 insertions(+), 12 deletions(-)
> 


One minor comment on one patch, otherwise LGTM.

Series is
Reviewed-by: Petri Latvala 
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t 1/7] lib/drmtest: Use igt_assert_eq() for do_or_die()

2021-03-18 Thread Petri Latvala
On Wed, Mar 17, 2021 at 06:49:43PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> Noticed this while working on some nouveau tests, if we use igt_assert_eq()
> here we'll output both the expected and returned value instead of just the
> expected value.

igt_assert_eq stuffs x into an int so there's one difference.

Hmm, but generally do_or_die is used with ioctl() or something that
wraps it and it will be an int.


> 
> Signed-off-by: Lyude Paul 
> Cc: Martin Peres 
> Cc: Ben Skeggs 
> Cc: Jeremy Cline 
> ---
>  lib/drmtest.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/drmtest.h b/lib/drmtest.h
> index d393dbf1..789452ea 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -113,7 +113,7 @@ bool is_vc4_device(int fd);
>   * that in any failure case the return value is non-zero and a precise error 
> is
>   * logged into errno. Uses igt_assert() internally.

A minor cosmetic change to this comment (igt_assert usage) is welcome.



Reviewed-by: Petri Latvala 


>   */
> -#define do_or_die(x) igt_assert((x) == 0)
> +#define do_or_die(x) igt_assert_eq((x), 0)
>  
>  /**
>   * do_ioctl:
> -- 
> 2.29.2
> 
> ___
> igt-dev mailing list
> igt-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t] tests/kms_cursor_crc: Test 32x32 cursors

2021-03-18 Thread Petri Latvala
On Thu, Mar 18, 2021 at 08:39:01AM +0200, Martin Peres wrote:
> On 18/03/2021 00:45, Lyude wrote:
> > From: Lyude Paul 
> > 
> > Since pre-nve4 only has two cursor sizes (32x32 and 64x64), we should at
> > least test both of them.
> 
> This adds 36 subtests, which take about 1s in average. So the runtime is not
> significantly increased on the Intel side.
> 
> It also seems that Intel should add skips or fix the kernel to support these
> 32xXX format.
> 
> @Petri, could you get someone to investigate this?


Ville, J-P?


-- 
Petri Latvala



> 
> In the mean time, here is my:
> 
> Reviewed-by: Martin Peres 
> 
> Martin
> > 
> > Signed-off-by: Lyude Paul 
> > Cc: Martin Peres 
> > Cc: Ben Skeggs 
> > Cc: Jeremy Cline 
> > ---
> >   tests/kms_cursor_crc.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
> > index 0be8f7f8..c70c4a8f 100644
> > --- a/tests/kms_cursor_crc.c
> > +++ b/tests/kms_cursor_crc.c
> > @@ -683,7 +683,7 @@ static void run_tests_on_pipe(data_t *data, enum pipe 
> > pipe)
> > igt_fixture
> > igt_remove_fb(data->drm_fd, &data->fb);
> > -   for (cursor_size = 64; cursor_size <= 512; cursor_size *= 2) {
> > +   for (cursor_size = 32; cursor_size <= 512; cursor_size *= 2) {
> > int w = cursor_size;
> > int h = cursor_size;
> > 
> ___
> igt-dev mailing list
> igt-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t] lib: Introduce the igt_nouveau library

2021-03-18 Thread Petri Latvala
On Wed, Mar 17, 2021 at 06:38:27PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> This introduces the igt_nouveau library, which enables support for tiling
> formats on nouveau, along with accelerated clears for allocated bos in VRAM
> using the dma-copy engine present on Nvidia hardware since Tesla. Typically
> the latter would be handled by the kernel automatically, which is the
> long-term plan for nouveau, but since the kernel doesn't yet support that
> we implement this in igt in order to fulfill the expectation that most of
> igt has in which newly allocated fbs are expected to be zero-filled by
> default.
> 
> The dma-copy engine is capable of fast blitting, and is also able to
> perform tiling/untiling at the same time. This is worth mentioning because
> unlike many of the other drivers supported in igt, we go out of our way to
> avoid using mmap() in order to perform CPU rendering wherever possible.
> Instead of mmap()ing an fb that we want to draw to on the CPU (whether it
> be for converting formats, or just normal rendering), we instead use
> dma-copy to blit linear/tiled fbs over to linear system memory which we
> mmap() instead. This is primarily because while mmap() is typically
> painfully slow for vram, it's even slower on nouveau due to the current
> lack of dynamic reclocking in our driver. Furthermore, using the dma-copy
> engine for copying things over to system ram is also dramatically faster
> than using igt's memcpy wc helpers even when no tiling is involved. Such
> speed improvements are both quite nice, but also very necessary for certain
> tests like kms_plane that are rather sensitive when it comes to slow
> rendering with drivers.
> 
> This doesn't mean we won't want to provide a way of using mmap() for
> rendering in the future however, as at least basic testing of mmap() is
> certainly something we eventually want for nouveau. However, I think the
> best way for us to do this in the future will be to adapt the igt_draw API
> to work with nouveau so we can explicitly request using mmap() in tests
> which need it.
> 
> Finally, this code also adds a hard dependency on libdrm support for
> nouveau tests. The main reason for this is currently there are no real
> applications that use nouveau's ioctls directly (mesa for instance, uses
> libdrm as well) and also that nouveau's ioctls are currently a bit
> complicated to use by hand. This will likely be temporary however, as Ben
> Skeggs is planning on revamping a lot of nouveau's APIs to simplify them
> and make libdrm support for nouveau obsolete in the future. Note that we
> take care to make sure that users can still disable libdrm support for
> nouveau if needed, with the only caveat being that any tests using
> igt_nouveau will be disabled, along with any tiling support for
> nvidia-specific tiling formats.
> 
> This should enable igt tests which test tiling formats to run on nouveau,
> and fix some seemingly random test failures as a result of not having
> zero-filled buffers in a few other tests like kms_cursor_crc.
> 
> Signed-off-by: Lyude Paul 
> Cc: Martin Peres 
> Cc: Ben Skeggs 
> Cc: Jeremy Cline 
> ---
>  .gitlab-ci.yml  |   7 +
>  include/drm-uapi/drm_fourcc.h   |   2 +-
>  lib/drmtest.c   |   5 +
>  lib/igt_fb.c|  98 +++--
>  lib/igt_fb.h|   2 +
>  lib/igt_nouveau.c   | 281 ++
>  lib/igt_nouveau.h   |  65 ++
>  lib/meson.build |   8 +
>  lib/nouveau/cea0b5.c| 252 +++
>  lib/nouveau/nvhw/class/cl906f.h | 103 ++
>  lib/nouveau/nvhw/class/cla0b5.h | 250 +++
>  lib/nouveau/nvhw/drf.h  | 209 +++
>  lib/nouveau/nvif/push.h | 345 
>  lib/nouveau/nvif/push906f.h |  70 +++
>  lib/nouveau/priv.h  |  57 ++
>  meson.build |   3 +
>  tests/meson.build   |   2 +-
>  17 files changed, 1745 insertions(+), 14 deletions(-)
>  create mode 100644 lib/igt_nouveau.c
>  create mode 100644 lib/igt_nouveau.h
>  create mode 100644 lib/nouveau/cea0b5.c
>  create mode 100644 lib/nouveau/nvhw/class/cl906f.h
>  create mode 100644 lib/nouveau/nvhw/class/cla0b5.h
>  create mode 100644 lib/nouveau/nvhw/drf.h
>  create mode 100644 lib/nouveau/nvif/push.h
>  create mode 100644 lib/nouveau/nvif/push906f.h
>  create mode 100644 lib/nouveau/priv.h

Do you want to support autotools?

-- 
Petri Latvala
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t] lib: Introduce the igt_nouveau library

2021-03-18 Thread Petri Latvala
On Thu, Mar 18, 2021 at 09:06:29AM +0200, Martin Peres wrote:
> On 18/03/2021 00:38, Lyude wrote:
> > diff --git a/include/drm-uapi/drm_fourcc.h b/include/drm-uapi/drm_fourcc.h
> > index a7bc058c..87c87485 100644
> > --- a/include/drm-uapi/drm_fourcc.h
> > +++ b/include/drm-uapi/drm_fourcc.h
> > @@ -681,7 +681,7 @@ drm_fourcc_canonicalize_nvidia_format_mod(__u64 
> > modifier)
> >   }
> >   /*
> > - * 16Bx2 Block Linear layout, used by Tegra K1 and later
> > + * 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1 and later
> 
> Maybe remove one of the "and"s?
> 
> 16Bx2 Block Linear layout, used by desktop GPUs, and Tegra K1+

drm_fourcc.h is copied from the kernel, no hand-editing in IGT.


-- 
Petri Latvala
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t v5 2/5] lib/igt_core: Add igt_require_fd()

2020-09-30 Thread Petri Latvala
On Wed, Sep 30, 2020 at 01:31:47PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> Like igt_assert_fd(), but using igt_require() instead
> 
> Changes since v1:
> * Fix documentation error in igt_require_fd() - Petri Latvala
> 
> Signed-off-by: Lyude Paul 

Reviewed-by: Petri Latvala 


> ---
>  lib/igt_core.h | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index e74ede8b..5d835260 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1021,6 +1021,18 @@ void igt_describe_f(const char *fmt, ...);
>   else igt_debug("Test requirement passed: %s\n", #expr); \
>  } while (0)
>  
> +/**
> + * igt_require_fd:
> + * @fd: file descriptor
> + *
> + * Skips (sub-) test if the given file descriptor is invalid.
> + *
> + * Like igt_require(), but displays the stringified identifier that was 
> supposed
> + * to contain a valid fd on failure.
> + */
> +#define igt_require_fd(fd) \
> + igt_require_f(fd >= 0, "file descriptor " #fd " failed\n");
> +
>  /**
>   * igt_skip_on_f:
>   * @expr: condition to test
> -- 
> 2.26.2
> 
> ___
> igt-dev mailing list
> igt-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t v5 1/5] lib/igt_core: Fix igt_assert_fd() documentation

2020-09-30 Thread Petri Latvala
On Wed, Sep 30, 2020 at 01:31:46PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> As Petri Latvala pointed out, some of the documentation in this macro is
> mistakenly copied from the other igt_assert*() macros. Let's fix that.
> 
> Signed-off-by: Lyude Paul 

Reviewed-by: Petri Latvala 


> ---
>  lib/igt_core.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index c5871520..e74ede8b 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -966,8 +966,8 @@ void igt_describe_f(const char *fmt, ...);
>   *
>   * Fails (sub-) test if the given file descriptor is invalid.
>   *
> - * Like igt_assert(), but displays the values being compared on failure 
> instead
> - * of simply printing the stringified expression.
> + * Like igt_assert(), but displays the stringified identifier that was 
> supposed
> + * to contain a valid fd on failure.
>   */
>  #define igt_assert_fd(fd) \
>   igt_assert_f(fd >= 0, "file descriptor " #fd " failed\n");
> -- 
> 2.26.2
> 
> ___
> igt-dev mailing list
> igt-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t v3 2/5] lib/igt_core: Add igt_require_fd()

2020-04-20 Thread Petri Latvala
On Fri, Apr 17, 2020 at 05:10:22PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> Like igt_assert_fd(), but using igt_require() instead
> 
> Changes since v1:
> * Fix documentation error in igt_require_fd() - Petri Latvala
> 
> Signed-off-by: Lyude Paul 


Reviewed-by: Petri Latvala 



> ---
>  lib/igt_core.h | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 3f69b072..8f68b2dd 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1021,6 +1021,18 @@ void igt_describe_f(const char *fmt, ...);
>   else igt_debug("Test requirement passed: %s\n", #expr); \
>  } while (0)
>  
> +/**
> + * igt_require_fd:
> + * @fd: file descriptor
> + *
> + * Skips (sub-) test if the given file descriptor is invalid.
> + *
> + * Like igt_require(), but displays the stringified identifier that was 
> supposed
> + * to contain a valid fd on failure.
> + */
> +#define igt_require_fd(fd) \
> + igt_require_f(fd >= 0, "file descriptor " #fd " failed\n");
> +
>  /**
>   * igt_skip_on_f:
>   * @expr: condition to test
> -- 
> 2.25.1
> 
> ___
> igt-dev mailing list
> igt-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t v3 1/5] lib/igt_core: Fix igt_assert_fd() documentation

2020-04-20 Thread Petri Latvala
On Fri, Apr 17, 2020 at 05:10:21PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> As Petri Latvala pointed out, some of the documentation in this macro is
> mistakenly copied from the other igt_assert*() macros. Let's fix that.
> 
> Signed-off-by: Lyude Paul 
> ---
>  lib/igt_core.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index b97fa2fa..3f69b072 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -966,8 +966,8 @@ void igt_describe_f(const char *fmt, ...);
>   *
>   * Fails (sub-) test if the given file descriptor is invalid.
>   *
> - * Like igt_assert(), but displays the values being compared on failure 
> instead
> - * of simply printing the stringified expression.
> + * Like igt_assert(), but displays the stringified identifier that was 
> supposed
> + * to contain a valid fd on failure.


For some values of "like" this is like igt_assert, but for some it's
not. I don't have enough coffee to suggest a better wording though.


Reviewed-by: Petri Latvala 


>   */
>  #define igt_assert_fd(fd) \
>   igt_assert_f(fd >= 0, "file descriptor " #fd " failed\n");
> -- 
> 2.25.1
> 
> ___
> igt-dev mailing list
> igt-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t 1/4] lib/igt_core: Add igt_require_fd()

2020-03-30 Thread Petri Latvala
On Tue, Mar 17, 2020 at 09:00:44PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> Like igt_assert_fd(), but using igt_require() instead
> 
> Signed-off-by: Lyude Paul 
> ---
>  lib/igt_core.h | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index fae5f59e..b66336cf 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -1008,6 +1008,18 @@ void igt_describe_f(const char *fmt, ...);
>   else igt_debug("Test requirement passed: %s\n", #expr); \
>  } while (0)
>  
> +/**
> + * igt_require_fd:
> + * @fd: file descriptor
> + *
> + * Skips (sub-) test if the given file descriptor is invalid.
> + *
> + * Like igt_require(), but displays the values being compared on failure 
> instead
> + * of simply printing the stringified expression..

igt_assert_fd has this documentation comment, but that's mistakenly
copypasted from igt_assert_eq and pals. Let's not propagate the
copypaste error further.


-- 
Petri Latvala


> + */
> +#define igt_require_fd(fd) \
> + igt_require_f(fd >= 0, "file descriptor " #fd " failed\n");
> +
>  /**
>   * igt_skip_on_f:
>   * @expr: condition to test
> -- 
> 2.24.1
> 
> ___
> igt-dev mailing list
> igt-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau


Re: [Nouveau] [igt-dev] [PATCH i-g-t 4/4] tests: Add nouveau-crc tests

2020-03-30 Thread Petri Latvala
On Tue, Mar 17, 2020 at 09:00:47PM -0400, Lyude wrote:
> From: Lyude Paul 
> 
> We're finally getting CRC support in nouveau, so let's start testing
> this in igt as well! While the normal CRC capture tests are nice,
> there's a number of Nvidia-specific hardware characteristics that we
> need to test as well.
> 
> The most important one is known as a "notifier context flip". Basically,
> Nvidia GPUs store generated CRCs in an allocated memory region, referred
> to as the notifier context, that the driver programs itself. Strangely,
> this region can only hold a limited number of CRC entries, and once it
> runs out of available entries the hardware simply sets an overrun bit
> and stops writing any new CRC entries.
> 
> Since igt-gpu-tools doesn't really have an expectation of only being
> able to grab a limited number of CRCs, we work around this in nouveau by
> allocating two separate CRC notifier regions each time we start
> capturing CRCs, and then flip between them whenever we get close to
> filling our currently programmed notifier context. While this keeps the
> number of CRC entries we lose to an absolute minimum, we are guaranteed
> to lose exactly one CRC entry between context flips. Thus, we add some
> tests to ensure that nouveau handles these flips correctly
> (pipe-[A-F]-ctx-flip-detection), and that igt itself is also able to
> handle them correctly (pipe-[A-F]-ctx-flip-skip-current-frame). Since
> these tests use a debugfs interface to manually control the notifier
> context flip threshold, we also add one test to ensure that any flip
> thresholds we set are cleared after a single CRC capture
> (ctx-flip-threshold-reset-after-capture).
> 
> In addition, we also add some simple tests to test Nvidia-specific CRC
> sources.
> 
> Signed-off-by: Lyude Paul 
> ---
>  lib/drmtest.c   |  10 ++
>  lib/drmtest.h   |   2 +
>  tests/meson.build   |   1 +
>  tests/nouveau_crc.c | 396 
>  4 files changed, 409 insertions(+)
>  create mode 100644 tests/nouveau_crc.c
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index 1fc39925..53c01754 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -112,6 +112,11 @@ bool is_i915_device(int fd)
>   return __is_device(fd, "i915");
>  }
>  
> +bool is_nouveau_device(int fd)
> +{
> + return __is_device(fd, "nouveau");
> +}
> +
>  bool is_vc4_device(int fd)
>  {
>   return __is_device(fd, "vc4");
> @@ -537,6 +542,11 @@ void igt_require_intel(int fd)
>   igt_require(is_i915_device(fd) && has_known_intel_chipset(fd));
>  }
>  
> +void igt_require_nouveau(int fd)
> +{
> + igt_require(is_nouveau_device(fd));
> +}
> +
>  void igt_require_vc4(int fd)
>  {
>   igt_require(is_vc4_device(fd));
> diff --git a/lib/drmtest.h b/lib/drmtest.h
> index 632c616b..4937e9d2 100644
> --- a/lib/drmtest.h
> +++ b/lib/drmtest.h
> @@ -97,10 +97,12 @@ void gem_quiescent_gpu(int fd);
>  
>  void igt_require_amdgpu(int fd);
>  void igt_require_intel(int fd);
> +void igt_require_nouveau(int fd);
>  void igt_require_vc4(int fd);
>  
>  bool is_amdgpu_device(int fd);
>  bool is_i915_device(int fd);
> +bool is_nouveau_device(int fd);
>  bool is_vc4_device(int fd);
>  
>  /**
> diff --git a/tests/meson.build b/tests/meson.build
> index 7629afde..9ff74cc6 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -70,6 +70,7 @@ test_progs = [
>   'kms_vblank',
>   'kms_vrr',
>   'meta_test',
> + 'nouveau_crc',
>   'panfrost_get_param',
>   'panfrost_gem_new',
>   'panfrost_prime',
> diff --git a/tests/nouveau_crc.c b/tests/nouveau_crc.c
> new file mode 100644
> index ..09e17a6f
> --- /dev/null
> +++ b/tests/nouveau_crc.c
> @@ -0,0 +1,396 @@
> +/*
> + * Copyright © 2019 Red Hat Inc.

Verify that the authoring year is correct.


-- 
Petri Latvala
___
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau