diff mbox series

[libdrm] vbltest: add option to use high pipe

Message ID 20230116094420.26075-1-hoegeun.kwon@samsung.com (mailing list archive)
State New, archived
Headers show
Series [libdrm] vbltest: add option to use high pipe | expand

Commit Message

Hoegeun Kwon Jan. 16, 2023, 9:44 a.m. UTC
Add option to use high pipe.

Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
---
 tests/vbltest/vbltest.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Hoegeun Kwon Feb. 7, 2023, 8:08 a.m. UTC | #1
Could you please check this patch.

Best regards
Hoegeun

> -----Original Message-----
> From: dri-devel <dri-devel-bounces@lists.freedesktop.org> On Behalf Of
> Hoegeun Kwon
> Sent: Monday, January 16, 2023 6:44 PM
> To: dri-devel@lists.freedesktop.org; hoegeun.kwon@samsung.com
> Subject: [PATCH libdrm] vbltest: add option to use high pipe
> 
> Add option to use high pipe.
> 
> Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
> ---
>  tests/vbltest/vbltest.c | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c index
> 1c2b519eec4a..1be77b81c560 100644
> --- a/tests/vbltest/vbltest.c
> +++ b/tests/vbltest/vbltest.c
> @@ -45,10 +45,13 @@
> 
>  extern char *optarg;
>  extern int optind, opterr, optopt;
> -static char optstr[] = "D:M:s";
> +static char optstr[] = "D:M:p:s";
> 
>  int secondary = 0;
> 
> +#define DRM_VBLANK_HIGH_CRTC_SHIFT 1
> +static int high_pipe = 0;
> +
>  struct vbl_info {
>  	unsigned int vbl_count;
>  	struct timeval start;
> @@ -65,6 +68,8 @@ static void vblank_handler(int fd, unsigned int frame,
> unsigned int sec,
>  	vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
>  	if (secondary)
>  		vbl.request.type |= DRM_VBLANK_SECONDARY;
> +	if (high_pipe)
> +		vbl.request.type |= high_pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
>  	vbl.request.sequence = 1;
>  	vbl.request.signal = (unsigned long)data;
> 
> @@ -90,6 +95,7 @@ static void usage(char *name)
>  	fprintf(stderr, "  -D DEVICE  open the given device\n");
>  	fprintf(stderr, "  -M MODULE  open the given module\n");
>  	fprintf(stderr, "  -s         use secondary pipe\n");
> +	fprintf(stderr, "  -p NUM     use high pipe\n");
>  	exit(0);
>  }
> 
> @@ -113,12 +119,18 @@ int main(int argc, char **argv)
>  		case 's':
>  			secondary = 1;
>  			break;
> +		case 'p':
> +			high_pipe = atoi(optarg);
> +			break;
>  		default:
>  			usage(argv[0]);
>  			break;
>  		}
>  	}
> 
> +	if (secondary && high_pipe)
> +		return 1;
> +
>  	fd = util_open(device, module);
>  	if (fd < 0)
>  		return 1;
> @@ -127,6 +139,8 @@ int main(int argc, char **argv)
>  	vbl.request.type = DRM_VBLANK_RELATIVE;
>  	if (secondary)
>  		vbl.request.type |= DRM_VBLANK_SECONDARY;
> +	if (high_pipe)
> +		vbl.request.type |= high_pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
>  	vbl.request.sequence = 0;
>  	ret = drmWaitVBlank(fd, &vbl);
>  	if (ret != 0) {
> @@ -143,6 +157,8 @@ int main(int argc, char **argv)
>  	vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
>  	if (secondary)
>  		vbl.request.type |= DRM_VBLANK_SECONDARY;
> +	if (high_pipe)
> +		vbl.request.type |= high_pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
>  	vbl.request.sequence = 1;
>  	vbl.request.signal = (unsigned long)&handler_info;
>  	ret = drmWaitVBlank(fd, &vbl);
> --
> 2.17.1
diff mbox series

Patch

diff --git a/tests/vbltest/vbltest.c b/tests/vbltest/vbltest.c
index 1c2b519eec4a..1be77b81c560 100644
--- a/tests/vbltest/vbltest.c
+++ b/tests/vbltest/vbltest.c
@@ -45,10 +45,13 @@ 
 
 extern char *optarg;
 extern int optind, opterr, optopt;
-static char optstr[] = "D:M:s";
+static char optstr[] = "D:M:p:s";
 
 int secondary = 0;
 
+#define DRM_VBLANK_HIGH_CRTC_SHIFT 1
+static int high_pipe = 0;
+
 struct vbl_info {
 	unsigned int vbl_count;
 	struct timeval start;
@@ -65,6 +68,8 @@  static void vblank_handler(int fd, unsigned int frame, unsigned int sec,
 	vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
 	if (secondary)
 		vbl.request.type |= DRM_VBLANK_SECONDARY;
+	if (high_pipe)
+		vbl.request.type |= high_pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
 	vbl.request.sequence = 1;
 	vbl.request.signal = (unsigned long)data;
 
@@ -90,6 +95,7 @@  static void usage(char *name)
 	fprintf(stderr, "  -D DEVICE  open the given device\n");
 	fprintf(stderr, "  -M MODULE  open the given module\n");
 	fprintf(stderr, "  -s         use secondary pipe\n");
+	fprintf(stderr, "  -p NUM     use high pipe\n");
 	exit(0);
 }
 
@@ -113,12 +119,18 @@  int main(int argc, char **argv)
 		case 's':
 			secondary = 1;
 			break;
+		case 'p':
+			high_pipe = atoi(optarg);
+			break;
 		default:
 			usage(argv[0]);
 			break;
 		}
 	}
 
+	if (secondary && high_pipe)
+		return 1;
+
 	fd = util_open(device, module);
 	if (fd < 0)
 		return 1;
@@ -127,6 +139,8 @@  int main(int argc, char **argv)
 	vbl.request.type = DRM_VBLANK_RELATIVE;
 	if (secondary)
 		vbl.request.type |= DRM_VBLANK_SECONDARY;
+	if (high_pipe)
+		vbl.request.type |= high_pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
 	vbl.request.sequence = 0;
 	ret = drmWaitVBlank(fd, &vbl);
 	if (ret != 0) {
@@ -143,6 +157,8 @@  int main(int argc, char **argv)
 	vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
 	if (secondary)
 		vbl.request.type |= DRM_VBLANK_SECONDARY;
+	if (high_pipe)
+		vbl.request.type |= high_pipe << DRM_VBLANK_HIGH_CRTC_SHIFT;
 	vbl.request.sequence = 1;
 	vbl.request.signal = (unsigned long)&handler_info;
 	ret = drmWaitVBlank(fd, &vbl);