summaryrefslogtreecommitdiff
path: root/src/glx
diff options
context:
space:
mode:
authorMartin Peres <martin.peres@linux.intel.com>2016-10-06 17:07:22 +0300
committerMartin Peres <martin.peres@linux.intel.com>2016-10-07 11:11:44 +0300
commit0247e5ee3edd546b8598082d5b45d110f61853d0 (patch)
tree428c1747d1b7fb8a49569c9bde6a0e2ffec63e96 /src/glx
parent82b4f1c47b1d6ca326dbd863253d89337f565309 (diff)
loader/dri3: add get_dri_screen() to the vtable
This allows querying the current active screen from the loader's common code. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/dri3_glx.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/glx/dri3_glx.c b/src/glx/dri3_glx.c
index 90d7bba1e6..51b6b1cdfa 100644
--- a/src/glx/dri3_glx.c
+++ b/src/glx/dri3_glx.c
@@ -132,6 +132,16 @@ 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)
{
@@ -169,6 +179,7 @@ static 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,
};