v2: Avoid making the Ximage for the screen that we'll never use, and
drive the screen pixmap creation for glamor ourselves.
Signed-off-by: Eric Anholt
Reviewed-by: Keith Packard (v1)
---
configure.ac | 3 +
glamor/glamor.c| 11 ++
glamor/glamor.h| 2 +
hw/kdrive/ephyr/Makefile.am| 20 ++-
hw/kdrive/ephyr/ephyr.c| 42 --
hw/kdrive/ephyr/ephyr.h| 14 ++
hw/kdrive/ephyr/ephyr_glamor_glx.c | 292 +
hw/kdrive/ephyr/ephyr_glamor_glx.h | 62
hw/kdrive/ephyr/ephyrinit.c| 14 ++
hw/kdrive/ephyr/hostx.c| 126 +++-
10 files changed, 570 insertions(+), 16 deletions(-)
create mode 100644 hw/kdrive/ephyr/ephyr_glamor_glx.c
create mode 100644 hw/kdrive/ephyr/ephyr_glamor_glx.h
diff --git a/configure.ac b/configure.ac
index 0fb2fc3..5934950 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2319,6 +2319,9 @@ if test "$KDRIVE" = yes; then
if test "x$DRI" = xyes && test "x$GLX" = xyes; then
XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS libdrm xcb-glx xcb-xf86dri
> 1.6"
fi
+if test "x$GLAMOR" = xyes; then
+XEPHYR_REQUIRED_LIBS="$XEPHYR_REQUIRED_LIBS x11-xcb"
+fi
if test "x$XEPHYR" = xauto; then
PKG_CHECK_MODULES(XEPHYR, $XEPHYR_REQUIRED_LIBS, [XEPHYR="yes"],
[XEPHYR="no"])
diff --git a/glamor/glamor.c b/glamor/glamor.c
index 7d8228c..85fd560 100644
--- a/glamor/glamor.c
+++ b/glamor/glamor.c
@@ -123,6 +123,17 @@ glamor_set_screen_pixmap(PixmapPtr screen_pixmap,
PixmapPtr *back_pixmap)
glamor_priv->back_pixmap = back_pixmap;
}
+uint32_t
+glamor_get_pixmap_texture(PixmapPtr pixmap)
+{
+glamor_pixmap_private *pixmap_priv = glamor_get_pixmap_private(pixmap);
+
+if (pixmap_priv->type != GLAMOR_TEXTURE_ONLY)
+return 0;
+
+return pixmap_priv->base.fbo->tex;
+}
+
PixmapPtr
glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth,
unsigned int usage)
diff --git a/glamor/glamor.h b/glamor/glamor.h
index eec6872..08ffd26 100644
--- a/glamor/glamor.h
+++ b/glamor/glamor.h
@@ -124,6 +124,8 @@ extern _X_EXPORT Bool glamor_close_screen(ScreenPtr screen);
extern _X_EXPORT void glamor_set_screen_pixmap(PixmapPtr screen_pixmap,
PixmapPtr *back_pixmap);
+extern _X_EXPORT uint32_t glamor_get_pixmap_texture(PixmapPtr pixmap);
+
/* @glamor_glyphs_init: Initialize glyphs internal data structures.
*
* @pScreen: Current screen pointer.
diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am
index 6b790fd..040993c 100644
--- a/hw/kdrive/ephyr/Makefile.am
+++ b/hw/kdrive/ephyr/Makefile.am
@@ -27,12 +27,20 @@ AM_CPPFLAGS = \
@XEPHYR_INCS@ \
@XEPHYR_CFLAGS@ \
-I$(top_srcdir) \
+ -I$(top_srcdir)/glamor \
-I$(top_srcdir)/exa
if XV
XV_SRCS = ephyrvideo.c
endif
+if GLAMOR
+GLAMOR_SRCS = \
+ ephyr_glamor_glx.c \
+ ephyr_glamor_glx.h \
+ ()
+endif
+
if DRI
DRI_SRCS = \
ephyrdriext.c \
@@ -59,14 +67,24 @@ Xephyr_SOURCES = \
hostx.h \
$(XV_SRCS) \
$(DRI_SRCS) \
+ $(GLAMOR_SRCS) \
$()
+if GLAMOR
+AM_CPPFLAGS += $(XLIB_CFLAGS)
+XEPHYR_GLAMOR_LIB = \
+ $(top_builddir)/glamor/libglamor.la \
+ $(top_builddir)/glamor/libglamor_egl_stubs.la \
+ $()
+endif
+
Xephyr_LDADD = \
$(top_builddir)/exa/libexa.la \
+ $(XEPHYR_GLAMOR_LIB)\
@KDRIVE_LIBS@ \
@XEPHYR_LIBS@
-Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@
+Xephyr_DEPENDENCIES = @KDRIVE_LOCAL_LIBS@ $(XEPHYR_GLAMOR_LIB)
Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG)
diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c
index 9681273..75a6fcb 100644
--- a/hw/kdrive/ephyr/ephyr.c
+++ b/hw/kdrive/ephyr/ephyr.c
@@ -43,9 +43,15 @@
#include "ephyrglxext.h"
#endif /* XF86DRI */
+#ifdef GLAMOR
+#include "glamor.h"
+#endif
+#include "ephyr_glamor_glx.h"
+
#include "xkbsrv.h"
extern int KdTsPhyScreen;
+extern Bool ephyr_glamor;
KdKeyboardInfo *ephyrKbd;
KdPointerInfo *ephyrMouse;
@@ -326,15 +332,19 @@ ephyrInternalDamageRedisplay(ScreenPtr pScreen)
int nbox;
BoxPtr pbox;
-nbox = RegionNumRects(pRegion);
-pbox = RegionRects(pRegion);
-
-while (nbox--) {
-hostx_paint_rect(screen,
- pbox->x1, pbox->y1,
- pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
-pbox++;
+if (ephyr_glamor) {
+ephyr_glamor_damage_redisplay(scrpriv->glamor, pRegion);
+} else {
+nbox =