On 21 November 2016 at 23:32, Lyude <lyude@xxxxxxxxxx> wrote: > On certain models of nvidia and AMD GPUs, we can have a primary plane > without any DRM plane for the cursor plane. Check for this so we don't > segfault on non-intel hardware. > > Signed-off-by: Lyude <lyude@xxxxxxxxxx> > --- > lib/igt_kms.c | 27 +++++++++++++++------------ > lib/igt_kms.h | 1 + > 2 files changed, 16 insertions(+), 12 deletions(-) > > diff --git a/lib/igt_kms.c b/lib/igt_kms.c > index 433a721..13d323e 100644 > --- a/lib/igt_kms.c > +++ b/lib/igt_kms.c > @@ -1419,7 +1419,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) > plane = &pipe->planes[IGT_PLANE_CURSOR]; > plane->is_cursor = 1; > plane->index = IGT_PLANE_CURSOR; > - display->has_universal_planes = 1; > + display->has_cursor_plane = 1; Looks good to me, but Daniel Vetter voiced support the other day for dropping support for !has_universal_planes so it may not be a good idea to complicate this further. But if we go this way, the has_cursor_plane name could be misleading in the !universal_plane case if there's a cursor plane. Regards, Tomeu > break; > default: > plane = &pipe->planes[p]; > @@ -1444,9 +1444,20 @@ void igt_display_init(igt_display_t *display, int drm_fd) > plane->rotation = (igt_rotation_t)prop_value; > } > > - if (display->has_universal_planes) { > + if (!display->has_universal_planes) { > + /* > + * No universal plane support. Add drm_plane-less > + * primary and cursor planes. > + */ > + plane = &pipe->planes[IGT_PLANE_PRIMARY]; > + plane->pipe = pipe; > + plane->index = IGT_PLANE_PRIMARY; > + plane->is_primary = true; > + } > + > + if (display->has_cursor_plane) { > /* > - * If we have universal planes, we should have both > + * If we have a cursor plane, we should have both > * primary and cursor planes setup now. > */ > igt_assert(pipe->planes[IGT_PLANE_PRIMARY].drm_plane && > @@ -1464,15 +1475,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) > sizeof *plane); > } > } else { > - /* > - * No universal plane support. Add drm_plane-less > - * primary and cursor planes. > - */ > - plane = &pipe->planes[IGT_PLANE_PRIMARY]; > - plane->pipe = pipe; > - plane->index = IGT_PLANE_PRIMARY; > - plane->is_primary = true; > - > + /* Add drm_plane-less cursor */ > plane = &pipe->planes[p]; > plane->pipe = pipe; > plane->index = p; > diff --git a/lib/igt_kms.h b/lib/igt_kms.h > index 95395cd..95d81c3 100644 > --- a/lib/igt_kms.h > +++ b/lib/igt_kms.h > @@ -312,6 +312,7 @@ struct igt_display { > igt_output_t *outputs; > igt_pipe_t pipes[I915_MAX_PIPES]; > bool has_universal_planes; > + bool has_cursor_plane; > bool is_atomic; > }; > > -- > 2.7.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > https://lists.freedesktop.org/mailman/listinfo/intel-gfx _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx