Re: [Intel-gfx] [PATCH 1/3] glamor: Initial commit to introduce glamor acceleration.

2011-11-11 Thread Eugeni Dodonov
On Fri, Nov 11, 2011 at 06:31, Zhigang Gong wrote:

> Added one configuration option --enable-glamor to control
> whether use glamor. Added one new file intel_glamor.c to
> wrap glamor egl API for intel driver's usage.
> This commit doesn't really change the driver's control path.
> It just adds necessary files for glamor and change some
> configuration.
>

For the series, I've reviewed the patches and they seem OK for me. I also
like the idea of having Glamor available in main ddx branch, for easier
testing.

So:
Reviewed-by: Eugeni Dodonov 

(However, I think Chris will have more comments, he is The Master of the
DDX).

-- 
Eugeni Dodonov

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/3] glamor: Initial commit to introduce glamor acceleration.

2011-11-11 Thread Zhigang Gong
Added one configuration option --enable-glamor to control
whether use glamor. Added one new file intel_glamor.c to
wrap glamor egl API for intel driver's usage.
This commit doesn't really change the driver's control path.
It just adds necessary files for glamor and change some
configuration.

Signed-off-by: Zhigang Gong 
---
 configure.ac   |   17 +++
 src/Makefile.am|5 ++
 src/intel_glamor.c |  130 
 src/intel_glamor.h |   45 ++
 4 files changed, 197 insertions(+), 0 deletions(-)
 create mode 100644 src/intel_glamor.c
 create mode 100644 src/intel_glamor.h

diff --git a/configure.ac b/configure.ac
index fccab56..dc01c46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,6 +126,15 @@ AC_ARG_ENABLE(sna,
  [SNA="$enableval"],
  [SNA=no])
 AM_CONDITIONAL(SNA, test x$SNA != xno)
+
+AC_ARG_ENABLE(glamor,
+ AS_HELP_STRING([--enable-glamor],
+[Enable glamor, a new GL-based acceleration 
[default=no]]),
+ [GLAMOR="$enableval"],
+ [GLAMOR=no])
+
+AM_CONDITIONAL(GLAMOR, test x$GLAMOR != xno)
+
 AC_MSG_CHECKING([whether to include SNA support])
 
 required_xorg_xserver_version=1.6
@@ -137,6 +146,14 @@ if test "x$SNA" != "xno"; then
 fi
 AC_MSG_RESULT([$SNA])
 
+if test "x$GLAMOR" != "xno"; then
+   PKG_CHECK_MODULES(LIBGLAMOR, [glamor])
+   PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
+   AC_DEFINE(GLAMOR, 1, [Enable glamor acceleration])
+fi
+
+AC_MSG_CHECKING([whether to include GLAMOR support])
+AC_MSG_RESULT([$GLAMOR])
 
 AC_ARG_ENABLE(vmap,
  AS_HELP_STRING([--enable-vmap],
diff --git a/src/Makefile.am b/src/Makefile.am
index cd1bb36..1a29390 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,6 +40,10 @@ SUBDIRS += sna
 intel_drv_la_LIBADD += sna/libsna.la
 endif
 
+if GLAMOR
+GLAMOR_SOURCE = intel_glamor.c
+endif
+
 NULL:=#
 
 intel_drv_la_SOURCES = \
@@ -70,6 +74,7 @@ intel_drv_la_SOURCES = \
 i965_3d.c \
 i965_video.c \
 i965_render.c \
+$(GLAMOR_SOURCE) \
 $(NULL)
 
 if DRI
diff --git a/src/intel_glamor.c b/src/intel_glamor.c
new file mode 100644
index 000..cadfc71
--- /dev/null
+++ b/src/intel_glamor.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright © 2011 Intel Corporation.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including
+ * the next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *Zhigang Gong 
+ *
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include 
+#endif
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define GLAMOR_FOR_XORG  1
+
+#include 
+#include "intel.h"
+#include "intel_glamor.h"
+
+Bool
+intel_glamor_create_screen_resources(ScreenPtr screen)
+{
+   ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+   intel_screen_private *intel = intel_get_screen_private(scrn);
+
+   if (!glamor_glyphs_init(screen))
+   return FALSE;
+   if (!glamor_egl_create_textured_screen(screen,
+  intel->front_buffer->handle,
+  intel->front_pitch))
+   return FALSE;
+   return TRUE;
+}
+
+Bool
+intel_glamor_pre_init(ScrnInfoPtr scrn)
+{
+   intel_screen_private *intel;
+   intel = intel_get_screen_private(scrn);
+   return glamor_egl_init(scrn, intel->drmSubFD);
+}
+
+Bool
+intel_glamor_create_textured_pixmap(PixmapPtr pixmap)
+{
+   struct intel_pixmap *priv;
+   priv = intel_get_pixmap_private(pixmap);
+   return glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
+priv->stride);
+}
+
+void
+intel_glamor_destroy_pixmap(PixmapPtr pixmap)
+{
+   glamor_egl_destroy_textured_pixmap(pixmap);
+}
+
+Bool
+intel_glamor_init(ScreenPtr screen)
+{
+   ScrnInfoPtr scrn = xf86Screens[screen->myNum];
+
+   if (!glamor_init(screen, GLAMOR_INVERTED_Y