summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-10-30 11:30:51 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2020-10-30 13:52:00 +0000
commit09d673d2a2bb83cac2620825dec04725fa67a394 (patch)
tree7aab326afe870fe83b73c532a87261587246b981
parentfd6d58edffbecbff884b03f4e92ec85172ee5675 (diff)
lib: Export drm_load_module()
Beneath drm_open_driver() we have a routine that tries to load a module appropriate for the selected chipset. This can be useful for tests that want to ensure the right module is loaded prior to starting, without opening the device itself. Suggested-by: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Petri Latvala <petri.latvala@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
-rw-r--r--lib/drmtest.c8
-rw-r--r--lib/drmtest.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/drmtest.c b/lib/drmtest.c
index 447f5435..49e294bd 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -283,7 +283,7 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset,
return -1;
}
-static void __try_modprobe(unsigned int chipset)
+void drm_load_module(unsigned int chipset)
{
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -307,7 +307,7 @@ static int __open_driver(const char *base, int offset, unsigned int chipset, int
if (fd != -1)
return fd;
- __try_modprobe(chipset);
+ drm_load_module(chipset);
return __search_and_open(base, offset, chipset, as_idx);
}
@@ -320,7 +320,7 @@ static int __open_driver_exact(const char *name, unsigned int chipset)
if (fd != -1)
return fd;
- __try_modprobe(chipset);
+ drm_load_module(chipset);
return open_device(name, chipset);
}
@@ -419,7 +419,7 @@ int __drm_open_driver_another(int idx, int chipset)
found = __get_card_for_nth_filter(idx, &card);
if (!found) {
- __try_modprobe(chipset);
+ drm_load_module(chipset);
found = __get_card_for_nth_filter(idx, &card);
}
diff --git a/lib/drmtest.h b/lib/drmtest.h
index dd4cd384..d393dbf1 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -87,6 +87,7 @@ void __set_forced_driver(const char *name);
*/
#define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
+void drm_load_module(unsigned int chipset);
int drm_open_driver(int chipset);
int drm_open_driver_master(int chipset);
int drm_open_driver_render(int chipset);