pipe CRCs, intel-gpu-tools
And now the igt part, that adds a basic test using CRCs.
Signature · 13 lines
Damien lib/Makefile.am | 4 + lib/drmtest.c | 8 ++ lib/drmtest.h | 16 +++ lib/igt_debugfs.c | 283 ++++++++++++++++++++++++++++++++++++++++ lib/igt_debugfs.h | 77 +++++++++++ lib/igt_display.c | 41 ++++++ lib/igt_display.h | 57 ++++++++ tests/.gitignore | 1 + tests/Makefile.am | 1 + tests/debugfs_pipe_crc.c | 237 +++++++++++++++++++++++++++++++++ 10 files changed, 725 insertions(+)
PATCH 1/8 lib: Add a small helper to open debugfs files
--- lib/Makefile.am | 2 ++ lib/igt_debugfs.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_debugfs.h | 36 ++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 lib/igt_debugfs.c create mode 100644 lib/igt_debugfs.h
lib/Makefile.am +2 -0
@@ -11,6 +11,8 @@ libintel_tools_la_SOURCES = \ i830_reg.h \ i915_3d.h \ i915_reg.h \ + igt_debugfs.c \ + igt_debugfs.h \ instdone.c \ instdone.h \ intel_batchbuffer.c \
lib/igt_debugfs.c new file +75 -0
75 lines not on this page · raw message
lib/igt_debugfs.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Copyright © 2013 Intel 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 (including the next +* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +* +*/ + +#ifndef __IGT_DEBUGFS_H__ +#define __IGT_DEBUGFS_H__ + +typedef struct { +char root[128 ]; +char dri_path[128 ]; +}igt_debugfs_t ; + +int igt_debugfs_init (igt_debugfs_t *debugfs); +int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename); + +#endif /* __IGT_DEBUGFS_H__ */
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 1/8] lib: Add a small helper to open debugfs files
Quoted 135 lines · Damien Lespiau
Signed-off-by Damien Lespiau <[email protected]>--- lib/Makefile.am | 2 ++ lib/igt_debugfs.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_debugfs.h | 36 ++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 lib/igt_debugfs.c create mode 100644 lib/igt_debugfs.hlib/Makefile.am +2
-0@@ -11,6 +11,8 @@ libintel_tools_la_SOURCES = \ i830_reg.h \ i915_3d.h \ i915_reg.h \ + igt_debugfs.c \ + igt_debugfs.h \ instdone.c \ instdone.h \ intel_batchbuffer.c \lib/igt_debugfs.c new file +75
-0@@ -0,0 +1,75 @@ +/* +* Copyright © 2013 Intel 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 (including the next +* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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 <sys/stat.h> +#include <sys/mount.h> +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <fcntl.h> + +#include "igt_debugfs.h" + +int igt_debugfs_init (igt_debugfs_t *debugfs) +{ +const char *path ="/sys/kernel/debug" ; +struct stat st; +int n; + +if (stat ("/debug/dri" , &st) ==0 ) { + path ="/debug/dri" ; + goto find_minor; + } + +if (stat ("/sys/kernel/debug/dri" , &st) ==0 ) + goto find_minor; + +if (stat ("/sys/kernel/debug" , &st)) +return errno; + +if (mount ("debug" ,"/sys/kernel/debug" ,"debugfs" ,0 ,0 )) +return errno; + +find_minor: +strcpy (debugfs->root, path); +for (n =0 ; n <16 ; n++) { +int len =sprintf (debugfs->dri_path,"%s/dri/%d" , path, n); +sprintf (debugfs->dri_path + len,"/i915_error_state" ); +if (stat (debugfs->dri_path, &st) ==0 ) { + debugfs->dri_path[len] ='\0' ; +return 0 ; + } + } + + debugfs->dri_path[0 ] ='\0' ; +return ENOENT ; +} + +int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename) +{ +char buf[1024 ]; + +sprintf (buf,"%s/%s" , debugfs->dri_path, filename); +return open (buf,O_RDONLY ); +}lib/igt_debugfs.h new file +26
-0@@ -0,0 +1,36 @@ +/* +* Copyright © 2013 Intel 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 (including the next +* paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. +* +*/ + +#ifndef __IGT_DEBUGFS_H__ +#define __IGT_DEBUGFS_H__
lib/igt_debugfs.h line 36
Quoted 10 lines
lib/igt_debugfs.h new file +10
-0+ +typedef struct { +char root[128 ]; +char dri_path[128 ]; +}igt_debugfs_t ; + +int igt_debugfs_init (igt_debugfs_t *debugfs); +int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename); + +#endif /* __IGT_DEBUGFS_H__ */
Can you please consolidate this with the stuff in lib/intel_mmio.c?
(I didn't look at the later patches yet).
Signature · 5 lines
Ben Widawsky, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/8 lib: Add igt_debugfs_fopen()
In reply to Damien Lespiau--- lib/igt_debugfs.c | 9 +++++++++ lib/igt_debugfs.h | 4 ++++ 2 files changed, 13 insertions(+)
lib/igt_debugfs.c +9 -0
@@ -73,3 +73,12 @@ int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename)sprintf (buf,"%s/%s" , debugfs->dri_path, filename);return open (buf,O_RDONLY ); } + +FILE *igt_debugfs_fopen (igt_debugfs_t *debugfs,const char *filename, +const char *mode) +{ +char buf[1024 ]; + +sprintf (buf,"%s/%s" , debugfs->dri_path, filename); +return fopen (buf, mode); +}
lib/igt_debugfs.h +4 -0
@@ -25,6 +25,8 @@ #ifndef __IGT_DEBUGFS_H__ #define __IGT_DEBUGFS_H__ +#include <stdio.h> + typedef struct { char root[128]; char dri_path[128];
@@ -32,5 +34,7 @@ typedef struct {int igt_debugfs_init (igt_debugfs_t *debugfs);int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename); +FILE *igt_debugfs_fopen (igt_debugfs_t *debugfs,const char *filename, +const char *mode);#endif /* __IGT_DEBUGFS_H__ */
Signature · 1 line
1.8.3.1
PATCH 3/8 lib: Add a igt_assert_cmpint()
In reply to Damien Lespiau--- lib/drmtest.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
lib/drmtest.h +14 -0
@@ -193,6 +193,20 @@ void igt_exit(void) __attribute__((noreturn)); __igt_fail_assert(99, __FILE__, __LINE__, __func__, #expr , f); \ }while (0 )/** +* igt_assert_cmptint +* +* Like igt_assert(), but displays the values being compared on failure. + */ +#define igt_assert_cmpint (n1, cmp, n2) \ + do { \ + int __n1 = (n1), __n2 = (n2); \ + if (__n1 cmp __n2) ; else \ + __igt_fail_assert(99, __FILE__, __LINE__, __func__, \ + #n1 " " #cmp " " #n2, \ + "error: %d %s %d\n", __n1, #cmp, __n2); \ + } while (0) + +/** * igt_require - skip a (sub-)test if a condition is not met * * This is useful to streamline the skip logic since it allows for a more flat
Signature · 1 line
1.8.3.1
PATCH 4/8 lib: Add kmstest_paint_color()
In reply to Damien Lespiau--- lib/drmtest.c | 8 ++++++++ lib/drmtest.h | 2 ++ 2 files changed, 10 insertions(+)
lib/drmtest.c +8 -0
@@ -1347,6 +1347,14 @@ static int create_bo_for_fb(int fd, int width, int height, int bpp,return 0 ; } +void kmstest_paint_color (cairo_t *cr,int x,int y,int w,int h, +double r,double g,double b) +{ +cairo_rectangle (cr, x, y, w, h); +cairo_set_source_rgb (cr, r, g, b); +cairo_fill (cr); +} +void kmstest_paint_color_gradient (cairo_t *cr,int x,int y,int w,int h,int r,int g,int b)
lib/drmtest.h +2 -0
@@ -359,6 +359,8 @@ unsigned int kmstest_create_fb2(int fd, int width, int height, uint32_t format, bool tiled, struct kmstest_fb *fb);void kmstest_remove_fb (int fd,struct kmstest_fb *fb_info);cairo_t *kmstest_get_cairo_ctx (int fd,struct kmstest_fb *fb); +void kmstest_paint_color (cairo_t *cr,int x,int y,int w,int h, +double r,double g,double b);void kmstest_paint_color_gradient (cairo_t *cr,int x,int y,int w,int h,int r,int g,int b);void kmstest_paint_test_pattern (cairo_t *cr,int width,int height);
Signature · 1 line
1.8.3.1
PATCH 5/8 lib: Add a igt_display.h with a few enums and defines from the kernel
In reply to Damien Lespiau--- lib/Makefile.am | 1 + lib/igt_display.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 lib/igt_display.h
lib/Makefile.am +1 -0
@@ -13,6 +13,7 @@ libintel_tools_la_SOURCES = \ i915_reg.h \ igt_debugfs.c \ igt_debugfs.h \ + igt_display.h \ instdone.c \ instdone.h \ intel_batchbuffer.c \
lib/igt_display.h new file +55 -0
55 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/8 lib: Make igt_debugfs_open() take the mode as argument
In reply to Damien Lespiau--- lib/igt_debugfs.c | 4 ++-- lib/igt_debugfs.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/igt_debugfs.c +2 -2
@@ -66,12 +66,12 @@ find_minor:return ENOENT ; } -int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename) +int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename,int mode) {char buf[1024 ];sprintf (buf,"%s/%s" , debugfs->dri_path, filename); -return open (buf,O_RDONLY ); +return open (buf, mode); } FILE *igt_debugfs_fopen(igt_debugfs_t *debugfs, const char *filename,
lib/igt_debugfs.h +1 -1
@@ -33,7 +33,7 @@ typedef struct { } igt_debugfs_t;int igt_debugfs_init (igt_debugfs_t *debugfs); -int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename); +int igt_debugfs_open (igt_debugfs_t *debugfs,const char *filename,int mode);FILE *igt_debugfs_fopen (igt_debugfs_t *debugfs,const char *filename,const char *mode);
Signature · 1 line
1.8.3.1
PATCH 7/8 lib: Add igt_wait_for_vblank() helper
In reply to Damien Lespiau---
lib/Makefile.am | 1 +
lib/{igt_display.h => igt_display.c} | 38 ++++++++++++------------------------
lib/igt_display.h | 2 ++
3 files changed, 15 insertions(+), 26 deletions(-)
copy lib/{igt_display.h => igt_display.c} (68%)lib/Makefile.am +1 -0
@@ -13,6 +13,7 @@ libintel_tools_la_SOURCES = \ i915_reg.h \ igt_debugfs.c \ igt_debugfs.h \ + igt_display.c \ igt_display.h \ instdone.c \ instdone.h \
lib/igt_display.c renamed from lib/igt_display.h +12 -26
@@ -22,34 +22,20 @@* */ -#ifndef __IGT_DISPLAY_H__ -#define __IGT_DISPLAY_H__ +#include <string.h> -enum pipe { -PIPE_A =0 , -PIPE_B , -PIPE_C , -I915_MAX_PIPES -}; -#define pipe_name (p) ((p) + 'A') +#include "drmtest.h" +#include "igt_display.h" -enum plane { -PLANE_A =0 , -PLANE_B , -PLANE_C , -}; -#define plane_name (p) ((p) + 'A') +void igt_wait_for_vblank (int drm_fd,enum pipe pipe) +{ +drmVBlank wait_vbl; -#define sprite_name (p, s) ((p) * dev_priv->num_plane + (s) + 'A') +memset (&wait_vbl,0 ,sizeof (wait_vbl)); -enum port { -PORT_A =0 , -PORT_B , -PORT_C , -PORT_D , -PORT_E , -I915_MAX_PORTS -}; -#define port_name (p) ((p) + 'A') + wait_vbl.request.type = pipe <<DRM_VBLANK_HIGH_CRTC_SHIFT | +DRM_VBLANK_RELATIVE ; + wait_vbl.request.sequence =1 ; -#endif /* __IGT_DISPLAY_H__ */ +igt_assert (drmWaitVBlank (drm_fd, &wait_vbl) ==0 ); +}
lib/igt_display.h +2 -0
@@ -52,4 +52,6 @@ enum port { };#define port_name (p) ((p) + 'A') +void igt_wait_for_vblank (int drm_fd,enum pipe pipe); +#endif /* __IGT_DISPLAY_H__ */
Signature · 1 line
1.8.3.1
PATCH 8/8 debugfs_pipe_crc: Let's check CRCs!
In reply to Damien LespiauLet's add a new test that sets a mode, wait for a few vblanks (3) and then make sure we read 3 identical CRCs.
Some subtests check for various parsing errors.
In the process, improve the debugfs helpers to deal with CRCs.
--- lib/igt_debugfs.c | 199 +++++++++++++++++++++++++++++++++++++++ lib/igt_debugfs.h | 37 ++++++++ tests/.gitignore | 1 + tests/Makefile.am | 1 + tests/debugfs_pipe_crc.c | 237 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 475 insertions(+) create mode 100644 tests/debugfs_pipe_crc.c
lib/igt_debugfs.c +199 -0
@@ -28,7 +28,10 @@#include <stdio.h> #include <string.h> #include <fcntl.h> +#include <unistd.h> +#include "drmtest.h" +#include "igt_display.h" #include "igt_debugfs.h" int igt_debugfs_init (igt_debugfs_t *debugfs)
@@ -82,3 +85,199 @@ FILE *igt_debugfs_fopen(igt_debugfs_t *debugfs, const char *filename,sprintf (buf,"%s/%s" , debugfs->dri_path, filename);return fopen (buf, mode); } + +/* +* Pipe CRC +*/ + +bool igt_crc_is_null (igt_crc_t *crc) +{ +int i; + +for (i =0 ; i < crc->n_words; i++) +if (crc->crc[i]) +return false; + +return true; +} + +bool igt_crc_equal (igt_crc_t *a,igt_crc_t *b) +{ +int i; + +if (a->n_words != b->n_words) +return false; + +for (i =0 ; i < a->n_words; i++) +if (a->crc[i] != b->crc[i]) +return false; + +return true; +} + +char *igt_crc_to_string (igt_crc_t *crc) +{ +char buf[128 ]; + +if (crc->n_words ==5 ) +sprintf (buf,"%08x %08x %08x %08x %08x" , crc->crc[0 ], + crc->crc[1 ], crc->crc[2 ], crc->crc[3 ], crc->crc[4 ]); +else +igt_assert (0 ); + +return strdup (buf); +} + +/* (6 fields, 8 chars each, space separated (5) + '\n') */ +#define PIPE_CRC_LINE_LEN (6 * 8 + 5 + 1) +/* account for \'0' */ +#define PIPE_CRC_BUFFER_LEN (PIPE_CRC_LINE_LEN + 1) + +struct _igt_pipe_crc { +int drm_fd; + +int ctl_fd; +int crc_fd; +int line_len; +int buffer_len; + +enum pipe pipe; +enum intel_pipe_crc_source source; +}; + +igt_pipe_crc_t * +igt_pipe_crc_new (igt_debugfs_t *debugfs,int drm_fd,enum pipe pipe, +enum intel_pipe_crc_source source) +{ +igt_pipe_crc_t *pipe_crc; +char buf[128 ]; + + pipe_crc =calloc (1 ,sizeof (struct _igt_pipe_crc )); + + pipe_crc->ctl_fd =igt_debugfs_open (debugfs, +"i915_display_crc_ctl" ,O_WRONLY ); +igt_assert (pipe_crc->crc_fd !=-1 ); + +sprintf (buf,"i915_pipe_%c_crc" ,pipe_name (pipe)); + pipe_crc->crc_fd =igt_debugfs_open (debugfs, buf,O_RDONLY ); +igt_assert (pipe_crc->crc_fd !=-1 ); + + pipe_crc->line_len =PIPE_CRC_LINE_LEN ; + pipe_crc->buffer_len =PIPE_CRC_BUFFER_LEN ; + pipe_crc->drm_fd = drm_fd; + pipe_crc->pipe = pipe; + pipe_crc->source = source; + +return pipe_crc; +} + +static void igt_pipe_crc_pipe_off (int fd,enum pipe pipe) +{ +char buf[32 ]; + +sprintf (buf,"pipe %c none" ,pipe_name (pipe)); +write (fd, buf,strlen (buf)); +} + +/* +* Turn off everything +*/ +void igt_pipe_crc_reset (void ) +{ +igt_debugfs_t debugfs; +int fd; + +igt_debugfs_init (&debugfs); + fd =igt_debugfs_open (&debugfs,"i915_display_crc_ctl" ,O_WRONLY ); + +igt_pipe_crc_pipe_off (fd,PIPE_A ); +igt_pipe_crc_pipe_off (fd,PIPE_B ); +igt_pipe_crc_pipe_off (fd,PIPE_C ); +} + +void igt_pipe_crc_free (igt_pipe_crc_t *pipe_crc) +{ +close (pipe_crc->ctl_fd); +close (pipe_crc->crc_fd); +free (pipe_crc); +} + +static const char *pipe_crc_sources[] = { +"none" , +"plane1" , +"plane2" , +"pf" , +}; + +static const char *pipe_crc_source_name (enum intel_pipe_crc_source source) +{ +return pipe_crc_sources[source]; +} + +void igt_pipe_crc_start (igt_pipe_crc_t *pipe_crc) +{ +char buf[64 ]; +igt_crc_t *crcs =NULL ; + +igt_wait_for_vblank (pipe_crc->drm_fd, pipe_crc->pipe); + +sprintf (buf,"pipe %c %s" ,pipe_name (pipe_crc->pipe), +pipe_crc_source_name (pipe_crc->source)); +write (pipe_crc->ctl_fd, buf,strlen (buf)); + +/* +* For some no yet identified reason, the first CRC is bonkers. So +* let's just wait for the next vblank and read out the buggy result. +*/ +igt_pipe_crc_get_crcs (pipe_crc,1 , &crcs); +free (crcs); +} + +void igt_pipe_crc_stop (igt_pipe_crc_t *pipe_crc) +{ +char buf[32 ]; + +sprintf (buf,"pipe %c none" ,pipe_name (pipe_crc->pipe)); +write (pipe_crc->ctl_fd, buf,strlen (buf)); +} + +static bool pipe_crc_init_from_string (igt_crc_t *crc,const char *line) +{ +int n; + + crc->n_words =5 ; + n =sscanf (line,"%8u %8x %8x %8x %8x %8x" , &crc->frame, &crc->crc[0 ], + &crc->crc[1 ], &crc->crc[2 ], &crc->crc[3 ], &crc->crc[4 ]); +return n ==6 ; +} + +/* +* Read @n_crcs from the @pipe_crc. This function blocks until @n_crcs are +* retrieved. +*/ +void +igt_pipe_crc_get_crcs (igt_pipe_crc_t *pipe_crc,int n_crcs, +igt_crc_t **out_crcs) +{ +ssize_t bytes_read; +igt_crc_t *crcs; +char buf[pipe_crc->buffer_len]; +int n =0 ; + + crcs =calloc (n_crcs,sizeof (igt_crc_t)); + +do { +igt_crc_t *crc = &crcs[n]; + + bytes_read =read (pipe_crc->crc_fd, &buf, pipe_crc->line_len); + igt_assert_cmpint(bytes_read, ==, pipe_crc->line_len); + buf[bytes_read] ='\0' ; + +if (!pipe_crc_init_from_string (crc, buf)) +continue ; + + n++; + }while (n < n_crcs); + + *out_crcs = crcs; +}
lib/igt_debugfs.h +37 -0
@@ -25,8 +25,12 @@ #ifndef __IGT_DEBUGFS_H__ #define __IGT_DEBUGFS_H__ +#include <stdbool.h> +#include <stdint.h> #include <stdio.h> +#include "igt_display.h" + typedef struct { char root[128]; char dri_path[128];
@@ -37,4 +41,37 @@ int igt_debugfs_open(igt_debugfs_t *debugfs, const char *filename, int mode);FILE *igt_debugfs_fopen (igt_debugfs_t *debugfs,const char *filename,const char *mode); +/* +* Pipe CRC +*/ + +enum intel_pipe_crc_source { +INTEL_PIPE_CRC_SOURCE_NONE , +INTEL_PIPE_CRC_SOURCE_PLANE1 , +INTEL_PIPE_CRC_SOURCE_PLANE2 , +INTEL_PIPE_CRC_SOURCE_PF , +INTEL_PIPE_CRC_SOURCE_MAX , +}; + +typedef struct _igt_pipe_crc igt_pipe_crc_t ; +typedef struct { +uint32_t frame; +int n_words; +uint32_t crc[5 ]; +}igt_crc_t ; + +bool igt_crc_is_null (igt_crc_t *crc); +bool igt_crc_equal (igt_crc_t *a,igt_crc_t *b); +char *igt_crc_to_string (igt_crc_t *crc); + +igt_pipe_crc_t * +igt_pipe_crc_new (igt_debugfs_t *debugfs,int drm_fd,enum pipe pipe, +enum intel_pipe_crc_source source); +void igt_pipe_crc_reset (void ); +void igt_pipe_crc_free (igt_pipe_crc_t *pipe_crc); +void igt_pipe_crc_start (igt_pipe_crc_t *pipe_crc); +void igt_pipe_crc_stop (igt_pipe_crc_t *pipe_crc); +void igt_pipe_crc_get_crcs (igt_pipe_crc_t *pipe_crc,int n_crcs, +igt_crc_t **out_crcs); +#endif /* __IGT_DEBUGFS_H__ */
tests/.gitignore +1 -0
@@ -1,5 +1,6 @@ # Please keep sorted alphabetically ddi_compute_wrpll +debugfs_pipe_crc drm_get_client_auth drm_vma_limiter drm_vma_limiter_cached
tests/Makefile.am +1 -0
@@ -17,6 +17,7 @@ NOUVEAU_TESTS_M = \ endif TESTS_progs_M = \ + debugfs_pipe_crc \ gem_basic \ gem_caching \ gem_concurrent_blit \
tests/debugfs_pipe_crc.c new file +237 -0
237 lines not on this page · raw message
Signature · 6 lines
1.8.3.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx