src/Makefile.am | 1 src/via_driver.c | 26 +++++++++---- src/via_glamor.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 8 deletions(-)
New commits: commit cd6dce5994d1be8961c5ffa61381ec4ad8f11fe8 Author: James Simmons <[email protected]> Date: Sat Jan 17 18:24:21 2015 -0700 Added in bring up of the glamor xorg module. Next step is to get Gallium to get past this step Signed-off-by: James Simmons <[email protected]> diff --git a/src/Makefile.am b/src/Makefile.am index 73c883c..22185c9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -91,6 +91,7 @@ openchrome_drv_la_SOURCES += \ if GLAMOR AM_CFLAGS += @LIBGLAMOR_CFLAGS@ openchrome_drv_la_LDFLAGS += @LIBGLAMOR_LIBS@ +openchrome_drv_la_SOURCES += via_glamor.c endif else diff --git a/src/via_driver.c b/src/via_driver.c index 2fd8f21..31ffec2 100644 --- a/src/via_driver.c +++ b/src/via_driver.c @@ -1279,8 +1279,10 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags) } /* Disable EXA for KMS case */ - if (pVia->KMS) + if (pVia->KMS) { pVia->NoAccel = TRUE; + pVia->useEXA = FALSE; + } xf86DrvMsg(pScrn->scrnIndex, from, "Hardware acceleration is %s.\n", !pVia->NoAccel ? "enabled" : "disabled"); @@ -1612,6 +1614,21 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } + if (pVia->shadowFB) { + if (!xf86LoadSubModule(pScrn, "shadow")) { + VIAFreeRec(pScrn); + return FALSE; + } + } + +#ifdef USE_GLAMOR + if (!via_glamor_pre_init(pScrn)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to pre init glamor display.\n"); + return FALSE; + } +#endif + if (!pVia->NoAccel) { XF86ModReqInfo req; int errmaj, errmin; @@ -1626,13 +1643,6 @@ VIAPreInit(ScrnInfoPtr pScrn, int flags) return FALSE; } } - - if (pVia->shadowFB) { - if (!xf86LoadSubModule(pScrn, "shadow")) { - VIAFreeRec(pScrn); - return FALSE; - } - } return TRUE; } diff --git a/src/via_glamor.c b/src/via_glamor.c new file mode 100644 index 0000000..c949313 --- /dev/null +++ b/src/via_glamor.c @@ -0,0 +1,109 @@ +/* + * Copyright C 2013 The Openchrome Project [openchrome.org] + * + * 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: + * James Simmons <[email protected]> + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <xf86.h> +#define GLAMOR_FOR_XORG 1 +#include <glamor.h> +#include "via_driver.h" + +#if HAS_DEVPRIVATEKEYREC +DevPrivateKeyRec glamor_pixmap_index; +#else +int glamor_pixmap_index; +#endif + +Bool +via_glamor_pre_init(ScrnInfoPtr pScrn) +{ + VIAPtr pVia = VIAPTR(pScrn); + pointer glamor_module; + CARD32 version; + + if (!xf86LoaderCheckSymbol("glamor_egl_init")) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "glamor requires Load \"glamoregl\" in " + "Section \"Module\", disabling.\n"); + return FALSE; + } + + /* Load glamor module */ + if ((glamor_module = xf86LoadSubModule(pScrn, GLAMOR_EGL_MODULE_NAME))) { + version = xf86GetModuleVersion(glamor_module); + if (version < MODULE_VERSION_NUMERIC(0,3,1)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Incompatible glamor version, required >= 0.3.0.\n"); + } else { + if (glamor_egl_init(pScrn, pVia->drmmode.fd)) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "glamor detected, initialising egl layer.\n"); + return TRUE; + } else + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "glamor detected, failed to initialize egl.\n"); + } + } else + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "glamor not available\n"); + + return FALSE; +} + +Bool +via_glamor_init(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); + + if (!glamor_init(pScreen, GLAMOR_INVERTED_Y_AXIS | GLAMOR_USE_EGL_SCREEN | + GLAMOR_USE_SCREEN | GLAMOR_USE_PICTURE_SCREEN)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to initialize glamor.\n"); + return FALSE; + } + + if (!glamor_egl_init_textured_pixmap(pScreen)) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Failed to initialize textured pixmap of screen for glamor.\n"); + return FALSE; + } + +#if HAS_DIXREGISTERPRIVATEKEY + if (!dixRegisterPrivateKey(&glamor_pixmap_index, PRIVATE_PIXMAP, 0)) +#else + if (!dixRequestPrivate(&glamor_pixmap_index, 0)) +#endif + return FALSE; + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Use GLAMOR acceleration.\n"); + return TRUE; +} _______________________________________________ Openchrome-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/openchrome-devel
