<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - _eglGetNativePlatform should not fall back to build-time configuration"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=69071">69071</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>_eglGetNativePlatform should not fall back to build-time configuration
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>minor
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>guillaume.melquiond@gmail.com
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>git
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>EGL
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr></table>
      <p>
        <div>
        <pre>In src/egl/main/egldisplay.c, function _eglGetNativePlatform looks at the
content of nativeDisplay. If this content does not match any of the supported
platforms, it returns one of the platforms selected at configure time (the
first one?).

As a consequence, if Mesa is configured without X11 support for EGL and you try
to run an EGL application under X, nativeDisplay contains the value returned by
XOpenDisplay; then _eglNativePlatformDetectNativeDisplay returns
_EGL_INVALID_PLATFORM; finally _eglGetNativePlatform falls back to
_EGL_PLATFORM_WAYLAND (for instance). Mesa ends up crashing in
src/egl/drivers/dri2/platform_wayland.c because dri2_dpy->wl_dpy does not point
to a wl_display structure.

Note that _eglNativePlatformDetectNativeDisplay correctly infers that the
platform cannot be Wayland (since nativeDisplay does not point to a Wayland
structure), still _eglGetNativePlatform falls back to it. Platform types ruled
out by _eglNativePlatformDetectNativeDisplay should never be returned by
_eglGetNativePlatform.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>