All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/2] kms_cursor_crc: Force the test to run in full RGB range
@ 2017-04-06  7:40 Ander Conselvan de Oliveira
  2017-04-06  7:40 ` [PATCH i-g-t 2/2] kms_cursor_limited: Test crc matches between cursor and overlay planes Ander Conselvan de Oliveira
  2017-04-11 11:13 ` [PATCH i-g-t v2] kms_cursor_crc: Force the test to run in full RGB range Ander Conselvan de Oliveira
  0 siblings, 2 replies; 6+ messages in thread
From: Ander Conselvan de Oliveira @ 2017-04-06  7:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ander Conselvan de Oliveira

In at least SKL and GLK (possibly other devices too), using a cursor
plane to scan out an fb might result in a different pipe crc than when
using a regular plane at the same position with the same fb. The
differences could be caused by the cursor plane being limited to 8 bpc
while the regular planes support higher bit depths, since the failures
happens with specific color values, but that's speculation.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 tests/kms_cursor_crc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 206f852..1208d90 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -372,6 +372,14 @@ static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int
 			  kmstest_pipe_name(data->pipe),
 			  igt_output_name(output));
 
+		/*
+		 * Force test to use full range RGB. Limited range causes CRC
+		 * mismatches in SKL and GLK.
+		 */
+		kmstest_set_connector_broadcast_rgb(data->drm_fd,
+						    data->output->config.connector,
+						    BROADCAST_RGB_FULL);
+
 		testfunc(data);
 
 		igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH i-g-t 2/2] kms_cursor_limited: Test crc matches between cursor and overlay planes
  2017-04-06  7:40 [PATCH i-g-t 1/2] kms_cursor_crc: Force the test to run in full RGB range Ander Conselvan de Oliveira
@ 2017-04-06  7:40 ` Ander Conselvan de Oliveira
  2017-04-11 11:13 ` [PATCH i-g-t v2] kms_cursor_crc: Force the test to run in full RGB range Ander Conselvan de Oliveira
  1 sibling, 0 replies; 6+ messages in thread
From: Ander Conselvan de Oliveira @ 2017-04-06  7:40 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ander Conselvan de Oliveira

This test actually *fails* in GLK and possibly SKL and others too. When
using limited range, the pipe crc when using the cursor plane is
different than the one when using an overlay plane, although the fb and
plane position is the same.

Since this test fails it should probably not be merged, but it is here
to prove the point of the previous patch.

Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 tests/Makefile.sources     |   1 +
 tests/kms_cursor_limited.c | 175 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 176 insertions(+)
 create mode 100644 tests/kms_cursor_limited.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 45c21a0..c7d36f6 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -99,6 +99,7 @@ TESTS_progs_M = \
 	kms_chv_cursor_fail \
 	kms_cursor_crc \
 	kms_cursor_legacy \
+	kms_cursor_limited \
 	kms_draw_crc \
 	kms_fbc_crc \
 	kms_fbcon_fbt \
