<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin-top:7.5pt;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
span.code-keyword
        {mso-style-name:code-keyword;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1440174224;
        mso-list-template-ids:-159062870;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:1.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:2.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:2.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:3.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:3.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:4.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:4.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">To whom it may concern:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">We would like to bring your attention to a potential wayland-egl issue with openCV Python script.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">The issue is that both Mesa and our mechanism to identify the wl_display  client from eglGetDIspaly() call fails for openCV Python script.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Mesa implementation:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">   if (_eglPointerIsDereferencable(nativeDisplay)) {<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">      void *first_pointer = *(void **) nativeDisplay;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">      (void) first_pointer; /* silence unused var warning */<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">#ifdef HAVE_WAYLAND_PLATFORM<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">      /* wl_display is a wl_proxy, which is a wl_object.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">       * wl_object's first element points to the interfacetype. */<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">      if (first_pointer ==
</span><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:red">&wl_display_interface</span><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">         return _EGL_PLATFORM_WAYLAND;<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">#endif<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.0pt;font-family:"Courier New";color:#333333">TI wayland-egl WS implementation:<o:p></o:p></span></p>
<pre><span class="code-keyword"><span lang="EN" style="color:#333333">if</span></span><span lang="EN" style="color:#333333"> (hNativeDisplay && is_ptr(hNativeDisplay)) {<o:p></o:p></span></pre>
<pre><span lang="EN" style="color:#333333">               struct wl_display *dpy = (struct wl_display *)hNativeDisplay;<o:p></o:p></span></pre>
<pre><span lang="EN" style="color:#333333">      <o:p></o:p></span></pre>
<pre><span lang="EN" style="color:#333333">               <span class="code-keyword">if</span> (*(void **)dpy == &wl_display_interface)<o:p></o:p></span></pre>
<pre><span lang="EN" style="color:#333333">                       <span class="code-keyword">return</span> WSEGL_SUCCESS;<o:p></o:p></span></pre>
<pre><span lang="EN" style="color:#333333">        }<o:p></o:p></span></pre>
<pre><span lang="EN" style="color:#333333">The problem is that the link address of wl_dispaly_interface at the caller and callee of API eglGetDispaly(wl_dispaly) are different. <o:p></o:p></span></pre>
<pre><span lang="EN" style="color:#333333">Here is what we found:<o:p></o:p></span></pre>
<p class="MsoNormal"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333"><br>
The following parameters from libwayland-client.so are dumped at three different *.so location.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:0in;text-indent:-.25in;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN" style="font-size:10.0pt;font-family:Wingdings;color:#333333"><span style="mso-list:Ignore">§<span style="font:7.0pt "Times New Roman""> 
</span></span></span><![endif]><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">mDisplay(dpy): struct wl_display* return from API wl_display_connect<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:0in;text-indent:-.25in;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN" style="font-size:10.0pt;font-family:Wingdings;color:#333333"><span style="mso-list:Ignore">§<span style="font:7.0pt "Times New Roman""> 
</span></span></span><![endif]><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">*mDisplay(*dby): the first element within struct wl_display and it should be a pointer to constant table wl_display_interface<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:0in;text-indent:-.25in;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN" style="font-size:10.0pt;font-family:Wingdings;color:#333333"><span style="mso-list:Ignore">§<span style="font:7.0pt "Times New Roman""> 
</span></span></span><![endif]><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">&wl_display_interface: address of this const table (@libwayland-client.so)<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:0in;text-indent:-.25in;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN" style="font-size:10.0pt;font-family:Wingdings;color:#333333"><span style="mso-list:Ignore">§<span style="font:7.0pt "Times New Roman""> 
</span></span></span><![endif]><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">wl_display_interface.name: the first entry within the wl_display_interface and it should be "wl_display"<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:0in;text-indent:-.25in;mso-list:l0 level1 lfo1">
<![if !supportLists]><span lang="EN" style="font-size:10.0pt;font-family:Wingdings;color:#333333"><span style="mso-list:Ignore">§<span style="font:7.0pt "Times New Roman""> 
</span></span></span><![endif]><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">wl_display_connect: address of this API (@libwayland-client.so)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">What I found is that the const table wl_display_interface resides at different location at different *.so as shown below:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">libQt5WaylandClient.so: mDisplay is created here and therefore all parameters are consistent:<br>
QWaylandDisplay: mDisplay=0xd6770, *mDisplay=0xb0b0c6ac </span><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:red">&wl_display_interface=0xb0b0c6ac</span><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">,
 wl_display_interface.name=wl_display, wl_display_connect=0xb0cb5aec,<br>
init done<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">QT plugins\wayland-graphics-integration-client\libwayland-egl.so: only wl_display_interface is moved, the API wl_display_connect
 stays at the same location:<br>
QWaylandEglClientBufferIntegration::initialize: mDisplay=0xd6770, *mDisplay=0xb0b0c6ac
</span><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:red">&wl_display_interface=0xb0cc9970</span><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">, wl_display_interface.name=wl_display,
 wl_display_connect=0xb0cb5aec<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">SGX DDK libpvrws_WAYLAND.so: only wl_display_interface is moved, the API wl_display_connect stays at the same location<br>
wlpvr: dpy=0xd6770, *dpy=0xb0b0c6ac </span><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:red">&wl_display_interface=0xb1df96b0</span><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333"> wl_display_connect
 =0xb0cb5aec, wl_display_interface.name=wl_display<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">With python openCV API cv2.imShow, the location of data table such as wl_display_interface is moved at each plugin as shown
 at the previous comment. However, the table content seems to be preserved at the old location. The following log shows the table content at the first and last location.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">// old location = 0xb0bb46ac, new location = 0xb1ea16b0<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">wlpvr: dpy=0xd6770, *dpy=0xb0bb46ac &wl_display_interface=0xb1ea16b0 wl_display_connect =0xb0d5daec, wl_display_interface.name=wl_display<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">// new location; name @0xb1e905f8 = "wl_display", where methods and events are also table pointers
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">wlpvr: wl_display_interface (new location):name=0xb1e905f8, version=1, method_count=2, methods=0xb1ea16e0, event_count=2, events=0xb1ea16c8<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">// old location: name @0xb0b7c228 = "wl_display"<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">wlpvr: wl_display_interface:name=0xb0b7c228, version=1, method_count=2, methods=0xb0bb46dc, event_count=2, events=0xb0bb46c4<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">We have also confirmed that the WL connection handle wl_display still works even though it still points to the old interface
 table.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-top:7.5pt"><span lang="EN" style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#333333">Eric<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>