<div dir="ltr">I sent the modified patches in another thread a while ago.<div>Please review in case got missed.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 30, 2017 at 7:35 PM, Leo Liu <span dir="ltr"><<a href="mailto:leo.liu@amd.com" target="_blank">leo.liu@amd.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><span class="">
    <p><br>
    </p>
    <br>
    <div class="m_6119295432499520115moz-cite-prefix">On 11/30/2017 06:22 AM, Julien Isorce
      wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi Gurkirpal,
        <div><br>
        </div>
        <div>
          <div>> Before refactoring process both the state trackers
            were in independent directories.</div>
          <div>> During earlier refactoring effort we decided to keep
            that directory structure so it made</div>
          <div>> sense to move them to auxiliary code. After that I
            moved them both under st/omx.</div>
          <div>> Since there could be a chance of it being useful out
            of st/omx, I left the decision to</div>
          <div>> keep it or move it back to st/omx to the mailing
            list.</div>
        </div>
        <div><br>
        </div>
        <div>Yes please move it back to st/omx for the reasons you said,
          i.e. there will now 2</div>
        <div>sub directories, st/omx/bellagio and st/omx/tizonia and
          common code in st/omx.</div>
      </div>
    </blockquote></span>
    Yes. Please move them back to st/omx.<br>
    <br>
    With that fixed, the series are:<br>
    <br>
    Acked-by: Leo Liu <a class="m_6119295432499520115moz-txt-link-rfc2396E" href="mailto:leo.liu@amd.com" target="_blank"><leo.liu@amd.com></a><br>
    <br>
    Thanks for the work!<span class="HOEnZb"><font color="#888888"><br>
    <br>
    Leo</font></span><div><div class="h5"><br>
    <br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div>Another reason is that the env var <span style="font-size:12.8px">"OMX_RENDER_</span><span style="font-size:12.8px">NODE"
            mentions OMX.</span></div>
        <div><br>
        </div>
        <div>Thx!</div>
        <div>Julien</div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On 29 November 2017 at 04:02, Gurkirpal
          Singh <span dir="ltr"><<a href="mailto:gurkirpal204@gmail.com" target="_blank">gurkirpal204@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
             src/gallium/auxiliary/Makefil<wbr>e.sources             | 
             2 +<br>
             src/gallium/auxiliary/vl/vl_s<wbr>creen.c               |
            107 +++++++++++++++++++++<br>
             src/gallium/auxiliary/vl/vl_s<wbr>creen.h               | 
            33 +++++++<br>
             .../state_trackers/omx_bellag<wbr>io/entrypoint.c       | 
            83 ----------------<br>
             .../state_trackers/omx_bellag<wbr>io/entrypoint.h       | 
             3 -<br>
             src/gallium/state_trackers/om<wbr>x_bellagio/vid_dec.c  | 
             5 +-<br>
             src/gallium/state_trackers/om<wbr>x_bellagio/vid_enc.c  | 
             5 +-<br>
             7 files changed, 148 insertions(+), 90 deletions(-)<br>
             create mode 100644 src/gallium/auxiliary/vl/vl_sc<wbr>reen.c<br>
             create mode 100644 src/gallium/auxiliary/vl/vl_sc<wbr>reen.h<br>
            <br>
            diff --git a/src/gallium/auxiliary/Makefi<wbr>le.sources
            b/src/gallium/auxiliary/Makefi<wbr>le.sources<br>
            index f40c472..35e89f9 100644<br>
            --- a/src/gallium/auxiliary/Makefi<wbr>le.sources<br>
            +++ b/src/gallium/auxiliary/Makefi<wbr>le.sources<br>
            @@ -343,6 +343,8 @@ VL_SOURCES := \<br>
                    vl/vl_mpeg12_decoder.c \<br>
                    vl/vl_mpeg12_decoder.h \<br>
                    vl/vl_rbsp.h \<br>
            +       vl/vl_screen.c \<br>
            +       vl/vl_screen.h \<br>
                    vl/vl_types.h \<br>
                    vl/vl_vertex_buffers.c \<br>
                    vl/vl_vertex_buffers.h \<br>
            diff --git a/src/gallium/auxiliary/vl/vl_<wbr>screen.c
            b/src/gallium/auxiliary/vl/vl_<wbr>screen.c<br>
            new file mode 100644<br>
            index 0000000..7192802<br>
            --- /dev/null<br>
            +++ b/src/gallium/auxiliary/vl/vl_<wbr>screen.c<br>
            @@ -0,0 +1,107 @@<br>
            +/****************************<wbr>******************************<wbr>****************<br>
            + *<br>
            + * Permission is hereby granted, free of charge, to any
            person obtaining a<br>
            + * copy of this software and associated documentation files
            (the<br>
            + * "Software"), to deal in the Software without
            restriction, including<br>
            + * without limitation the rights to use, copy, modify,
            merge, publish,<br>
            + * distribute, sub license, and/or sell copies of the
            Software, and to<br>
            + * permit persons to whom the Software is furnished to do
            so, subject to<br>
            + * the following conditions:<br>
            + *<br>
            + * The above copyright notice and this permission notice
            (including the<br>
            + * next paragraph) shall be included in all copies or
            substantial portions<br>
            + * of the Software.<br>
            + *<br>
            + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
            ANY KIND, EXPRESS<br>
            + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
            OF<br>
            + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
            NON-INFRINGEMENT.<br>
            + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE
            FOR<br>
            + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
            ACTION OF CONTRACT,<br>
            + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
            WITH THE<br>
            + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
            + *<br>
            + ******************************<wbr>******************************<wbr>**************/<br>
            +<br>
            +#include <assert.h><br>
            +#include <string.h><br>
            +#include <stdbool.h><br>
            +<br>
            +#include "os/os_thread.h"<br>
            +#include "util/u_memory.h"<br>
            +#include "loader/loader.h"<br>
            +#include "vl_screen.h"<br>
            +<br>
            +#if defined(HAVE_X11_PLATFORM)<br>
            +#include <X11/Xlib.h><br>
            +#else<br>
            +#define XOpenDisplay(x) NULL<br>
            +#define XCloseDisplay(x)<br>
            +#define Display void<br>
            +#endif<br>
            +<br>
            +static mtx_t st_lock = _MTX_INITIALIZER_NP;<br>
            +static Display *st_display = NULL;<br>
            +static struct vl_screen *st_screen = NULL;<br>
            +static unsigned st_usecount = 0;<br>
            +static const char *st_render_node = NULL;<br>
            +static int drm_fd;<br>
            +<br>
            +struct vl_screen *vl_get_screen(const char* render_node)<br>
            +{<br>
            +   static bool first_time = true;<br>
            +   mtx_lock(&st_lock);<br>
            +<br>
            +   if (!st_screen) {<br>
            +      if (first_time) {<br>
            +         st_render_node = debug_get_option(render_node,
            NULL);<br>
            +         first_time = false;<br>
            +      }<br>
            +      if (st_render_node) {<br>
            +         drm_fd = loader_open_device(st_render_n<wbr>ode);<br>
            +         if (drm_fd < 0)<br>
            +            goto error;<br>
            +<br>
            +         st_screen = vl_drm_screen_create(drm_fd);<br>
            +         if (!st_screen) {<br>
            +            close(drm_fd);<br>
            +            goto error;<br>
            +         }<br>
            +      } else {<br>
            +         st_display = XOpenDisplay(NULL);<br>
            +         if (!st_display)<br>
            +            goto error;<br>
            +<br>
            +         st_screen = vl_dri3_screen_create(st_displ<wbr>ay,
            0);<br>
            +         if (!st_screen)<br>
            +            st_screen = vl_dri2_screen_create(st_displ<wbr>ay,
            0);<br>
            +         if (!st_screen) {<br>
            +            XCloseDisplay(st_display);<br>
            +            goto error;<br>
            +         }<br>
            +      }<br>
            +   }<br>
            +<br>
            +   ++st_usecount;<br>
            +<br>
            +   mtx_unlock(&st_lock);<br>
            +   return st_screen;<br>
            +<br>
            +error:<br>
            +   mtx_unlock(&st_lock);<br>
            +   return NULL;<br>
            +}<br>
            +<br>
            +void vl_put_screen(void)<br>
            +{<br>
            +   mtx_lock(&st_lock);<br>
            +   if ((--st_usecount) == 0) {<br>
            +      st_screen->destroy(st_screen);<br>
            +      st_screen = NULL;<br>
            +<br>
            +      if (st_render_node)<br>
            +         close(drm_fd);<br>
            +      else<br>
            +         XCloseDisplay(st_display);<br>
            +   }<br>
            +   mtx_unlock(&st_lock);<br>
            +}<br>
            diff --git a/src/gallium/auxiliary/vl/vl_<wbr>screen.h
            b/src/gallium/auxiliary/vl/vl_<wbr>screen.h<br>
            new file mode 100644<br>
            index 0000000..1e14775<br>
            --- /dev/null<br>
            +++ b/src/gallium/auxiliary/vl/vl_<wbr>screen.h<br>
            @@ -0,0 +1,33 @@<br>
            +/****************************<wbr>******************************<wbr>****************<br>
            + *<br>
            + * Permission is hereby granted, free of charge, to any
            person obtaining a<br>
            + * copy of this software and associated documentation files
            (the<br>
            + * "Software"), to deal in the Software without
            restriction, including<br>
            + * without limitation the rights to use, copy, modify,
            merge, publish,<br>
            + * distribute, sub license, and/or sell copies of the
            Software, and to<br>
            + * permit persons to whom the Software is furnished to do
            so, subject to<br>
            + * the following conditions:<br>
            + *<br>
            + * The above copyright notice and this permission notice
            (including the<br>
            + * next paragraph) shall be included in all copies or
            substantial portions<br>
            + * of the Software.<br>
            + *<br>
            + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
            ANY KIND, EXPRESS<br>
            + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
            OF<br>
            + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
            NON-INFRINGEMENT.<br>
            + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE
            FOR<br>
            + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
            ACTION OF CONTRACT,<br>
            + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
            WITH THE<br>
            + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.<br>
            + *<br>
            + ******************************<wbr>******************************<wbr>**************/<br>
            +<br>
            +#ifndef VL_VL_SCREEN_H<br>
            +#define VL_VL_SCREEN_H<br>
            +<br>
            +#include "vl_winsys.h"<br>
            +<br>
            +struct vl_screen *vl_get_screen(const char* render_node);<br>
            +void vl_put_screen(void);<br>
            +<br>
            +#endif<br>
            diff --git a/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.c
            b/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.c<br>
            index 251cc7d..5c75e8d 100644<br>
            --- a/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.c<br>
            +++ b/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.c<br>
            @@ -31,33 +31,10 @@<br>
              *<br>
              */<br>
            <br>
            -#include <assert.h><br>
            -#include <string.h><br>
            -#include <stdbool.h><br>
            -<br>
            -#if defined(HAVE_X11_PLATFORM)<br>
            -#include <X11/Xlib.h><br>
            -#else<br>
            -#define XOpenDisplay(x) NULL<br>
            -#define XCloseDisplay(x)<br>
            -#define Display void<br>
            -#endif<br>
            -<br>
            -#include "os/os_thread.h"<br>
            -#include "util/u_memory.h"<br>
            -#include "loader/loader.h"<br>
            -<br>
             #include "entrypoint.h"<br>
             #include "vid_dec.h"<br>
             #include "vid_enc.h"<br>
            <br>
            -static mtx_t omx_lock = _MTX_INITIALIZER_NP;<br>
            -static Display *omx_display = NULL;<br>
            -static struct vl_screen *omx_screen = NULL;<br>
            -static unsigned omx_usecount = 0;<br>
            -static const char *omx_render_node = NULL;<br>
            -static int drm_fd;<br>
            -<br>
             int omx_component_library_Setup(st<wbr>LoaderComponentType
            **stComponents)<br>
             {<br>
                OMX_ERRORTYPE r;<br>
            @@ -78,66 +55,6 @@ int omx_component_library_Setup(st<wbr>LoaderComponentType
            **stComponents)<br>
                return 2;<br>
             }<br>
            <br>
            -struct vl_screen *omx_get_screen(void)<br>
            -{<br>
            -   static bool first_time = true;<br>
            -   mtx_lock(&omx_lock);<br>
            -<br>
            -   if (!omx_screen) {<br>
            -      if (first_time) {<br>
            -         omx_render_node = debug_get_option("OMX_RENDER_N<wbr>ODE",
            NULL);<br>
            -         first_time = false;<br>
            -      }<br>
            -      if (omx_render_node) {<br>
            -         drm_fd = loader_open_device(omx_render_<wbr>node);<br>
            -         if (drm_fd < 0)<br>
            -            goto error;<br>
            -<br>
            -         omx_screen = vl_drm_screen_create(drm_fd);<br>
            -         if (!omx_screen) {<br>
            -            close(drm_fd);<br>
            -            goto error;<br>
            -         }<br>
            -      } else {<br>
            -         omx_display = XOpenDisplay(NULL);<br>
            -         if (!omx_display)<br>
            -            goto error;<br>
            -<br>
            -         omx_screen = vl_dri3_screen_create(omx_disp<wbr>lay,
            0);<br>
            -         if (!omx_screen)<br>
            -            omx_screen = vl_dri2_screen_create(omx_disp<wbr>lay,
            0);<br>
            -         if (!omx_screen) {<br>
            -            XCloseDisplay(omx_display);<br>
            -            goto error;<br>
            -         }<br>
            -      }<br>
            -   }<br>
            -<br>
            -   ++omx_usecount;<br>
            -<br>
            -   mtx_unlock(&omx_lock);<br>
            -   return omx_screen;<br>
            -<br>
            -error:<br>
            -   mtx_unlock(&omx_lock);<br>
            -   return NULL;<br>
            -}<br>
            -<br>
            -void omx_put_screen(void)<br>
            -{<br>
            -   mtx_lock(&omx_lock);<br>
            -   if ((--omx_usecount) == 0) {<br>
            -      omx_screen->destroy(omx_screen<wbr>);<br>
            -      omx_screen = NULL;<br>
            -<br>
            -      if (omx_render_node)<br>
            -         close(drm_fd);<br>
            -      else<br>
            -         XCloseDisplay(omx_display);<br>
            -   }<br>
            -   mtx_unlock(&omx_lock);<br>
            -}<br>
            -<br>
             OMX_ERRORTYPE omx_workaround_Destructor(OMX_<wbr>COMPONENTTYPE
            *comp)<br>
             {<br>
                omx_base_component_PrivateType<wbr>* priv =
            (omx_base_component_PrivateTyp<wbr>e*)comp->pComponentPrivate;<br>
            diff --git a/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.h
            b/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.h<br>
            index 7625d7a..d566d1e 100644<br>
            --- a/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.h<br>
            +++ b/src/gallium/state_trackers/o<wbr>mx_bellagio/entrypoint.h<br>
            @@ -40,9 +40,6 @@<br>
            <br>
             PUBLIC extern int omx_component_library_Setup(st<wbr>LoaderComponentType
            **stComponents);<br>
            <br>
            -struct vl_screen *omx_get_screen(void);<br>
            -void omx_put_screen(void);<br>
            -<br>
             OMX_ERRORTYPE omx_workaround_Destructor(OMX_<wbr>COMPONENTTYPE
            *comp);<br>
            <br>
             #endif<br>
            diff --git a/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_dec.c
            b/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_dec.c<br>
            index f9fe19f..b62c705 100644<br>
            --- a/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_dec.c<br>
            +++ b/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_dec.c<br>
            @@ -50,6 +50,7 @@<br>
             #include "util/u_surface.h"<br>
             #include "vl/vl_video_buffer.h"<br>
             #include "vl/vl_vlc.h"<br>
            +#include "vl/vl_screen.h"<br>
            <br>
             #include "entrypoint.h"<br>
             #include "vid_dec.h"<br>
            @@ -173,7 +174,7 @@ static OMX_ERRORTYPE
            vid_dec_Constructor(OMX_COMPON<wbr>ENTTYPE *comp, OMX_STRING
            nam<br>
                comp->SetParameter = vid_dec_SetParameter;<br>
                comp->GetParameter = vid_dec_GetParameter;<br>
            <br>
            -   priv->screen = omx_get_screen();<br>
            +   priv->screen = vl_get_screen("OMX_RENDER_NODE<wbr>");<br>
                if (!priv->screen)<br>
                   return OMX_ErrorInsufficientResources<wbr>;<br>
            <br>
            @@ -253,7 +254,7 @@ static OMX_ERRORTYPE
            vid_dec_Destructor(OMX_COMPONE<wbr>NTTYPE *comp)<br>
                }<br>
            <br>
                if (priv->screen)<br>
            -      omx_put_screen();<br>
            +      vl_put_screen();<br>
            <br>
                return omx_workaround_Destructor(comp<wbr>);<br>
             }<br>
            diff --git a/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_enc.c
            b/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_enc.c<br>
            index 1a4fb62..40e7a0f 100644<br>
            --- a/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_enc.c<br>
            +++ b/src/gallium/state_trackers/o<wbr>mx_bellagio/vid_enc.c<br>
            @@ -50,6 +50,7 @@<br>
             #include "pipe/p_video_codec.h"<br>
             #include "util/u_memory.h"<br>
             #include "vl/vl_video_buffer.h"<br>
            +#include "vl/vl_screen.h"<br>
            <br>
             #include "entrypoint.h"<br>
             #include "vid_enc.h"<br>
            @@ -170,7 +171,7 @@ static OMX_ERRORTYPE
            vid_enc_Constructor(OMX_COMPON<wbr>ENTTYPE *comp, OMX_STRING
            nam<br>
                comp->GetConfig = vid_enc_GetConfig;<br>
                comp->SetConfig = vid_enc_SetConfig;<br>
            <br>
            -   priv->screen = omx_get_screen();<br>
            +   priv->screen = vl_get_screen("OMX_RENDER_NODE<wbr>");<br>
                if (!priv->screen)<br>
                   return OMX_ErrorInsufficientResources<wbr>;<br>
            <br>
            @@ -296,7 +297,7 @@ static OMX_ERRORTYPE
            vid_enc_Destructor(OMX_COMPONE<wbr>NTTYPE *comp)<br>
                   priv->t_pipe->destroy(priv-><wbr>t_pipe);<br>
            <br>
                if (priv->screen)<br>
            -      omx_put_screen();<br>
            +      vl_put_screen();<br>
            <br>
                return omx_workaround_Destructor(comp<wbr>);<br>
             }<br>
            <span class="m_6119295432499520115HOEnZb"><font color="#888888">--<br>
                2.7.4<br>
                <br>
                ______________________________<wbr>_________________<br>
                mesa-dev mailing list<br>
                <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
                <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="m_6119295432499520115mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
mesa-dev mailing list
<a class="m_6119295432499520115moz-txt-link-abbreviated" href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a>
<a class="m_6119295432499520115moz-txt-link-freetext" href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>