On Tue, 5 Feb 2019 at 15:35, Emil Velikov <emil.l.veli...@gmail.com> wrote:
>
> From: Emil Velikov <emil.veli...@collabora.com>
>
> VGEM and kms_swrast were introduced to work with one another.
>
> All we do is CPU rendering to dumb buffers. There is no reason to carve
> out GPU memory, increasing the memory pressure on a device that could
> make a better use of it.
>
> For kms_swrast to work properly we require the primary node, as the dumb
> buffer ioctls are not exposed via the render node.
>
> Note that this requires libdrm commit 3df8a7f0 ("xf86drm: fallback to
> MODALIAS for OF less platform devices")
>
> Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
> ---
>  src/egl/drivers/dri2/platform_surfaceless.c | 20 ++++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/src/egl/drivers/dri2/platform_surfaceless.c 
> b/src/egl/drivers/dri2/platform_surfaceless.c
> index e1151e3585c..54c6856c63c 100644
> --- a/src/egl/drivers/dri2/platform_surfaceless.c
> +++ b/src/egl/drivers/dri2/platform_surfaceless.c
> @@ -286,10 +286,11 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool swrast)
>     for (i = 0; i < num_devices; ++i) {
>        device = devices[i];
>
> -      if (!(device->available_nodes & (1 << DRM_NODE_RENDER)))
> +      const unsigned node_type = swrast ? DRM_NODE_PRIMARY : DRM_NODE_RENDER;
> +      if (!(device->available_nodes & (1 << node_type)))
>           continue;
>
> -      dri2_dpy->fd = loader_open_device(device->nodes[DRM_NODE_RENDER]);
> +      dri2_dpy->fd = loader_open_device(device->nodes[node_type]);
>        if (dri2_dpy->fd < 0)
>           continue;
>
> @@ -300,10 +301,17 @@ surfaceless_probe_device(_EGLDisplay *dpy, bool swrast)
>           continue;
>        }
>
> -      if (swrast)
> -         dri2_dpy->driver_name = strdup("kms_swrast");
> -      else
> -         dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
> +      dri2_dpy->driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
> +      if (swrast) {
> +         /* Use kms swrast only with vgem */
> +         if (strcmp(dri2_dpy->driver_name, "vgem") != 0) {
> +            free(dri2_dpy->driver_name);
> +            dri2_dpy->driver_name = NULL;
> +         } else {
> +            free(dri2_dpy->driver_name);
> +            dri2_dpy->driver_name = strdup("kms_swrast");
> +         }
> +      }
>
Chad, Gurchetan can you look at the series when you have some time?

Thanks
Emil
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to