+#ifdef HAVE_TIZEN_PLATFORM
+static EGLBoolean
+tizen_bind_wayland_display_wl(_EGLDisplay *disp,
+ struct wl_display *wl_dpy)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+
+ (void) wl_dpy;
+
+ if (!dri2_dpy->tpl_display)
+ return EGL_FALSE;
+
+ if (!tpl_display_get_native_handle(dri2_dpy->tpl_display))
+ return EGL_FALSE;
+
+ return EGL_TRUE;
+}
+
+static EGLBoolean
+tizen_unbind_wayland_display_wl(_EGLDisplay *disp,
+ struct wl_display *wl_dpy)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+
+ (void) wl_dpy;
+
+ if (!dri2_dpy->tpl_display)
+ return EGL_FALSE;
+
+ if (!tpl_display_get_native_handle(dri2_dpy->tpl_display))
+ return EGL_FALSE;
+
+ return EGL_TRUE;
+}
+
+static EGLBoolean
+tizen_query_wayland_buffer_wl(_EGLDisplay *disp,
+ struct wl_resource *buffer_resource,
+ EGLint attribute, EGLint *value)
+{
+ struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
+ tbm_format tbm_format = 0;
+ int width = 0, height = 0;
+ tpl_result_t res;
+
+ if (!dri2_dpy->tpl_display)
+ return EGL_FALSE;
+
+ if (!tpl_display_get_native_handle(dri2_dpy->tpl_display))
+ return EGL_FALSE;
+
+ res = tpl_display_get_native_pixmap_info(dri2_dpy->tpl_display,
+ (tpl_handle_t)buffer_resource,
+ &width, &height, &tbm_format);
+ if (res != TPL_ERROR_NONE)
+ return EGL_FALSE;
+
+ switch (attribute) {
+ case EGL_TEXTURE_FORMAT:
+ switch (tbm_format) {
+ case TBM_FORMAT_ARGB8888:
+ *value = EGL_TEXTURE_RGBA;
+ return EGL_TRUE;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wswitch"
+ case TBM_FORMAT_XRGB8888:
+ case TBM_FORMAT_RGB565:
+#pragma GCC diagnostic pop
+ *value = EGL_TEXTURE_RGB;
+ return EGL_TRUE;
+ default:
+ break;
+ }
+ break;
+ case EGL_WIDTH:
+ *value = width;
+ return EGL_TRUE;
+ case EGL_HEIGHT:
+ *value = height;
+ return EGL_TRUE;
+ default:
+ break;
+ }
+
+ return EGL_FALSE;
+}
+#endif
+