[PATCH] fix typo for drmOpenByName
emil.l.velikov at gmail.com
Thu May 14 16:11:20 PDT 2015
On 14/05/15 12:38, Guo, Yejun wrote:
> Thanks Daniel Kurtz and Emil Velikov for the reply.
> In general, drm APIs are invoked by user mode drivers, but, I want to mimic the behavior of driver in my unit test to create buffer objects. After do some searching, I wrote the following code in my unit test (user mode simple application based on libdrm). It does work in my old system (cannot go back to it and so do not know the exact version), but it failed when porting the unit test based on latest libdrm code. I stepped into function drmOpenByName and thought it is a typo.
> int fd = drmOpen("i915", NULL);
> drm_intel_bufmgr* bufmgr = drm_intel_bufmgr_gem_init(fd, 1024);
> drm_intel_bo * bo = drm_intel_bo_alloc(bufmgr,...);
I honestly hope that your code has error checking and you've dropped
them here for simplicity.
> After read the comment, looks like the above code is not used as expected. (I execute the utest together with X11 is running).
> Back to my original purpose, what's the correct way for me to create bo? One possible way is to open("/dev/dri/renderDxxx"), but what should I do if the kernel version is too low to has this feature?
Afaict there are a few solutions possible (listed in order of preference):
1. Run your test without/outside X
2. Opt for render nodes, but it again depends on exactly what your
3. Use open(...cardX...) directly, but you might need to set/drop
master depending your program.
Needless to say personally I would opt for 1 :)
* You can confirm with the rest of the Intel crew if your program
requires master/root/auth from the drm and/or i915 module. Alternatively
you can check with the kernel
$ git grep "DRM_AUTH\|DRM_MASTER\|DRM_ROOT_ONLY" --
More information about the dri-devel