[Mesa-dev] [PATCH 09/10] pipe-loader: add support for non-pci (platform) devices

Emil Velikov emil.l.velikov at gmail.com
Sat Jan 11 08:54:50 PST 2014


Culled out of the "loader: refactor duplicated code into loader util lib"
patch by Rob Clark.

Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/auxiliary/pipe-loader/pipe_loader.h     | 1 +
 src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c | 2 ++
 src/gallium/state_trackers/clover/core/device.cpp   | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader.h b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
index 444bdf1..e915c63 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -44,6 +44,7 @@ struct pipe_screen;
 enum pipe_loader_device_type {
    PIPE_LOADER_DEVICE_SOFTWARE,
    PIPE_LOADER_DEVICE_PCI,
+   PIPE_LOADER_DEVICE_PLATFORM,
    NUM_PIPE_LOADER_DEVICE_TYPES
 };
 
diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index 9e9dc33..a9e2143 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -121,6 +121,8 @@ pipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd)
       ddev->base.type = PIPE_LOADER_DEVICE_PCI;
       ddev->base.u.pci.vendor_id = vendor_id;
       ddev->base.u.pci.chip_id = chip_id;
+   } else {
+      ddev->base.type = PIPE_LOADER_DEVICE_PLATFORM;
    }
    ddev->base.ops = &pipe_loader_drm_ops;
    ddev->fd = fd;
diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
index e5e429a..76a49d0 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -63,6 +63,7 @@ device::type() const {
    case PIPE_LOADER_DEVICE_SOFTWARE:
       return CL_DEVICE_TYPE_CPU;
    case PIPE_LOADER_DEVICE_PCI:
+   case PIPE_LOADER_DEVICE_PLATFORM:
       return CL_DEVICE_TYPE_GPU;
    default:
       assert(0);
@@ -74,6 +75,7 @@ cl_uint
 device::vendor_id() const {
    switch (ldev->type) {
    case PIPE_LOADER_DEVICE_SOFTWARE:
+   case PIPE_LOADER_DEVICE_PLATFORM:
       return 0;
    case PIPE_LOADER_DEVICE_PCI:
       return ldev->u.pci.vendor_id;
-- 
1.8.5.1



More information about the mesa-dev mailing list