Remove defunct glamor support

It never was a stable or complete replacement, and now it is
incorporated in Xorg itself!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-11-05 11:56:20 +00:00
parent 4281bbdd5b
commit 0aa2edbd29
20 changed files with 9 additions and 1121 deletions

View File

@ -427,31 +427,6 @@ fi
PKG_CHECK_MODULES(XORG, [xorg-server >= $required_xorg_server_version xproto fontsproto pixman-1 >= $required_pixman_version $REQUIRED_MODULES])
ABI_VERSION=`$PKG_CONFIG --variable=abi_videodrv xorg-server`
AC_ARG_ENABLE(glamor,
AS_HELP_STRING([--enable-glamor],
[Enable glamor, a new GL-based acceleration [default=no]]),
[GLAMOR="$enableval"],
[GLAMOR="no"])
if test "x$GLAMOR" != "xno"; then
if test "x$UXA" != "xyes"; then
AC_MSG_ERROR([Glamor acceleration requested but UXA is not enabled])
fi
if pkg-config --exists "xorg-server >= 1.15.99.901"; then
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$XORG_CFLAGS"
AC_CHECK_HEADER([glamor.h],
[GLAMOR="yes (using Xorg glamor module)"],
[test "x$GLAMOR" != "xauto" && AC_MSG_ERROR("failed to find required Xorg headers for glamor")
GLAMOR="no"], [#include <xorg-server.h>])
CPPFLAGS=$save_CPPFLAGS
else
PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.6.0])
PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl])
GLAMOR="yes (using libglamor)"
fi
AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration])
fi
if test "x$ONLY_UMS" = "xyes"; then
UMS="yes"
KMS="no"
@ -651,10 +626,6 @@ AC_MSG_CHECKING([whether to include UXA support])
AC_MSG_RESULT([$UXA])
AM_CONDITIONAL(UXA, test "x$UXA" != "xno")
AC_MSG_CHECKING([whether to include GLAMOR support])
AC_MSG_RESULT([$GLAMOR])
AM_CONDITIONAL(GLAMOR, test "x$GLAMOR" != "xno")
AC_MSG_CHECKING([whether to include SNA support])
AM_CONDITIONAL(SNA, test "x$SNA" != "xno")
AC_MSG_RESULT([$SNA])
@ -675,7 +646,7 @@ fi
AC_ARG_WITH(default-accel,
AS_HELP_STRING([--with-default-accel],
[Select the default acceleration method out of glamor, none, sna, or uxa [default is sna if enabled, otherwise uxa]]),
[Select the default acceleration method out of none, sna, or uxa [default is sna if enabled, otherwise uxa]]),
[accel="$withval"],
[accel="auto"])
if test "x$accel" = "xyes"; then
@ -716,15 +687,6 @@ if test "x$accel" = "xuxa"; then
fi
fi
if test "x$accel" = "xglamor"; then
if test "x$GLAMOR" != "xno"; then
AC_DEFINE(DEFAULT_ACCEL_METHOD, GLAMOR, [Default acceleration method])
have_accel="yes"
else
AC_MSG_ERROR([glamor acceleration requested as default, but is not enabled])
fi
fi
if test "x$have_accel" = "xnone"; then
if test "x$KMS" = "xyes"; then
if test "x$SNA" != "xno" -o "x$UXA" != "xno"; then
@ -922,13 +884,6 @@ if test "x$UXA" != "xno"; then
accel_msg="$accel_msg uxa"
fi
fi
if test "x$GLAMOR" != "xno"; then
if test "$accel" = "glamor"; then
accel_msg="$accel_msg *glamor"
else
accel_msg="$accel_msg glamor"
fi
fi
if test "x$dri_msg" = "x"; then
dri_msg=" none"

View File

@ -137,7 +137,7 @@ void intel_put_device(struct intel_device *dev);
void intel_detect_chipset(ScrnInfoPtr scrn, struct intel_device *dev);
#define IS_DEFAULT_ACCEL_METHOD(x) ({ \
enum { NOACCEL, SNA, UXA, GLAMOR } default_accel_method__ = DEFAULT_ACCEL_METHOD; \
enum { NOACCEL, SNA, UXA } default_accel_method__ = DEFAULT_ACCEL_METHOD; \
default_accel_method__ == x; \
})

View File