diff --git a/tests/kms_cursor_limited.c b/tests/kms_cursor_limited.c
new file mode 100644
index 0000000..88c130c
--- /dev/null
+++ b/tests/kms_cursor_limited.c
@@ -0,0 +1,175 @@
+#include "igt.h"
+
+typedef struct {
+	int drm_fd;
+	igt_display_t display;
+	struct igt_fb primary_fb;
+	struct igt_fb fb;
+	int fb_w, fb_h;
+	igt_output_t *output;
+	enum pipe pipe;
+	igt_pipe_crc_t *pipe_crc;
+} data_t;
+
+static void cursor_enable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *cursor;
+
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
+	igt_plane_set_fb(cursor, &data->fb);
+	igt_plane_set_size(cursor, data->fb_w, data->fb_h);
+}
+
+static void cursor_disable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *cursor;
+
+	cursor = igt_output_get_plane_type(output, DRM_PLANE_TYPE_CURSOR);
+	igt_plane_set_fb(cursor, NULL);
+}
+
+static void overlay_enable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *overlay;
+
+	overlay = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
+	igt_plane_set_fb(overlay, &data->fb);
+	igt_plane_set_size(overlay, data->fb_w, data->fb_h);
+}
+
+static void overlay_disable(data_t *data)
+{
+	igt_output_t *output = data->output;
+	igt_plane_t *overlay;
+
+	overlay = igt_output_get_plane_type(output, DRM_PLANE_TYPE_OVERLAY);
+	igt_plane_set_fb(overlay, NULL);
+}
+
+static void create_fb(data_t *data)
+{
+	uint32_t fb_id;
+
+	fb_id = igt_create_color_fb(data->drm_fd, data->fb_w, data->fb_h,
+				    DRM_FORMAT_ARGB8888,
+				    LOCAL_DRM_FORMAT_MOD_NONE,
+				    0.5, 0.5, 0.5,
+				    &data->fb);
+	igt_assert(fb_id);
+}
+
+static void prepare_crtc(data_t *data, igt_output_t *output, int w, int h)
+{
+	drmModeModeInfo *mode;
+	igt_display_t *display = &data->display;
+	igt_plane_t *primary;
+
+	/* select the pipe we want to use */
+	igt_output_set_pipe(output, data->pipe);
+	cursor_disable(data);
+
+	/* create and set the primary plane fb */
+	mode = igt_output_get_mode(output);
+	igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay,
+			    DRM_FORMAT_XRGB8888,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    0.0, 0.0, 0.0,
+			    &data->primary_fb);
+
+	primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+	igt_plane_set_fb(primary, &data->primary_fb);
+
+	igt_display_commit(display);
+
+	/* create the pipe_crc object for this pipe */
+	if (data->pipe_crc)
+		igt_pipe_crc_free(data->pipe_crc);
+
+	data->pipe_crc = igt_pipe_crc_new(data->drm_fd, data->pipe,
+					  INTEL_PIPE_CRC_SOURCE_AUTO);
+
+	data->fb_w = w;
+	data->fb_h = h;
+	create_fb(data);
+
+	/* make sure cursor is disabled */
+	cursor_disable(data);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+}
+
+static void do_single_test(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	igt_pipe_crc_t *pipe_crc = data->pipe_crc;
+	igt_crc_t cursor_crc, overlay_crc;
+	igt_plane_t *cursor, *overlay;
+
+	cursor_enable(data);
+	cursor = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_CURSOR);
+	igt_plane_set_position(cursor, 0, 0);
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &cursor_crc);
+
+	cursor_disable(data);
+	overlay_enable(data);
+	overlay = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_OVERLAY);
+	igt_plane_set_position(overlay, 0, 0);
+	igt_display_commit(display);
+	igt_wait_for_vblank(data->drm_fd, data->pipe);
+	igt_pipe_crc_collect_crc(pipe_crc, &overlay_crc);
+
+	igt_assert_crc_equal(&cursor_crc, &overlay_crc);
+
+	overlay_disable(data);
+	igt_display_commit(display);
+}
+
+static void run_tests(data_t *data)
+{
+	enum pipe p;
+	igt_output_t *output;
+
+	struct {
+		const char *name;
+		enum kmstest_broadcast_rgb_mode mode;
+	} tests[] = {
+		{ .name = "full", .mode = BROADCAST_RGB_FULL },
+		{ .name = "limited", .mode = BROADCAST_RGB_16_235 },
+	};
+
+
+	for (int i = 0; i < ARRAY_SIZE(tests); i++) {
+		igt_subtest(tests[i].name) {
+			for_each_pipe_with_valid_output(&data->display, p, output) {
+				data->output = output;
+				data->pipe = p;
+
+				prepare_crtc(data, output, 64, 64);
+
+				kmstest_set_connector_broadcast_rgb(data->drm_fd,
+								    output->config.connector,
+								    tests[i].mode);
+
+				do_single_test(data);
+			}
+		}
+	}
+}
+
+static data_t data;
+
+igt_main
+{
+	igt_fixture {
+		data.drm_fd = drm_open_driver_master(DRIVER_INTEL);
+		kmstest_set_vt_graphics_mode();
+
+		igt_display_init(&data.display, data.drm_fd);
+	}
+
+	run_tests(&data);
+}
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH i-g-t v2] kms_cursor_crc: Force the test to run in full RGB range
  2017-04-06  7:40 [PATCH i-g-t 1/2] kms_cursor_crc: Force the test to run in full RGB range Ander Conselvan de Oliveira
  2017-04-06  7:40 ` [PATCH i-g-t 2/2] kms_cursor_limited: Test crc matches between cursor and overlay planes Ander Conselvan de Oliveira
@ 2017-04-11 11:13 ` Ander Conselvan de Oliveira
  2017-04-18 13:04   ` [PATCH i-g-t v3] lib/igt_kms: Force outputs to use full range RGB Ander Conselvan de Oliveira
  1 sibling, 1 reply; 6+ messages in thread
From: Ander Conselvan de Oliveira @ 2017-04-11 11:13 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ander Conselvan de Oliveira

In at least SKL and GLK (possibly other devices too), using a cursor
plane to scan out an fb might result in a different pipe crc than when
using a regular plane at the same position with the same fb while using
the CSC logic to limit the color range. The differences could be caused
by the cursor plane being limited to 8 bpc while the regular planes
support higher bit depths, leading to slightly different values to be
used internally. This is evidenced by the failures happening with
specific color values, 0.5 for example, but that's mostly speculation.

v2: Add more details to the commit message.
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 tests/kms_cursor_crc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index 206f852..1208d90 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -372,6 +372,14 @@ static void run_test(data_t *data, void (*testfunc)(data_t *), int cursor_w, int
 			  kmstest_pipe_name(data->pipe),
 			  igt_output_name(output));
 
+		/*
+		 * Force test to use full range RGB. Limited range causes CRC
+		 * mismatches in SKL and GLK.
+		 */
+		kmstest_set_connector_broadcast_rgb(data->drm_fd,
+						    data->output->config.connector,
+						    BROADCAST_RGB_FULL);
+
 		testfunc(data);
 
 		igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH i-g-t v3] lib/igt_kms: Force outputs to use full range RGB
  2017-04-11 11:13 ` [PATCH i-g-t v2] kms_cursor_crc: Force the test to run in full RGB range Ander Conselvan de Oliveira
