* [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected
@ 2016-11-23 13:04 Tomeu Vizoso
2016-11-23 13:04 ` [PATCH i-g-t 1/2] lib: Check format of framebuffer before SetPlane Tomeu Vizoso
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tomeu Vizoso @ 2016-11-23 13:04 UTC (permalink / raw)
To: Intel GFX discussion; +Cc: Tomeu Vizoso
Hi,
kms_plane_scaling would happily try to use the cursor plane as if it was an
overlay, and the first signal of it would be the kernel refusing the SetPlane
call because of the pixel format not matching.
To improve this situation, we check the format of the framebuffer before
calling SetPlane (printing the supported formats), and skip the test if there
aren't enough overlay planes.
Thanks,
Tomeu
Tomeu Vizoso (2):
lib: Check format of framebuffer before SetPlane
kms_plane_scaling: Skip if we don't have enough overlays
lib/igt_kms.c | 35 +++++++++++++++++++++++++++++++++++
tests/kms_plane_scaling.c | 4 ++++
2 files changed, 39 insertions(+)
--
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] 4+ messages in thread
* [PATCH i-g-t 1/2] lib: Check format of framebuffer before SetPlane
2016-11-23 13:04 [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected Tomeu Vizoso
@ 2016-11-23 13:04 ` Tomeu Vizoso
2016-11-23 13:04 ` [PATCH i-g-t 2/2] kms_plane_scaling: Skip if we don't have enough overlays Tomeu Vizoso
2016-11-29 20:54 ` [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected Robert Foss
2 siblings, 0 replies; 4+ messages in thread
From: Tomeu Vizoso @ 2016-11-23 13:04 UTC (permalink / raw)
To: Intel GFX discussion; +Cc: Tomeu Vizoso
Avoid setting a framebuffer in a format that the plane doesn't support,
so we have better debug output in IGT and we don't have to dig into
dmesg files to find out what's going on.
I found this issue when kms_plane_scaling tried to use a cursor plane as
a regular one in a Skylake machine with just one overlay.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
lib/igt_kms.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 989704e14803..3234fa1bbdc4 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -1670,6 +1670,14 @@ static uint32_t igt_plane_get_fb_id(igt_plane_t *plane)
return 0;
}
+static uint32_t igt_plane_get_fb_format(igt_plane_t *plane)
+{
+ if (plane->fb)
+ return plane->fb->drm_format;
+ else
+ return 0;
+}
+
static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
{
if (plane->fb)
@@ -1678,6 +1686,28 @@ static uint32_t igt_plane_get_fb_gem_handle(igt_plane_t *plane)
return 0;
}
+static bool igt_plane_supports_format(igt_plane_t *plane, uint32_t format)
+{
+ int i;
+
+ for (i = 0; i < plane->drm_plane->count_formats; i++) {
+ if (format == plane->drm_plane->formats[i])
+ return true;
+ }
+
+ igt_debug("Plane %d in pipe %s doesn't support format %s.\n",
+ plane->index,
+ kmstest_pipe_name(plane->pipe->pipe),
+ igt_format_str(format));
+
+ igt_debug("Formats supported are:");
+ for (i = 0; i < plane->drm_plane->count_formats; i++)
+ igt_debug(" %s", igt_format_str(plane->drm_plane->formats[i]));
+ igt_debug(".\n");
+
+ return false;
+}
+
#define CHECK_RETURN(r, fail) { \
if (r && !fail) \
return r; \
@@ -1772,6 +1802,7 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
int32_t crtc_y;
uint32_t crtc_w;
uint32_t crtc_h;
+ uint32_t format;
igt_assert(plane->drm_plane);
@@ -1821,6 +1852,10 @@ static int igt_drm_plane_commit(igt_plane_t *plane,
src_x >> 16, src_y >> 16, src_w >> 16, src_h >> 16,
crtc_x, crtc_y, crtc_w, crtc_h);
+ /* it's an error to try an unsupported format */
+ format = igt_plane_get_fb_format(plane);
+ igt_assert(igt_plane_supports_format(plane, format));
+
ret = drmModeSetPlane(display->drm_fd,
plane->drm_plane->plane_id,
crtc_id,
--
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] 4+ messages in thread
* [PATCH i-g-t 2/2] kms_plane_scaling: Skip if we don't have enough overlays
2016-11-23 13:04 [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected Tomeu Vizoso
2016-11-23 13:04 ` [PATCH i-g-t 1/2] lib: Check format of framebuffer before SetPlane Tomeu Vizoso
@ 2016-11-23 13:04 ` Tomeu Vizoso
2016-11-29 20:54 ` [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected Robert Foss
2 siblings, 0 replies; 4+ messages in thread
From: Tomeu Vizoso @ 2016-11-23 13:04 UTC (permalink / raw)
To: Intel GFX discussion; +Cc: Tomeu Vizoso
The test currently assumes that there are two overlay planes available,
but that's not generally true and from the error that returns the
kernel, it isn't obvious what's going on.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
tests/kms_plane_scaling.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 4546ce548515..0e2a875c6542 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -229,6 +229,8 @@ static void test_plane_scaling(data_t *d)
/* Set up fb2->plane2 mapping. */
d->plane2 = igt_output_get_plane(output, IGT_PLANE_2);
+ if(d->plane2->is_cursor)
+ continue;
igt_plane_set_fb(d->plane2, &d->fb2);
/* 2nd plane windowed */
@@ -265,6 +267,8 @@ static void test_plane_scaling(data_t *d)
/* Set up fb3->plane3 mapping. */
d->plane3 = igt_output_get_plane(output, IGT_PLANE_3);
+ if(d->plane3->is_cursor)
+ continue;
igt_plane_set_fb(d->plane3, &d->fb3);
/* 3rd plane windowed - no scaling */
--
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] 4+ messages in thread
* Re: [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected
2016-11-23 13:04 [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected Tomeu Vizoso
2016-11-23 13:04 ` [PATCH i-g-t 1/2] lib: Check format of framebuffer before SetPlane Tomeu Vizoso
2016-11-23 13:04 ` [PATCH i-g-t 2/2] kms_plane_scaling: Skip if we don't have enough overlays Tomeu Vizoso
@ 2016-11-29 20:54 ` Robert Foss
2 siblings, 0 replies; 4+ messages in thread
From: Robert Foss @ 2016-11-29 20:54 UTC (permalink / raw)
To: Tomeu Vizoso, Intel GFX discussion
Hi tomeu,
This series looks good to me, feel free to add my r-b.
Rob.
> Hi,
>
> kms_plane_scaling would happily try to use the cursor plane as if it
> was an
> overlay, and the first signal of it would be the kernel refusing the
> SetPlane
> call because of the pixel format not matching.
>
> To improve this situation, we check the format of the framebuffer
> before
> calling SetPlane (printing the supported formats), and skip the test
> if there
> aren't enough overlay planes.
>
> Thanks,
>
> Tomeu
>
> Tomeu Vizoso (2):
> lib: Check format of framebuffer before SetPlane
> kms_plane_scaling: Skip if we don't have enough overlays
>
> lib/igt_kms.c | 35 +++++++++++++++++++++++++++++++++++
> tests/kms_plane_scaling.c | 4 ++++
> 2 files changed, 39 insertions(+)
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-29 20:54 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-23 13:04 [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected Tomeu Vizoso
2016-11-23 13:04 ` [PATCH i-g-t 1/2] lib: Check format of framebuffer before SetPlane Tomeu Vizoso
2016-11-23 13:04 ` [PATCH i-g-t 2/2] kms_plane_scaling: Skip if we don't have enough overlays Tomeu Vizoso
2016-11-29 20:54 ` [PATCH i-g-t 0/2] Improve error report when there are less overlays than expected Robert Foss
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).