[Mesa-dev] [PATCH 3/3] egl/sl: use kms_swrast with vgem instead of a random GPU
Emil Velikov
emil.l.velikov at gmail.com
Fri Feb 15 17:16:07 UTC 2019
On Tue, 5 Feb 2019 at 15:35, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>
> From: Emil Velikov <emil.velikov at 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.velikov at 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
More information about the mesa-dev
mailing list