@ 2017-04-18 13:04   ` Ander Conselvan de Oliveira
  2017-05-09 10:22     ` Mika Kahola
  0 siblings, 1 reply; 6+ messages in thread
From: Ander Conselvan de Oliveira @ 2017-04-18 13:04 UTC (permalink / raw)
  To: intel-gfx; +Cc: Ander Conselvan de Oliveira

In at least SKL and GLK (possibly other devices too), using a cursor
plane to scan out an fb might result in a different pipe crc than when
using a regular plane at the same position with the same fb while using
the CSC logic to limit the color range. The differences could be caused
by the cursor plane being limited to 8 bpc while the regular planes
support higher bit depths, leading to slightly different values to be
used internally. This is evidenced by the failures happening with
specific color values, 0.5 for example, but that's mostly speculation.

To avoid misterious failures caused by limited range rgb, force all
tests to use full range. It is still possible for tests to override this
if necessary.

v2: Add more details to the commit message.
v3: Force all tests to use full range.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
---
 lib/igt_kms.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 5811414..9f72913 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1455,10 +1455,15 @@ static void igt_output_refresh(igt_output_t *output)
 			       -1);
 	}
 
-	if (output->config.connector)
+	if (output->config.connector) {
 		igt_atomic_fill_connector_props(display, output,
 			IGT_NUM_CONNECTOR_PROPS, igt_connector_prop_names);
 
+		kmstest_set_connector_broadcast_rgb(display->drm_fd,
+						    output->config.connector,
+						    BROADCAST_RGB_FULL);
+	}
+
 	if (output->use_override_mode)
 		output->config.default_mode = output->override_mode;
 
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH i-g-t v3] lib/igt_kms: Force outputs to use full range RGB
  2017-04-18 13:04   ` [PATCH i-g-t v3] lib/igt_kms: Force outputs to use full range RGB Ander Conselvan de Oliveira
@ 2017-05-09 10:22     ` Mika Kahola
  2017-05-10  6:37       ` Conselvan De Oliveira, Ander
  0 siblings, 1 reply; 6+ messages in thread
From: Mika Kahola @ 2017-05-09 10:22 UTC (permalink / raw)
  To: Ander Conselvan de Oliveira, intel-gfx

On Tue, 2017-04-18 at 16:04 +0300, Ander Conselvan de Oliveira wrote:
> In at least SKL and GLK (possibly other devices too), using a cursor
> plane to scan out an fb might result in a different pipe crc than
> when
> using a regular plane at the same position with the same fb while
> using
> the CSC logic to limit the color range. The differences could be
> caused
> by the cursor plane being limited to 8 bpc while the regular planes
> support higher bit depths, leading to slightly different values to be
> used internally. This is evidenced by the failures happening with
> specific color values, 0.5 for example, but that's mostly
> speculation.
> 
> To avoid misterious failures caused by limited range rgb, force all
> tests to use full range. It is still possible for tests to override
> this
> if necessary.
By this way, we know for sure what is the color range in use.

Reviewed-by: Mika Kahola <mika.kahola@intel.com>

> 
> v2: Add more details to the commit message.
> v3: Force all tests to use full range.
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Ander Conselvan de Oliveira
> <ander.conselvan.de.oliveira@intel.com>
> ---
>  lib/igt_kms.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 5811414..9f72913 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -1455,10 +1455,15 @@ static void igt_output_refresh(igt_output_t
> *output)
>  			       -1);
>  	}
>  
> -	if (output->config.connector)
> +	if (output->config.connector) {
>  		igt_atomic_fill_connector_props(display, output,
>  			IGT_NUM_CONNECTOR_PROPS,
> igt_connector_prop_names);
>  
> +		kmstest_set_connector_broadcast_rgb(display->drm_fd,
> +						    output-
> >config.connector,
> +						    BROADCAST_RGB_FU
> LL);
> +	}
> +
>  	if (output->use_override_mode)
>  		output->config.default_mode = output->override_mode;
>  
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH i-g-t v3] lib/igt_kms: Force outputs to use full range RGB
  2017-05-09 10:22     ` Mika Kahola
