diff options
author | Micah Fedke <micah.fedke@collabora.co.uk> | 2015-07-22 21:42:51 +0000 |
---|---|---|
committer | Thomas Wood <thomas.wood@intel.com> | 2015-09-11 14:39:43 +0100 |
commit | e2241805a43e2cbd5287010e90005542845b48cd (patch) | |
tree | 0e1492fb642bcf904d1a55dfd2607f256390ac91 /lib/drmtest.h | |
parent | 2bacd07eb3be30fd30ed4fa4645901683b1c6b09 (diff) |
lib: adding drm_open_driver() interface
The drm_open_driver*() functions replace the drm_open_any*() functions and
provide the same utility, but in a way that is platform agnostic, not
intel-specific. This opens the path for adopting intel-gpu-tools to non-intel
platforms.
This commit renames the calls and adds the chipset parameter which can be used
to restrict the opening to a specific hardware family. For example,
drm_open_driver(DRIVER_INTEL) will only return a valid fd if an intel GPU is
found on the system, along with performing intel-specific initialization stuff
like gem_quiescent_gpu(), et al. If OPEN_ANY_GPU is specified, the first
available drm device of any type will be opened.
Other hardware type flags may be added in the future.
The drm_open_any*() calls are retained as aliases of
drm_open_driver*(OPEN_ANY_GPU) but will be removed in a subsequent patch.
Signed-off-by: Micah Fedke <micah.fedke@collabora.co.uk>
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
Diffstat (limited to 'lib/drmtest.h')
-rw-r--r-- | lib/drmtest.h | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/drmtest.h b/lib/drmtest.h index 7d20d770..96863682 100644 --- a/lib/drmtest.h +++ b/lib/drmtest.h @@ -38,6 +38,16 @@ #include "intel_batchbuffer.h" +#define DRIVER_ANY 0x1 +#define DRIVER_INTEL (0x1 << 1) + +/* provide the deprecated drm_open_any*() calls */ +#define drm_open_any() drm_open_driver(DRIVER_ANY) +#define drm_open_any_master() drm_open_driver_master(DRIVER_ANY) +#define drm_open_any_render() drm_open_driver_render(DRIVER_ANY) +#define __drm_open_any() __drm_open_driver(DRIVER_ANY) + + #ifdef ANDROID #if (!(defined HAVE_MMAP64)) && (!(defined __x86_64__)) extern void* __mmap2(void *, size_t, int, int, int, off_t); @@ -71,10 +81,10 @@ static inline void *igt_mmap64(void *addr, size_t length, int prot, int flags, #define ALIGN(v, a) (((v) + (a)-1) & ~((a)-1)) int drm_get_card(void); -int __drm_open_any(void); -int drm_open_any(void); -int drm_open_any_master(void); -int drm_open_any_render(void); +int drm_open_driver(int chipset); +int drm_open_driver_master(int chipset); +int drm_open_driver_render(int chipset); +int __drm_open_driver(int chipset); void gem_quiescent_gpu(int fd); |