st/xorg: Replace compile-time acceleration switch with Option "2DAccel".

This option can be used to disable 2D acceleration. DRI2 and XVideo blits will
still be accelerated, at least to some degree even with compositing.
This commit is contained in:
Michel Dänzer 2009-11-19 17:52:55 +01:00
parent 10c67f9381
commit 31ea323b4d
5 changed files with 25 additions and 12 deletions

View file

@ -276,6 +276,7 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
PixmapPtr dst_pixmap;
GCPtr gc;
RegionPtr copy_clip;
Bool save_accel;
/*
* In driCreateBuffers we dewrap windows into the
@ -341,8 +342,11 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion,
}
}
save_accel = ms->exa->accel;
ms->exa->accel = TRUE;
(*gc->ops->CopyArea)(&src_pixmap->drawable, &dst_pixmap->drawable, gc,
0, 0, pDraw->width, pDraw->height, 0, 0);
ms->exa->accel = save_accel;
FreeScratchGC(gc);

View file

@ -75,10 +75,12 @@ static Bool PreInit(ScrnInfoPtr pScrn, int flags);
typedef enum
{
OPTION_SW_CURSOR,
OPTION_2D_ACCEL,
} modesettingOpts;
static const OptionInfoRec Options[] = {
{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_2D_ACCEL, "2DAccel", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@ -609,7 +611,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86SetBlackWhitePixels(pScreen);
ms->exa = xorg_exa_init(pScrn);
ms->exa = xorg_exa_init(pScrn, xf86ReturnOptValBool(ms->Options,
OPTION_2D_ACCEL, TRUE));
ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE);
xorg_init_video(pScreen);

View file

@ -46,7 +46,6 @@
#include "util/u_rect.h"
#define DEBUG_PRINT 0
#define ACCEL_ENABLED TRUE
/*
* Helper functions
@ -376,7 +375,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
XORG_FALLBACK("format %s", pf_name(priv->tex->format));
}
return ACCEL_ENABLED && xorg_solid_bind_state(exa, priv, fg);
return exa->accel && xorg_solid_bind_state(exa, priv, fg);
}
static void
@ -435,7 +434,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
exa->copy.src = src_priv;
exa->copy.dst = priv;
return ACCEL_ENABLED;
return exa->accel;
}
static void
@ -564,7 +563,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
render_format_name(pMaskPicture->format));
}
return ACCEL_ENABLED &&
return exa->accel &&
xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture,
pDstPicture,
pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL,
@ -597,6 +596,9 @@ ExaCheckComposite(int op,
PicturePtr pSrcPicture, PicturePtr pMaskPicture,
PicturePtr pDstPicture)
{
ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa = ms->exa;
boolean accelerated = xorg_composite_accelerated(op,
pSrcPicture,
pMaskPicture,
@ -605,7 +607,7 @@ ExaCheckComposite(int op,
debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n",
op, pSrcPicture, pMaskPicture, pDstPicture, accelerated);
#endif
return ACCEL_ENABLED && accelerated;
return exa->accel && accelerated;
}
static void *
@ -743,10 +745,11 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
bitsPerPixel, devKind, NULL);
/* Deal with screen resize */
if (!priv->tex ||
(priv->tex->width[0] != width ||
priv->tex->height[0] != height ||
priv->tex_flags != priv->flags)) {
if ((exa->accel || priv->flags) &&
(!priv->tex ||
(priv->tex->width[0] != width ||
priv->tex->height[0] != height ||
priv->tex_flags != priv->flags))) {
struct pipe_texture *texture = NULL;
struct pipe_texture template;
@ -861,7 +864,7 @@ xorg_exa_close(ScrnInfoPtr pScrn)
}
void *
xorg_exa_init(ScrnInfoPtr pScrn)
xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
{
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa;
@ -926,6 +929,7 @@ xorg_exa_init(ScrnInfoPtr pScrn)
ms->ctx = exa->pipe;
exa->renderer = renderer_create(exa->pipe);
exa->accel = accel;
return (void *)exa;

View file

@ -24,6 +24,8 @@ struct exa_context
float solid_color[4];
boolean has_solid_color;
boolean accel;
/* float[9] projective matrix bound to pictures */
struct {
float src[9];

View file

@ -131,7 +131,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
int depth, int bpp);
void *
xorg_exa_init(ScrnInfoPtr pScrn);
xorg_exa_init(ScrnInfoPtr pScrn, Bool accel);
void
xorg_exa_close(ScrnInfoPtr pScrn);