Commit 68c3c6eb authored by Zhigang Gong's avatar Zhigang Gong
Browse files

glamor-es2: Add gles2 option.



First commit to enable gles2 support. --enable-glamor-ddx
--enable-glamor-gles2 will set thwo MACROs GLAMOR_DDX and
GLAMOR_GLES2.

Currently, the gles2 support is still incomplete.
Signed-off-by: default avatarZhigang Gong <zhigang.gong@linux.intel.com>
parent 98f8ef5f
......@@ -17,6 +17,10 @@ if RECORD
RECORD_DIR=record
endif
if GLAMOR
GLAMOR_DIR=glamor
endif
SUBDIRS = \
doc \
man \
......@@ -38,7 +42,7 @@ SUBDIRS = \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
exa \
glamor \
$(GLAMOR_DIR) \
config \
hw \
test
......
......@@ -646,6 +646,8 @@ AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest serv
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
#AC_ARG_ENABLE(glamor, AS_HELP_STRING([--enable-glamor], [Build glamor server (default: no)]), [GLAMOR=$enableval], [GLAMOR=no])
AC_ARG_ENABLE(glamor-ddx, AS_HELP_STRING([--enable-glamor-ddx], [Build glamor ddx (default: no)]), [GLAMOR_DDX=$enableval], [GLAMOR_DDX=no])
dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
......@@ -655,6 +657,8 @@ dnl kdrive options
AC_ARG_ENABLE(kdrive-kbd, AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd driver for kdrive (default: auto)]), [KDRIVE_KBD=$enableval], [KDRIVE_KBD=auto])
AC_ARG_ENABLE(kdrive-mouse, AC_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto])
AC_ARG_ENABLE(kdrive-evdev, AC_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto])
dnl glamor options
AC_ARG_ENABLE(glamor-gles2, AS_HELP_STRING([--enable-glamor-gles2], [Build glamor based on gles2 (default: no)]), [GLAMOR_GLES2=$enableval], [GLAMOR_GLES2=no])
dnl chown/chmod to be setuid root as part of build
......@@ -1765,6 +1769,25 @@ AM_CONDITIONAL([SOLARIS_VT], [test "x$solaris_vt" = xyes])
AM_CONDITIONAL([DGA], [test "x$DGA" = xyes])
AM_CONDITIONAL([XF86VIDMODE], [test "x$XF86VIDMODE" = xyes])
dnl glamor
AM_CONDITIONAL([GLAMOR], [test "x$XEPHYR" = xyes || test "x$GLAMOR_DDX" = xyes])
GLAMOR=yes
if test "x$GLAMOR" = xyes; then
AC_DEFINE(GLAMOR,1,[Build Glamor])
if test "x$GLAMOR_GLES2" = xyes; then
AC_DEFINE(GLAMOR_GLES2,1,[Build glamor over GLES2])
else
AC_DEFINE(GLAMOR_GL,1,[Build glamor over GL])
fi
if test "x$GLAMOR_DDX" = xyes; then
AC_DEFINE(GLAMOR_DDX,1,[Enable glamor ddx driver])
fi
fi
dnl XWin DDX
AC_MSG_CHECKING([whether to build XWin DDX])
......
......@@ -29,10 +29,28 @@
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#include <xorg-config.h>
#endif
#include "glamor.h"
#ifdef GLAMOR_GLES2
#define GLEW_ES_ONLY 1
#define GL_BGRA GL_BGRA_EXT
#define GL_COLOR_INDEX 0x1900
#define GL_BITMAP 0x1A00
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
#endif
#include <GL/glew.h>
#ifdef RENDER
......
......@@ -27,12 +27,16 @@ if INT10MODULE
INT10_SUBDIR = int10
endif
SUBDIRS = common ddc i2c x86emu $(INT10_SUBDIR) fbdevhw glamor os-support parser \
if GLAMOR
GLAMOR_DIR=glamor
endif
SUBDIRS = common ddc i2c x86emu $(INT10_SUBDIR) fbdevhw $(GLAMOR_DIR) os-support parser \
ramdac shadowfb $(VBE_SUBDIR) $(VGAHW_SUBDIR) $(XAA_SUBDIR) \
loader dixmods exa modes \
$(DRI_SUBDIR) $(DRI2_SUBDIR) $(XF86UTILS_SUBDIR) doc man
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw glamor os-support \
DIST_SUBDIRS = common ddc i2c x86emu int10 fbdevhw $(GLAMOR_DIR) os-support \
parser ramdac shadowfb vbe vgahw xaa \
loader dixmods dri dri2 exa modes \
utils doc man
......
......@@ -1118,7 +1118,11 @@ videoPtrToDriverList(struct pci_device *dev,
} else if (dev->device_id == 0x8108) {
break; /* "hooray" for poulsbo */
} else {
#if GLAMOR_DDX
driverList[0] = "glamor";
#else
driverList[0] = "intel";
#endif
}
break;
case 0x102b: driverList[0] = "mga"; break;
......
......@@ -12,8 +12,11 @@ glamor_la_CFLAGS = \
-I$(top_srcdir)/glamor \
-I/usr/include/drm
glamor_la_LDFLAGS = \
-module -avoid-version -L$(libdir) -lEGL $(top_builddir)/glamor/libglamor.la -lGLEW
glamor_la_LDFLAGS = \
-module -avoid-version -L$(libdir) -lEGL \
$(top_builddir)/glamor/libglamor.la \
-L$(libdir)/../lib64 -lGLEW
glamor_ladir = $(moduledir)/drivers
glamor_la_SOURCES = \
glamor.c \
......
......@@ -38,7 +38,13 @@
#define GL_GLEXT_PROTOTYPES
#define EGL_EGLEXT_PROTOTYPES
#define EGL_DISPLAY_NO_X_MESA
#if GLAMOR_GLES2
#include <GLES2/gl2.h>
#else
#include <GL/gl.h>
#endif
#include <EGL/egl.h>
#include <EGL/eglext.h>
......@@ -322,7 +328,6 @@ glamor_screen_init_ddx(int scrnIndex, ScreenPtr screen, int argc, char **argv)
glamor->display = eglGetDRMDisplayMESA(glamor->fd);
eglBindAPI(EGL_OPENGL_API);
LogMessageVerb(X_INFO, 0, "%s glCreateProgramObjectARB=%p", __FUNCTION__, *(&glCreateProgramObjectARB));
if (!eglInitialize(glamor->display, &glamor->major, &glamor->minor)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"eglInitialize() failed\n");
......
......@@ -53,7 +53,17 @@
#define GL_GLEXT_PROTOTYPES
#define EGL_EGLEXT_PROTOTYPES
#define EGL_DISPLAY_NO_X_MESA
#if GLAMOR_GLES2
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#ifndef GL_BGRA
#define GL_BGRA GL_BGRA_EXT
#endif
#else
#include <GL/gl.h>
#endif
#include <EGL/egl.h>
#include <EGL/eglext.h>
......@@ -482,11 +492,15 @@ drmmode_load_cursor_argb (xf86CrtcPtr crtc, CARD32 *image)
GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, drmmode_crtc->cursor);
}
glPixelStorei(GL_UNPACK_ROW_LENGTH, 64);
glBindTexture(GL_TEXTURE_2D, drmmode_crtc->cursor_tex);
#if GLAMOR_GLES2
glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA, 64, 64, 0,
GL_BGRA, GL_UNSIGNED_BYTE, image);
#else
glPixelStorei(GL_UNPACK_ROW_LENGTH, 64);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 64, 0,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, image);
#endif
}
......
......@@ -139,4 +139,15 @@
/* Build with libdrm support */
#undef WITH_LIBDRM
/* Build GLAMOR */
#undef GLAMOR
/* Build GLAMOR over GLES2*/
#undef GLAMOR_GLES2
/* Build GLAMOR ddx*/
#undef GLAMOR_DDX
#endif /* _XORG_CONFIG_H_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment