All of lore.kernel.org
 help / color / mirror / Atom feed
From: Emil Velikov <emil.l.velikov@gmail.com>
To: "Guo, Yejun" <yejun.guo@intel.com>, Daniel Kurtz <djkurtz@chromium.org>
Cc: emil.l.velikov@gmail.com, dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] fix typo for drmOpenByName
Date: Thu, 14 May 2015 23:11:20 +0000	[thread overview]
Message-ID: <55552B98.6030203@gmail.com> (raw)
In-Reply-To: <854E8DBA9F41904AB047E03BB6963AE50553574D@SHSMSX101.ccr.corp.intel.com>

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
program does*.
 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 :)

-Emil

* 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" --
$(linux_top)/drivers/gpu/drm

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2015-05-14 22:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14  6:17 [PATCH] fix typo for drmOpenByName Guo Yejun
2015-05-14 10:53 ` Daniel Kurtz
2015-05-14 12:38   ` Guo, Yejun
2015-05-14 23:11     ` Emil Velikov [this message]
2015-05-14 10:55 ` Emil Velikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55552B98.6030203@gmail.com \
    --to=emil.l.velikov@gmail.com \
    --cc=djkurtz@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=yejun.guo@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.