drm-shim: return device platform as specified
v2: Embed the libdrm dependency inside the drm-shim dependency Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Eric Anholt <eric@anholt.net> (v1) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4429>
This commit is contained in:
parent
fa5a36dbd4
commit
c3e305616c
|
@ -78,6 +78,7 @@ v3d_ioctl_get_bo_offset(int fd, unsigned long request, void *arg)
|
|||
void
|
||||
drm_shim_driver_init(void)
|
||||
{
|
||||
shim_device.bus_type = DRM_BUS_PLATFORM;
|
||||
shim_device.driver_name = "v3d";
|
||||
|
||||
drm_shim_override_file("OF_FULLNAME=/rdb/v3d\n"
|
||||
|
|
|
@ -146,6 +146,7 @@ static ioctl_fn_t driver_ioctls[] = {
|
|||
void
|
||||
drm_shim_driver_init(void)
|
||||
{
|
||||
shim_device.bus_type = DRM_BUS_PLATFORM;
|
||||
shim_device.driver_name = "v3d";
|
||||
shim_device.driver_ioctls = driver_ioctls;
|
||||
shim_device.driver_ioctl_count = ARRAY_SIZE(driver_ioctls);
|
||||
|
|
|
@ -452,8 +452,26 @@ readlink(const char *path, char *buf, size_t size)
|
|||
|
||||
if (strcmp(path, subsystem_path) != 0)
|
||||
return real_readlink(path, buf, size);
|
||||
strncpy(buf, "/platform", size);
|
||||
buf[size - 1] = 0;
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
int bus_type;
|
||||
} bus_types[] = {
|
||||
{ "/pci", DRM_BUS_PCI },
|
||||
{ "/usb", DRM_BUS_USB },
|
||||
{ "/platform", DRM_BUS_PLATFORM },
|
||||
{ "/spi", DRM_BUS_PLATFORM },
|
||||
{ "/host1x", DRM_BUS_HOST1X },
|
||||
};
|
||||
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(bus_types); i++) {
|
||||
if (bus_types[i].bus_type != shim_device.bus_type)
|
||||
continue;
|
||||
|
||||
strncpy(buf, bus_types[i].name, size);
|
||||
buf[size - 1] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return strlen(buf) + 1;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "util/macros.h"
|
||||
#include "util/hash_table.h"
|
||||
|
||||
#include <xf86drm.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#define DRM_MAJOR 226
|
||||
#endif
|
||||
|
@ -44,6 +46,7 @@ struct shim_device {
|
|||
/* Returned by drmGetVersion(). */
|
||||
const char *driver_name;
|
||||
int version_major, version_minor, version_patchlevel;
|
||||
int bus_type;
|
||||
};
|
||||
|
||||
extern struct shim_device shim_device;
|
||||
|
|
|
@ -25,9 +25,10 @@ drm_shim = static_library(
|
|||
'drm_shim.c',
|
||||
],
|
||||
include_directories: [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
|
||||
dependencies: [idep_mesautil, dep_dl],
|
||||
dependencies: [dep_libdrm, idep_mesautil, dep_dl],
|
||||
c_args : [c_vis_args, '-std=gnu99'],
|
||||
)
|
||||
dep_drm_shim = declare_dependency(
|
||||
link_with: drm_shim
|
||||
link_with: drm_shim,
|
||||
dependencies: dep_libdrm,
|
||||
)
|
||||
|
|
|
@ -215,6 +215,7 @@ static ioctl_fn_t driver_ioctls[] = {
|
|||
void
|
||||
drm_shim_driver_init(void)
|
||||
{
|
||||
shim_device.bus_type = DRM_BUS_PLATFORM;
|
||||
shim_device.driver_name = "etnaviv";
|
||||
shim_device.driver_ioctls = driver_ioctls;
|
||||
shim_device.driver_ioctl_count = ARRAY_SIZE(driver_ioctls);
|
||||
|
|
|
@ -168,6 +168,7 @@ static ioctl_fn_t driver_ioctls[] = {
|
|||
void
|
||||
drm_shim_driver_init(void)
|
||||
{
|
||||
shim_device.bus_type = DRM_BUS_PLATFORM;
|
||||
shim_device.driver_name = "msm";
|
||||
shim_device.driver_ioctls = driver_ioctls;
|
||||
shim_device.driver_ioctl_count = ARRAY_SIZE(driver_ioctls);
|
||||
|
|
Loading…
Reference in New Issue