loader_dri3/glx/egl: Remove the loader_dri3_vtable get_dri_screen callback
authorThomas Hellstrom <thellstrom@vmware.com>
Fri, 11 Aug 2017 07:57:51 +0000 (09:57 +0200)
committerThomas Hellstrom <thellstrom@vmware.com>
Thu, 17 Aug 2017 05:39:42 +0000 (07:39 +0200)
It's not very usable since in the rare, but definitely existing case that
we don't have a current context, it will return NULL.

Presumably it will always be safe to use the dri screen the drawable was
created with for operations on that drawable.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/egl/drivers/dri2/platform_x11_dri3.c
src/glx/dri3_glx.c
src/loader/loader_dri3_helper.c
src/loader/loader_dri3_helper.h

index 9c018168b1cd4f57159425c1a1005b453917f6d1..991749803eaae0cf72c227aaa7f2492f6d3ed0ff 100644 (file)
@@ -75,17 +75,6 @@ egl_dri3_get_dri_context(struct loader_dri3_drawable *draw)
    return dri2_ctx->dri_context;
 }
 
-static __DRIscreen *
-egl_dri3_get_dri_screen(struct loader_dri3_drawable *draw)
-{
-   _EGLContext *ctx = _eglGetCurrentContext();
-   struct dri2_egl_context *dri2_ctx;
-   if (!ctx)
-      return NULL;
-   dri2_ctx = dri2_egl_context(ctx);
-   return dri2_egl_display(dri2_ctx->base.Resource.Display)->dri_screen;
-}
-
 static void
 egl_dri3_flush_drawable(struct loader_dri3_drawable *draw, unsigned flags)
 {
@@ -99,7 +88,6 @@ static const struct loader_dri3_vtable egl_dri3_vtable = {
    .set_drawable_size = egl_dri3_set_drawable_size,
    .in_current_context = egl_dri3_in_current_context,
    .get_dri_context = egl_dri3_get_dri_context,
-   .get_dri_screen = egl_dri3_get_dri_screen,
    .flush_drawable = egl_dri3_flush_drawable,
    .show_fps = NULL,
 };
index 024e8ab0479917cb63f9073d68ddb4bc8994b4f5..dc94740763533a3cfa79e673da92ce7e991ea2b9 100644 (file)
@@ -116,16 +116,6 @@ glx_dri3_get_dri_context(struct loader_dri3_drawable *draw)
    return (gc != &dummyContext) ? dri3Ctx->driContext : NULL;
 }
 
-static __DRIscreen *
-glx_dri3_get_dri_screen(struct loader_dri3_drawable *draw)
-{
-   struct glx_context *gc = __glXGetCurrentContext();
-   struct dri3_context *pcp = (struct dri3_context *) gc;
-   struct dri3_screen *psc = (struct dri3_screen *) pcp->base.psc;
-
-   return (gc != &dummyContext && psc) ? psc->driScreen : NULL;
-}
-
 static void
 glx_dri3_flush_drawable(struct loader_dri3_drawable *draw, unsigned flags)
 {
@@ -160,7 +150,6 @@ static const struct loader_dri3_vtable glx_dri3_vtable = {
    .set_drawable_size = glx_dri3_set_drawable_size,
    .in_current_context = glx_dri3_in_current_context,
    .get_dri_context = glx_dri3_get_dri_context,
-   .get_dri_screen = glx_dri3_get_dri_screen,
    .flush_drawable = glx_dri3_flush_drawable,
    .show_fps = glx_dri3_show_fps,
 };
index 9d24130291803cd831bdf31d0dd404fc075eddfd..5346d0757df5408c4df3fd524f2b64dceff1a2db 100644 (file)
@@ -1116,7 +1116,6 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, unsigned int format,
    xcb_sync_fence_t                     sync_fence;
    struct xshmfence                     *shm_fence;
    int                                  fence_fd;
-   __DRIscreen                          *cur_screen;
 
    if (buffer)
       return buffer;
@@ -1147,17 +1146,8 @@ dri3_get_pixmap_buffer(__DRIdrawable *driDrawable, unsigned int format,
    if (!bp_reply)
       goto no_image;
 
-   /* Get the currently-bound screen or revert to using the drawable's screen if
-    * no contexts are currently bound. The latter case is at least necessary for
-    * obs-studio, when using Window Capture (Xcomposite) as a Source.
-    */
-   cur_screen = draw->vtable->get_dri_screen(draw);
-   if (!cur_screen) {
-       cur_screen = draw->dri_screen;
-   }
-
    buffer->image = loader_dri3_create_image(draw->conn, bp_reply, format,
-                                            cur_screen, draw->ext->image,
+                                            draw->dri_screen, draw->ext->image,
                                             buffer);
    if (!buffer->image)
       goto no_image;
index af42425df7f9f83889a51b393bef5d623b4d0a24..34498c93ff56009696547b049c1d126f207c117a 100644 (file)
@@ -100,7 +100,6 @@ struct loader_dri3_vtable {
    void (*set_drawable_size)(struct loader_dri3_drawable *, int, int);
    bool (*in_current_context)(struct loader_dri3_drawable *);
    __DRIcontext *(*get_dri_context)(struct loader_dri3_drawable *);
-   __DRIscreen *(*get_dri_screen)(struct loader_dri3_drawable *);
    void (*flush_drawable)(struct loader_dri3_drawable *, unsigned);
    void (*show_fps)(struct loader_dri3_drawable *, uint64_t);
 };