static GstVaapiTexture *
gst_vaapi_display_glx_create_texture (GstVaapiDisplay * display, GstVaapiID id,
    guint target, guint format, guint width, guint height)
{
  return id != GST_VAAPI_ID_INVALID ?
      gst_vaapi_texture_glx_new_wrapped (display, id, target, format) :
      gst_vaapi_texture_glx_new (display, target, format, width, height);
}
static GstVaapiTexture *
gst_vaapi_display_glx_create_texture (GstVaapiDisplay * display, GstVaapiID id,
    guint target, guint format, guint width, guint height)
{
  GstVaapiTexture *texture;
  GstVaapiDisplayGLX *dpy = GST_VAAPI_DISPLAY_GLX (display);

  if (id == GST_VAAPI_ID_INVALID)
    return gst_vaapi_texture_glx_new (display, target, format, width, height);

  ensure_texture_map (dpy);
  if (!(texture = gst_vaapi_texture_map_lookup (dpy->texture_map, id))) {
    if ((texture =
            gst_vaapi_texture_glx_new_wrapped (display, id, target, format))) {
      gst_vaapi_texture_map_add (dpy->texture_map, texture, id);
    }
  }

  return texture;
}