[Mesa-dev] [PATCH 4/4] st/omx: add headless support

Liu, Leo Leo.Liu at amd.com
Fri Nov 6 08:00:16 PST 2015


Hi Emil,

>Shorten the variable name - OMX_RENDER_NODE ? debug_get_option is only
>available on debug builds so better use getenv.
>

The debug_get_*_option() functions are used all around mesa, and functions are explicitly preferred to working with getenv() directly.

Regards,
Leo


>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


More information about the mesa-dev mailing list