Re: [PATCH 1/6] xephyr: Build support for rendering with glamor using a -glamor option.

2014-03-07 Thread Jon TURNEY
On 25/02/2014 01:47, Eric Anholt wrote:
 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 e...@anholt.net
 Reviewed-by: Keith Packard kei...@keithp.com (v1)

It seems this needs some more #ifdef GLAMOR/#endif guards to compile
successfully when ./configured --disable-glamor

See http://tinderbox.x.org/builds/2014-03-07-0004/logs/xserver/#build

Patch attached.

From 2f16a186a27ca9a88b72337ffacb86c8afb33803 Mon Sep 17 00:00:00 2001
From: Jon TURNEY jon.tur...@dronecode.org.uk
Date: Fri, 7 Mar 2014 14:53:07 +
Subject: [PATCH] Fix xephyr build in --disable-glamor case

Fix xephyr build in --disable-glamor case, after commit
9fe052d90cca90fdf750d3a45b151be2ac7f0ebd xephyr: Build support for rendering
with glamor using a -glamor option.

See http://tinderbox.x.org/builds/2014-03-07-0004/logs/xserver/#build

Signed-off-by: Jon TURNEY jon.tur...@dronecode.org.uk
---
 hw/kdrive/ephyr/hostx.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 19c2ed2..859beca 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -309,9 +309,11 @@ hostx_init(void)
 | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
 
 EPHYR_DBG(mark);
+#ifdef GLAMOR
 if (ephyr_glamor)
 HostX.conn = ephyr_glamor_connect();
 else
+#endif
 HostX.conn = xcb_connect(NULL, HostX.screen);
 if (xcb_connection_has_error(HostX.conn)) {
 fprintf(stderr, \nXephyr cannot open host display. Is DISPLAY 
set?\n);
@@ -322,11 +324,12 @@ hostx_init(void)
 HostX.winroot = xscreen-root;
 HostX.gc = xcb_generate_id(HostX.conn);
 HostX.depth = xscreen-root_depth;
-if (ephyr_glamor) {
+#ifdef GLAMOR
+if (ephyr_glamor)
 HostX.visual = ephyr_glamor_get_visual();
-} else {
+else
+#endif
 HostX.visual = xcb_aux_find_visual_by_id(xscreen,xscreen-root_visual);
-}
 
 xcb_create_gc(HostX.conn, HostX.gc, HostX.winroot, 0, NULL);
 cookie_WINDOW_STATE = xcb_intern_atom(HostX.conn, FALSE,
@@ -760,6 +763,7 @@ hostx_paint_rect(KdScreenInfo *screen,
 
 EPHYR_DBG(painting in screen %d\n, scrpriv-mynum);
 
+#ifdef GLAMOR
 if (ephyr_glamor) {
 BoxRec box;
 RegionRec region;
@@ -774,6 +778,7 @@ hostx_paint_rect(KdScreenInfo *screen,
 RegionUninit(region);
 return;
 }
+#endif
 
 /*
  *  Copy the image data updated by the shadow layer
-- 
1.8.3.4

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 1/6] xephyr: Build support for rendering with glamor using a -glamor option.

2014-03-07 Thread Eric Anholt
Jon TURNEY jon.tur...@dronecode.org.uk writes:

 On 25/02/2014 01:47, Eric Anholt wrote:
 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 e...@anholt.net
 Reviewed-by: Keith Packard kei...@keithp.com (v1)

 It seems this needs some more #ifdef GLAMOR/#endif guards to compile
 successfully when ./configured --disable-glamor

 See http://tinderbox.x.org/builds/2014-03-07-0004/logs/xserver/#build

Sent out a pull request for the reviewed change.

The ifdeffing is kind of ugly, but I'm already guilty of a bunch of that
in this code.  I like the idea of static inline stubs for compiled-out
code, but it's only partially done in ephyr_glamor_glx.h so far.  We can
leave that as a cleanup for later.

It would be nice to have a cleaner version of the static inline thing
than what I've done currently.  Not sure if preprocessor macros could be
used to make doing that more sane, or less.


pgp3Vr_8NY66t.pgp
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH 1/6] xephyr: Build support for rendering with glamor using a -glamor option.

2014-02-24 Thread Eric Anholt
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 e...@anholt.net
Reviewed-by: Keith Packard kei...@keithp.com (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 =