Differential D23161 Diff 66727 graphics/mesa/files/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
Changeset View
Changeset View
Standalone View
Standalone View
graphics/mesa/files/patch-src_gallium_auxiliary_pipe-loader_pipe__loader__drm.c
Show All 19 Lines | |||||
v2: Clarify the linking topic in the commit message. | v2: Clarify the linking topic in the commit message. | ||||
Cc: Tom Stellard <thomas.stellard@amd.com> | Cc: Tom Stellard <thomas.stellard@amd.com> | ||||
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> | Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> | ||||
Reviewed-by: Francisco Jerez <currojerez@riseup.net> | Reviewed-by: Francisco Jerez <currojerez@riseup.net> | ||||
--- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2017-12-21 17:31:21 UTC | --- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2019-12-18 19:04:21 UTC | ||||
+++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | +++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | ||||
@@ -207,6 +207,14 @@ pipe_loader_drm_probe_fd(struct pipe_loa | @@ -241,6 +241,14 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **d | ||||
} | } | ||||
static int | static int | ||||
+open_drm_minor(int minor) | +open_drm_minor(int minor) | ||||
+{ | +{ | ||||
+ char path[PATH_MAX]; | + char path[PATH_MAX]; | ||||
+ snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor); | + snprintf(path, sizeof(path), DRM_DEV_NAME, DRM_DIR_NAME, minor); | ||||
+ return open(path, O_RDWR, 0); | + return open(path, O_RDWR, 0); | ||||
+} | +} | ||||
+ | + | ||||
+static int | +static int | ||||
open_drm_render_node_minor(int minor) | open_drm_render_node_minor(int minor) | ||||
{ | { | ||||
char path[PATH_MAX]; | char path[PATH_MAX]; | ||||
@@ -218,8 +226,15 @@ open_drm_render_node_minor(int minor) | @@ -252,8 +260,15 @@ open_drm_render_node_minor(int minor) | ||||
int | int | ||||
pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev) | pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev) | ||||
{ | { | ||||
- int i, j, fd; | - int i, j, fd; | ||||
+ int i, k, fd, num_render_node_devs; | + int i, k, fd, num_render_node_devs; | ||||
+ int j = 0; | + int j = 0; | ||||
+ | |||||
+ struct { | + struct { | ||||
+ unsigned vendor_id; | + unsigned vendor_id; | ||||
+ unsigned chip_id; | + unsigned chip_id; | ||||
+ } render_node_devs[DRM_RENDER_NODE_MAX_NODES]; | + } render_node_devs[DRM_RENDER_NODE_MAX_NODES]; | ||||
+ | |||||
+ /* Look for render nodes first */ | + /* Look for render nodes first */ | ||||
for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0; | for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0; | ||||
i <= DRM_RENDER_NODE_MAX_MINOR; i++) { | i <= DRM_RENDER_NODE_MAX_MINOR; i++) { | ||||
struct pipe_loader_device *dev; | struct pipe_loader_device *dev; | ||||
@@ -233,6 +248,9 @@ pipe_loader_drm_probe(struct pipe_loader | @@ -267,12 +282,55 @@ pipe_loader_drm_probe(struct pipe_loader_device **devs | ||||
continue; | continue; | ||||
} | } | ||||
+ render_node_devs[j].vendor_id = dev->u.pci.vendor_id; | + render_node_devs[j].vendor_id = dev->u.pci.vendor_id; | ||||
+ render_node_devs[j].chip_id = dev->u.pci.chip_id; | + render_node_devs[j].chip_id = dev->u.pci.chip_id; | ||||
+ | + | ||||
if (j < ndev) { | if (j < ndev) { | ||||
devs[j] = dev; | devs[j] = dev; | ||||
} else { | } else { | ||||
@@ -242,6 +260,46 @@ pipe_loader_drm_probe(struct pipe_loader | close(fd); | ||||
j++; | dev->ops->release(&dev); | ||||
} | } | ||||
+ j++; | |||||
+ } | |||||
+ | |||||
+ num_render_node_devs = j; | + num_render_node_devs = j; | ||||
+ | + | ||||
+ /* Next look for drm devices. */ | + /* Next look for drm devices. */ | ||||
+ for (i = 0; i < DRM_MAX_MINOR; i++) { | + for (i = 0; i < DRM_MAX_MINOR; i++) { | ||||
+ struct pipe_loader_device *dev; | + struct pipe_loader_device *dev; | ||||
+ boolean duplicate = FALSE; | + boolean duplicate = FALSE; | ||||
+ fd = open_drm_minor(i); | + fd = open_drm_minor(i); | ||||
+ if (fd < 0) | + if (fd < 0) | ||||
Show All 21 Lines | |||||
+ continue; | + continue; | ||||
+ | + | ||||
+ if (j < ndev) { | + if (j < ndev) { | ||||
+ devs[j] = dev; | + devs[j] = dev; | ||||
+ } else { | + } else { | ||||
+ dev->ops->release(&dev); | + dev->ops->release(&dev); | ||||
+ } | + } | ||||
+ | + | ||||
+ j++; | j++; | ||||
+ } | |||||
+ | |||||
return j; | |||||
} | } | ||||