@ -500,7 +500,7 @@ _xf86findDriver(const char *ident, XF86ConfDevicePtr p)
return NULL;
}
static enum accel_method { NOACCEL, SNA, UXA, GLAMOR } get_accel_method(void)
static enum accel_method { NOACCEL, SNA, UXA } get_accel_method(void)
{
enum accel_method accel_method = DEFAULT_ACCEL_METHOD;
XF86ConfDevicePtr dev;
@ -520,8 +520,6 @@ static enum accel_method { NOACCEL, SNA, UXA, GLAMOR } get_accel_method(void)
accel_method = SNA;
else if (strcasecmp(s, "uxa") == 0)
accel_method = UXA;
else if (strcasecmp(s, "glamor") == 0)
accel_method = GLAMOR;
}
}
@ -583,7 +581,6 @@ intel_scrn_create(DriverPtr driver,
#if !USE_SNA
case NOACCEL:
#endif
case GLAMOR:
case UXA:
return intel_init_scrn(scrn);
#endif

View File

@ -34,7 +34,6 @@ libuxa_la_SOURCES = \
intel_batchbuffer.h \
intel_display.c \
intel_driver.c \
intel_glamor.h \
intel_memory.c \
intel_uxa.c \
intel_video.c \
@ -58,21 +57,12 @@ libuxa_la_SOURCES = \
uxa.c \
uxa.h \
uxa-accel.c \
uxa-glamor.h \
uxa-glyphs.c \
uxa-render.c \
uxa-priv.h \
uxa-unaccel.c
$(NULL)
if GLAMOR
AM_CFLAGS += $(LIBGLAMOR_CFLAGS)
libuxa_la_LIBADD += $(LIBGLAMOR_LIBS)
libuxa_la_SOURCES += \
intel_glamor.c \
$(NULL)
endif
if DRI2
AM_CFLAGS += $(DRI2_CFLAGS)
libuxa_la_SOURCES += \

View File

@ -60,8 +60,6 @@
#include "intel_uxa.h"
#endif
#include "intel_glamor.h"
#define KNOWN_MODE_FLAGS ((1<<14)-1)
struct intel_drm_queue {

View File

@ -69,7 +69,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#if USE_UXA
#include "intel_uxa.h"
#endif
#include "intel_glamor.h"
typedef struct {
int refcnt;
@ -109,58 +108,6 @@ static PixmapPtr get_front_buffer(DrawablePtr drawable)
return pixmap;
}
static PixmapPtr fixup_glamor(DrawablePtr drawable, PixmapPtr pixmap)
{
ScreenPtr screen = drawable->pScreen;
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
PixmapPtr old = get_drawable_pixmap(drawable);
struct intel_uxa_pixmap *priv = intel_uxa_get_pixmap_private(pixmap);
GCPtr gc;
/* With a glamor pixmap, 2D pixmaps are created in texture
* and without a static BO attached to it. To support DRI,
* we need to create a new textured-drm pixmap and
* need to copy the original content to this new textured-drm
* pixmap, and then convert the old pixmap to a coherent
* textured-drm pixmap which has a valid BO attached to it
* and also has a valid texture, thus both glamor and DRI2
* can access it.
*
*/
/* Copy the current contents of the pixmap to the bo. */
gc = GetScratchGC(drawable->depth, screen);
if (gc) {
ValidateGC(&pixmap->drawable, gc);
gc->ops->CopyArea(drawable, &pixmap->drawable,
gc,
0, 0,
drawable->width,
drawable->height,
0, 0);
FreeScratchGC(gc);
}
intel_uxa_set_pixmap_private(pixmap, NULL);
/* Exchange the underlying texture/image. */
intel_glamor_exchange_buffers(intel, old, pixmap);
/* And redirect the pixmap to the new bo (for 3D). */
intel_uxa_set_pixmap_private(old, priv);
old->refcnt++;
screen->ModifyPixmapHeader(old,
drawable->width,
drawable->height,
0, 0,
intel_pixmap_pitch(pixmap),
NULL);
screen->DestroyPixmap(pixmap);
intel_get_screen_private(xf86ScreenToScrn(screen))->needs_flush = TRUE;
return old;
}
#if DRI2INFOREC_VERSION < 2
static DRI2BufferPtr
I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
@ -172,7 +119,6 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
DRI2BufferPtr buffers;
I830DRI2BufferPrivatePtr privates;
PixmapPtr pixmap, pDepthPixmap;
Bool is_glamor_pixmap = FALSE;
int i;
buffers = calloc(count, sizeof *buffers);
@ -190,10 +136,8 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
if (attachments[i] == DRI2BufferFrontLeft) {
pixmap = get_front_buffer(drawable);
if (pixmap == NULL) {
if (pixmap == NULL)
drawable = &(get_drawable_pixmap(drawable)->drawable);
is_glamor_pixmap = TRUE;
}
} else if (attachments[i] == DRI2BufferStencil && pDepthPixmap) {
pixmap = pDepthPixmap;
pixmap->refcnt++;
@ -231,9 +175,6 @@ I830DRI2CreateBuffers(DrawablePtr drawable, unsigned int *attachments,
screen->DestroyPixmap(pixmap);
goto unwind;
}
if (is_glamor_pixmap)
pixmap = fixup_glamor(drawable, pixmap);
}
if (attachments[i] == DRI2BufferDepth)
@ -294,7 +235,6 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
DRI2Buffer2Ptr buffer;
I830DRI2BufferPrivatePtr privates;
PixmapPtr pixmap;
Bool is_glamor_pixmap = FALSE;
buffer = calloc(1, sizeof *buffer);
if (buffer == NULL)
@ -308,11 +248,8 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
pixmap = NULL;
if (attachment == DRI2BufferFrontLeft) {
pixmap = get_front_buffer(drawable);
if (pixmap == NULL) {
if (pixmap == NULL)
drawable = &(get_drawable_pixmap(drawable)->drawable);
is_glamor_pixmap = TRUE;
}
}
if (pixmap == NULL) {
@ -385,8 +322,6 @@ I830DRI2CreateBuffer(DrawablePtr drawable, unsigned int attachment,
free(buffer);
return NULL;
}
if (is_glamor_pixmap)
pixmap = fixup_glamor(drawable, pixmap);
}
buffer->attachment = attachment;
@ -764,8 +699,6 @@ intel_exchange_pixmap_buffers(struct intel_screen_private *intel, PixmapPtr fron
new_front->busy = 1;
new_back->busy = -1;
intel_glamor_exchange_buffers(intel, front, back);
DamageRegionProcessPending(&front->drawable);
return new_front;
@ -795,38 +728,6 @@ I830DRI2ExchangeBuffers(struct intel_screen_private *intel, DRI2BufferPtr front,
dri_bo_reference (intel->front_buffer);
}
static PixmapPtr
intel_glamor_create_back_pixmap(ScreenPtr screen,
PixmapPtr front_pixmap,
drm_intel_bo *back_bo)
{
PixmapPtr back_pixmap;
back_pixmap = screen->CreatePixmap(screen,
0,
0,
front_pixmap->drawable.depth,
0);
if (back_pixmap == NULL)
return NULL;
screen->ModifyPixmapHeader(back_pixmap,
front_pixmap->drawable.width,
front_pixmap->drawable.height,
0, 0,
front_pixmap->devKind,
0);
intel_set_pixmap_bo(back_pixmap, back_bo);
if (!intel_glamor_create_textured_pixmap(back_pixmap)) {
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Failed to create textured back pixmap.\n");
screen->DestroyPixmap(back_pixmap);
return NULL;
}
return back_pixmap;
}
static drm_intel_bo *get_pixmap_bo(I830DRI2BufferPrivatePtr priv)
{
drm_intel_bo *bo = intel_get_pixmap_bo(priv->pixmap);
@ -885,10 +786,6 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
}
if (intel->back_buffer == NULL) {
I830DRI2BufferPrivatePtr drvpriv;
PixmapPtr front_pixmap, back_pixmap;
ScreenPtr screen;
new_back = drm_intel_bo_alloc(intel->bufmgr, "front buffer",
intel->front_buffer->size, 0);
if (new_back == NULL)
@ -905,21 +802,6 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
drm_intel_bo_disable_reuse(new_back);
dri_bo_flink(new_back, &intel->back_name);
if ((intel->uxa_flags & UXA_USE_GLAMOR)) {
screen = draw->pScreen;
drvpriv = info->front->driverPrivate;
front_pixmap = drvpriv->pixmap;
back_pixmap = intel_glamor_create_back_pixmap(screen,
front_pixmap,
new_back);
if (back_pixmap == NULL) {
drm_intel_bo_unreference(new_back);
return FALSE;
}
intel->back_pixmap = back_pixmap;
}
} else {
new_back = intel->back_buffer;
intel->back_buffer = NULL;
@ -939,13 +821,8 @@ I830DRI2ScheduleFlip(struct intel_screen_private *intel,
intel->back_buffer = intel->front_buffer;
drm_intel_bo_reference(intel->back_buffer);
if (!(intel->uxa_flags & UXA_USE_GLAMOR)) {
intel_set_pixmap_bo(priv->pixmap, new_back);
drm_intel_bo_unreference(new_back);
}
else
intel_exchange_pixmap_buffers(intel, priv->pixmap,
intel->back_pixmap);
intel_exchange_pixmap_buffers(intel, priv->pixmap,
intel->back_pixmap);
tmp_name = info->front->name;
info->front->name = intel->back_name;

View File

@ -33,7 +33,6 @@
#include "intel_uxa.h"
#endif
#include "dri3.h"
#include "intel_glamor.h"
static int
intel_dri3_open(ScreenPtr screen,
@ -66,10 +65,6 @@ static PixmapPtr intel_dri3_pixmap_from_fd(ScreenPtr screen,
PixmapPtr pixmap;
dri_bo *bo;
pixmap = intel_glamor_pixmap_from_fd(screen, fd, width, height, stride, depth, bpp);
if (pixmap)
return pixmap;
if (depth < 8)
return NULL;
@ -118,10 +113,6 @@ static int intel_dri3_fd_from_pixmap(ScreenPtr screen,
struct intel_uxa_pixmap *priv;
int fd;
fd = intel_glamor_fd_from_pixmap(screen, pixmap, stride, size);
if (fd >= 0)
return fd;
priv = intel_uxa_get_pixmap_private(pixmap);
if (!priv)
return -1;

View File

@ -72,7 +72,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "intel_uxa.h"
#endif
#include "intel_glamor.h"
#include "intel_options.h"
#include "i915_drm.h"
@ -610,13 +609,6 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
return FALSE;
}
if (!intel_glamor_pre_init(scrn)) {
PreInitCleanup(scrn);
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to pre init glamor display.\n");
return FALSE;
}
/* Load the dri modules if requested. */
#if HAVE_DRI2
if (intel->dri2 != DRI_DISABLED && !xf86LoadSubModule(scrn, "dri2"))
@ -964,7 +956,6 @@ I830ScreenInit(SCREEN_INIT_ARGS_DECL)
intel->CreateScreenResources = screen->CreateScreenResources;
screen->CreateScreenResources = i830CreateScreenResources;
intel_glamor_init(screen);
if (!xf86CrtcScreenInit(screen))
return FALSE;
@ -1125,8 +1116,6 @@ static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
intel_glamor_close_screen(screen);
TimerFree(intel->cache_expire);
intel->cache_expire = NULL;

View File

@ -1,309 +0,0 @@
/*
* 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 <zhigang.gong@linux.intel.com>
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "xorg-server.h"
#include <xf86.h>
#define GLAMOR_FOR_XORG 1
#include <glamor.h>
#include "intel.h"
#include "i915_drm.h"
#include "intel_glamor.h"
#include "intel_uxa.h"
#include "intel_options.h"
void
intel_glamor_exchange_buffers(struct intel_screen_private *intel,
PixmapPtr src,
PixmapPtr dst)
{
if (!(intel->uxa_flags & UXA_USE_GLAMOR))
return;
glamor_egl_exchange_buffers(src, dst);
}
XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
if ((intel->uxa_flags & UXA_USE_GLAMOR) == 0)
return NULL;
return glamor_xv_init(screen, num_ports);
}
Bool
intel_glamor_create_screen_resources(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
if (!(intel->uxa_flags & UXA_USE_GLAMOR))
return TRUE;
if (!glamor_glyphs_init(screen))
return FALSE;
if (!glamor_egl_create_textured_screen_ext(screen,
intel->front_buffer->handle,
intel->front_pitch,
&intel->back_pixmap))
return FALSE;
return TRUE;
}
static Bool
intel_glamor_enabled(intel_screen_private *intel)
{
const char *s;
s = xf86GetOptValString(intel->Options, OPTION_ACCEL_METHOD);
if (s == NULL)
return IS_DEFAULT_ACCEL_METHOD(GLAMOR);
return strcasecmp(s, "glamor") == 0;
}
Bool
intel_glamor_pre_init(ScrnInfoPtr scrn)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
pointer glamor_module;
CARD32 version;
if (!intel_glamor_enabled(intel))
return TRUE;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(1,15,0,0,0)
if (!xf86LoaderCheckSymbol("glamor_egl_init")) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"glamor requires Load \"glamoregl\" in "
"Section \"Module\", disabling.\n");
return TRUE;
}
#endif
/* Load glamor module */
if ((glamor_module = xf86LoadSubModule(scrn, GLAMOR_EGL_MODULE_NAME))) {
version = xf86GetModuleVersion(glamor_module);
if (version < MODULE_VERSION_NUMERIC(0,3,1)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Incompatible glamor version, required >= 0.3.0.\n");
} else {
if (glamor_egl_init(scrn, intel->drmSubFD)) {
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"glamor detected, initialising egl layer.\n");
intel->uxa_flags = UXA_GLAMOR_EGL_INITIALIZED;
} else
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"glamor detected, failed to initialize egl.\n");
}
} else
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"glamor not available\n");
return TRUE;
}
PixmapPtr
intel_glamor_pixmap_from_fd(ScreenPtr screen,
int fd,
CARD16 width,
CARD16 height,
CARD16 stride,
CARD8 depth,
CARD8 bpp)
{
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,902,0)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
if (intel->uxa_flags & UXA_USE_GLAMOR)
return glamor_pixmap_from_fd(screen, fd, width, height, stride, depth, bpp);
else
#endif
return NULL;
}
int
intel_glamor_fd_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap, CARD16 *stride, CARD32 *size)
{
#if XORG_VERSION_CURRENT >= XORG_VERSION_NUMERIC(1,15,99,902,0)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
if (intel->uxa_flags & UXA_USE_GLAMOR)
return glamor_fd_from_pixmap(screen, pixmap, stride, size);
else
#endif
return -1;
}
PixmapPtr
intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
if (intel->uxa_flags & UXA_USE_GLAMOR)
return glamor_create_pixmap(screen, w, h, depth, usage);
else
return NULL;
}
Bool
intel_glamor_create_textured_pixmap(PixmapPtr pixmap)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
intel_screen_private *intel = intel_get_screen_private(scrn);
struct intel_uxa_pixmap *priv;
if ((intel->uxa_flags & UXA_USE_GLAMOR) == 0)
return TRUE;
priv = intel_uxa_get_pixmap_private(pixmap);
if (glamor_egl_create_textured_pixmap(pixmap, priv->bo->handle,
intel_pixmap_pitch(pixmap))) {
drm_intel_bo_disable_reuse(priv->bo);
priv->pinned |= PIN_GLAMOR;
return TRUE;
} else
return FALSE;
}
void
intel_glamor_destroy_pixmap(PixmapPtr pixmap)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
intel_screen_private * intel;
intel = intel_get_screen_private(scrn);
if (intel->uxa_flags & UXA_USE_GLAMOR)
glamor_egl_destroy_textured_pixmap(pixmap);
}
static void
intel_glamor_need_flush(DrawablePtr pDrawable)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(pDrawable->pScreen);
intel_screen_private * intel;
intel = intel_get_screen_private(scrn);
intel->needs_flush = TRUE;
}
static void
intel_glamor_finish_access(PixmapPtr pixmap, uxa_access_t access)
{
switch(access) {
case UXA_ACCESS_RO:
case UXA_ACCESS_RW:
case UXA_GLAMOR_ACCESS_RO:
break;
case UXA_GLAMOR_ACCESS_RW:
intel_glamor_need_flush(&pixmap->drawable);
break;
default:
ErrorF("Invalid access mode %d\n", access);
}
return;
}
Bool
intel_glamor_init(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
if ((intel->uxa_flags & UXA_GLAMOR_EGL_INITIALIZED) == 0)
goto fail;
if (!glamor_init(screen,
#if defined(GLAMOR_NO_DRI3)
/* Not doing DRI3 yet, since Present support hasn't landed. */
GLAMOR_NO_DRI3 |
#endif
GLAMOR_INVERTED_Y_AXIS |
GLAMOR_USE_EGL_SCREEN)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to initialize glamor.\n");
goto fail;
}
if (!glamor_egl_init_textured_pixmap(screen)) {
xf86DrvMsg(scrn->scrnIndex, X_ERROR,
"Failed to initialize textured pixmap of screen for glamor.\n");
goto fail;
}
intel->uxa_driver->flags |= UXA_USE_GLAMOR;
intel->uxa_flags |= intel->uxa_driver->flags;
intel->uxa_driver->finish_access = intel_glamor_finish_access;
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Use GLAMOR acceleration.\n");
return TRUE;
fail:
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Use legacy UXA acceleration.\n");
return FALSE;
}
void
intel_glamor_flush(intel_screen_private * intel)
{
ScreenPtr screen;
screen = xf86ScrnToScreen(intel->scrn);
if (intel->uxa_flags & UXA_USE_GLAMOR)
glamor_block_handler(screen);
}
Bool
intel_glamor_close_screen(ScreenPtr screen)
{
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
if (intel->uxa_flags & UXA_USE_GLAMOR)
intel->uxa_flags &= ~UXA_USE_GLAMOR;
return TRUE;
}

View File

@ -1,96 +0,0 @@
/*
* 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 <zhigang.gong@linux.intel.com>
*
*/
#ifndef INTEL_GLAMOR_H
#define INTEL_GLAMOR_H
#include <xf86xv.h>
#ifdef USE_GLAMOR
Bool intel_glamor_pre_init(ScrnInfoPtr scrn);
Bool intel_glamor_init(ScreenPtr screen);
Bool intel_glamor_create_screen_resources(ScreenPtr screen);
Bool intel_glamor_close_screen(ScreenPtr screen);
void intel_glamor_free_screen(int scrnIndex, int flags);
void intel_glamor_flush(intel_screen_private * intel);
Bool intel_glamor_create_textured_pixmap(PixmapPtr pixmap);
void intel_glamor_destroy_pixmap(PixmapPtr pixmap);
PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage);
void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst);
XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports);
int
intel_glamor_fd_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap, CARD16 *stride, CARD32 *size);
PixmapPtr
intel_glamor_pixmap_from_fd(ScreenPtr screen,
int fd,
CARD16 width,
CARD16 height,
CARD16 stride,
CARD8 depth,
CARD8 bpp);
#else
static inline Bool intel_glamor_pre_init(ScrnInfoPtr scrn) { return TRUE; }
static inline Bool intel_glamor_init(ScreenPtr screen) { return TRUE; }
static inline Bool intel_glamor_create_screen_resources(ScreenPtr screen) { return TRUE; }
static inline Bool intel_glamor_close_screen(ScreenPtr screen) { return TRUE; }
static inline void intel_glamor_free_screen(int scrnIndex, int flags) { }
static inline void intel_glamor_flush(intel_screen_private * intel) { }
static inline Bool intel_glamor_create_textured_pixmap(PixmapPtr pixmap) { return TRUE; }
static inline void intel_glamor_destroy_pixmap(PixmapPtr pixmap) { }
static inline PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h,
int depth, unsigned int usage) { return NULL; }
static inline void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst) {}
static inline XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports) { return NULL; }
static inline PixmapPtr intel_glamor_pixmap_from_fd(ScreenPtr screen,
int fd,
CARD16 width,
CARD16 height,
CARD16 stride,
CARD8 depth,
CARD8 bpp) { return NULL; }
static inline int
intel_glamor_fd_from_pixmap(ScreenPtr screen,
PixmapPtr pixmap, CARD16 *stride, CARD32 *size) { return -1; }
#endif
#endif /* INTEL_GLAMOR_H */

View File

@ -41,7 +41,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "intel.h"
#include "intel_uxa.h"
#include "intel_glamor.h"
#include "i830_reg.h"
#include "i915_drm.h"
@ -657,16 +656,7 @@ static Bool intel_uxa_prepare_access(PixmapPtr pixmap, uxa_access_t access)
dri_bo *bo = priv->bo;
int ret;
/* Transitioning to glamor acceleration, we need to flush all pending
* usage by UXA. */
if (access == UXA_GLAMOR_ACCESS_RW || access == UXA_GLAMOR_ACCESS_RO) {
if (!list_is_empty(&priv->batch))
intel_batch_submit(scrn);
return TRUE;
}
/* When falling back to swrast, flush all pending operations */
intel_glamor_flush(intel);
if (access == UXA_ACCESS_RW || priv->dirty)
intel_batch_submit(scrn);
@ -692,9 +682,6 @@ static void intel_uxa_finish_access(PixmapPtr pixmap, uxa_access_t access)
{
struct intel_uxa_pixmap *priv;
if (access == UXA_GLAMOR_ACCESS_RW || access == UXA_GLAMOR_ACCESS_RO)
return;
priv = intel_uxa_get_pixmap_private(pixmap);
if (priv == NULL)
return;
@ -963,7 +950,6 @@ void intel_uxa_block_handler(intel_screen_private *intel)
* and beyond rendering results may not hit the
* framebuffer until significantly later.
*/
intel_glamor_flush(intel);
intel_flush_rendering(intel);
intel_throttle(intel);
}
@ -977,12 +963,6 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
struct intel_uxa_pixmap *priv;
PixmapPtr pixmap, new_pixmap = NULL;
if (!(usage & INTEL_CREATE_PIXMAP_DRI2)) {
pixmap = intel_glamor_create_pixmap(screen, w, h, depth, usage);
if (pixmap)
return pixmap;
}
if (w > 32767 || h > 32767)
return NullPixmap;
@ -1061,35 +1041,10 @@ intel_uxa_create_pixmap(ScreenPtr screen, int w, int h, int depth,
intel_uxa_set_pixmap_private(pixmap, priv);
screen->ModifyPixmapHeader(pixmap, w, h, 0, 0, stride, NULL);
if (!intel_glamor_create_textured_pixmap(pixmap))
goto fallback_glamor;
}
return pixmap;
fallback_glamor:
if (usage & INTEL_CREATE_PIXMAP_DRI2) {
/* XXX need further work to handle the DRI2 failure case.
* Glamor don't know how to handle a BO only pixmap. Put
* a warning indicator here.
*/
xf86DrvMsg(scrn->scrnIndex, X_WARNING,
"Failed to create textured DRI2 pixmap.");
return pixmap;
}
/* Create textured pixmap failed means glamor failed to
* create a texture from current BO for some reasons. We turn
* to create a new glamor pixmap and clean up current one.
* One thing need to be noted, this new pixmap doesn't
* has a priv and bo attached to it. It's glamor's responsbility
* to take care of it. Glamor will mark this new pixmap as a
* texture only pixmap and will never fallback to DDX layer
* afterwards.
*/
new_pixmap = intel_glamor_create_pixmap(screen, w, h,
depth, usage);
dri_bo_unreference(priv->bo);
fallback_priv:
free(priv);
fallback_pixmap:
@ -1102,10 +1057,8 @@ fallback_pixmap:
static Bool intel_uxa_destroy_pixmap(PixmapPtr pixmap)
{
if (pixmap->refcnt == 1) {
intel_glamor_destroy_pixmap(pixmap);
if (pixmap->refcnt == 1)
intel_uxa_set_pixmap_bo(pixmap, NULL);
}
fbDestroyPixmap(pixmap);
return TRUE;
}
@ -1141,9 +1094,6 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen)
if (intel_uxa_get_pixmap_private(pixmap) == NULL)
goto err;
if (!intel_glamor_create_screen_resources(screen))
goto err;
intel_uxa_get_pixmap_private(pixmap)->pinned |= PIN_SCANOUT;
scrn->displayWidth = intel->front_pitch / intel->cpp;

View File

@ -40,7 +40,6 @@ struct intel_uxa_pixmap {
#define PIN_DRI2 0x2
#define PIN_DRI3 0x4
#define PIN_PRIME 0x8
#define PIN_GLAMOR 0x10
};
#if HAS_DEVPRIVATEKEYREC

View File

@ -74,7 +74,6 @@
#define _INTEL_XVMC_SERVER_
#include "intel_xvmc.h"
#endif
#include "intel_glamor.h"
/* overlay debugging printf function */
#if 0

View File

@ -78,7 +78,6 @@
#define _INTEL_XVMC_SERVER_
#include "intel_xvmc.h"
#endif
#include "intel_glamor.h"
#include "intel_uxa.h"
#include "intel_video_overlay.h"
@ -163,7 +162,7 @@ void intel_video_init(ScreenPtr screen)
ScrnInfoPtr scrn = xf86ScreenToScrn(screen);
intel_screen_private *intel = intel_get_screen_private(scrn);
XF86VideoAdaptorPtr *adaptors = NULL, *newAdaptors = NULL;
XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL, glamorAdaptor = NULL;
XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL;
int num_adaptors = xf86XVListGenericAdaptors(scrn, &adaptors);
/* Give our adaptor list enough space for the overlay and/or texture video
@ -213,21 +212,12 @@ void intel_video_init(ScreenPtr screen)
}
}
glamorAdaptor = intel_glamor_xv_init(screen, 16);
if (glamorAdaptor != NULL)
xf86DrvMsg(scrn->scrnIndex, X_INFO,
"Set up textured video using glamor\n");
if (overlayAdaptor && intel->XvPreferOverlay)
adaptors[num_adaptors++] = overlayAdaptor;
if (texturedAdaptor)
adaptors[num_adaptors++] = texturedAdaptor;
if (glamorAdaptor)
adaptors[num_adaptors++] = glamorAdaptor;
if (overlayAdaptor && !intel->XvPreferOverlay)
adaptors[num_adaptors++] = overlayAdaptor;

View File

@ -32,7 +32,6 @@
#include <dix-config.h>
#endif
#include "uxa-priv.h"
#include "uxa-glamor.h"
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "uxa.h"
@ -50,21 +49,6 @@ uxa_fill_spans(DrawablePtr pDrawable, GCPtr pGC, int n,
int x1, x2, y;
int off_x, off_y;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_fill_spans_nf(pDrawable,
pGC, n, ppt, pwidth, fSorted);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
if (uxa_screen->force_fallback)
goto fallback;
@ -210,26 +194,8 @@ static void
uxa_put_image(DrawablePtr pDrawable, GCPtr pGC, int depth, int x, int y,
int w, int h, int leftPad, int format, char *bits)
{
uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_put_image_nf(pDrawable,
pGC, depth, x, y, w, h,
leftPad, format, bits);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
if (!uxa_do_put_image(pDrawable, pGC, depth, x, y, w, h, format, bits,
PixmapBytePad(w, pDrawable->depth))) {
fallback:
uxa_check_put_image(pDrawable, pGC, depth, x, y, w, h, leftPad,
format, bits);
}
@ -374,26 +340,6 @@ uxa_copy_n_to_n(DrawablePtr pSrcDrawable,
int dst_off_x, dst_off_y;
PixmapPtr pSrcPixmap, pDstPixmap;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pSrcDrawable, UXA_GLAMOR_ACCESS_RO)) {
if (uxa_prepare_access(pDstDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_copy_n_to_n_nf(pSrcDrawable, pDstDrawable,
pGC, pbox, nbox, dx, dy,
reverse, upsidedown, bitplane,
closure);
uxa_finish_access(pDstDrawable, UXA_GLAMOR_ACCESS_RW);
}
uxa_finish_access(pSrcDrawable, UXA_GLAMOR_ACCESS_RO);
}
if (!ok)
goto fallback;
return;
}
if (uxa_screen->force_fallback)
goto fallback;
@ -560,19 +506,6 @@ uxa_poly_point(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
{
int i;
xRectangle *prect;
uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_poly_point_nf(pDrawable, pGC, mode, npt, ppt);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (ok)
return;
}
/* If we can't reuse the current GC as is, don't bother accelerating the
* points.
@ -611,19 +544,6 @@ uxa_poly_lines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt,
xRectangle *prect;
int x1, x2, y1, y2;
int i;
uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_poly_lines_nf(pDrawable, pGC, mode, npt, ppt);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (ok)
return;
}
/* Don't try to do wide lines or non-solid fill style. */
if (pGC->lineWidth != 0 || pGC->lineStyle != LineSolid ||
@ -722,19 +642,6 @@ uxa_poly_segment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSeg)
{
xRectangle *prect;
int i;
uxa_screen_t *uxa_screen = uxa_get_screen(pDrawable->pScreen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_poly_segment_nf(pDrawable, pGC, nseg, pSeg);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (ok)
return;
}
/* Don't try to do wide lines or non-solid fill style. */
if (pGC->lineWidth != 0 || pGC->lineStyle != LineSolid ||
@ -782,20 +689,6 @@ uxa_poly_fill_rect(DrawablePtr pDrawable,
int xorg, yorg;
int n;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_poly_fill_rect_nf(pDrawable, pGC, nrect, prect);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
uxa_check_poly_fill_rect(pDrawable, pGC, nrect, prect);
return;
}
/* Compute intersection of rects and clip region */
pReg = RECTS_TO_REGION(pScreen, nrect, prect, CT_UNSORTED);
REGION_TRANSLATE(pScreen, pReg, pDrawable->x, pDrawable->y);
@ -905,25 +798,6 @@ uxa_get_spans(DrawablePtr pDrawable,
int wMax,
DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart)
{
ScreenPtr screen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_get_spans_nf(pDrawable, wMax, ppt,
pwidth, nspans, pdstStart);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
fallback:
uxa_check_get_spans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
}
@ -931,25 +805,6 @@ static void
uxa_set_spans(DrawablePtr pDrawable, GCPtr gc, char *src,
DDXPointPtr points, int *widths, int n, int sorted)
{
ScreenPtr screen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_set_spans_nf(pDrawable, gc, src,
points, widths, n, sorted);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
fallback:
uxa_check_set_spans(pDrawable, gc, src, points, widths, n, sorted);
}
@ -958,27 +813,6 @@ uxa_copy_plane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
int srcx, int srcy, int w, int h, int dstx, int dsty,
unsigned long bitPlane)
{
ScreenPtr screen = pDst->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
RegionPtr region = NULL;
int ok = 0;
if (uxa_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW)) {
if (uxa_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO)) {
ok = glamor_copy_plane_nf(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane, &region);
uxa_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
}
uxa_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return region;
}
fallback:
return uxa_check_copy_plane(pSrc, pDst, pGC, srcx, srcy, w, h,
dstx, dsty, bitPlane);
}
@ -988,22 +822,6 @@ uxa_image_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr * ppci, pointer pglyphBase)
{
ScreenPtr screen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_image_glyph_blt_nf(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
fallback:
uxa_check_image_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
}
@ -1012,22 +830,6 @@ uxa_poly_glyph_blt(DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr * ppci, pointer pglyphBase)
{
ScreenPtr screen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_poly_glyph_blt_nf(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
fallback:
uxa_check_poly_glyph_blt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
}
@ -1035,25 +837,6 @@ static void
uxa_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
DrawablePtr pDrawable, int w, int h, int x, int y)
{
ScreenPtr screen = pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
if (uxa_prepare_access(&pBitmap->drawable, UXA_GLAMOR_ACCESS_RO)) {
ok = glamor_push_pixels_nf(pGC, pBitmap, pDrawable, w, h, x, y);
uxa_finish_access(&pBitmap->drawable, UXA_GLAMOR_ACCESS_RO);
}
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
fallback:
uxa_check_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y);
}
@ -1264,20 +1047,6 @@ uxa_get_image(DrawablePtr pDrawable, int x, int y, int w, int h,
Box.x2 = Box.x1 + w;
Box.y2 = Box.y1 + h;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
ok = 0;
if (uxa_prepare_access(pDrawable, UXA_GLAMOR_ACCESS_RW)) {
ok = glamor_get_image_nf(pDrawable, x, y, w, h,
format, planeMask, d);
uxa_finish_access(pDrawable, UXA_GLAMOR_ACCESS_RW);
}
if (!ok)
goto fallback;
return;
}
if (uxa_screen->force_fallback)
goto fallback;

