On 5 November 2015 at 18:47, Leo Liu <leo....@amd.com> wrote: > This will allow dec/enc/transcode without X > Are we talking about multi GPU setup where X is running on one, and OMX on another, or a true "without X" case ? I'm leaning that the latter isn't really possible, yet.
> Signed-off-by: Leo Liu <leo....@amd.com> > --- > src/gallium/state_trackers/omx/entrypoint.c | 39 > +++++++++++++++++++++-------- > 1 file changed, 29 insertions(+), 10 deletions(-) > > diff --git a/src/gallium/state_trackers/omx/entrypoint.c > b/src/gallium/state_trackers/omx/entrypoint.c > index a765666..a6a1279 100644 > --- a/src/gallium/state_trackers/omx/entrypoint.c > +++ b/src/gallium/state_trackers/omx/entrypoint.c > @@ -33,6 +33,7 @@ > > #include <assert.h> > #include <string.h> > +#include <fcntl.h> > > #include <X11/Xlib.h> > > @@ -47,6 +48,7 @@ pipe_static_mutex(omx_lock); > static Display *omx_display = NULL; > static struct vl_screen *omx_screen = NULL; > static unsigned omx_usecount = 0; > +static const char *omx_render_node = NULL; > > int omx_component_library_Setup(stLoaderComponentType **stComponents) > { > @@ -73,33 +75,50 @@ struct vl_screen *omx_get_screen(void) > pipe_mutex_lock(omx_lock); > > if (!omx_display) { > + omx_render_node = debug_get_option("OMX_DRM_RENDER_NODES", NULL); Shorten the variable name - OMX_RENDER_NODE ? debug_get_option is only available on debug builds so better use getenv. omx_render_node can be an empty string so we should check for that. > omx_display = XOpenDisplay(NULL); > if (!omx_display) { > - pipe_mutex_unlock(omx_lock); > - return NULL; > - } > + if (!omx_render_node) > + goto error; > + } else > + omx_render_node = NULL; The following will honour the env override, without attempting to connect to X. if (!omx_render_node && omx_render_node != "") { int fd = loader_open_device() vl_drm_screen_create() } else { omx_display = XOpenDisplay() vl_screen_create() } > } > > if (!omx_screen) { > - omx_screen = vl_screen_create(omx_display, 0); > - if (!omx_screen) { > - pipe_mutex_unlock(omx_lock); > - return NULL; > - } > + if (omx_render_node) { > + int fd = open(omx_render_node, O_RDWR); Use loader_open_device(), it gives you free C_CLOEXEC handling. As you send v2 of the series feel free to squash patches 2 and 3. Thanks Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev