2005-07-01 10:56:12 +02:00
|
|
|
|
/*
|
|
|
|
|
* Copyright <EFBFBD> 2001 Keith Packard
|
|
|
|
|
*
|
|
|
|
|
* Partly based on code that is Copyright <EFBFBD> The XFree86 Project Inc.
|
|
|
|
|
*
|
|
|
|
|
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
|
* documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
|
* the above copyright notice appear in all copies and that both that
|
|
|
|
|
* copyright notice and this permission notice appear in supporting
|
|
|
|
|
* documentation, and that the name of Keith Packard not be used in
|
|
|
|
|
* advertising or publicity pertaining to distribution of the software without
|
|
|
|
|
* specific, written prior permission. Keith Packard makes no
|
|
|
|
|
* representations about the suitability of this software for any purpose. It
|
|
|
|
|
* is provided "as is" without express or implied warranty.
|
|
|
|
|
*
|
|
|
|
|
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
|
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
|
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
|
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/** @file
|
|
|
|
|
* This file covers the initialization and teardown of EXA, and has various
|
|
|
|
|
* functions not responsible for performing rendering, pixmap migration, or
|
|
|
|
|
* memory management.
|
|
|
|
|
*/
|
|
|
|
|
|
2006-02-16 01:14:11 +01:00
|
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
|
#include <dix-config.h>
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#endif
|
2006-02-16 01:14:11 +01:00
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
2006-02-02 21:09:14 +01:00
|
|
|
|
#include "exa_priv.h"
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#include "exa.h"
|
|
|
|
|
|
2008-08-29 00:05:40 +02:00
|
|
|
|
static int exaScreenPrivateKeyIndex;
|
|
|
|
|
DevPrivateKey exaScreenPrivateKey = &exaScreenPrivateKeyIndex;
|
|
|
|
|
static int exaPixmapPrivateKeyIndex;
|
|
|
|
|
DevPrivateKey exaPixmapPrivateKey = &exaPixmapPrivateKeyIndex;
|
2009-01-31 16:30:31 +01:00
|
|
|
|
static int exaGCPrivateKeyIndex;
|
|
|
|
|
DevPrivateKey exaGCPrivateKey = &exaGCPrivateKeyIndex;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2008-09-16 17:13:42 +02:00
|
|
|
|
#ifdef MITSHM
|
|
|
|
|
static ShmFuncs exaShmFuncs = { NULL, NULL };
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-09-06 13:10:16 +02:00
|
|
|
|
static _X_INLINE void*
|
|
|
|
|
ExaGetPixmapAddress(PixmapPtr p)
|
|
|
|
|
{
|
|
|
|
|
ExaPixmapPriv(p);
|
|
|
|
|
|
|
|
|
|
if (pExaPixmap->offscreen && pExaPixmap->fb_ptr)
|
|
|
|
|
return pExaPixmap->fb_ptr;
|
|
|
|
|
else
|
|
|
|
|
return pExaPixmap->sys_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaGetPixmapOffset() returns the offset (in bytes) within the framebuffer of
|
|
|
|
|
* the beginning of the given pixmap.
|
|
|
|
|
*
|
|
|
|
|
* Note that drivers are free to, and often do, munge this offset as necessary
|
|
|
|
|
* for handing to the hardware -- for example, translating it into a different
|
|
|
|
|
* aperture. This function may need to be extended in the future if we grow
|
|
|
|
|
* support for having multiple card-accessible offscreen, such as an AGP memory
|
|
|
|
|
* pool alongside the framebuffer pool.
|
2005-08-25 00:43:27 +02:00
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
unsigned long
|
2005-08-25 00:43:27 +02:00
|
|
|
|
exaGetPixmapOffset(PixmapPtr pPix)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv (pPix->drawable.pScreen);
|
2009-02-28 21:46:00 +01:00
|
|
|
|
ExaPixmapPriv (pPix);
|
2005-08-25 00:43:27 +02:00
|
|
|
|
|
2009-02-28 21:46:00 +01:00
|
|
|
|
return (CARD8 *)pExaPixmap->fb_ptr - pExaScr->info->memoryBase;
|
2005-08-25 00:43:27 +02:00
|
|
|
|
}
|
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
void *
|
2007-10-02 05:32:57 +02:00
|
|
|
|
exaGetPixmapDriverPrivate(PixmapPtr pPix)
|
|
|
|
|
{
|
|
|
|
|
ExaPixmapPriv(pPix);
|
|
|
|
|
|
|
|
|
|
return pExaPixmap->driverPriv;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaGetPixmapPitch() returns the pitch (in bytes) of the given pixmap.
|
|
|
|
|
*
|
|
|
|
|
* This is a helper to make driver code more obvious, due to the rather obscure
|
|
|
|
|
* naming of the pitch field in the pixmap.
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
unsigned long
|
2005-08-25 00:43:27 +02:00
|
|
|
|
exaGetPixmapPitch(PixmapPtr pPix)
|
|
|
|
|
{
|
|
|
|
|
return pPix->devKind;
|
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaGetPixmapSize() returns the size in bytes of the given pixmap in video
|
|
|
|
|
* memory. Only valid when the pixmap is currently in framebuffer.
|
2005-09-11 21:08:10 +02:00
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
unsigned long
|
2005-09-11 21:08:10 +02:00
|
|
|
|
exaGetPixmapSize(PixmapPtr pPix)
|
|
|
|
|
{
|
|
|
|
|
ExaPixmapPrivPtr pExaPixmap;
|
|
|
|
|
|
|
|
|
|
pExaPixmap = ExaGetPixmapPriv(pPix);
|
|
|
|
|
if (pExaPixmap != NULL)
|
2006-03-16 19:43:55 +01:00
|
|
|
|
return pExaPixmap->fb_size;
|
2005-09-11 21:08:10 +02:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaGetDrawablePixmap() returns a backing pixmap for a given drawable.
|
|
|
|
|
*
|
|
|
|
|
* @param pDrawable the drawable being requested.
|
|
|
|
|
*
|
|
|
|
|
* This function returns the backing pixmap for a drawable, whether it is a
|
|
|
|
|
* redirected window, unredirected window, or already a pixmap. Note that
|
|
|
|
|
* coordinate translation is needed when drawing to the backing pixmap of a
|
|
|
|
|
* redirected window, and the translation coordinates are provided by calling
|
|
|
|
|
* exaGetOffscreenPixmap() on the drawable.
|
|
|
|
|
*/
|
2006-02-02 22:07:06 +01:00
|
|
|
|
PixmapPtr
|
|
|
|
|
exaGetDrawablePixmap(DrawablePtr pDrawable)
|
|
|
|
|
{
|
|
|
|
|
if (pDrawable->type == DRAWABLE_WINDOW)
|
|
|
|
|
return pDrawable->pScreen->GetWindowPixmap ((WindowPtr) pDrawable);
|
|
|
|
|
else
|
|
|
|
|
return (PixmapPtr) pDrawable;
|
2008-12-19 23:12:37 +01:00
|
|
|
|
}
|
2006-02-02 22:07:06 +01:00
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
2006-12-19 18:57:22 +01:00
|
|
|
|
* Sets the offsets to add to coordinates to make them address the same bits in
|
|
|
|
|
* the backing drawable. These coordinates are nonzero only for redirected
|
|
|
|
|
* windows.
|
|
|
|
|
*/
|
2007-04-29 23:46:49 +02:00
|
|
|
|
void
|
2006-12-19 18:57:22 +01:00
|
|
|
|
exaGetDrawableDeltas (DrawablePtr pDrawable, PixmapPtr pPixmap,
|
|
|
|
|
int *xp, int *yp)
|
|
|
|
|
{
|
|
|
|
|
#ifdef COMPOSITE
|
|
|
|
|
if (pDrawable->type == DRAWABLE_WINDOW) {
|
|
|
|
|
*xp = -pPixmap->screen_x;
|
|
|
|
|
*yp = -pPixmap->screen_y;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
*xp = 0;
|
|
|
|
|
*yp = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* exaPixmapDirty() marks a pixmap as dirty, allowing for
|
2006-03-10 00:18:15 +01:00
|
|
|
|
* optimizations in pixmap migration when no changes have occurred.
|
|
|
|
|
*/
|
2005-07-01 10:56:12 +02:00
|
|
|
|
void
|
2006-12-19 18:57:22 +01:00
|
|
|
|
exaPixmapDirty (PixmapPtr pPix, int x1, int y1, int x2, int y2)
|
2005-07-01 10:56:12 +02:00
|
|
|
|
{
|
2006-12-19 18:57:22 +01:00
|
|
|
|
BoxRec box;
|
2006-06-12 20:19:11 +02:00
|
|
|
|
RegionRec region;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2006-12-19 18:57:22 +01:00
|
|
|
|
box.x1 = max(x1, 0);
|
|
|
|
|
box.y1 = max(y1, 0);
|
|
|
|
|
box.x2 = min(x2, pPix->drawable.width);
|
|
|
|
|
box.y2 = min(y2, pPix->drawable.height);
|
|
|
|
|
|
|
|
|
|
if (box.x1 >= box.x2 || box.y1 >= box.y2)
|
|
|
|
|
return;
|
|
|
|
|
|
2006-06-12 20:19:11 +02:00
|
|
|
|
REGION_INIT(pScreen, ®ion, &box, 1);
|
2009-02-17 19:06:35 +01:00
|
|
|
|
DamageRegionAppend(&pPix->drawable, ®ion);
|
|
|
|
|
DamageRegionProcessPending(&pPix->drawable);
|
2006-06-12 20:19:11 +02:00
|
|
|
|
REGION_UNINIT(pScreen, ®ion);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
|
exaDestroyPixmap (PixmapPtr pPixmap)
|
|
|
|
|
{
|
2007-10-02 06:03:39 +02:00
|
|
|
|
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
2009-01-31 19:25:20 +01:00
|
|
|
|
Bool ret;
|
2007-10-02 06:03:39 +02:00
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
if (pPixmap->refcnt == 1)
|
|
|
|
|
{
|
|
|
|
|
ExaPixmapPriv (pPixmap);
|
2007-10-02 06:03:39 +02:00
|
|
|
|
|
|
|
|
|
if (pExaPixmap->driverPriv) {
|
|
|
|
|
pExaScr->info->DestroyPixmap(pScreen, pExaPixmap->driverPriv);
|
|
|
|
|
pExaPixmap->driverPriv = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
if (pExaPixmap->area)
|
|
|
|
|
{
|
|
|
|
|
DBG_PIXMAP(("-- 0x%p (0x%x) (%dx%d)\n",
|
|
|
|
|
(void*)pPixmap->drawable.id,
|
|
|
|
|
ExaGetPixmapPriv(pPixmap)->area->offset,
|
|
|
|
|
pPixmap->drawable.width,
|
|
|
|
|
pPixmap->drawable.height));
|
|
|
|
|
/* Free the offscreen area */
|
|
|
|
|
exaOffscreenFree (pPixmap->drawable.pScreen, pExaPixmap->area);
|
2006-03-16 19:43:55 +01:00
|
|
|
|
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
|
|
|
|
|
pPixmap->devKind = pExaPixmap->sys_pitch;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
2007-08-24 19:24:18 +02:00
|
|
|
|
REGION_UNINIT(pPixmap->drawable.pScreen, &pExaPixmap->validSys);
|
|
|
|
|
REGION_UNINIT(pPixmap->drawable.pScreen, &pExaPixmap->validFB);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
2009-01-31 19:25:20 +01:00
|
|
|
|
|
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
ret = pScreen->DestroyPixmap (pPixmap);
|
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
|
|
|
|
|
return ret;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-16 19:43:55 +01:00
|
|
|
|
static int
|
|
|
|
|
exaLog2(int val)
|
|
|
|
|
{
|
|
|
|
|
int bits;
|
|
|
|
|
|
2006-06-24 15:21:17 +02:00
|
|
|
|
if (val <= 0)
|
2006-03-16 19:43:55 +01:00
|
|
|
|
return 0;
|
|
|
|
|
for (bits = 0; val != 0; bits++)
|
|
|
|
|
val >>= 1;
|
|
|
|
|
return bits - 1;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-14 11:43:51 +02:00
|
|
|
|
static void
|
|
|
|
|
exaSetAccelBlock(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
|
|
|
|
|
int w, int h, int bpp)
|
|
|
|
|
{
|
|
|
|
|
pExaPixmap->accel_blocked = 0;
|
|
|
|
|
|
|
|
|
|
if (pExaScr->info->maxPitchPixels) {
|
|
|
|
|
int max_pitch = pExaScr->info->maxPitchPixels * (bpp + 7) / 8;
|
|
|
|
|
|
|
|
|
|
if (pExaPixmap->fb_pitch > max_pitch)
|
|
|
|
|
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pExaScr->info->maxPitchBytes &&
|
|
|
|
|
pExaPixmap->fb_pitch > pExaScr->info->maxPitchBytes)
|
|
|
|
|
pExaPixmap->accel_blocked |= EXA_RANGE_PITCH;
|
|
|
|
|
|
|
|
|
|
if (w > pExaScr->info->maxX)
|
|
|
|
|
pExaPixmap->accel_blocked |= EXA_RANGE_WIDTH;
|
|
|
|
|
|
|
|
|
|
if (h > pExaScr->info->maxY)
|
|
|
|
|
pExaPixmap->accel_blocked |= EXA_RANGE_HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
2008-04-21 11:03:27 +02:00
|
|
|
|
static void
|
|
|
|
|
exaSetFbPitch(ExaScreenPrivPtr pExaScr, ExaPixmapPrivPtr pExaPixmap,
|
|
|
|
|
int w, int h, int bpp)
|
|
|
|
|
{
|
|
|
|
|
if (pExaScr->info->flags & EXA_OFFSCREEN_ALIGN_POT && w != 1)
|
2009-03-17 19:34:45 +01:00
|
|
|
|
pExaPixmap->fb_pitch = ((1 << (exaLog2(w - 1) + 1)) * bpp + 7) / 8;
|
2008-04-21 11:03:27 +02:00
|
|
|
|
else
|
2009-03-17 19:34:45 +01:00
|
|
|
|
pExaPixmap->fb_pitch = (w * bpp + 7) / 8;
|
2008-04-21 11:03:27 +02:00
|
|
|
|
|
|
|
|
|
pExaPixmap->fb_pitch = EXA_ALIGN(pExaPixmap->fb_pitch,
|
|
|
|
|
pExaScr->info->pixmapPitchAlign);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaCreatePixmap() creates a new pixmap.
|
|
|
|
|
*
|
|
|
|
|
* If width and height are 0, this won't be a full-fledged pixmap and it will
|
|
|
|
|
* get ModifyPixmapHeader() called on it later. So, we mark it as pinned, because
|
|
|
|
|
* ModifyPixmapHeader() would break migration. These types of pixmaps are used
|
|
|
|
|
* for scratch pixmaps, or to represent the visible screen.
|
|
|
|
|
*/
|
2005-07-01 10:56:12 +02:00
|
|
|
|
static PixmapPtr
|
2007-10-31 22:15:35 +01:00
|
|
|
|
exaCreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
|
|
|
|
|
unsigned usage_hint)
|
2005-07-01 10:56:12 +02:00
|
|
|
|
{
|
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
|
ExaPixmapPrivPtr pExaPixmap;
|
2009-02-16 17:17:14 +01:00
|
|
|
|
BoxRec box;
|
2007-10-02 06:03:39 +02:00
|
|
|
|
int driver_alloc = 0;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
int bpp;
|
2005-07-09 16:15:35 +02:00
|
|
|
|
ExaScreenPriv(pScreen);
|
2005-07-07 17:05:02 +02:00
|
|
|
|
|
2005-09-13 03:33:19 +02:00
|
|
|
|
if (w > 32767 || h > 32767)
|
|
|
|
|
return NullPixmap;
|
2005-10-20 23:45:40 +02:00
|
|
|
|
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, CreatePixmap);
|
2009-04-23 04:04:17 +02:00
|
|
|
|
if (!pExaScr->info->CreatePixmap && !pExaScr->info->CreatePixmap2) {
|
2009-01-31 19:25:20 +01:00
|
|
|
|
pPixmap = pScreen->CreatePixmap (pScreen, w, h, depth, usage_hint);
|
2007-10-02 06:03:39 +02:00
|
|
|
|
} else {
|
|
|
|
|
driver_alloc = 1;
|
2009-01-31 19:25:20 +01:00
|
|
|
|
pPixmap = pScreen->CreatePixmap(pScreen, 0, 0, depth, usage_hint);
|
2007-10-02 06:03:39 +02:00
|
|
|
|
}
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, CreatePixmap);
|
2007-10-02 06:03:39 +02:00
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
if (!pPixmap)
|
2007-10-02 06:03:39 +02:00
|
|
|
|
return NULL;
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
2007-11-17 09:20:49 +01:00
|
|
|
|
pExaPixmap->driverPriv = NULL;
|
- Don't try to upload 0 byte-per-pixel (PICT_a1) data using
RADEONHostDataBlit.
- Disable the shortcut for switching from 3d to 3d in radeon_exa.c. It
appears that we do need the cache flush here, thought it's not clear
why. Disable the 2d to 2d shortcut while here, since I'm unsure of what
we're doing. Exposed by the following bit:
- Bug #4485: Add a new routine, exaGlyphs, to handle font drawing. Glyphs
were being accumulated in from non-migratable scratch pixmaps, causing
the destination pixmap to move towards screen but the migration
necessary for source never to happen, leading to abysmal performance.
Instead, copy the scratch glyph data into a real pixmap first, then
composite from that into the destination, allowing for migration. time
ls -lR from programs/Xserver showed 26.9% (+/- 6.3%) decrease in wall
time (n=3).
- Create exaDrawableUse* wrapping exaPixmapUse*, but which are aware of
windows needing backing store. Makes migration code prettier, and
ensures that composited windows will be migrated as normal when we turn
off cw for EXA. (issue brought up by keithp)
2005-09-17 22:02:02 +02:00
|
|
|
|
|
2006-03-16 19:43:55 +01:00
|
|
|
|
bpp = pPixmap->drawable.bitsPerPixel;
|
|
|
|
|
|
2007-10-02 06:03:39 +02:00
|
|
|
|
if (driver_alloc) {
|
|
|
|
|
size_t paddedWidth, datasize;
|
|
|
|
|
|
|
|
|
|
paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
|
|
|
|
|
if (paddedWidth / 4 > 32767 || h > 32767)
|
|
|
|
|
return NullPixmap;
|
|
|
|
|
|
2008-04-21 11:03:27 +02:00
|
|
|
|
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
|
|
|
|
|
|
2007-10-02 06:03:39 +02:00
|
|
|
|
if (paddedWidth < pExaPixmap->fb_pitch)
|
|
|
|
|
paddedWidth = pExaPixmap->fb_pitch;
|
|
|
|
|
|
|
|
|
|
datasize = h * paddedWidth;
|
|
|
|
|
|
2008-12-26 16:38:27 +01:00
|
|
|
|
/* Set this before driver hooks, to allow for !offscreen pixmaps.
|
|
|
|
|
* !offscreen pixmaps have a valid pointer at all times.
|
|
|
|
|
*/
|
|
|
|
|
pPixmap->devPrivate.ptr = NULL;
|
|
|
|
|
|
2009-04-23 04:04:17 +02:00
|
|
|
|
if (pExaScr->info->CreatePixmap2)
|
|
|
|
|
pExaPixmap->driverPriv = pExaScr->info->CreatePixmap2(pScreen, w, h, depth, usage_hint, bpp);
|
|
|
|
|
else
|
|
|
|
|
pExaPixmap->driverPriv = pExaScr->info->CreatePixmap(pScreen, datasize, 0);
|
2008-06-18 23:34:02 +02:00
|
|
|
|
if (!pExaPixmap->driverPriv) {
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
pScreen->DestroyPixmap (pPixmap);
|
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
return NULL;
|
2007-10-02 06:03:39 +02:00
|
|
|
|
}
|
2006-03-16 19:43:55 +01:00
|
|
|
|
|
2009-03-13 00:40:43 +01:00
|
|
|
|
/* Allow ModifyPixmapHeader to set sys_ptr appropriately. */
|
|
|
|
|
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
|
|
|
|
pExaPixmap->fb_ptr = NULL;
|
|
|
|
|
pExaPixmap->pDamage = NULL;
|
|
|
|
|
pExaPixmap->sys_ptr = NULL;
|
|
|
|
|
|
|
|
|
|
(*pScreen->ModifyPixmapHeader)(pPixmap, w, h, 0, 0,
|
|
|
|
|
paddedWidth, NULL);
|
2008-09-25 07:40:19 +02:00
|
|
|
|
|
2007-10-02 06:03:39 +02:00
|
|
|
|
} else {
|
2008-06-18 23:34:02 +02:00
|
|
|
|
pExaPixmap->driverPriv = NULL;
|
|
|
|
|
/* Scratch pixmaps may have w/h equal to zero, and may not be
|
|
|
|
|
* migrated.
|
|
|
|
|
*/
|
2007-10-02 06:03:39 +02:00
|
|
|
|
if (!w || !h)
|
|
|
|
|
pExaPixmap->score = EXA_PIXMAP_SCORE_PINNED;
|
|
|
|
|
else
|
|
|
|
|
pExaPixmap->score = EXA_PIXMAP_SCORE_INIT;
|
|
|
|
|
|
|
|
|
|
pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
|
|
|
|
|
pExaPixmap->sys_pitch = pPixmap->devKind;
|
|
|
|
|
|
|
|
|
|
pPixmap->devPrivate.ptr = NULL;
|
|
|
|
|
pExaPixmap->offscreen = FALSE;
|
|
|
|
|
|
|
|
|
|
pExaPixmap->fb_ptr = NULL;
|
2008-04-21 11:03:27 +02:00
|
|
|
|
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
|
2007-10-02 06:03:39 +02:00
|
|
|
|
pExaPixmap->fb_size = pExaPixmap->fb_pitch * h;
|
|
|
|
|
|
|
|
|
|
if (pExaPixmap->fb_pitch > 131071) {
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
pScreen->DestroyPixmap (pPixmap);
|
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
return NULL;
|
2007-10-02 06:03:39 +02:00
|
|
|
|
}
|
2006-03-16 19:43:55 +01:00
|
|
|
|
|
2008-08-08 12:17:58 +02:00
|
|
|
|
/* Set up damage tracking */
|
2008-08-29 22:15:23 +02:00
|
|
|
|
pExaPixmap->pDamage = DamageCreate (NULL, NULL,
|
|
|
|
|
DamageReportNone, TRUE,
|
2008-08-08 12:17:58 +02:00
|
|
|
|
pScreen, pPixmap);
|
2006-06-12 20:19:11 +02:00
|
|
|
|
|
2008-08-08 12:17:58 +02:00
|
|
|
|
if (pExaPixmap->pDamage == NULL) {
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
pScreen->DestroyPixmap (pPixmap);
|
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
2008-08-08 12:17:58 +02:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2006-06-12 20:19:11 +02:00
|
|
|
|
|
2008-08-08 12:17:58 +02:00
|
|
|
|
DamageRegister (&pPixmap->drawable, pExaPixmap->pDamage);
|
2008-08-29 22:15:23 +02:00
|
|
|
|
/* This ensures that pending damage reflects the current operation. */
|
|
|
|
|
/* This is used by exa to optimize migration. */
|
2008-08-08 12:17:58 +02:00
|
|
|
|
DamageSetReportAfterOp (pExaPixmap->pDamage, TRUE);
|
|
|
|
|
}
|
2008-12-19 23:12:37 +01:00
|
|
|
|
|
2008-08-08 12:17:58 +02:00
|
|
|
|
pExaPixmap->area = NULL;
|
2006-06-12 20:19:11 +02:00
|
|
|
|
|
2009-02-16 17:17:14 +01:00
|
|
|
|
/* We set the initial pixmap as completely valid for a simple reason.
|
|
|
|
|
* Imagine a 1000x1000 pixmap, it has 1 million pixels, 250000 of which
|
|
|
|
|
* could form single pixel rects as part of a region. Setting the complete region
|
|
|
|
|
* as valid is a natural defragmentation of the region.
|
|
|
|
|
*/
|
|
|
|
|
box.x1 = 0;
|
|
|
|
|
box.y1 = 0;
|
|
|
|
|
box.x2 = w;
|
|
|
|
|
box.y2 = h;
|
|
|
|
|
REGION_INIT(pScreen, &pExaPixmap->validSys, &box, 0);
|
|
|
|
|
REGION_INIT(pScreen, &pExaPixmap->validFB, &box, 0);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2008-04-14 11:43:51 +02:00
|
|
|
|
exaSetAccelBlock(pExaScr, pExaPixmap,
|
|
|
|
|
w, h, bpp);
|
2007-09-24 22:06:52 +02:00
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
return pPixmap;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-06 13:10:16 +02:00
|
|
|
|
static Bool
|
|
|
|
|
exaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
|
|
|
|
|
int bitsPerPixel, int devKind, pointer pPixData)
|
|
|
|
|
{
|
2007-08-30 13:48:03 +02:00
|
|
|
|
ExaScreenPrivPtr pExaScr;
|
|
|
|
|
ExaPixmapPrivPtr pExaPixmap;
|
2007-10-02 06:03:39 +02:00
|
|
|
|
Bool ret;
|
2007-09-06 13:10:16 +02:00
|
|
|
|
|
|
|
|
|
if (!pPixmap)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2008-04-14 11:43:51 +02:00
|
|
|
|
pExaScr = ExaGetScreenPriv(pPixmap->drawable.pScreen);
|
2007-08-30 13:48:03 +02:00
|
|
|
|
pExaPixmap = ExaGetPixmapPriv(pPixmap);
|
|
|
|
|
|
2008-04-14 11:43:51 +02:00
|
|
|
|
if (pExaPixmap) {
|
2008-04-21 11:03:27 +02:00
|
|
|
|
if (pPixData)
|
|
|
|
|
pExaPixmap->sys_ptr = pPixData;
|
2007-09-06 13:10:16 +02:00
|
|
|
|
|
2008-04-21 11:03:27 +02:00
|
|
|
|
if (devKind > 0)
|
|
|
|
|
pExaPixmap->sys_pitch = devKind;
|
|
|
|
|
|
2009-03-19 19:07:59 +01:00
|
|
|
|
/* Classic EXA:
|
|
|
|
|
* - Framebuffer.
|
|
|
|
|
* - Scratch pixmap with offscreen memory.
|
|
|
|
|
*/
|
|
|
|
|
if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) &&
|
|
|
|
|
pExaScr->info->memoryBase && pPixData) {
|
|
|
|
|
if ((CARD8 *)pPixData >= pExaScr->info->memoryBase &&
|
|
|
|
|
((CARD8 *)pPixData - pExaScr->info->memoryBase) <
|
|
|
|
|
pExaScr->info->memorySize) {
|
|
|
|
|
pExaPixmap->fb_ptr = pPixData;
|
|
|
|
|
pExaPixmap->fb_pitch = devKind;
|
|
|
|
|
pExaPixmap->offscreen = TRUE;
|
|
|
|
|
}
|
2009-02-28 21:46:00 +01:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-21 11:03:27 +02:00
|
|
|
|
if (width > 0 && height > 0 && bitsPerPixel > 0) {
|
|
|
|
|
exaSetFbPitch(pExaScr, pExaPixmap,
|
|
|
|
|
width, height, bitsPerPixel);
|
|
|
|
|
|
|
|
|
|
exaSetAccelBlock(pExaScr, pExaPixmap,
|
|
|
|
|
width, height, bitsPerPixel);
|
|
|
|
|
}
|
2009-02-26 10:35:44 +01:00
|
|
|
|
|
|
|
|
|
/* Pixmaps subject to ModifyPixmapHeader will be pinned to system or
|
|
|
|
|
* offscreen memory, so there's no need to track damage.
|
|
|
|
|
*/
|
|
|
|
|
if (pExaPixmap->pDamage) {
|
|
|
|
|
DamageUnregister(&pPixmap->drawable, pExaPixmap->pDamage);
|
|
|
|
|
DamageDestroy(pExaPixmap->pDamage);
|
|
|
|
|
pExaPixmap->pDamage = NULL;
|
|
|
|
|
}
|
2008-04-14 11:43:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-02 06:03:39 +02:00
|
|
|
|
if (pExaScr->info->ModifyPixmapHeader) {
|
|
|
|
|
ret = pExaScr->info->ModifyPixmapHeader(pPixmap, width, height, depth,
|
|
|
|
|
bitsPerPixel, devKind, pPixData);
|
2009-02-28 21:59:09 +01:00
|
|
|
|
/* For EXA_HANDLES_PIXMAPS, we set pPixData to NULL.
|
|
|
|
|
* If pPixmap->devPrivate.ptr is non-NULL, then we've got a non-offscreen pixmap.
|
|
|
|
|
* We need to store the pointer, because PrepareAccess won't be called.
|
|
|
|
|
*/
|
|
|
|
|
if (!pPixData && pPixmap->devPrivate.ptr && pPixmap->devKind) {
|
|
|
|
|
pExaPixmap->sys_ptr = pPixmap->devPrivate.ptr;
|
|
|
|
|
pExaPixmap->sys_pitch = pPixmap->devKind;
|
|
|
|
|
}
|
2007-10-02 06:03:39 +02:00
|
|
|
|
if (ret == TRUE)
|
2009-02-28 21:59:09 +01:00
|
|
|
|
goto out;
|
2007-10-02 06:03:39 +02:00
|
|
|
|
}
|
2009-02-28 21:59:09 +01:00
|
|
|
|
ret = pExaScr->SavedModifyPixmapHeader(pPixmap, width, height, depth,
|
2007-09-06 13:10:16 +02:00
|
|
|
|
bitsPerPixel, devKind, pPixData);
|
2009-02-28 21:59:09 +01:00
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
/* Always NULL this, we don't want lingering pointers. */
|
|
|
|
|
pPixmap->devPrivate.ptr = NULL;
|
|
|
|
|
|
|
|
|
|
return ret;
|
2007-09-06 13:10:16 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaPixmapIsOffscreen() is used to determine if a pixmap is in offscreen
|
|
|
|
|
* memory, meaning that acceleration could probably be done to it, and that it
|
|
|
|
|
* will need to be wrapped by PrepareAccess()/FinishAccess() when accessing it
|
|
|
|
|
* with the CPU.
|
|
|
|
|
*
|
|
|
|
|
* Note that except for UploadToScreen()/DownloadFromScreen() (which explicitly
|
|
|
|
|
* deal with moving pixmaps in and out of system memory), EXA will give drivers
|
|
|
|
|
* pixmaps as arguments for which exaPixmapIsOffscreen() is TRUE.
|
|
|
|
|
*
|
|
|
|
|
* @return TRUE if the given drawable is in framebuffer memory.
|
|
|
|
|
*/
|
2005-07-01 10:56:12 +02:00
|
|
|
|
Bool
|
|
|
|
|
exaPixmapIsOffscreen(PixmapPtr p)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = p->drawable.pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
2007-09-06 13:10:16 +02:00
|
|
|
|
ExaPixmapPriv(p);
|
|
|
|
|
Bool ret;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2009-02-28 21:46:00 +01:00
|
|
|
|
if (pExaScr->info->PixmapIsOffscreen) {
|
2007-09-06 13:10:16 +02:00
|
|
|
|
p->devPrivate.ptr = ExaGetPixmapAddress(p);
|
|
|
|
|
ret = pExaScr->info->PixmapIsOffscreen(p);
|
2009-02-28 21:46:00 +01:00
|
|
|
|
p->devPrivate.ptr = NULL;
|
|
|
|
|
} else
|
|
|
|
|
ret = (pExaPixmap->offscreen && pExaPixmap->fb_ptr);
|
2007-04-04 12:28:48 +02:00
|
|
|
|
|
2007-09-06 13:10:16 +02:00
|
|
|
|
return ret;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaDrawableIsOffscreen() is a convenience wrapper for exaPixmapIsOffscreen().
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
Bool
|
2006-02-02 22:07:06 +01:00
|
|
|
|
exaDrawableIsOffscreen (DrawablePtr pDrawable)
|
|
|
|
|
{
|
|
|
|
|
return exaPixmapIsOffscreen (exaGetDrawablePixmap (pDrawable));
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* Returns the pixmap which backs a drawable, and the offsets to add to
|
|
|
|
|
* coordinates to make them address the same bits in the backing drawable.
|
|
|
|
|
*/
|
2005-07-01 10:56:12 +02:00
|
|
|
|
PixmapPtr
|
|
|
|
|
exaGetOffscreenPixmap (DrawablePtr pDrawable, int *xp, int *yp)
|
|
|
|
|
{
|
2006-12-19 18:57:22 +01:00
|
|
|
|
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
|
|
|
|
|
|
|
|
|
|
exaGetDrawableDeltas (pDrawable, pPixmap, xp, yp);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
|
|
|
|
if (exaPixmapIsOffscreen (pPixmap))
|
|
|
|
|
return pPixmap;
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-26 22:18:03 +01:00
|
|
|
|
/**
|
|
|
|
|
* Returns TRUE if pixmap can be accessed offscreen.
|
|
|
|
|
*/
|
|
|
|
|
Bool
|
2007-09-05 20:10:09 +02:00
|
|
|
|
ExaDoPrepareAccess(DrawablePtr pDrawable, int index)
|
2005-09-11 21:08:10 +02:00
|
|
|
|
{
|
2009-02-28 21:59:09 +01:00
|
|
|
|
ScreenPtr pScreen = pDrawable->pScreen;
|
|
|
|
|
ExaScreenPriv (pScreen);
|
|
|
|
|
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
|
|
|
|
|
ExaPixmapPriv(pPixmap);
|
|
|
|
|
Bool offscreen;
|
|
|
|
|
|
|
|
|
|
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (pExaPixmap == NULL)
|
|
|
|
|
EXA_FatalErrorDebugWithRet(("EXA bug: ExaDoPrepareAccess was called on a non-exa pixmap.\n"), FALSE);
|
2005-09-11 21:08:10 +02:00
|
|
|
|
|
2009-02-28 21:59:09 +01:00
|
|
|
|
/* Check if we're dealing SRC == DST or similar.
|
|
|
|
|
* In that case the first PrepareAccess has already set pPixmap->devPrivate.ptr.
|
|
|
|
|
*/
|
|
|
|
|
if (pPixmap->devPrivate.ptr != NULL) {
|
|
|
|
|
int i;
|
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
|
if (pExaScr->prepare_access[i] == pPixmap)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
/* No known PrepareAccess or double prepare on the same index. */
|
|
|
|
|
if (i == 6 || i == index)
|
|
|
|
|
EXA_FatalErrorDebug(("EXA bug: pPixmap->devPrivate.ptr was %p, but should have been NULL.\n",
|
|
|
|
|
pPixmap->devPrivate.ptr));
|
2006-03-31 21:41:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
2009-02-28 21:59:09 +01:00
|
|
|
|
offscreen = exaPixmapIsOffscreen(pPixmap);
|
|
|
|
|
|
|
|
|
|
if (offscreen)
|
|
|
|
|
pPixmap->devPrivate.ptr = pExaPixmap->fb_ptr;
|
|
|
|
|
else
|
|
|
|
|
pPixmap->devPrivate.ptr = pExaPixmap->sys_ptr;
|
|
|
|
|
|
|
|
|
|
/* Store so we can check SRC and DEST being the same. */
|
|
|
|
|
pExaScr->prepare_access[index] = pPixmap;
|
|
|
|
|
|
2007-09-06 13:10:16 +02:00
|
|
|
|
if (!offscreen)
|
2009-02-26 22:18:03 +01:00
|
|
|
|
return FALSE;
|
2007-09-06 13:10:16 +02:00
|
|
|
|
|
|
|
|
|
exaWaitSync (pDrawable->pScreen);
|
|
|
|
|
|
2006-03-09 07:04:07 +01:00
|
|
|
|
if (pExaScr->info->PrepareAccess == NULL)
|
2009-02-26 22:18:03 +01:00
|
|
|
|
return TRUE;
|
2005-09-11 21:08:10 +02:00
|
|
|
|
|
2009-02-27 22:26:52 +01:00
|
|
|
|
if (index >= EXA_PREPARE_AUX_DEST &&
|
2009-02-27 16:37:28 +01:00
|
|
|
|
!(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
|
2009-03-17 10:45:21 +01:00
|
|
|
|
if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
|
|
|
|
|
FatalError("Unsupported AUX indices used on a pinned pixmap.\n");
|
2009-02-27 16:37:28 +01:00
|
|
|
|
exaMoveOutPixmap (pPixmap);
|
2009-02-27 22:26:52 +01:00
|
|
|
|
return FALSE;
|
2009-02-27 16:37:28 +01:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-09 07:04:07 +01:00
|
|
|
|
if (!(*pExaScr->info->PrepareAccess) (pPixmap, index)) {
|
2008-08-17 19:57:02 +02:00
|
|
|
|
if (pExaPixmap->score == EXA_PIXMAP_SCORE_PINNED)
|
2009-02-28 21:59:09 +01:00
|
|
|
|
FatalError("Driver failed PrepareAccess on a pinned pixmap.\n");
|
2005-09-11 21:08:10 +02:00
|
|
|
|
exaMoveOutPixmap (pPixmap);
|
2009-02-26 22:18:03 +01:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
2005-09-11 21:08:10 +02:00
|
|
|
|
}
|
2009-02-26 22:18:03 +01:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
2005-09-11 21:08:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
2007-09-05 20:10:09 +02:00
|
|
|
|
void
|
2007-08-29 19:55:22 +02:00
|
|
|
|
exaPrepareAccessReg(DrawablePtr pDrawable, int index, RegionPtr pReg)
|
2007-09-05 20:10:09 +02:00
|
|
|
|
{
|
|
|
|
|
ExaMigrationRec pixmaps[1];
|
|
|
|
|
|
2009-02-27 22:26:52 +01:00
|
|
|
|
if (index == EXA_PREPARE_DEST || index == EXA_PREPARE_AUX_DEST) {
|
|
|
|
|
pixmaps[0].as_dst = TRUE;
|
|
|
|
|
pixmaps[0].as_src = FALSE;
|
|
|
|
|
} else {
|
|
|
|
|
pixmaps[0].as_dst = FALSE;
|
|
|
|
|
pixmaps[0].as_src = TRUE;
|
|
|
|
|
}
|
2007-09-05 20:10:09 +02:00
|
|
|
|
pixmaps[0].pPix = exaGetDrawablePixmap (pDrawable);
|
2007-08-29 19:55:22 +02:00
|
|
|
|
pixmaps[0].pReg = pReg;
|
2007-09-05 20:10:09 +02:00
|
|
|
|
|
|
|
|
|
exaDoMigration(pixmaps, 1, FALSE);
|
|
|
|
|
|
|
|
|
|
ExaDoPrepareAccess(pDrawable, index);
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-29 19:55:22 +02:00
|
|
|
|
/**
|
|
|
|
|
* exaPrepareAccess() is EXA's wrapper for the driver's PrepareAccess() handler.
|
|
|
|
|
*
|
|
|
|
|
* It deals with waiting for synchronization with the card, determining if
|
|
|
|
|
* PrepareAccess() is necessary, and working around PrepareAccess() failure.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
exaPrepareAccess(DrawablePtr pDrawable, int index)
|
|
|
|
|
{
|
|
|
|
|
exaPrepareAccessReg(pDrawable, index, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaFinishAccess() is EXA's wrapper for the driver's FinishAccess() handler.
|
|
|
|
|
*
|
2006-06-12 20:19:11 +02:00
|
|
|
|
* It deals with calling the driver's FinishAccess() only if necessary.
|
2006-03-15 01:13:52 +01:00
|
|
|
|
*/
|
2005-09-11 21:08:10 +02:00
|
|
|
|
void
|
|
|
|
|
exaFinishAccess(DrawablePtr pDrawable, int index)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = pDrawable->pScreen;
|
|
|
|
|
ExaScreenPriv (pScreen);
|
2007-09-06 13:10:16 +02:00
|
|
|
|
PixmapPtr pPixmap = exaGetDrawablePixmap (pDrawable);
|
|
|
|
|
ExaPixmapPriv (pPixmap);
|
2006-03-31 21:41:28 +02:00
|
|
|
|
|
2009-02-28 21:59:09 +01:00
|
|
|
|
if (!(pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (pExaPixmap == NULL)
|
|
|
|
|
EXA_FatalErrorDebugWithRet(("EXA bug: exaFinishAccesss was called on a non-exa pixmap.\n"),);
|
|
|
|
|
|
|
|
|
|
/* Avoid mismatching indices. */
|
|
|
|
|
if (pExaScr->prepare_access[index] != pPixmap)
|
|
|
|
|
EXA_FatalErrorDebug(("EXA bug: Calling FinishAccess on pixmap %p with index %d while "
|
|
|
|
|
"it should have been %p.\n", pPixmap, index, pExaScr->prepare_access[index]));
|
|
|
|
|
pExaScr->prepare_access[index] = NULL;
|
|
|
|
|
|
|
|
|
|
/* We always hide the devPrivate.ptr. */
|
|
|
|
|
pPixmap->devPrivate.ptr = NULL;
|
2006-03-31 21:41:28 +02:00
|
|
|
|
|
2006-03-09 07:04:07 +01:00
|
|
|
|
if (pExaScr->info->FinishAccess == NULL)
|
2005-09-11 21:08:10 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!exaPixmapIsOffscreen (pPixmap))
|
|
|
|
|
return;
|
|
|
|
|
|
2009-02-27 22:26:52 +01:00
|
|
|
|
if (index >= EXA_PREPARE_AUX_DEST &&
|
2009-02-27 16:37:28 +01:00
|
|
|
|
!(pExaScr->info->flags & EXA_SUPPORTS_PREPARE_AUX)) {
|
|
|
|
|
ErrorF("EXA bug: Trying to call driver FinishAccess hook with "
|
|
|
|
|
"unsupported index EXA_PREPARE_AUX*\n");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-09 07:04:07 +01:00
|
|
|
|
(*pExaScr->info->FinishAccess) (pPixmap, index);
|
2005-09-11 21:08:10 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
2009-01-31 18:53:52 +01:00
|
|
|
|
* Here begins EXA's GC code.
|
|
|
|
|
* Do not ever access the fb/mi layer directly.
|
2006-03-15 01:13:52 +01:00
|
|
|
|
*/
|
2009-01-31 18:53:52 +01:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaValidateGC(GCPtr pGC,
|
|
|
|
|
unsigned long changes,
|
|
|
|
|
DrawablePtr pDrawable);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaDestroyGC(GCPtr pGC);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaChangeGC (GCPtr pGC,
|
|
|
|
|
unsigned long mask);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaCopyGC (GCPtr pGCSrc,
|
|
|
|
|
unsigned long mask,
|
|
|
|
|
GCPtr pGCDst);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaChangeClip (GCPtr pGC,
|
|
|
|
|
int type,
|
|
|
|
|
pointer pvalue,
|
|
|
|
|
int nrects);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaDestroyClip(GCPtr pGC);
|
|
|
|
|
|
|
|
|
|
const GCFuncs exaGCFuncs = {
|
|
|
|
|
exaValidateGC,
|
|
|
|
|
exaChangeGC,
|
|
|
|
|
exaCopyGC,
|
|
|
|
|
exaDestroyGC,
|
|
|
|
|
exaChangeClip,
|
|
|
|
|
exaDestroyClip,
|
|
|
|
|
exaCopyClip
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This wrapper exists to allow fbValidateGC to work.
|
2009-02-08 18:43:15 +01:00
|
|
|
|
* Note that we no longer assume newly created pixmaps to be in normal ram.
|
|
|
|
|
* This assumption is certainly not garuanteed with driver allocated pixmaps.
|
2009-01-31 18:53:52 +01:00
|
|
|
|
*/
|
|
|
|
|
static PixmapPtr
|
|
|
|
|
exaCreatePixmapWithPrepare(ScreenPtr pScreen, int w, int h, int depth,
|
|
|
|
|
unsigned usage_hint)
|
|
|
|
|
{
|
|
|
|
|
PixmapPtr pPixmap;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
|
|
|
|
|
/* This swaps between this function and the real upper layer function.
|
|
|
|
|
* Normally this would swap to the fb layer pointer, this is a very special case.
|
|
|
|
|
*/
|
|
|
|
|
swap(pExaScr, pScreen, CreatePixmap);
|
|
|
|
|
pPixmap = pScreen->CreatePixmap(pScreen, w, h, depth, usage_hint);
|
|
|
|
|
swap(pExaScr, pScreen, CreatePixmap);
|
|
|
|
|
|
|
|
|
|
if (!pPixmap)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2009-03-02 17:05:28 +01:00
|
|
|
|
/* Note the usage of ExaDoPrepareAccess, this allowed because:
|
|
|
|
|
* The pixmap is new, so not offscreen in the classic exa case.
|
|
|
|
|
* For EXA_HANDLES_PIXMAPS the driver will handle whatever is needed.
|
|
|
|
|
* We want to signal that the pixmaps will be used as destination.
|
|
|
|
|
*/
|
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_DEST] == NULL) {
|
|
|
|
|
ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_DEST);
|
|
|
|
|
pExaScr->prepare_access[EXA_PREPARE_DEST] = pPixmap;
|
|
|
|
|
} else if (pExaScr->prepare_access[EXA_PREPARE_AUX_DEST] == NULL) {
|
|
|
|
|
ExaDoPrepareAccess(&pPixmap->drawable, EXA_PREPARE_AUX_DEST);
|
|
|
|
|
pExaScr->prepare_access[EXA_PREPARE_AUX_DEST] = pPixmap;
|
|
|
|
|
} else {
|
|
|
|
|
FatalError("exaCreatePixmapWithPrepare can only accomodate two pixmaps, we're at three.\n");
|
|
|
|
|
}
|
2009-01-31 18:53:52 +01:00
|
|
|
|
|
|
|
|
|
return pPixmap;
|
|
|
|
|
}
|
|
|
|
|
|
2009-03-02 17:05:28 +01:00
|
|
|
|
static Bool
|
|
|
|
|
exaDestroyPixmapWithFinish(PixmapPtr pPixmap)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = pPixmap->drawable.pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
int i;
|
|
|
|
|
Bool ret;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
|
if (pExaScr->prepare_access[i] == pPixmap)
|
|
|
|
|
exaFinishAccess(&pPixmap->drawable, i);
|
|
|
|
|
|
|
|
|
|
/* This swaps between this function and the real upper layer function.
|
|
|
|
|
* Normally this would swap to the fb layer pointer, this is a very special case.
|
|
|
|
|
*/
|
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
ret = pScreen->DestroyPixmap(pPixmap);
|
|
|
|
|
swap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
static void
|
2009-01-31 18:53:52 +01:00
|
|
|
|
exaValidateGC(GCPtr pGC,
|
|
|
|
|
unsigned long changes,
|
|
|
|
|
DrawablePtr pDrawable)
|
2005-07-01 10:56:12 +02:00
|
|
|
|
{
|
2006-04-02 01:28:17 +02:00
|
|
|
|
/* fbValidateGC will do direct access to pixmaps if the tiling has changed.
|
2009-01-31 18:53:52 +01:00
|
|
|
|
* Do a few smart things so fbValidateGC can do it's work.
|
2006-04-02 01:28:17 +02:00
|
|
|
|
*/
|
|
|
|
|
|
2009-01-31 18:53:52 +01:00
|
|
|
|
ScreenPtr pScreen = pDrawable->pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
CreatePixmapProcPtr old_ptr = NULL;
|
2009-03-02 17:05:28 +01:00
|
|
|
|
DestroyPixmapProcPtr old_ptr2 = NULL;
|
2009-01-31 18:53:52 +01:00
|
|
|
|
PixmapPtr pTile = NULL;
|
|
|
|
|
EXA_GC_PROLOGUE(pGC);
|
2009-02-08 18:43:15 +01:00
|
|
|
|
|
|
|
|
|
/* save the "fb" pointer. */
|
|
|
|
|
old_ptr = pExaScr->SavedCreatePixmap;
|
|
|
|
|
/* create a new upper layer pointer. */
|
|
|
|
|
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmapWithPrepare);
|
|
|
|
|
|
2009-03-02 17:05:28 +01:00
|
|
|
|
/* save the "fb" pointer. */
|
|
|
|
|
old_ptr2 = pExaScr->SavedDestroyPixmap;
|
|
|
|
|
/* create a new upper layer pointer. */
|
|
|
|
|
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmapWithFinish);
|
|
|
|
|
|
2009-02-08 18:43:15 +01:00
|
|
|
|
/* Either of these conditions is enough to trigger access to a tile pixmap. */
|
|
|
|
|
/* With pGC->tileIsPixel == 1, you run the risk of dereferencing an invalid tile pixmap pointer. */
|
|
|
|
|
if (pGC->fillStyle == FillTiled || ((changes & GCTile) && !pGC->tileIsPixel)) {
|
|
|
|
|
pTile = pGC->tile.pixmap;
|
|
|
|
|
|
|
|
|
|
/* Sometimes tile pixmaps are swapped, you need access to:
|
|
|
|
|
* - The current tile if it depth matches.
|
|
|
|
|
* - Or the rotated tile if that one matches depth and !(changes & GCTile).
|
|
|
|
|
* - Or the current tile pixmap and a newly created one.
|
|
|
|
|
*/
|
|
|
|
|
if (pTile && pTile->drawable.depth != pDrawable->depth && !(changes & GCTile)) {
|
|
|
|
|
PixmapPtr pRotatedTile = fbGetRotatedPixmap(pGC);
|
|
|
|
|
if (pRotatedTile->drawable.depth == pDrawable->depth)
|
|
|
|
|
pTile = pRotatedTile;
|
2006-04-02 01:28:17 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-02-08 18:43:15 +01:00
|
|
|
|
|
|
|
|
|
if (pGC->stipple)
|
|
|
|
|
exaPrepareAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
|
|
|
|
|
if (pTile)
|
|
|
|
|
exaPrepareAccess(&pTile->drawable, EXA_PREPARE_SRC);
|
|
|
|
|
|
|
|
|
|
(*pGC->funcs->ValidateGC)(pGC, changes, pDrawable);
|
|
|
|
|
|
2009-03-02 17:05:28 +01:00
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_SRC]) /* tile */
|
|
|
|
|
exaFinishAccess(&pExaScr->prepare_access[EXA_PREPARE_SRC]->drawable, EXA_PREPARE_SRC);
|
2009-02-08 18:43:15 +01:00
|
|
|
|
if (pGC->stipple)
|
|
|
|
|
exaFinishAccess(&pGC->stipple->drawable, EXA_PREPARE_MASK);
|
|
|
|
|
|
|
|
|
|
/* switch back to the normal upper layer. */
|
|
|
|
|
unwrap(pExaScr, pScreen, CreatePixmap);
|
|
|
|
|
/* restore copy of fb layer pointer. */
|
|
|
|
|
pExaScr->SavedCreatePixmap = old_ptr;
|
|
|
|
|
|
2009-03-02 17:05:28 +01:00
|
|
|
|
/* switch back to the normal upper layer. */
|
|
|
|
|
unwrap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
/* restore copy of fb layer pointer. */
|
|
|
|
|
pExaScr->SavedDestroyPixmap = old_ptr2;
|
|
|
|
|
|
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_DEST])
|
|
|
|
|
exaFinishAccess(&pExaScr->prepare_access[EXA_PREPARE_DEST]->drawable,
|
|
|
|
|
EXA_PREPARE_DEST);
|
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_AUX_DEST])
|
|
|
|
|
exaFinishAccess(&pExaScr->prepare_access[EXA_PREPARE_AUX_DEST]->drawable,
|
|
|
|
|
EXA_PREPARE_AUX_DEST);
|
|
|
|
|
|
2009-01-31 18:53:52 +01:00
|
|
|
|
EXA_GC_EPILOGUE(pGC);
|
|
|
|
|
}
|
2006-04-02 01:28:17 +02:00
|
|
|
|
|
2009-01-31 18:53:52 +01:00
|
|
|
|
/* Is exaPrepareAccessGC() needed? */
|
|
|
|
|
static void
|
|
|
|
|
exaDestroyGC(GCPtr pGC)
|
|
|
|
|
{
|
|
|
|
|
EXA_GC_PROLOGUE (pGC);
|
|
|
|
|
(*pGC->funcs->DestroyGC)(pGC);
|
|
|
|
|
EXA_GC_EPILOGUE (pGC);
|
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2009-01-31 18:53:52 +01:00
|
|
|
|
static void
|
|
|
|
|
exaChangeGC (GCPtr pGC,
|
|
|
|
|
unsigned long mask)
|
|
|
|
|
{
|
|
|
|
|
EXA_GC_PROLOGUE (pGC);
|
|
|
|
|
(*pGC->funcs->ChangeGC) (pGC, mask);
|
|
|
|
|
EXA_GC_EPILOGUE (pGC);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2009-01-31 18:53:52 +01:00
|
|
|
|
static void
|
|
|
|
|
exaCopyGC (GCPtr pGCSrc,
|
|
|
|
|
unsigned long mask,
|
|
|
|
|
GCPtr pGCDst)
|
|
|
|
|
{
|
|
|
|
|
EXA_GC_PROLOGUE (pGCDst);
|
|
|
|
|
(*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
|
|
|
|
|
EXA_GC_EPILOGUE (pGCDst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaChangeClip (GCPtr pGC,
|
|
|
|
|
int type,
|
|
|
|
|
pointer pvalue,
|
|
|
|
|
int nrects)
|
|
|
|
|
{
|
|
|
|
|
EXA_GC_PROLOGUE (pGC);
|
|
|
|
|
(*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
|
|
|
|
|
EXA_GC_EPILOGUE (pGC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaCopyClip(GCPtr pGCDst, GCPtr pGCSrc)
|
|
|
|
|
{
|
|
|
|
|
EXA_GC_PROLOGUE (pGCDst);
|
|
|
|
|
(*pGCDst->funcs->CopyClip)(pGCDst, pGCSrc);
|
|
|
|
|
EXA_GC_EPILOGUE (pGCDst);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
exaDestroyClip(GCPtr pGC)
|
|
|
|
|
{
|
|
|
|
|
EXA_GC_PROLOGUE (pGC);
|
|
|
|
|
(*pGC->funcs->DestroyClip)(pGC);
|
|
|
|
|
EXA_GC_EPILOGUE (pGC);
|
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaCreateGC makes a new GC and hooks up its funcs handler, so that
|
|
|
|
|
* exaValidateGC() will get called.
|
|
|
|
|
*/
|
2005-07-01 10:56:12 +02:00
|
|
|
|
static int
|
|
|
|
|
exaCreateGC (GCPtr pGC)
|
|
|
|
|
{
|
2009-01-31 18:53:52 +01:00
|
|
|
|
ScreenPtr pScreen = pGC->pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
2009-01-31 16:30:31 +01:00
|
|
|
|
ExaGCPriv(pGC);
|
2009-01-31 18:53:52 +01:00
|
|
|
|
Bool ret;
|
2009-01-31 16:30:31 +01:00
|
|
|
|
|
2009-01-31 18:53:52 +01:00
|
|
|
|
swap(pExaScr, pScreen, CreateGC);
|
|
|
|
|
if ((ret = (*pScreen->CreateGC) (pGC))) {
|
|
|
|
|
wrap(pExaGC, pGC, funcs, (GCFuncs *) &exaGCFuncs);
|
|
|
|
|
wrap(pExaGC, pGC, ops, (GCOps *) &exaOps);
|
|
|
|
|
}
|
|
|
|
|
swap(pExaScr, pScreen, CreateGC);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2009-01-31 18:53:52 +01:00
|
|
|
|
return ret;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-08-19 11:36:12 +02:00
|
|
|
|
static Bool
|
|
|
|
|
exaChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
|
2007-07-17 09:16:51 +02:00
|
|
|
|
{
|
2008-08-19 11:36:12 +02:00
|
|
|
|
Bool ret;
|
2009-01-31 19:25:20 +01:00
|
|
|
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
2009-03-02 17:05:28 +01:00
|
|
|
|
CreatePixmapProcPtr old_ptr = NULL;
|
|
|
|
|
DestroyPixmapProcPtr old_ptr2 = NULL;
|
|
|
|
|
|
|
|
|
|
/* save the "fb" pointer. */
|
|
|
|
|
old_ptr = pExaScr->SavedCreatePixmap;
|
|
|
|
|
/* create a new upper layer pointer. */
|
|
|
|
|
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmapWithPrepare);
|
|
|
|
|
|
|
|
|
|
/* save the "fb" pointer. */
|
|
|
|
|
old_ptr2 = pExaScr->SavedDestroyPixmap;
|
|
|
|
|
/* create a new upper layer pointer. */
|
|
|
|
|
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmapWithFinish);
|
2008-08-19 11:36:12 +02:00
|
|
|
|
|
|
|
|
|
if ((mask & CWBackPixmap) && pWin->backgroundState == BackgroundPixmap)
|
2009-03-02 17:05:28 +01:00
|
|
|
|
exaPrepareAccess(&pWin->background.pixmap->drawable, EXA_PREPARE_SRC);
|
2007-07-17 09:16:51 +02:00
|
|
|
|
|
2008-08-19 11:36:12 +02:00
|
|
|
|
if ((mask & CWBorderPixmap) && pWin->borderIsPixel == FALSE)
|
2009-03-02 17:05:28 +01:00
|
|
|
|
exaPrepareAccess(&pWin->border.pixmap->drawable, EXA_PREPARE_MASK);
|
2007-07-17 09:16:51 +02:00
|
|
|
|
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, ChangeWindowAttributes);
|
|
|
|
|
ret = pScreen->ChangeWindowAttributes(pWin, mask);
|
|
|
|
|
swap(pExaScr, pScreen, ChangeWindowAttributes);
|
2007-07-17 09:16:51 +02:00
|
|
|
|
|
2009-03-02 17:05:28 +01:00
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_SRC]) /* background */
|
|
|
|
|
exaFinishAccess(&pExaScr->prepare_access[EXA_PREPARE_SRC]->drawable, EXA_PREPARE_SRC);
|
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_MASK]) /* border */
|
|
|
|
|
exaFinishAccess(&pExaScr->prepare_access[EXA_PREPARE_MASK]->drawable, EXA_PREPARE_MASK);
|
2007-07-17 09:16:51 +02:00
|
|
|
|
|
2009-03-02 17:05:28 +01:00
|
|
|
|
/* switch back to the normal upper layer. */
|
|
|
|
|
unwrap(pExaScr, pScreen, CreatePixmap);
|
|
|
|
|
/* restore copy of fb layer pointer. */
|
|
|
|
|
pExaScr->SavedCreatePixmap = old_ptr;
|
|
|
|
|
|
|
|
|
|
/* switch back to the normal upper layer. */
|
|
|
|
|
unwrap(pExaScr, pScreen, DestroyPixmap);
|
|
|
|
|
/* restore copy of fb layer pointer. */
|
|
|
|
|
pExaScr->SavedDestroyPixmap = old_ptr2;
|
|
|
|
|
|
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_DEST])
|
|
|
|
|
exaFinishAccess(&pExaScr->prepare_access[EXA_PREPARE_DEST]->drawable,
|
|
|
|
|
EXA_PREPARE_DEST);
|
|
|
|
|
if (pExaScr->prepare_access[EXA_PREPARE_AUX_DEST])
|
|
|
|
|
exaFinishAccess(&pExaScr->prepare_access[EXA_PREPARE_AUX_DEST]->drawable,
|
|
|
|
|
EXA_PREPARE_AUX_DEST);
|
2007-07-17 09:16:51 +02:00
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static RegionPtr
|
|
|
|
|
exaBitmapToRegion(PixmapPtr pPix)
|
|
|
|
|
{
|
2008-12-19 23:12:37 +01:00
|
|
|
|
RegionPtr ret;
|
2009-01-31 19:25:20 +01:00
|
|
|
|
ScreenPtr pScreen = pPix->drawable.pScreen;
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
|
2008-12-19 23:12:37 +01:00
|
|
|
|
exaPrepareAccess(&pPix->drawable, EXA_PREPARE_SRC);
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, BitmapToRegion);
|
|
|
|
|
ret = pScreen->BitmapToRegion(pPix);
|
|
|
|
|
swap(pExaScr, pScreen, BitmapToRegion);
|
2008-12-19 23:12:37 +01:00
|
|
|
|
exaFinishAccess(&pPix->drawable, EXA_PREPARE_SRC);
|
2009-01-31 19:25:20 +01:00
|
|
|
|
|
2008-12-19 23:12:37 +01:00
|
|
|
|
return ret;
|
2007-07-17 09:16:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-04-21 11:22:07 +02:00
|
|
|
|
static Bool
|
|
|
|
|
exaCreateScreenResources(ScreenPtr pScreen)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
PixmapPtr pScreenPixmap;
|
|
|
|
|
Bool b;
|
|
|
|
|
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, CreateScreenResources);
|
2008-04-21 11:22:07 +02:00
|
|
|
|
b = pScreen->CreateScreenResources(pScreen);
|
2009-01-31 19:25:20 +01:00
|
|
|
|
swap(pExaScr, pScreen, CreateScreenResources);
|
2008-04-21 11:22:07 +02:00
|
|
|
|
|
|
|
|
|
if (!b)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
pScreenPixmap = pScreen->GetScreenPixmap(pScreen);
|
|
|
|
|
|
|
|
|
|
if (pScreenPixmap) {
|
|
|
|
|
ExaPixmapPriv(pScreenPixmap);
|
|
|
|
|
|
|
|
|
|
exaSetAccelBlock(pExaScr, pExaPixmap,
|
|
|
|
|
pScreenPixmap->drawable.width,
|
|
|
|
|
pScreenPixmap->drawable.height,
|
|
|
|
|
pScreenPixmap->drawable.bitsPerPixel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-05-18 17:48:57 +02:00
|
|
|
|
static void
|
|
|
|
|
ExaBlockHandler(int screenNum, pointer blockData, pointer pTimeout,
|
|
|
|
|
pointer pReadmask)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = screenInfo.screens[screenNum];
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
|
|
|
|
|
unwrap(pExaScr, pScreen, BlockHandler);
|
|
|
|
|
(*pScreen->BlockHandler) (screenNum, blockData, pTimeout, pReadmask);
|
|
|
|
|
wrap(pExaScr, pScreen, BlockHandler, ExaBlockHandler);
|
|
|
|
|
|
|
|
|
|
/* Try and keep the offscreen memory area tidy every now and then (at most
|
|
|
|
|
* once per second) when the server has been idle for at least 100ms.
|
|
|
|
|
*/
|
|
|
|
|
if (pExaScr->numOffscreenAvailable > 1) {
|
|
|
|
|
CARD32 now = GetTimeInMillis();
|
|
|
|
|
|
|
|
|
|
pExaScr->nextDefragment = now +
|
|
|
|
|
max(100, (INT32)(pExaScr->lastDefragment + 1000 - now));
|
|
|
|
|
AdjustWaitForDelay(pTimeout, pExaScr->nextDefragment - now);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
ExaWakeupHandler(int screenNum, pointer wakeupData, unsigned long result,
|
|
|
|
|
pointer pReadmask)
|
|
|
|
|
{
|
|
|
|
|
ScreenPtr pScreen = screenInfo.screens[screenNum];
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
|
|
|
|
|
unwrap(pExaScr, pScreen, WakeupHandler);
|
|
|
|
|
(*pScreen->WakeupHandler) (screenNum, wakeupData, result, pReadmask);
|
|
|
|
|
wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler);
|
|
|
|
|
|
|
|
|
|
if (result == 0 && pExaScr->numOffscreenAvailable > 1) {
|
|
|
|
|
CARD32 now = GetTimeInMillis();
|
|
|
|
|
|
|
|
|
|
if ((int)(now - pExaScr->nextDefragment) > 0) {
|
|
|
|
|
ExaOffscreenDefragment(pScreen);
|
|
|
|
|
pExaScr->lastDefragment = now;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-15 01:13:52 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaCloseScreen() unwraps its wrapped screen functions and tears down EXA's
|
|
|
|
|
* screen private, before calling down to the next CloseSccreen.
|
|
|
|
|
*/
|
2005-07-04 16:15:57 +02:00
|
|
|
|
static Bool
|
|
|
|
|
exaCloseScreen(int i, ScreenPtr pScreen)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
#ifdef RENDER
|
|
|
|
|
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-08-19 11:22:40 +02:00
|
|
|
|
if (ps->Glyphs == exaGlyphs)
|
|
|
|
|
exaGlyphsFini(pScreen);
|
2008-04-28 21:00:54 +02:00
|
|
|
|
|
2009-05-18 17:48:57 +02:00
|
|
|
|
if (pScreen->BlockHandler == ExaBlockHandler)
|
|
|
|
|
unwrap(pExaScr, pScreen, BlockHandler);
|
|
|
|
|
if (pScreen->WakeupHandler == ExaWakeupHandler)
|
|
|
|
|
unwrap(pExaScr, pScreen, WakeupHandler);
|
2009-01-31 19:25:20 +01:00
|
|
|
|
unwrap(pExaScr, pScreen, CreateGC);
|
|
|
|
|
unwrap(pExaScr, pScreen, CloseScreen);
|
|
|
|
|
unwrap(pExaScr, pScreen, GetImage);
|
|
|
|
|
unwrap(pExaScr, pScreen, GetSpans);
|
|
|
|
|
if (pExaScr->SavedCreatePixmap)
|
|
|
|
|
unwrap(pExaScr, pScreen, CreatePixmap);
|
|
|
|
|
if (pExaScr->SavedDestroyPixmap)
|
|
|
|
|
unwrap(pExaScr, pScreen, DestroyPixmap);
|
2009-02-28 22:15:04 +01:00
|
|
|
|
if (pExaScr->SavedModifyPixmapHeader)
|
|
|
|
|
unwrap(pExaScr, pScreen, ModifyPixmapHeader);
|
2009-01-31 19:25:20 +01:00
|
|
|
|
unwrap(pExaScr, pScreen, CopyWindow);
|
|
|
|
|
unwrap(pExaScr, pScreen, ChangeWindowAttributes);
|
|
|
|
|
unwrap(pExaScr, pScreen, BitmapToRegion);
|
|
|
|
|
unwrap(pExaScr, pScreen, CreateScreenResources);
|
2005-07-04 16:15:57 +02:00
|
|
|
|
#ifdef RENDER
|
|
|
|
|
if (ps) {
|
2009-01-31 19:25:20 +01:00
|
|
|
|
unwrap(pExaScr, ps, Composite);
|
|
|
|
|
if (pExaScr->SavedGlyphs)
|
|
|
|
|
unwrap(pExaScr, ps, Glyphs);
|
|
|
|
|
unwrap(pExaScr, ps, Trapezoids);
|
|
|
|
|
unwrap(pExaScr, ps, Triangles);
|
|
|
|
|
unwrap(pExaScr, ps, AddTraps);
|
2005-07-04 16:15:57 +02:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
xfree (pExaScr);
|
|
|
|
|
|
|
|
|
|
return (*pScreen->CloseScreen) (i, pScreen);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-09 07:04:07 +01:00
|
|
|
|
/**
|
|
|
|
|
* This function allocates a driver structure for EXA drivers to fill in. By
|
|
|
|
|
* having EXA allocate the structure, the driver structure can be extended
|
|
|
|
|
* without breaking ABI between EXA and the drivers. The driver's
|
|
|
|
|
* responsibility is to check beforehand that the EXA module has a matching
|
|
|
|
|
* major number and sufficient minor. Drivers are responsible for freeing the
|
|
|
|
|
* driver structure using xfree().
|
2006-03-10 00:18:15 +01:00
|
|
|
|
*
|
|
|
|
|
* @return a newly allocated, zero-filled driver structure
|
2006-03-09 07:04:07 +01:00
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
ExaDriverPtr
|
2006-03-09 07:04:07 +01:00
|
|
|
|
exaDriverAlloc(void)
|
|
|
|
|
{
|
|
|
|
|
return xcalloc(1, sizeof(ExaDriverRec));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2006-03-10 00:18:15 +01:00
|
|
|
|
* @param pScreen screen being initialized
|
|
|
|
|
* @param pScreenInfo EXA driver record
|
|
|
|
|
*
|
2006-03-09 07:04:07 +01:00
|
|
|
|
* exaDriverInit sets up EXA given a driver record filled in by the driver.
|
2006-03-10 00:18:15 +01:00
|
|
|
|
* pScreenInfo should have been allocated by exaDriverAlloc(). See the
|
|
|
|
|
* comments in _ExaDriver for what must be filled in and what is optional.
|
|
|
|
|
*
|
|
|
|
|
* @return TRUE if EXA was successfully initialized.
|
2006-03-09 07:04:07 +01:00
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
Bool
|
2005-07-01 10:56:12 +02:00
|
|
|
|
exaDriverInit (ScreenPtr pScreen,
|
|
|
|
|
ExaDriverPtr pScreenInfo)
|
|
|
|
|
{
|
|
|
|
|
ExaScreenPrivPtr pExaScr;
|
2006-06-07 10:46:00 +02:00
|
|
|
|
#ifdef RENDER
|
|
|
|
|
PictureScreenPtr ps;
|
|
|
|
|
#endif
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2007-07-17 12:12:02 +02:00
|
|
|
|
if (!pScreenInfo)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2007-09-22 13:02:08 +02:00
|
|
|
|
if (pScreenInfo->exa_major != EXA_VERSION_MAJOR ||
|
|
|
|
|
pScreenInfo->exa_minor > EXA_VERSION_MINOR)
|
|
|
|
|
{
|
|
|
|
|
LogMessage(X_ERROR, "EXA(%d): driver's EXA version requirements "
|
|
|
|
|
"(%d.%d) are incompatible with EXA version (%d.%d)\n",
|
|
|
|
|
pScreen->myNum,
|
|
|
|
|
pScreenInfo->exa_major, pScreenInfo->exa_minor,
|
|
|
|
|
EXA_VERSION_MAJOR, EXA_VERSION_MINOR);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-06-09 01:14:50 +02:00
|
|
|
|
if (!pScreenInfo->CreatePixmap && !pScreenInfo->CreatePixmap2) {
|
2007-08-03 08:33:33 +02:00
|
|
|
|
if (!pScreenInfo->memoryBase) {
|
|
|
|
|
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memoryBase "
|
|
|
|
|
"must be non-zero\n", pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-07-17 12:12:02 +02:00
|
|
|
|
|
2007-08-03 08:33:33 +02:00
|
|
|
|
if (!pScreenInfo->memorySize) {
|
|
|
|
|
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memorySize must be "
|
|
|
|
|
"non-zero\n", pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-07-17 12:12:02 +02:00
|
|
|
|
|
2007-08-03 08:33:33 +02:00
|
|
|
|
if (pScreenInfo->offScreenBase > pScreenInfo->memorySize) {
|
|
|
|
|
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::offScreenBase must "
|
|
|
|
|
"be <= ExaDriverRec::memorySize\n", pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2007-07-17 12:12:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!pScreenInfo->PrepareSolid) {
|
|
|
|
|
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareSolid must be "
|
|
|
|
|
"non-NULL\n", pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!pScreenInfo->PrepareCopy) {
|
|
|
|
|
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareCopy must be "
|
|
|
|
|
"non-NULL\n", pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!pScreenInfo->WaitMarker) {
|
|
|
|
|
LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::WaitMarker must be "
|
|
|
|
|
"non-NULL\n", pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2007-09-24 22:06:52 +02:00
|
|
|
|
/* If the driver doesn't set any max pitch values, we'll just assume
|
|
|
|
|
* that there's a limitation by pixels, and that it's the same as
|
|
|
|
|
* maxX.
|
2007-09-27 22:36:52 +02:00
|
|
|
|
*
|
|
|
|
|
* We want maxPitchPixels or maxPitchBytes to be set so we can check
|
|
|
|
|
* pixmaps against the max pitch in exaCreatePixmap() -- it matters
|
|
|
|
|
* whether a pixmap is rejected because of its pitch or
|
|
|
|
|
* because of its width.
|
2007-09-24 22:06:52 +02:00
|
|
|
|
*/
|
|
|
|
|
if (!pScreenInfo->maxPitchPixels && !pScreenInfo->maxPitchBytes)
|
2006-03-09 07:04:07 +01:00
|
|
|
|
{
|
2007-09-24 22:06:52 +02:00
|
|
|
|
pScreenInfo->maxPitchPixels = pScreenInfo->maxX;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#ifdef RENDER
|
2006-06-07 10:46:00 +02:00
|
|
|
|
ps = GetPictureScreenIfSet(pScreen);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#endif
|
|
|
|
|
|
2005-07-09 16:15:35 +02:00
|
|
|
|
pExaScr = xcalloc (sizeof (ExaScreenPrivRec), 1);
|
2005-08-26 22:21:57 +02:00
|
|
|
|
if (!pExaScr) {
|
2006-02-16 01:14:11 +01:00
|
|
|
|
LogMessage(X_WARNING, "EXA(%d): Failed to allocate screen private\n",
|
|
|
|
|
pScreen->myNum);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
return FALSE;
|
2005-08-26 22:21:57 +02:00
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
|
|
|
|
pExaScr->info = pScreenInfo;
|
|
|
|
|
|
2007-08-28 15:28:25 +02:00
|
|
|
|
dixSetPrivate(&pScreen->devPrivates, exaScreenPrivateKey, pExaScr);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2006-12-28 22:21:25 +01:00
|
|
|
|
pExaScr->migration = ExaMigrationAlways;
|
2006-03-15 02:20:08 +01:00
|
|
|
|
|
2006-02-16 01:14:11 +01:00
|
|
|
|
exaDDXDriverInit(pScreen);
|
|
|
|
|
|
2009-01-31 16:30:31 +01:00
|
|
|
|
if (!dixRequestPrivate(exaGCPrivateKey, sizeof(ExaGCPrivRec))) {
|
|
|
|
|
LogMessage(X_WARNING,
|
|
|
|
|
"EXA(%d): Failed to allocate GC private\n",
|
|
|
|
|
pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
/*
|
|
|
|
|
* Replace various fb screen functions
|
|
|
|
|
*/
|
2009-05-18 17:48:57 +02:00
|
|
|
|
if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) &&
|
|
|
|
|
!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
|
|
|
|
|
wrap(pExaScr, pScreen, BlockHandler, ExaBlockHandler);
|
|
|
|
|
wrap(pExaScr, pScreen, WakeupHandler, ExaWakeupHandler);
|
|
|
|
|
}
|
2009-01-31 19:25:20 +01:00
|
|
|
|
wrap(pExaScr, pScreen, CreateGC, exaCreateGC);
|
|
|
|
|
wrap(pExaScr, pScreen, CloseScreen, exaCloseScreen);
|
|
|
|
|
wrap(pExaScr, pScreen, GetImage, exaGetImage);
|
|
|
|
|
wrap(pExaScr, pScreen, GetSpans, ExaCheckGetSpans);
|
|
|
|
|
wrap(pExaScr, pScreen, CopyWindow, exaCopyWindow);
|
|
|
|
|
wrap(pExaScr, pScreen, ChangeWindowAttributes, exaChangeWindowAttributes);
|
|
|
|
|
wrap(pExaScr, pScreen, BitmapToRegion, exaBitmapToRegion);
|
|
|
|
|
wrap(pExaScr, pScreen, CreateScreenResources, exaCreateScreenResources);
|
2008-04-21 11:22:07 +02:00
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
#ifdef RENDER
|
|
|
|
|
if (ps) {
|
2009-01-31 19:25:20 +01:00
|
|
|
|
wrap(pExaScr, ps, Composite, exaComposite);
|
|
|
|
|
if (pScreenInfo->PrepareComposite)
|
|
|
|
|
wrap(pExaScr, ps, Glyphs, exaGlyphs);
|
|
|
|
|
wrap(pExaScr, ps, Trapezoids, exaTrapezoids);
|
|
|
|
|
wrap(pExaScr, ps, Triangles, exaTriangles);
|
|
|
|
|
wrap(pExaScr, ps, AddTraps, ExaCheckAddTraps);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2008-09-16 17:13:42 +02:00
|
|
|
|
#ifdef MITSHM
|
|
|
|
|
/*
|
|
|
|
|
* Don't allow shared pixmaps.
|
|
|
|
|
*/
|
|
|
|
|
ShmRegisterFuncs(pScreen, &exaShmFuncs);
|
|
|
|
|
#endif
|
2005-07-01 10:56:12 +02:00
|
|
|
|
/*
|
|
|
|
|
* Hookup offscreen pixmaps
|
|
|
|
|
*/
|
2007-08-03 08:33:33 +02:00
|
|
|
|
if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS)
|
2005-07-01 10:56:12 +02:00
|
|
|
|
{
|
2007-08-28 15:28:25 +02:00
|
|
|
|
if (!dixRequestPrivate(exaPixmapPrivateKey, sizeof(ExaPixmapPrivRec))) {
|
2006-02-16 01:14:11 +01:00
|
|
|
|
LogMessage(X_WARNING,
|
|
|
|
|
"EXA(%d): Failed to allocate pixmap private\n",
|
|
|
|
|
pScreen->myNum);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
return FALSE;
|
2005-08-26 22:21:57 +02:00
|
|
|
|
}
|
2009-01-31 19:25:20 +01:00
|
|
|
|
wrap(pExaScr, pScreen, CreatePixmap, exaCreatePixmap);
|
|
|
|
|
wrap(pExaScr, pScreen, DestroyPixmap, exaDestroyPixmap);
|
2006-06-19 04:12:15 +02:00
|
|
|
|
|
2009-02-28 22:15:04 +01:00
|
|
|
|
wrap(pExaScr, pScreen, ModifyPixmapHeader, exaModifyPixmapHeader);
|
2009-04-23 04:04:17 +02:00
|
|
|
|
if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
|
2007-08-03 08:33:33 +02:00
|
|
|
|
LogMessage(X_INFO, "EXA(%d): Offscreen pixmap area of %lu bytes\n",
|
|
|
|
|
pScreen->myNum,
|
|
|
|
|
pExaScr->info->memorySize - pExaScr->info->offScreenBase);
|
|
|
|
|
} else {
|
|
|
|
|
LogMessage(X_INFO, "EXA(%d): Driver allocated offscreen pixmaps\n",
|
|
|
|
|
pScreen->myNum);
|
2007-10-02 06:03:39 +02:00
|
|
|
|
|
2007-08-03 08:33:33 +02:00
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
2006-02-16 01:14:11 +01:00
|
|
|
|
LogMessage(X_INFO, "EXA(%d): No offscreen pixmaps\n", pScreen->myNum);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
|
2009-04-23 04:04:17 +02:00
|
|
|
|
if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS)) {
|
2007-08-03 08:33:33 +02:00
|
|
|
|
DBG_PIXMAP(("============== %ld < %ld\n", pExaScr->info->offScreenBase,
|
|
|
|
|
pExaScr->info->memorySize));
|
|
|
|
|
if (pExaScr->info->offScreenBase < pExaScr->info->memorySize) {
|
|
|
|
|
if (!exaOffscreenInit (pScreen)) {
|
|
|
|
|
LogMessage(X_WARNING, "EXA(%d): Offscreen pixmap setup failed\n",
|
|
|
|
|
pScreen->myNum);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2008-08-19 11:22:40 +02:00
|
|
|
|
if (ps->Glyphs == exaGlyphs)
|
|
|
|
|
exaGlyphsInit(pScreen);
|
2008-04-28 21:00:54 +02:00
|
|
|
|
|
2006-06-19 04:12:15 +02:00
|
|
|
|
LogMessage(X_INFO, "EXA(%d): Driver registered support for the following"
|
|
|
|
|
" operations:\n", pScreen->myNum);
|
|
|
|
|
assert(pScreenInfo->PrepareSolid != NULL);
|
|
|
|
|
LogMessage(X_INFO, " Solid\n");
|
|
|
|
|
assert(pScreenInfo->PrepareCopy != NULL);
|
|
|
|
|
LogMessage(X_INFO, " Copy\n");
|
|
|
|
|
if (pScreenInfo->PrepareComposite != NULL) {
|
|
|
|
|
LogMessage(X_INFO, " Composite (RENDER acceleration)\n");
|
|
|
|
|
}
|
|
|
|
|
if (pScreenInfo->UploadToScreen != NULL) {
|
|
|
|
|
LogMessage(X_INFO, " UploadToScreen\n");
|
|
|
|
|
}
|
|
|
|
|
if (pScreenInfo->DownloadFromScreen != NULL) {
|
|
|
|
|
LogMessage(X_INFO, " DownloadFromScreen\n");
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-01 10:56:12 +02:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaDriverFini tears down EXA on a given screen.
|
|
|
|
|
*
|
|
|
|
|
* @param pScreen screen being torn down.
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
void
|
2005-07-01 10:56:12 +02:00
|
|
|
|
exaDriverFini (ScreenPtr pScreen)
|
|
|
|
|
{
|
2005-07-04 16:15:57 +02:00
|
|
|
|
/*right now does nothing*/
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaMarkSync() should be called after any asynchronous drawing by the hardware.
|
|
|
|
|
*
|
|
|
|
|
* @param pScreen screen which drawing occurred on
|
|
|
|
|
*
|
|
|
|
|
* exaMarkSync() sets a flag to indicate that some asynchronous drawing has
|
|
|
|
|
* happened and a WaitSync() will be necessary before relying on the contents of
|
|
|
|
|
* offscreen memory from the CPU's perspective. It also calls an optional
|
|
|
|
|
* driver MarkSync() callback, the return value of which may be used to do partial
|
|
|
|
|
* synchronization with the hardware in the future.
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
void exaMarkSync(ScreenPtr pScreen)
|
2005-07-01 10:56:12 +02:00
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
|
2006-03-09 07:04:07 +01:00
|
|
|
|
pExaScr->info->needsSync = TRUE;
|
|
|
|
|
if (pExaScr->info->MarkSync != NULL) {
|
|
|
|
|
pExaScr->info->lastMarker = (*pExaScr->info->MarkSync)(pScreen);
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-10 00:18:15 +01:00
|
|
|
|
/**
|
|
|
|
|
* exaWaitSync() ensures that all drawing has been completed.
|
|
|
|
|
*
|
|
|
|
|
* @param pScreen screen being synchronized.
|
|
|
|
|
*
|
|
|
|
|
* Calls down into the driver to ensure that all previous drawing has completed.
|
|
|
|
|
* It should always be called before relying on the framebuffer contents
|
|
|
|
|
* reflecting previous drawing, from a CPU perspective.
|
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
|
void exaWaitSync(ScreenPtr pScreen)
|
2005-07-01 10:56:12 +02:00
|
|
|
|
{
|
|
|
|
|
ExaScreenPriv(pScreen);
|
|
|
|
|
|
2006-03-09 07:04:07 +01:00
|
|
|
|
if (pExaScr->info->needsSync && !pExaScr->swappedOut) {
|
|
|
|
|
(*pExaScr->info->WaitMarker)(pScreen, pExaScr->info->lastMarker);
|
|
|
|
|
pExaScr->info->needsSync = FALSE;
|
2005-07-01 10:56:12 +02:00
|
|
|
|
}
|
|
|
|
|
}
|