View File

@ -1,65 +0,0 @@
/*
* 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 <zhigang.gong@linux.intel.com>
*
*/
#ifndef UXA_GLAMOR_H
#define UXA_GLAMOR_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef USE_GLAMOR
#include "glamor.h"
#else
#define glamor_fill_spans_nf(...) FALSE
#define glamor_poly_fill_rect_nf(...) FALSE
#define glamor_put_image_nf(...) FALSE
#define glamor_copy_n_to_n_nf(...) FALSE
#define glamor_get_spans_nf(...) FALSE
#define glamor_set_spans_nf(...) FALSE
#define glamor_get_image_nf(...) FALSE
#define glamor_glyphs_nf(...) FALSE
#define glamor_glyph_unrealize(...) do { } while(0)
#define glamor_composite_nf(...) FALSE
#define glamor_composite_rects_nf(...) FALSE
#define glamor_trapezoids_nf(...) FALSE
#define glamor_triangles_nf(...) FALSE
#define glamor_add_traps_nf(...) FALSE
#define glamor_create_gc(...) FALSE
#define glamor_validate_gc(...) do { } while(0)
#define glamor_poly_point_nf(...) FALSE
#define glamor_poly_segment_nf(...) FALSE
#define glamor_poly_lines_nf(...) FALSE
#define glamor_push_pixels_nf(...) FALSE
#define glamor_copy_plane_nf(...) FALSE
#define glamor_image_glyph_blt_nf(...) FALSE
#define glamor_poly_glyph_blt_nf(...) FALSE
#endif
#endif /* UXA_GLAMOR_H */

