* [igt-dev] [PATCH i-g-t 0/2] Test modes with aspect ratios
@ 2018-01-24 12:50 Nautiyal, Ankit K
2018-01-24 12:50 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode Nautiyal, Ankit K
2018-01-24 12:51 ` [igt-dev] [PATCH i-g-t 2/2] tests/testdisplay.c: add support to test modes with aspect ratio Nautiyal, Ankit K
0 siblings, 2 replies; 5+ messages in thread
From: Nautiyal, Ankit K @ 2018-01-24 12:50 UTC (permalink / raw)
To: igt-dev, intel-gfx; +Cc: Ankit Nautiyal
From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
This patch series provides a means to test the aspect ratio support
in DRM layer.
https://patchwork.freedesktop.org/series/33984/
Patch 1: adds support to print aspect ratio information for a mode.
Patch 2: modifies the testdisplay to test modes with aspect ratios
Ankit Nautiyal (2):
lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a
mode
tests/testdisplay.c: add support to test modes with aspect ratio
lib/igt_kms.c | 31 +++++++++++++++-
tests/testdisplay.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 129 insertions(+), 6 deletions(-)
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode
2018-01-24 12:50 [igt-dev] [PATCH i-g-t 0/2] Test modes with aspect ratios Nautiyal, Ankit K
@ 2018-01-24 12:50 ` Nautiyal, Ankit K
2018-02-12 14:34 ` Mika Kahola
2018-01-24 12:51 ` [igt-dev] [PATCH i-g-t 2/2] tests/testdisplay.c: add support to test modes with aspect ratio Nautiyal, Ankit K
1 sibling, 1 reply; 5+ messages in thread
From: Nautiyal, Ankit K @ 2018-01-24 12:50 UTC (permalink / raw)
To: igt-dev, intel-gfx; +Cc: Ankit Nautiyal
From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
This patch adds the support to print the aspect ratio of the modes
(if provided) along with other mode information.
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
lib/igt_kms.c | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index eb57f4a..585f94d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -56,6 +56,14 @@
#include "igt_sysfs.h"
#include "sw_sync.h"
+#ifndef DRM_MODE_FLAG_PIC_AR_64_27
+#define DRM_MODE_FLAG_PIC_AR_64_27 (3<<19)
+#endif
+
+#ifndef DRM_MODE_FLAG_PIC_AR_256_135
+#define DRM_MODE_FLAG_PIC_AR_256_135 (4<<19)
+#endif
+
/**
* SECTION:igt_kms
* @short_description: Kernel modesetting support library
@@ -491,6 +499,22 @@ static const char *mode_stereo_name(const drmModeModeInfo *mode)
}
}
+static const char *mode_aspect_name(const drmModeModeInfo *mode)
+{
+ switch (mode->flags & DRM_MODE_FLAG_PIC_AR_MASK) {
+ case DRM_MODE_FLAG_PIC_AR_4_3:
+ return "4:3";
+ case DRM_MODE_FLAG_PIC_AR_16_9:
+ return "16:9";
+ case DRM_MODE_FLAG_PIC_AR_64_27:
+ return "64:27";
+ case DRM_MODE_FLAG_PIC_AR_256_135:
+ return "256:135";
+ default:
+ return NULL;
+ }
+}
+
/**
* kmstest_dump_mode:
* @mode: libdrm mode structure
@@ -500,8 +524,9 @@ static const char *mode_stereo_name(const drmModeModeInfo *mode)
void kmstest_dump_mode(drmModeModeInfo *mode)
{
const char *stereo = mode_stereo_name(mode);
+ const char *aspect_ratio = mode_aspect_name(mode);
- igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s\n",
+ igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s %s%s%s\n",
mode->name, mode->vrefresh,
mode->hdisplay, mode->hsync_start,
mode->hsync_end, mode->htotal,
@@ -509,7 +534,9 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
mode->vsync_end, mode->vtotal,
mode->flags, mode->type, mode->clock,
stereo ? " (3D:" : "",
- stereo ? stereo : "", stereo ? ")" : "");
+ stereo ? stereo : "", stereo ? ")" : "",
+ aspect_ratio ? " (Pixel Aspect Ratio:" : "",
+ aspect_ratio ? aspect_ratio : "", aspect_ratio ? ")" : "");
}
/**
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [igt-dev] [PATCH i-g-t 2/2] tests/testdisplay.c: add support to test modes with aspect ratio
2018-01-24 12:50 [igt-dev] [PATCH i-g-t 0/2] Test modes with aspect ratios Nautiyal, Ankit K
2018-01-24 12:50 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode Nautiyal, Ankit K
@ 2018-01-24 12:51 ` Nautiyal, Ankit K
1 sibling, 0 replies; 5+ messages in thread
From: Nautiyal, Ankit K @ 2018-01-24 12:51 UTC (permalink / raw)
To: igt-dev, intel-gfx; +Cc: Ankit Nautiyal
From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
This patch adds the support to test the modes with aspect ratios.
If the kernel supports the aspect ratio capabilities, the modes
with aspect ratios are set one by one.
This test is a means to verify the drm patch series :Aspect ratio
support in DRM : https://patchwork.freedesktop.org/series/33984/
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
---
tests/testdisplay.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 100 insertions(+), 4 deletions(-)
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index b0156c5..910e395 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -73,13 +73,22 @@
#define Yb_OPT 3
#define Yf_OPT 4
+#ifndef DRM_CLIENT_CAP_ASPECT_RATIO
+/**
+ * Taken from drm-uapi/drm.h
+ * DRM_CLIENT_CAP_ASPECT_RATIO
+ *
+ * If set to 1, the DRM core will expose aspect ratio to userspace
+ */
+#define DRM_CLIENT_CAP_ASPECT_RATIO 4
+#endif
static int tio_fd;
struct termios saved_tio;
drmModeRes *resources;
int drm_fd, modes;
int test_all_modes = 0, test_preferred_mode = 0, force_mode = 0, test_plane,
- test_stereo_modes;
+test_stereo_modes, test_aspect_ratio_modes = 0;
uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE;
int sleep_between_modes = 5;
int do_dpms = 0; /* This aliases to DPMS_ON */
@@ -443,6 +452,62 @@ set_stereo_mode(struct connector *c)
drmModeFreeConnector(c->connector);
}
+static void
+set_aspect_ratio_mode(struct connector *c)
+{
+ int i, n;
+ uint32_t fb_id;
+ struct igt_fb fb_info = { };
+
+
+ if (specified_mode_num != -1)
+ n = 1;
+ else
+ n = c->connector->count_modes;
+
+ for (i = 0; i < n; i++) {
+ if (specified_mode_num == -1)
+ c->mode = c->connector->modes[i];
+
+ if (!c->mode_valid)
+ continue;
+
+ if (!(c->mode.flags & DRM_MODE_FLAG_PIC_AR_MASK))
+ continue;
+
+ igt_info("CRTC(%u): [%d]", c->crtc, i);
+ kmstest_dump_mode(&c->mode);
+ width = c->mode.hdisplay;
+ height = c->mode.vdisplay;
+
+ fb_id = igt_create_pattern_fb(drm_fd, width, height,
+ igt_bpp_depth_to_drm_format(bpp, depth),
+ tiling, &fb_info);
+ paint_output_info(c, &fb_info);
+ paint_color_key(&fb_info);
+
+ kmstest_dump_mode(&c->mode);
+ igt_warn_on_f(drmModeSetCrtc(drm_fd, c->crtc, fb_id, 0, 0, &c->id, 1, &c->mode),
+ "failed to set mode (%dx%d@%dHz): %s\n", width, height, c->mode.vrefresh, strerror(errno));
+ if (qr_code) {
+ set_single();
+ pause();
+ } else if (sleep_between_modes)
+ sleep(sleep_between_modes);
+
+ if (do_dpms) {
+ kmstest_set_connector_dpms(drm_fd, c->connector,
+ DRM_MODE_DPMS_OFF);
+ sleep(sleep_between_modes);
+ kmstest_set_connector_dpms(drm_fd, c->connector,
+ DRM_MODE_DPMS_ON);
+ }
+
+ igt_remove_fb(drm_fd, &fb_info);
+ }
+ drmModeFreeEncoder(c->encoder);
+ drmModeFreeConnector(c->connector);
+}
/*
* Re-probe outputs and light up as many as possible.
*
@@ -517,18 +582,39 @@ int update_display(bool probe)
}
}
+ if (test_aspect_ratio_modes) {
+ for (c = 0; c < resources->count_connectors; c++) {
+ struct connector *connector = &connectors[c];
+
+ connector->id = resources->connectors[c];
+ if (specified_disp_id != -1 &&
+ connector->id != specified_disp_id)
+ continue;
+
+ connector_find_preferred_mode(connector->id,
+ -1UL,
+ specified_mode_num,
+ connector, probe);
+ if (!connector->mode_valid)
+ continue;
+
+ set_aspect_ratio_mode(connector);
+ }
+ }
+
free(connectors);
drmModeFreeResources(resources);
return 1;
}
-static char optstr[] = "3hiaf:s:d:p:mrto:j:y";
+static char optstr[] = "3hziaf:s:d:p:mrto:j:y";
static void __attribute__((noreturn)) usage(char *name, char opt)
{
igt_info("usage: %s [-hiasdpmtf]\n", name);
igt_info("\t-i\tdump info\n");
igt_info("\t-a\ttest all modes\n");
+ igt_info("\t-z\ttest aspect ratio modes\n");
igt_info("\t-s\t<duration>\tsleep between each mode test\n");
igt_info("\t-d\t<depth>\tbit depth of scanout buffer\n");
igt_info("\t-p\t<planew,h>,<crtcx,y>,<crtcw,h> test overlay plane\n");
@@ -637,6 +723,9 @@ int main(int argc, char **argv)
case '3':
test_stereo_modes = 1;
break;
+ case 'z':
+ test_aspect_ratio_modes = 1;
+ break;
case 'i':
opt_dump_info = true;
break;
@@ -716,7 +805,8 @@ int main(int argc, char **argv)
bpp = 32;
if (!test_all_modes && !force_mode && !test_preferred_mode &&
- specified_mode_num == -1 && !test_stereo_modes)
+ specified_mode_num == -1 && !test_stereo_modes &&
+ !test_aspect_ratio_modes)
test_all_modes = 1;
drm_fd = drm_open_driver(DRIVER_ANY);
@@ -727,6 +817,12 @@ int main(int argc, char **argv)
goto out_close;
}
+ if (test_aspect_ratio_modes &&
+ drmSetClientCap(drm_fd, DRM_CLIENT_CAP_ASPECT_RATIO, 1) < 0) {
+ igt_warn("DRM_CLIENT_CAP_ASPECT_RATIO failed\n");
+ goto out_close;
+ }
+
if (opt_dump_info) {
dump_info();
goto out_close;
@@ -766,7 +862,7 @@ int main(int argc, char **argv)
goto out_stdio;
}
- if (test_all_modes)
+ if (test_all_modes || test_aspect_ratio_modes)
goto out_stdio;
g_main_loop_run(mainloop);
--
2.7.4
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode
2018-01-24 12:50 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode Nautiyal, Ankit K
@ 2018-02-12 14:34 ` Mika Kahola
2018-02-13 11:09 ` Nautiyal, Ankit K
0 siblings, 1 reply; 5+ messages in thread
From: Mika Kahola @ 2018-02-12 14:34 UTC (permalink / raw)
To: Nautiyal, Ankit K, igt-dev, intel-gfx
On Wed, 2018-01-24 at 18:20 +0530, Nautiyal, Ankit K wrote:
> From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>
> This patch adds the support to print the aspect ratio of the modes
> (if provided) along with other mode information.
>
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
> lib/igt_kms.c | 31 +++++++++++++++++++++++++++++--
> 1 file changed, 29 insertions(+), 2 deletions(-)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index eb57f4a..585f94d 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -56,6 +56,14 @@
> #include "igt_sysfs.h"
> #include "sw_sync.h"
>
> +#ifndef DRM_MODE_FLAG_PIC_AR_64_27
> +#define DRM_MODE_FLAG_PIC_AR_64_27 (3<<19)
> +#endif
> +
> +#ifndef DRM_MODE_FLAG_PIC_AR_256_135
> +#define DRM_MODE_FLAG_PIC_AR_256_135 (4<<19)
> +#endif
> +
Shouldn't these be defined in /include/uapi/drm/drm_mode.h? Although, I
wasn't able to find these definitions from that file. Do we have a
patch under review in drm to fill this gap?
Otherwise, the patch looks good.
Acked-by: Mika Kahola <mika.kahola@intel.com>
> /**
> * SECTION:igt_kms
> * @short_description: Kernel modesetting support library
> @@ -491,6 +499,22 @@ static const char *mode_stereo_name(const
> drmModeModeInfo *mode)
> }
> }
>
> +static const char *mode_aspect_name(const drmModeModeInfo *mode)
> +{
> + switch (mode->flags & DRM_MODE_FLAG_PIC_AR_MASK) {
> + case DRM_MODE_FLAG_PIC_AR_4_3:
> + return "4:3";
> + case DRM_MODE_FLAG_PIC_AR_16_9:
> + return "16:9";
> + case DRM_MODE_FLAG_PIC_AR_64_27:
> + return "64:27";
> + case DRM_MODE_FLAG_PIC_AR_256_135:
> + return "256:135";
> + default:
> + return NULL;
> + }
> +}
> +
> /**
> * kmstest_dump_mode:
> * @mode: libdrm mode structure
> @@ -500,8 +524,9 @@ static const char *mode_stereo_name(const
> drmModeModeInfo *mode)
> void kmstest_dump_mode(drmModeModeInfo *mode)
> {
> const char *stereo = mode_stereo_name(mode);
> + const char *aspect_ratio = mode_aspect_name(mode);
>
> - igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x
> %d%s%s%s\n",
> + igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s
> %s%s%s\n",
> mode->name, mode->vrefresh,
> mode->hdisplay, mode->hsync_start,
> mode->hsync_end, mode->htotal,
> @@ -509,7 +534,9 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
> mode->vsync_end, mode->vtotal,
> mode->flags, mode->type, mode->clock,
> stereo ? " (3D:" : "",
> - stereo ? stereo : "", stereo ? ")" : "");
> + stereo ? stereo : "", stereo ? ")" : "",
> + aspect_ratio ? " (Pixel Aspect Ratio:" : "",
> + aspect_ratio ? aspect_ratio : "", aspect_ratio ?
> ")" : "");
> }
>
> /**
--
Mika Kahola - Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode
2018-02-12 14:34 ` Mika Kahola
@ 2018-02-13 11:09 ` Nautiyal, Ankit K
0 siblings, 0 replies; 5+ messages in thread
From: Nautiyal, Ankit K @ 2018-02-13 11:09 UTC (permalink / raw)
To: Kahola, Mika, igt-dev@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org
[-- Attachment #1.1: Type: text/plain, Size: 3211 bytes --]
Hi Mika,
Thanks for the review.
Please find my comments inline:
On 2/12/2018 8:04 PM, Kahola, Mika wrote:
> On Wed, 2018-01-24 at 18:20 +0530, Nautiyal, Ankit K wrote:
>> From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>>
>> This patch adds the support to print the aspect ratio of the modes
>> (if provided) along with other mode information.
>>
>> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>> ---
>> lib/igt_kms.c | 31 +++++++++++++++++++++++++++++--
>> 1 file changed, 29 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
>> index eb57f4a..585f94d 100644
>> --- a/lib/igt_kms.c
>> +++ b/lib/igt_kms.c
>> @@ -56,6 +56,14 @@
>> #include "igt_sysfs.h"
>> #include "sw_sync.h"
>>
>> +#ifndef DRM_MODE_FLAG_PIC_AR_64_27
>> +#define DRM_MODE_FLAG_PIC_AR_64_27 (3<<19)
>> +#endif
>> +
>> +#ifndef DRM_MODE_FLAG_PIC_AR_256_135
>> +#define DRM_MODE_FLAG_PIC_AR_256_135 (4<<19)
>> +#endif
>> +
> Shouldn't these be defined in /include/uapi/drm/drm_mode.h? Although, I
> wasn't able to find these definitions from that file. Do we have a
> patch under review in drm to fill this gap?
Yes you are right. These macros are introduced in the drm-devel
patch-series to add aspect-ratio
support in drm layer.
https://patchwork.freedesktop.org/series/33984/ which is under review.
When the kernel patch gets r-b, I will remove these macros from here and
submit
next patchset for this series.
Regards,
Ankit
>
> Otherwise, the patch looks good.
>
> Acked-by: Mika Kahola <mika.kahola@intel.com>
>
>> /**
>> * SECTION:igt_kms
>> * @short_description: Kernel modesetting support library
>> @@ -491,6 +499,22 @@ static const char *mode_stereo_name(const
>> drmModeModeInfo *mode)
>> }
>> }
>>
>> +static const char *mode_aspect_name(const drmModeModeInfo *mode)
>> +{
>> + switch (mode->flags & DRM_MODE_FLAG_PIC_AR_MASK) {
>> + case DRM_MODE_FLAG_PIC_AR_4_3:
>> + return "4:3";
>> + case DRM_MODE_FLAG_PIC_AR_16_9:
>> + return "16:9";
>> + case DRM_MODE_FLAG_PIC_AR_64_27:
>> + return "64:27";
>> + case DRM_MODE_FLAG_PIC_AR_256_135:
>> + return "256:135";
>> + default:
>> + return NULL;
>> + }
>> +}
>> +
>> /**
>> * kmstest_dump_mode:
>> * @mode: libdrm mode structure
>> @@ -500,8 +524,9 @@ static const char *mode_stereo_name(const
>> drmModeModeInfo *mode)
>> void kmstest_dump_mode(drmModeModeInfo *mode)
>> {
>> const char *stereo = mode_stereo_name(mode);
>> + const char *aspect_ratio = mode_aspect_name(mode);
>>
>> - igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x
>> %d%s%s%s\n",
>> + igt_info(" %s %d %d %d %d %d %d %d %d %d 0x%x 0x%x %d%s%s%s
>> %s%s%s\n",
>> mode->name, mode->vrefresh,
>> mode->hdisplay, mode->hsync_start,
>> mode->hsync_end, mode->htotal,
>> @@ -509,7 +534,9 @@ void kmstest_dump_mode(drmModeModeInfo *mode)
>> mode->vsync_end, mode->vtotal,
>> mode->flags, mode->type, mode->clock,
>> stereo ? " (3D:" : "",
>> - stereo ? stereo : "", stereo ? ")" : "");
>> + stereo ? stereo : "", stereo ? ")" : "",
>> + aspect_ratio ? " (Pixel Aspect Ratio:" : "",
>> + aspect_ratio ? aspect_ratio : "", aspect_ratio ?
>> ")" : "");
>> }
>>
>> /**
[-- Attachment #1.2: Type: text/html, Size: 4271 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-02-13 11:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-24 12:50 [igt-dev] [PATCH i-g-t 0/2] Test modes with aspect ratios Nautiyal, Ankit K
2018-01-24 12:50 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_kms.c: modify kmstest_dump_mode to print aspect ratio of a mode Nautiyal, Ankit K
2018-02-12 14:34 ` Mika Kahola
2018-02-13 11:09 ` Nautiyal, Ankit K
2018-01-24 12:51 ` [igt-dev] [PATCH i-g-t 2/2] tests/testdisplay.c: add support to test modes with aspect ratio Nautiyal, Ankit K
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox