aboutsummaryrefslogtreecommitdiffstats
path: root/src/egl/drivers
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2019-02-19 14:08:08 +0000
committerEmil Velikov <[email protected]>2019-02-28 12:05:03 +0000
commit7ad1a05c8314b4b6887f0a23892fa4f7fbca9720 (patch)
tree905585ee9a3d7ec547b0606225bc6abe8d2303b5 /src/egl/drivers
parent218c7b5acaa053482d368afbce4612232731b3a4 (diff)
egl/sl: use kms_swrast with vgem instead of a random GPU
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. Note: - The original code did not work out of the box, since the dumb buffer ioctls are not exposed to render nodes. - This requires libdrm commit 3df8a7f0 ("xf86drm: fallback to MODALIAS for OF less platform devices") - The non-kms, swrast is unaffected by this change. v2: - elaborate what and how is/isn't working (Eric) - simplify driver_name handling (Eric) v3: - move node_type outside of the loop (Eric) - kill no longer needed DRM_RENDER_DEV_NAME define Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Eric Engestrom <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]>
Diffstat (limited to 'src/egl/drivers')
-rw-r--r--src/egl/drivers/dri2/platform_surfaceless.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/egl/drivers/dri2/platform_surfaceless.c b/src/egl/drivers/dri2/platform_surfaceless.c
index ccdc370d059..4fe364ab22e 100644
--- a/src/egl/drivers/dri2/platform_surfaceless.c
+++ b/src/egl/drivers/dri2/platform_surfaceless.c
@@ -254,8 +254,6 @@ static const __DRIswrastLoaderExtension swrast_loader_extension = {
.getImage = NULL,
};
-#define DRM_RENDER_DEV_NAME "%s/renderD%d"
-
static const __DRIextension *image_loader_extensions[] = {
&image_loader_extension.base,
&image_lookup_extension.base,
@@ -275,6 +273,7 @@ static bool
surfaceless_probe_device(_EGLDisplay *disp, bool swrast)
{
#define MAX_DRM_DEVICES 64
+ const unsigned node_type = swrast ? DRM_NODE_PRIMARY : DRM_NODE_RENDER;
struct dri2_egl_display *dri2_dpy = disp->DriverData;
drmDevicePtr device, devices[MAX_DRM_DEVICES] = { NULL };
int i, num_devices;
@@ -286,10 +285,10 @@ surfaceless_probe_device(_EGLDisplay *disp, bool swrast)
for (i = 0; i < num_devices; ++i) {
device = devices[i];
- if (!(device->available_nodes & (1 << 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 +299,16 @@ surfaceless_probe_device(_EGLDisplay *disp, 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);
+ char *driver_name = loader_get_driver_for_fd(dri2_dpy->fd);
+ if (swrast) {
+ /* Use kms swrast only with vgem */
+ if (strcmp(driver_name, "vgem") == 0)
+ dri2_dpy->driver_name = strdup("kms_swrast");
+ free(driver_name);
+ } else {
+ /* Use the given hardware driver */
+ dri2_dpy->driver_name = driver_name;
+ }
if (dri2_dpy->driver_name && dri2_load_driver_dri3(disp))
break;