@ 2017-05-10  6:37       ` Conselvan De Oliveira, Ander
  0 siblings, 0 replies; 6+ messages in thread
From: Conselvan De Oliveira, Ander @ 2017-05-10  6:37 UTC (permalink / raw)
  To: Kahola, Mika, intel-gfx

On Tue, 2017-05-09 at 13:22 +0300, Mika Kahola wrote:
> On Tue, 2017-04-18 at 16:04 +0300, Ander Conselvan de Oliveira wrote:
> > In at least SKL and GLK (possibly other devices too), using a cursor
> > plane to scan out an fb might result in a different pipe crc than
> > when
> > using a regular plane at the same position with the same fb while
> > using
> > the CSC logic to limit the color range. The differences could be
> > caused
> > by the cursor plane being limited to 8 bpc while the regular planes
> > support higher bit depths, leading to slightly different values to be
> > used internally. This is evidenced by the failures happening with
> > specific color values, 0.5 for example, but that's mostly
> > speculation.
> > 
> > To avoid misterious failures caused by limited range rgb, force all
> > tests to use full range. It is still possible for tests to override
> > this
> > if necessary.
> 
> By this way, we know for sure what is the color range in use.
> 
> Reviewed-by: Mika Kahola <mika.kahola@intel.com>

Thanks, patch pushed.

Ander

> 
> >  
> > v2: Add more details to the commit message.
> > v3: Force all tests to use full range.
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > Signed-off-by: Ander Conselvan de Oliveira
> > <ander.conselvan.de.oliveira@intel.com>
> > ---
> >  lib/igt_kms.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> > index 5811414..9f72913 100644
> > --- a/lib/igt_kms.c
> > +++ b/lib/igt_kms.c
> > @@ -1455,10 +1455,15 @@ static void igt_output_refresh(igt_output_t
> > *output)
> >  			       -1);
> >  	}
> >  
> > -	if (output->config.connector)
> > +	if (output->config.connector) {
> >  		igt_atomic_fill_connector_props(display, output,
> >  			IGT_NUM_CONNECTOR_PROPS,
> > igt_connector_prop_names);
> >  
> > +		kmstest_set_connector_broadcast_rgb(display->drm_fd,
> > +						    output-
> > > config.connector,
> > 
> > +						    BROADCAST_RGB_FU
> > LL);
> > +	}
> > +
> >  	if (output->use_override_mode)
> >  		output->config.default_mode = output->override_mode;
> >  
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-10  6:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06  7:40 [PATCH i-g-t 1/2] kms_cursor_crc: Force the test to run in full RGB range Ander Conselvan de Oliveira
2017-04-06  7:40 ` [PATCH i-g-t 2/2] kms_cursor_limited: Test crc matches between cursor and overlay planes Ander Conselvan de Oliveira
2017-04-11 11:13 ` [PATCH i-g-t v2] kms_cursor_crc: Force the test to run in full RGB range Ander Conselvan de Oliveira
2017-04-18 13:04   ` [PATCH i-g-t v3] lib/igt_kms: Force outputs to use full range RGB Ander Conselvan de Oliveira
2017-05-09 10:22     ` Mika Kahola
2017-05-10  6:37       ` Conselvan De Oliveira, Ander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.