From 1f8b2b348526d94e9bde4a285f331a4934c11078 Mon Sep 17 00:00:00 2001 From: Ilia Mirkin Date: Sat, 11 Jul 2015 17:08:52 -0400 Subject: glamor: remove If you want glamor, just use modesetting instead. It's hooked up incorrectly in nouveau, and there doesn't seem to be any point in fixing it when the modesetting driver does it all properly. Signed-off-by: Ilia Mirkin --- configure.ac | 11 --- man/nouveau.man | 3 +- src/Makefile.am | 2 - src/drmmode_display.c | 7 -- src/nouveau_glamor.c | 253 -------------------------------------------------- src/nouveau_glamor.h | 33 ------- src/nouveau_present.c | 29 +----- src/nouveau_wfb.c | 8 +- src/nouveau_xv.c | 4 - src/nv_driver.c | 16 ---- src/nv_type.h | 1 - 11 files changed, 3 insertions(+), 364 deletions(-) delete mode 100644 src/nouveau_glamor.c delete mode 100644 src/nouveau_glamor.h diff --git a/configure.ac b/configure.ac index 03563c1..9c77f94 100644 --- a/configure.ac +++ b/configure.ac @@ -140,17 +140,6 @@ if test "x$have_list_h" = xyes; then #include "list.h"]) fi -AC_CHECK_HEADERS([glamor.h],[found_glamor_header=yes],[found_glamor_header=no], - [#include "xorg-server.h"]) -AC_MSG_CHECKING([whether to include GLAMOR support]) -if test "x$found_glamor_header" = xyes && pkg-config --exists "xorg-server >= 1.15.99.901" -then - AC_DEFINE(HAVE_GLAMOR, 1, [Build support for glamor acceleration]) - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi - AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/man/nouveau.man b/man/nouveau.man index 3d5a428..64e4144 100644 --- a/man/nouveau.man +++ b/man/nouveau.man @@ -81,8 +81,7 @@ are supported: Enable or disable the HW cursor. Default: on. .TP .BI "Option \*qAccelMethod\*q \*q" string \*q -Specify the acceleration method. One of \*qnone\*q, \*qexa\*q, or -\*qglamor\*q. Default: exa, except for GMxxx which default to glamor. +Specify the acceleration method. One of \*qnone\*q, or \*qexa\*q. Default: exa. .TP .BI "Option \*qNoAccel\*q \*q" boolean \*q Disable or enable acceleration. Default: acceleration is enabled. diff --git a/src/Makefile.am b/src/Makefile.am index 9d39a00..1e04ddf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -35,7 +35,6 @@ nouveau_drv_la_SOURCES = \ nouveau_copy90b5.c \ nouveau_copya0b5.c \ nouveau_exa.c nouveau_xv.c nouveau_dri2.c \ - nouveau_glamor.c \ nouveau_present.c \ nouveau_sync.c \ nouveau_wfb.c \ @@ -123,7 +122,6 @@ EXTRA_DIST = hwdefs/nv_3ddefs.xml.h \ shader/Makefile \ nouveau_local.h \ nouveau_copy.h \ - nouveau_glamor.h \ nouveau_present.h \ nouveau_sync.h \ nv_const.h \ diff --git a/src/drmmode_display.c b/src/drmmode_display.c index cd13820..6495961 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -42,8 +42,6 @@ #include "libudev.h" #endif -#include "nouveau_glamor.h" - static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height); typedef struct { int fd; @@ -107,8 +105,6 @@ static inline struct nouveau_pixmap * drmmode_pixmap(PixmapPtr ppix) { NVPtr pNv = NVPTR(xf86ScreenToScrn(ppix->drawable.pScreen)); - if (pNv->AccelMethod == GLAMOR) - return nouveau_glamor_pixmap_get(ppix); return nouveau_pixmap(ppix); } @@ -1393,9 +1389,6 @@ drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) crtc->rotation, crtc->x, crtc->y); } - if (pNv->AccelMethod == GLAMOR) - nouveau_glamor_create_screen_resources(scrn->pScreen); - if (old_fb_id) drmModeRmFB(drmmode->fd, old_fb_id); nouveau_bo_ref(NULL, &old_bo); diff --git a/src/nouveau_glamor.c b/src/nouveau_glamor.c deleted file mode 100644 index a8e9206..0000000 --- a/src/nouveau_glamor.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2014 Red Hat Inc. - * - * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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: Ben Skeggs - */ - -#include "nouveau_glamor.h" -#ifdef HAVE_GLAMOR - -static DevPrivateKeyRec glamor_private; - -void -nouveau_glamor_pixmap_set(PixmapPtr pixmap, struct nouveau_pixmap *priv) -{ - dixSetPrivate(&pixmap->devPrivates, &glamor_private, priv); -} - -struct nouveau_pixmap * -nouveau_glamor_pixmap_get(PixmapPtr pixmap) -{ - return dixGetPrivate(&pixmap->devPrivates, &glamor_private); -} - -static Bool -nouveau_glamor_destroy_pixmap(PixmapPtr pixmap) -{ - struct nouveau_pixmap *priv = nouveau_glamor_pixmap_get(pixmap); - if (pixmap->refcnt == 1) { - glamor_egl_destroy_textured_pixmap(pixmap); - if (priv) - nouveau_bo_ref(NULL, &priv->bo); - } - fbDestroyPixmap(pixmap); - return TRUE; -} - -static PixmapPtr -nouveau_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, - unsigned usage) -{ - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - struct nouveau_pixmap *priv; - PixmapPtr pixmap; - int pitch; - - if (usage != CREATE_PIXMAP_USAGE_SHARED) - return glamor_create_pixmap(screen, w, h, depth, usage); - if (depth == 1) - return fbCreatePixmap(screen, w, h, depth, usage); - if (w > 32767 || h > 32767) - return NullPixmap; - - pixmap = fbCreatePixmap(screen, 0, 0, depth, usage); - if (pixmap == NullPixmap || !w || !h) - return pixmap; - - priv = calloc(1, sizeof(*priv)); - if (!priv) - goto fail_priv; - - if (!nouveau_allocate_surface(scrn, w, h, - pixmap->drawable.bitsPerPixel, - usage, &pitch, &priv->bo)) - goto fail_bo; - - nouveau_glamor_pixmap_set(pixmap, priv); - screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, pitch, NULL); - - if (!glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle, - pixmap->devKind)) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, - "[GLAMOR] failed to create textured PRIME pixmap."); - return pixmap; - } - - return pixmap; -fail_bo: - free(priv); -fail_priv: - fbDestroyPixmap(pixmap); - return fbCreatePixmap(screen, w, h, depth, usage); -} - -static Bool -nouveau_glamor_share_pixmap_backing(PixmapPtr pixmap, ScreenPtr slave, - void **phandle) -{ - struct nouveau_pixmap *priv = nouveau_glamor_pixmap_get(pixmap); - int ret, handle; - - ret = nouveau_bo_set_prime(priv->bo, &handle); - if (ret) - return FALSE; - - priv->shared = TRUE; - *phandle = (void *)(long)handle; - return TRUE; -} - -static Bool -nouveau_glamor_set_shared_pixmap_backing(PixmapPtr pixmap, void *_handle) -{ - struct nouveau_pixmap *priv = nouveau_glamor_pixmap_get(pixmap); - ScreenPtr screen = pixmap->drawable.pScreen; - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - NVPtr pNv = NVPTR(scrn); - struct nouveau_bo *bo; - int ret, handle = (int)(long)_handle; - - ret = nouveau_bo_prime_handle_ref(pNv->dev, handle, &bo); - if (ret) - return FALSE; - - if (!priv) { - priv = calloc(1, sizeof(*priv)); - if (!priv) - return FALSE; - nouveau_glamor_pixmap_set(pixmap, priv); - } - - priv->bo = bo; - priv->shared = TRUE; - close(handle); - - if (!glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle, - pixmap->devKind)) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "[GLAMOR] failed to get PRIME drawable\n"); - return FALSE; - } - - return TRUE; -} - -static void -nouveau_glamor_flush(ScrnInfoPtr pScrn) -{ - glamor_block_handler(pScrn->pScreen); -} - -Bool -nouveau_glamor_create_screen_resources(ScreenPtr screen) -{ - PixmapPtr ppix = screen->GetScreenPixmap(screen); - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - NVPtr pNv = NVPTR(scrn); - - if (!glamor_glyphs_init(screen)) - return FALSE; - - if (!glamor_egl_create_textured_screen_ext(screen, - pNv->scanout->handle, - scrn->displayWidth * - scrn->bitsPerPixel / 8, - NULL)) - return FALSE; - - if (!nouveau_glamor_pixmap_get(ppix)) { - struct nouveau_pixmap *priv = calloc(1, sizeof(*priv)); - if (priv) { - nouveau_bo_ref(pNv->scanout, &priv->bo); - nouveau_glamor_pixmap_set(ppix, priv); - } - } - - return TRUE; -} - -Bool -nouveau_glamor_pre_init(ScrnInfoPtr scrn) -{ - NVPtr pNv = NVPTR(scrn); - pointer glamor_module; - - if (scrn->depth < 24) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "[GLAMOR] requires depth >= 24\n"); - return FALSE; - } - - if ((glamor_module = xf86LoadSubModule(scrn, GLAMOR_EGL_MODULE_NAME))) { - if (!glamor_egl_init(scrn, pNv->dev->fd)) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "[GLAMOR] failed to initialise EGL\n"); - return FALSE; - } - } else { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, "[GLAMOR] unavailable\n"); - return FALSE; - } - - xf86DrvMsg(scrn->scrnIndex, X_INFO, "[GLAMOR] EGL initialised\n"); - return TRUE; -} - -Bool -nouveau_glamor_init(ScreenPtr screen) -{ - ScrnInfoPtr scrn = xf86ScreenToScrn(screen); - NVPtr pNv = NVPTR(scrn); - - if (!glamor_init(screen, GLAMOR_INVERTED_Y_AXIS | - GLAMOR_USE_EGL_SCREEN | - GLAMOR_USE_SCREEN | - GLAMOR_USE_PICTURE_SCREEN)) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "[GLAMOR] failed to initialise\n"); - return FALSE; - } - - if (!glamor_egl_init_textured_pixmap(screen)) { - xf86DrvMsg(scrn->scrnIndex, X_ERROR, - "[GLAMOR] failed to initialize screen pixmap\n"); - return FALSE; - } - - if (!dixRegisterPrivateKey(&glamor_private, PRIVATE_PIXMAP, 0)) - return FALSE; - - screen->CreatePixmap = nouveau_glamor_create_pixmap; - screen->DestroyPixmap = nouveau_glamor_destroy_pixmap; - screen->SharePixmapBacking = nouveau_glamor_share_pixmap_backing; - screen->SetSharedPixmapBacking = nouveau_glamor_set_shared_pixmap_backing; - - xf86DrvMsg(scrn->scrnIndex, X_INFO, "[GLAMOR] initialised with DRI3\n"); - pNv->Flush = nouveau_glamor_flush; - return TRUE; -} - -XF86VideoAdaptorPtr -nouveau_glamor_xv_init(ScreenPtr pScreen, int num_adapt) -{ - return glamor_xv_init(pScreen, num_adapt); -} -#endif diff --git a/src/nouveau_glamor.h b/src/nouveau_glamor.h deleted file mode 100644 index fb6565d..0000000 --- a/src/nouveau_glamor.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __NOUVEAU_GLAMOR_H__ -#define __NOUVEAU_GLAMOR_H__ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "xf86xv.h" - -#ifdef HAVE_GLAMOR -#include "nv_include.h" -#define GLAMOR_FOR_XORG 1 -#include "glamor.h" - -Bool nouveau_glamor_pre_init(ScrnInfoPtr scrn); -Bool nouveau_glamor_init(ScreenPtr screen); -Bool nouveau_glamor_create_screen_resources(ScreenPtr screen); -XF86VideoAdaptorPtr nouveau_glamor_xv_init(ScreenPtr pScreen, int num_adapt); -void nouveau_glamor_pixmap_set(PixmapPtr pixmap, struct nouveau_pixmap *priv); -struct nouveau_pixmap *nouveau_glamor_pixmap_get(PixmapPtr pixmap); -#else -static inline Bool nouveau_glamor_pre_init(ScrnInfoPtr scrn) { return FALSE; } -static inline Bool nouveau_glamor_init(ScreenPtr screen) { return FALSE; } -static inline Bool -nouveau_glamor_create_screen_resources(ScreenPtr screen) { return FALSE; } -static inline void -nouveau_glamor_pixmap_set(PixmapPtr pixmap, void *priv) { } -static inline struct nouveau_pixmap * -nouveau_glamor_pixmap_get(PixmapPtr pixmap) { return NULL; } -static inline XF86VideoAdaptorPtr -nouveau_glamor_xv_init(ScreenPtr pScreen, int num_adapt) { return NULL; } -#endif - -#endif diff --git a/src/nouveau_present.c b/src/nouveau_present.c index 699a58d..482ac6e 100644 --- a/src/nouveau_present.c +++ b/src/nouveau_present.c @@ -25,7 +25,6 @@ #include "nouveau_present.h" #if defined(DRI3) #include "nv_include.h" -#include "nouveau_glamor.h" #include "xf86drmMode.h" struct nouveau_present { @@ -177,38 +176,12 @@ static Bool nouveau_present_flip_exec(ScrnInfoPtr scrn, uint64_t event_id, int sync, uint64_t target_msc, PixmapPtr pixmap, Bool vsync) { - ScreenPtr screen = scrn->pScreen; - struct nouveau_pixmap *priv = NULL; + struct nouveau_pixmap *priv = nouveau_pixmap(pixmap); NVPtr pNv = NVPTR(scrn); uint32_t next_fb; - CARD16 stride; - CARD32 size; void *token; int ret; -#ifdef HAVE_GLAMOR - if (pNv->AccelMethod == GLAMOR && - !(priv = nouveau_glamor_pixmap_get(pixmap))) { - int fd = glamor_fd_from_pixmap(screen, pixmap, &stride, &size); - if (fd < 0) - return FALSE; - - priv = calloc(1, sizeof(*priv)); - if (!priv) - return FALSE; - - ret = nouveau_bo_prime_handle_ref(pNv->dev, fd, &priv->bo); - if (ret) { - free(priv); - return FALSE; - } - - nouveau_glamor_pixmap_set(pixmap, priv); - } else -#endif - if (!priv) - priv = nouveau_pixmap(pixmap); - ret = drmModeAddFB(pNv->dev->fd, pixmap->drawable.width, pixmap->drawable.height, pixmap->drawable.depth, pixmap->drawable.bitsPerPixel, pixmap->devKind, diff --git a/src/nouveau_wfb.c b/src/nouveau_wfb.c index 10f0f27..a52f2fd 100644 --- a/src/nouveau_wfb.c +++ b/src/nouveau_wfb.c @@ -26,7 +26,6 @@ */ #include "nv_include.h" -#include "nouveau_glamor.h" struct wfb_pixmap { PixmapPtr ppix; @@ -136,12 +135,7 @@ nouveau_wfb_setup_wrap(ReadMemoryProcPtr *pRead, WriteMemoryProcPtr *pWrite, ppix = NVGetDrawablePixmap(pDraw); if (ppix) { - NVPtr pNv = NVPTR(xf86ScreenToScrn(pDraw->pScreen)); - struct nouveau_pixmap *priv; - if (pNv->AccelMethod == GLAMOR) - priv = nouveau_glamor_pixmap_get(ppix); - else - priv = nouveau_pixmap(ppix); + struct nouveau_pixmap *priv = nouveau_pixmap(ppix); bo = priv ? priv->bo : NULL; } diff --git a/src/nouveau_xv.c b/src/nouveau_xv.c index a479d38..a82ef2c 100644 --- a/src/nouveau_xv.c +++ b/src/nouveau_xv.c @@ -38,7 +38,6 @@ #include "nv_include.h" #include "nv_dma.h" -#include "nouveau_glamor.h" #include "vl_hwmc.h" @@ -2182,9 +2181,6 @@ NVInitVideo(ScreenPtr pScreen) } NVSetupTexturedVideo(pScreen, textureAdaptor); - } else - if (pNv->AccelMethod == GLAMOR) { - blitAdaptor = nouveau_glamor_xv_init(pScreen, 16); } num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); diff --git a/src/nv_driver.c b/src/nv_driver.c index 514a8bc..ab7e127 100644 --- a/src/nv_driver.c +++ b/src/nv_driver.c @@ -34,7 +34,6 @@ #endif #include "nouveau_copy.h" -#include "nouveau_glamor.h" #include "nouveau_present.h" #include "nouveau_sync.h" @@ -625,9 +624,6 @@ NVCreateScreenResources(ScreenPtr pScreen) if (pNv->AccelMethod == EXA) { PixmapPtr ppix = pScreen->GetScreenPixmap(pScreen); nouveau_bo_ref(pNv->scanout, &nouveau_pixmap(ppix)->bo); - } else - if (pNv->AccelMethod == GLAMOR) { - nouveau_glamor_create_screen_resources(pScreen); } return TRUE; @@ -1049,9 +1045,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) if (string) { if (!strcmp(string, "none")) pNv->AccelMethod = NONE; else if (!strcmp(string, "exa")) pNv->AccelMethod = EXA; -#ifdef HAVE_GLAMOR - else if (!strcmp(string, "glamor")) pNv->AccelMethod = GLAMOR; -#endif else { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Invalid AccelMethod specified\n"); @@ -1087,11 +1080,6 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) pNv->tiled_scanout = TRUE; } - if (pNv->AccelMethod == GLAMOR) { - if (!nouveau_glamor_pre_init(pScrn)) - pNv->AccelMethod = EXA; - } - pNv->ce_enabled = xf86ReturnOptValBool(pNv->Options, OPTION_ASYNC_COPY, FALSE); @@ -1502,10 +1490,6 @@ NVScreenInit(SCREEN_INIT_ARGS_DECL) nouveau_sync_init(pScreen); nouveau_dri2_init(pScreen); - if (pNv->AccelMethod == GLAMOR) { - if (!nouveau_glamor_init(pScreen)) - return FALSE; - } else if (pNv->AccelMethod == EXA) { if (pNv->max_dri_level >= 3 && !nouveau_dri3_screen_init(pScreen)) diff --git a/src/nv_type.h b/src/nv_type.h index 510a30c..d903e75 100644 --- a/src/nv_type.h +++ b/src/nv_type.h @@ -53,7 +53,6 @@ typedef struct _NVRec { UNKNOWN = 0, NONE, EXA, - GLAMOR, } AccelMethod; void (*Flush)(ScrnInfoPtr); -- cgit v1.2.3