View File

@ -65,7 +65,6 @@
#include <stdlib.h>
#include "uxa-priv.h"
#include "uxa-glamor.h"
#include "common.h"
/* Width of the pixmaps we use for the caches; this should be less than
@ -210,10 +209,6 @@ bail:
Bool uxa_glyphs_init(ScreenPtr pScreen)
{
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR)
return TRUE;
#if HAS_DIXREGISTERPRIVATEKEY
if (!dixRegisterPrivateKey(&uxa_glyph_key, PRIVATE_GLYPH, 0))
return FALSE;
@ -308,12 +303,6 @@ uxa_glyph_unrealize(ScreenPtr screen,
GlyphPtr glyph)
{
struct uxa_glyph *priv;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
glamor_glyph_unrealize(screen, glyph);
return;
}
/* Use Lookup in case we have not attached to this glyph. */
priv = dixLookupPrivate(&glyph->devPrivates, &uxa_glyph_key);
@ -975,23 +964,6 @@ uxa_glyphs(CARD8 op,
ScreenPtr screen = pDst->pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(screen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok;
uxa_picture_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
uxa_picture_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
ok = glamor_glyphs_nf(op,
pSrc, pDst, maskFormat,
xSrc, ySrc, nlist, list, glyphs);
uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
if (!ok)
goto fallback;
return;
}
if (!uxa_screen->info->prepare_composite ||
uxa_screen->force_fallback ||
!uxa_drawable_is_offscreen(pDst->pDrawable) ||

View File

@ -29,23 +29,10 @@
#include <stdlib.h>
#include "uxa-priv.h"
#include "uxa-glamor.h"
#ifdef RENDER
#include "mipict.h"
/* Note: when using glamor we can not fail through to the ordinary UXA
* code paths, as glamor keeps an internal texture which will become
* inconsistent with the original bo. (The texture is replaced whenever
* the format changes, e.g. switching between xRGB and ARGB, for which mesa
* will allocate its own bo.)
*
* Ergo it is unsafe to fall through to the original backend operations if
* glamor is enabled.
*
* XXX This has some serious implications for mixing Render, DRI, scanout...
*/
static void uxa_composite_fallback_pict_desc(PicturePtr pict, char *string,
int n)
{
@ -1357,30 +1344,6 @@ uxa_composite(CARD8 op,
RegionRec region;
int tx, ty;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok;
uxa_picture_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
uxa_picture_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
if (pMask)
uxa_picture_prepare_access(pMask, UXA_GLAMOR_ACCESS_RO);
ok = glamor_composite_nf(op,
pSrc, pMask, pDst, xSrc, ySrc,
xMask, yMask, xDst, yDst,
width, height);
if (pMask)
uxa_picture_finish_access(pMask, UXA_GLAMOR_ACCESS_RO);
uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
if (!ok)
goto fallback;
return;
}
if (uxa_screen->force_fallback)
goto fallback;
@ -1722,25 +1685,7 @@ uxa_trapezoids(CARD8 op, PicturePtr src, PicturePtr dst,
BoxRec bounds;
Bool direct;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok;
uxa_picture_prepare_access(dst, UXA_GLAMOR_ACCESS_RW);
uxa_picture_prepare_access(src, UXA_GLAMOR_ACCESS_RO);
ok = glamor_trapezoids_nf(op,
src, dst, maskFormat, xSrc,
ySrc, ntrap, traps);
uxa_picture_finish_access(src, UXA_GLAMOR_ACCESS_RO);
uxa_picture_finish_access(dst, UXA_GLAMOR_ACCESS_RW);
if (!ok)
goto fallback;
return;
}
if (uxa_screen->force_fallback) {
fallback:
uxa_check_trapezoids(op, src, dst, maskFormat, xSrc, ySrc, ntrap, traps);
return;
}
@ -1951,25 +1896,7 @@ uxa_triangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
BoxRec bounds;
Bool direct;
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok;
uxa_picture_prepare_access(pDst, UXA_GLAMOR_ACCESS_RW);
uxa_picture_prepare_access(pSrc, UXA_GLAMOR_ACCESS_RO);
ok = glamor_triangles_nf(op,
pSrc, pDst, maskFormat, xSrc,
ySrc, ntri, tris);
uxa_picture_finish_access(pSrc, UXA_GLAMOR_ACCESS_RO);
uxa_picture_finish_access(pDst, UXA_GLAMOR_ACCESS_RW);
if (!ok)
goto fallback;
return;
}
if (uxa_screen->force_fallback) {
fallback:
uxa_check_triangles(op, pSrc, pDst, maskFormat,
xSrc, ySrc, ntri, tris);
return;
@ -2051,23 +1978,5 @@ void
uxa_add_traps(PicturePtr pPicture,
INT16 x_off, INT16 y_off, int ntrap, xTrap * traps)
{
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
uxa_screen_t *uxa_screen = uxa_get_screen(pScreen);
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
int ok;
uxa_picture_prepare_access(pPicture, UXA_GLAMOR_ACCESS_RW);
ok = glamor_add_traps_nf(pPicture,
x_off, y_off, ntrap, traps);
uxa_picture_finish_access(pPicture, UXA_GLAMOR_ACCESS_RW);
if (!ok)
goto fallback;
return;
}
fallback:
uxa_check_add_traps(pPicture, x_off, y_off, ntrap, traps);
}

View File

@ -38,7 +38,6 @@
#include <X11/fonts/fontstruct.h>
#include "dixfontstr.h"
#include "uxa.h"
#include "uxa-glamor.h"
#if HAS_DEVPRIVATEKEYREC
DevPrivateKeyRec uxa_screen_index;
@ -184,21 +183,12 @@ void uxa_finish_access(DrawablePtr pDrawable, uxa_access_t access)
static void
uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
{
uxa_screen_t *uxa_screen = uxa_get_screen(pGC->pScreen);
/* fbValidateGC will do direct access to pixmaps if the tiling has
* changed.
* Preempt fbValidateGC by doing its work and masking the change out, so
* that we can do the Prepare/finish_access.
*/
/* If we are using GLAMOR, then the tile or stipple pixmap
* may be pure GLAMOR pixmap, then we should let the glamor
* to do the validation.
*/
if (uxa_screen->info->flags & UXA_USE_GLAMOR) {
glamor_validate_gc(pGC, changes, pDrawable);
goto set_ops;
}
#ifdef FB_24_32BIT
if ((changes & GCTile) && fbGetRotatedPixmap(pGC)) {
(*pGC->pScreen->DestroyPixmap) (fbGetRotatedPixmap(pGC));
@ -267,7 +257,6 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
fbValidateGC(pGC, changes, pDrawable);
}
set_ops:
pGC->ops = (GCOps *) & uxa_ops;
}

View File

@ -46,8 +46,6 @@
typedef enum {
UXA_ACCESS_RO,
UXA_ACCESS_RW,
UXA_GLAMOR_ACCESS_RO,
UXA_GLAMOR_ACCESS_RW
} uxa_access_t;
/**
@ -545,20 +543,6 @@ typedef struct _UxaDriver {
*/
#define UXA_TWO_BITBLT_DIRECTIONS (1 << 2)
/**
* UXA_USE_GLAMOR indicates to use glamor acceleration to perform rendering.
* And if glamor fail to accelerate the rendering, then goto fallback to
* use CPU to do the rendering. This flag will be set only when glamor get
* initialized successfully.
* Note, in ddx close screen, this bit need to be cleared.
*/
#define UXA_USE_GLAMOR (1 << 3)
/* UXA_GLAMOR_EGL_INITIALIZED indicates glamor egl layer get initialized
* successfully. UXA layer does not use this flag, before call to
* glamor_init, ddx need to check this flag. */
#define UXA_GLAMOR_EGL_INITIALIZED (1 << 4)
/** @} */
/** @name UXA CreatePixmap hint flags
* @{