2003-11-25 20:29:01 +01:00
|
|
|
/*
|
|
|
|
* XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com)
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1998-2003 by The XFree86 Project, Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Except as contained in this notice, the name of the copyright holder(s)
|
|
|
|
* and author(s) shall not be used in advertising or otherwise to promote
|
|
|
|
* the sale, use or other dealings in this Software without prior written
|
|
|
|
* authorization from the copyright holder(s) and author(s).
|
|
|
|
*/
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2005-07-03 09:02:09 +02:00
|
|
|
#ifdef HAVE_XORG_CONFIG_H
|
|
|
|
#include <xorg-config.h>
|
|
|
|
#endif
|
|
|
|
|
2005-07-03 10:53:54 +02:00
|
|
|
#include "misc.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "xf86.h"
|
|
|
|
#include "xf86_OSproc.h"
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/X.h>
|
|
|
|
#include <X11/Xproto.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "scrnintstr.h"
|
|
|
|
#include "regionstr.h"
|
|
|
|
#include "windowstr.h"
|
|
|
|
#include "pixmapstr.h"
|
|
|
|
#include "mivalidate.h"
|
|
|
|
#include "validate.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "gcstruct.h"
|
|
|
|
#include "dixstruct.h"
|
|
|
|
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/extensions/Xv.h>
|
|
|
|
#include <X11/extensions/Xvproto.h>
|
2003-11-14 17:48:57 +01:00
|
|
|
#include "xvdix.h"
|
|
|
|
#include "xvmodproc.h"
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
#include "xf86xvpriv.h"
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* XvScreenRec fields */
|
|
|
|
|
|
|
|
static Bool xf86XVCloseScreen(int, ScreenPtr);
|
|
|
|
static int xf86XVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *);
|
|
|
|
|
|
|
|
/* XvAdaptorRec fields */
|
|
|
|
|
|
|
|
static int xf86XVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*);
|
|
|
|
static int xf86XVFreePort(XvPortPtr);
|
|
|
|
static int xf86XVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16, INT16, CARD16, CARD16,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16, INT16, CARD16, CARD16);
|
|
|
|
static int xf86XVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16, INT16, CARD16, CARD16,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16, INT16, CARD16, CARD16);
|
|
|
|
static int xf86XVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16, INT16, CARD16, CARD16,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16, INT16, CARD16, CARD16);
|
|
|
|
static int xf86XVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16, INT16, CARD16, CARD16,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16, INT16, CARD16, CARD16);
|
|
|
|
static int xf86XVStopVideo(ClientPtr, XvPortPtr, DrawablePtr);
|
|
|
|
static int xf86XVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32);
|
|
|
|
static int xf86XVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32*);
|
|
|
|
static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8,
|
2003-11-25 20:29:01 +01:00
|
|
|
CARD16, CARD16,CARD16, CARD16,
|
2003-11-14 17:48:57 +01:00
|
|
|
unsigned int*, unsigned int*);
|
|
|
|
static int xf86XVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16, INT16, CARD16, CARD16,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16, INT16, CARD16, CARD16,
|
|
|
|
XvImagePtr, unsigned char*, Bool,
|
|
|
|
CARD16, CARD16);
|
2003-11-25 20:29:01 +01:00
|
|
|
static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
|
2003-11-14 17:48:57 +01:00
|
|
|
CARD16*, CARD16*, int*, int*);
|
|
|
|
|
|
|
|
|
|
|
|
/* ScreenRec fields */
|
|
|
|
|
|
|
|
static Bool xf86XVDestroyWindow(WindowPtr pWin);
|
|
|
|
static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
|
2011-01-13 19:50:16 +01:00
|
|
|
static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind);
|
2003-11-14 17:48:57 +01:00
|
|
|
static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
|
|
|
|
|
2011-01-14 14:03:28 +01:00
|
|
|
#define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* ScrnInfoRec functions */
|
|
|
|
|
|
|
|
static Bool xf86XVEnterVT(int, int);
|
|
|
|
static void xf86XVLeaveVT(int, int);
|
|
|
|
static void xf86XVAdjustFrame(int index, int x, int y, int flags);
|
2010-10-29 16:34:56 +02:00
|
|
|
static void xf86XVModeSet(ScrnInfoPtr pScrn);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/* misc */
|
|
|
|
|
|
|
|
static Bool xf86XVInitAdaptors(ScreenPtr, XF86VideoAdaptorPtr*, int);
|
|
|
|
|
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
static DevPrivateKeyRec XF86XVWindowKeyRec;
|
|
|
|
#define XF86XVWindowKey (&XF86XVWindowKeyRec)
|
|
|
|
|
|
|
|
DevPrivateKey XF86XvScreenKey;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static unsigned long PortResource = 0;
|
|
|
|
|
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
|
|
|
DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
|
|
|
|
unsigned long (*XvGetRTPortProc)(void) = NULL;
|
|
|
|
int (*XvScreenInitProc)(ScreenPtr) = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
#define GET_XV_SCREEN(pScreen) \
|
2007-08-28 15:28:25 +02:00
|
|
|
((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
#define GET_XF86XV_SCREEN(pScreen) \
|
2007-08-28 15:28:25 +02:00
|
|
|
((XF86XVScreenPtr)(GET_XV_SCREEN(pScreen)->devPriv.ptr))
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
#define GET_XF86XV_WINDOW(pWin) \
|
2007-08-28 15:28:25 +02:00
|
|
|
((XF86XVWindowPtr)dixLookupPrivate(&(pWin)->devPrivates, XF86XVWindowKey))
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
static xf86XVInitGenericAdaptorPtr *GenDrivers = NULL;
|
|
|
|
static int NumGenDrivers = 0;
|
|
|
|
|
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
|
|
|
int
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVRegisterGenericAdaptorDriver(
|
|
|
|
xf86XVInitGenericAdaptorPtr InitFunc
|
|
|
|
){
|
|
|
|
xf86XVInitGenericAdaptorPtr *newdrivers;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
newdrivers = realloc(GenDrivers, sizeof(xf86XVInitGenericAdaptorPtr) *
|
2003-11-14 17:48:57 +01:00
|
|
|
(1 + NumGenDrivers));
|
|
|
|
if (!newdrivers)
|
|
|
|
return 0;
|
|
|
|
GenDrivers = newdrivers;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
GenDrivers[NumGenDrivers++] = InitFunc;
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
int
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVListGenericAdaptors(
|
2003-11-25 20:29:01 +01:00
|
|
|
ScrnInfoPtr pScrn,
|
2003-11-14 17:48:57 +01:00
|
|
|
XF86VideoAdaptorPtr **adaptors
|
|
|
|
){
|
|
|
|
int i,j,n,num;
|
|
|
|
XF86VideoAdaptorPtr *DrivAdap,*new;
|
|
|
|
|
|
|
|
num = 0;
|
|
|
|
*adaptors = NULL;
|
2003-11-25 20:29:01 +01:00
|
|
|
/*
|
|
|
|
* The v4l driver registers itself first, but can use surfaces registered
|
|
|
|
* by other drivers. So, call the v4l driver last.
|
|
|
|
*/
|
|
|
|
for (i = NumGenDrivers; --i >= 0; ) {
|
|
|
|
DrivAdap = NULL;
|
|
|
|
n = (*GenDrivers[i])(pScrn, &DrivAdap);
|
2003-11-14 17:48:57 +01:00
|
|
|
if (0 == n)
|
|
|
|
continue;
|
2010-05-05 20:44:06 +02:00
|
|
|
new = realloc(*adaptors, sizeof(XF86VideoAdaptorPtr) * (num+n));
|
2003-11-14 17:48:57 +01:00
|
|
|
if (NULL == new)
|
|
|
|
continue;
|
|
|
|
*adaptors = new;
|
|
|
|
for (j = 0; j < n; j++, num++)
|
|
|
|
(*adaptors)[num] = DrivAdap[j];
|
|
|
|
}
|
|
|
|
return num;
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
/**************** Offscreen surface stuff *******************/
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
XF86OffscreenImagePtr images;
|
|
|
|
int num;
|
|
|
|
} OffscreenImageRec;
|
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
static DevPrivateKeyRec OffscreenPrivateKeyRec;
|
|
|
|
#define OffscreenPrivateKey (&OffscreenPrivateKeyRec)
|
2010-04-23 06:35:17 +02:00
|
|
|
#define GetOffscreenImage(pScreen) ((OffscreenImageRec *) dixLookupPrivate(&(pScreen)->devPrivates, OffscreenPrivateKey))
|
2003-11-25 20:29:01 +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
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVRegisterOffscreenImages(
|
|
|
|
ScreenPtr pScreen,
|
|
|
|
XF86OffscreenImagePtr images,
|
|
|
|
int num
|
|
|
|
){
|
2010-04-23 06:35:17 +02:00
|
|
|
OffscreenImageRec *OffscreenImage;
|
|
|
|
/* This function may be called before xf86XVScreenInit, so there's
|
2010-04-27 02:22:21 +02:00
|
|
|
* no better place than this to call dixRegisterPrivateKey to ensure we
|
2010-04-23 06:35:17 +02:00
|
|
|
* have space reserved. After the first call it is a no-op. */
|
2010-04-27 02:22:21 +02:00
|
|
|
if(!dixRegisterPrivateKey(OffscreenPrivateKey, PRIVATE_SCREEN, sizeof(OffscreenImageRec)) ||
|
2010-04-23 06:35:17 +02:00
|
|
|
!(OffscreenImage = GetOffscreenImage(pScreen)))
|
|
|
|
/* Every X.org driver assumes this function always succeeds, so
|
|
|
|
* just die on allocation failure. */
|
|
|
|
FatalError("Could not allocate private storage for XV offscreen images.\n");
|
|
|
|
|
|
|
|
OffscreenImage->num = num;
|
|
|
|
OffscreenImage->images = images;
|
2003-11-25 20:29:01 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
XF86OffscreenImagePtr
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVQueryOffscreenImages(
|
|
|
|
ScreenPtr pScreen,
|
|
|
|
int *num
|
|
|
|
){
|
2010-04-23 06:35:17 +02:00
|
|
|
OffscreenImageRec *OffscreenImage = GetOffscreenImage(pScreen);
|
|
|
|
*num = OffscreenImage->num;
|
|
|
|
return OffscreenImage->images;
|
2003-11-25 20:29:01 +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
|
|
|
XF86VideoAdaptorPtr
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr pScrn)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
return calloc(1, sizeof(XF86VideoAdaptorRec));
|
2003-11-14 17:48:57 +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
|
|
|
void
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr)
|
|
|
|
{
|
2010-05-05 20:44:06 +02:00
|
|
|
free(ptr);
|
2003-11-14 17:48:57 +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
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVScreenInit(
|
2003-11-25 20:29:01 +01:00
|
|
|
ScreenPtr pScreen,
|
2003-11-14 17:48:57 +01:00
|
|
|
XF86VideoAdaptorPtr *adaptors,
|
|
|
|
int num
|
|
|
|
){
|
|
|
|
ScrnInfoPtr pScrn;
|
|
|
|
XF86XVScreenPtr ScreenPriv;
|
|
|
|
XvScreenPtr pxvs;
|
|
|
|
|
|
|
|
if(num <= 0 ||
|
2007-08-28 15:28:25 +02:00
|
|
|
!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
|
2003-11-25 20:29:01 +01:00
|
|
|
return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
|
|
|
|
|
2010-04-27 02:22:21 +02:00
|
|
|
if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0))
|
|
|
|
return FALSE;
|
|
|
|
|
2007-08-28 15:28:25 +02:00
|
|
|
XF86XvScreenKey = (*XvGetScreenKeyProc)();
|
2010-04-27 02:22:21 +02:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
PortResource = (*XvGetRTPortProc)();
|
|
|
|
|
|
|
|
pxvs = GET_XV_SCREEN(pScreen);
|
|
|
|
|
|
|
|
/* Anyone initializing the Xv layer must provide these two.
|
|
|
|
The Xv di layer calls them without even checking if they exist! */
|
|
|
|
|
|
|
|
pxvs->ddCloseScreen = xf86XVCloseScreen;
|
|
|
|
pxvs->ddQueryAdaptors = xf86XVQueryAdaptors;
|
|
|
|
|
|
|
|
/* The Xv di layer provides us with a private hook so that we don't
|
|
|
|
have to allocate our own screen private. They also provide
|
|
|
|
a CloseScreen hook so that we don't have to wrap it. I'm not
|
|
|
|
sure that I appreciate that. */
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
ScreenPriv = malloc(sizeof(XF86XVScreenRec));
|
2003-11-14 17:48:57 +01:00
|
|
|
pxvs->devPriv.ptr = (pointer)ScreenPriv;
|
|
|
|
|
|
|
|
if(!ScreenPriv) return FALSE;
|
|
|
|
|
|
|
|
pScrn = xf86Screens[pScreen->myNum];
|
|
|
|
|
|
|
|
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
|
|
|
|
ScreenPriv->WindowExposures = pScreen->WindowExposures;
|
2011-01-14 14:03:28 +01:00
|
|
|
ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
|
2003-11-14 17:48:57 +01:00
|
|
|
ScreenPriv->ClipNotify = pScreen->ClipNotify;
|
|
|
|
ScreenPriv->EnterVT = pScrn->EnterVT;
|
|
|
|
ScreenPriv->LeaveVT = pScrn->LeaveVT;
|
|
|
|
ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
|
2010-10-29 16:34:56 +02:00
|
|
|
ScreenPriv->ModeSet = pScrn->ModeSet;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pScreen->DestroyWindow = xf86XVDestroyWindow;
|
|
|
|
pScreen->WindowExposures = xf86XVWindowExposures;
|
|
|
|
pScreen->ClipNotify = xf86XVClipNotify;
|
|
|
|
pScrn->EnterVT = xf86XVEnterVT;
|
|
|
|
pScrn->LeaveVT = xf86XVLeaveVT;
|
|
|
|
if(pScrn->AdjustFrame)
|
|
|
|
pScrn->AdjustFrame = xf86XVAdjustFrame;
|
2010-10-29 16:34:56 +02:00
|
|
|
pScrn->ModeSet = xf86XVModeSet;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(!xf86XVInitAdaptors(pScreen, adaptors, num))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pAdaptor->name);
|
2011-04-04 19:25:32 +02:00
|
|
|
pAdaptor->name = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(pAdaptor->pEncodings) {
|
|
|
|
XvEncodingPtr pEncode = pAdaptor->pEncodings;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pEncode->name);
|
|
|
|
free(pAdaptor->pEncodings);
|
2011-04-04 19:25:32 +02:00
|
|
|
pAdaptor->pEncodings = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pAdaptor->pFormats);
|
2011-04-04 19:25:32 +02:00
|
|
|
pAdaptor->pFormats = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(pAdaptor->pPorts) {
|
|
|
|
XvPortPtr pPort = pAdaptor->pPorts;
|
|
|
|
XvPortRecPrivatePtr pPriv;
|
|
|
|
|
|
|
|
for(i = 0; i < pAdaptor->nPorts; i++, pPort++) {
|
2003-11-25 20:29:01 +01:00
|
|
|
pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
|
2003-11-14 17:48:57 +01:00
|
|
|
if(pPriv) {
|
2003-11-25 20:29:01 +01:00
|
|
|
if(pPriv->clientClip)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(pPriv->clientClip);
|
2003-11-25 20:29:01 +01:00
|
|
|
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(pPriv->pCompositeClip);
|
2011-01-17 15:58:00 +01:00
|
|
|
if (pPriv->ckeyFilled)
|
|
|
|
RegionDestroy(pPriv->ckeyFilled);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pPriv);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pAdaptor->pPorts);
|
2011-04-04 19:25:32 +02:00
|
|
|
pAdaptor->pPorts = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2011-03-31 22:44:03 +02:00
|
|
|
if(pAdaptor->pAttributes) {
|
2003-11-14 17:48:57 +01:00
|
|
|
XvAttributePtr pAttribute = pAdaptor->pAttributes;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pAttribute->name);
|
|
|
|
free(pAdaptor->pAttributes);
|
2011-03-31 22:44:03 +02:00
|
|
|
pAdaptor->pAttributes = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pAdaptor->pImages);
|
|
|
|
free(pAdaptor->devPriv.ptr);
|
2011-04-04 19:25:32 +02:00
|
|
|
pAdaptor->pImages = NULL;
|
|
|
|
pAdaptor->devPriv.ptr = NULL;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
xf86XVInitAdaptors(
|
2003-11-25 20:29:01 +01:00
|
|
|
ScreenPtr pScreen,
|
2003-11-14 17:48:57 +01:00
|
|
|
XF86VideoAdaptorPtr *infoPtr,
|
|
|
|
int number
|
|
|
|
) {
|
|
|
|
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
|
|
|
XF86VideoAdaptorPtr adaptorPtr;
|
|
|
|
XvAdaptorPtr pAdaptor, pa;
|
|
|
|
XvAdaptorRecPrivatePtr adaptorPriv;
|
|
|
|
int na, numAdaptor;
|
|
|
|
XvPortRecPrivatePtr portPriv;
|
|
|
|
XvPortPtr pPort, pp;
|
|
|
|
int numPort;
|
|
|
|
XF86AttributePtr attributePtr;
|
|
|
|
XvAttributePtr pAttribute, pat;
|
|
|
|
XF86VideoFormatPtr formatPtr;
|
|
|
|
XvFormatPtr pFormat, pf;
|
|
|
|
int numFormat, totFormat;
|
|
|
|
XF86VideoEncodingPtr encodingPtr;
|
|
|
|
XvEncodingPtr pEncode, pe;
|
|
|
|
XF86ImagePtr imagePtr;
|
|
|
|
XvImagePtr pImage, pi;
|
|
|
|
int numVisuals;
|
|
|
|
VisualPtr pVisual;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
pxvs->nAdaptors = 0;
|
|
|
|
pxvs->pAdaptors = NULL;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
if(!(pAdaptor = calloc(number, sizeof(XvAdaptorRec))))
|
2003-11-14 17:48:57 +01:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
|
|
|
|
adaptorPtr = infoPtr[na];
|
|
|
|
|
|
|
|
if(!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
|
|
|
|
!adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* client libs expect at least one encoding */
|
|
|
|
if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings)
|
|
|
|
continue;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
pa->type = adaptorPtr->type;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo)
|
|
|
|
pa->type &= ~XvVideoMask;
|
|
|
|
|
|
|
|
if(!adaptorPtr->PutStill && !adaptorPtr->GetStill)
|
|
|
|
pa->type &= ~XvStillMask;
|
|
|
|
|
|
|
|
if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes)
|
|
|
|
pa->type &= ~XvImageMask;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage &&
|
2003-11-14 17:48:57 +01:00
|
|
|
!adaptorPtr->PutStill)
|
|
|
|
pa->type &= ~XvInputMask;
|
|
|
|
|
|
|
|
if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill)
|
|
|
|
pa->type &= ~XvOutputMask;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask)))
|
2003-11-14 17:48:57 +01:00
|
|
|
continue;
|
2003-11-25 20:29:01 +01:00
|
|
|
if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask)))
|
2003-11-14 17:48:57 +01:00
|
|
|
continue;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
pa->pScreen = pScreen;
|
2003-11-14 17:48:57 +01:00
|
|
|
pa->ddAllocatePort = xf86XVAllocatePort;
|
|
|
|
pa->ddFreePort = xf86XVFreePort;
|
|
|
|
pa->ddPutVideo = xf86XVPutVideo;
|
|
|
|
pa->ddPutStill = xf86XVPutStill;
|
|
|
|
pa->ddGetVideo = xf86XVGetVideo;
|
|
|
|
pa->ddGetStill = xf86XVGetStill;
|
|
|
|
pa->ddStopVideo = xf86XVStopVideo;
|
|
|
|
pa->ddPutImage = xf86XVPutImage;
|
|
|
|
pa->ddSetPortAttribute = xf86XVSetPortAttribute;
|
|
|
|
pa->ddGetPortAttribute = xf86XVGetPortAttribute;
|
|
|
|
pa->ddQueryBestSize = xf86XVQueryBestSize;
|
|
|
|
pa->ddQueryImageAttributes = xf86XVQueryImageAttributes;
|
2010-08-28 00:34:49 +02:00
|
|
|
pa->name = strdup(adaptorPtr->name);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(adaptorPtr->nEncodings &&
|
2010-05-05 20:44:06 +02:00
|
|
|
(pEncode = calloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) {
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0;
|
|
|
|
i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++)
|
|
|
|
{
|
2003-11-14 17:48:57 +01:00
|
|
|
pe->id = encodingPtr->id;
|
|
|
|
pe->pScreen = pScreen;
|
2010-08-28 00:34:49 +02:00
|
|
|
pe->name = strdup(encodingPtr->name);
|
2003-11-14 17:48:57 +01:00
|
|
|
pe->width = encodingPtr->width;
|
|
|
|
pe->height = encodingPtr->height;
|
|
|
|
pe->rate.numerator = encodingPtr->rate.numerator;
|
|
|
|
pe->rate.denominator = encodingPtr->rate.denominator;
|
|
|
|
}
|
|
|
|
pa->nEncodings = adaptorPtr->nEncodings;
|
2003-11-25 20:29:01 +01:00
|
|
|
pa->pEncodings = pEncode;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(adaptorPtr->nImages &&
|
2010-05-05 20:44:06 +02:00
|
|
|
(pImage = calloc(adaptorPtr->nImages, sizeof(XvImageRec)))) {
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages;
|
|
|
|
i < adaptorPtr->nImages; i++, pi++, imagePtr++)
|
|
|
|
{
|
2003-11-14 17:48:57 +01:00
|
|
|
pi->id = imagePtr->id;
|
|
|
|
pi->type = imagePtr->type;
|
|
|
|
pi->byte_order = imagePtr->byte_order;
|
|
|
|
memcpy(pi->guid, imagePtr->guid, 16);
|
|
|
|
pi->bits_per_pixel = imagePtr->bits_per_pixel;
|
|
|
|
pi->format = imagePtr->format;
|
|
|
|
pi->num_planes = imagePtr->num_planes;
|
|
|
|
pi->depth = imagePtr->depth;
|
|
|
|
pi->red_mask = imagePtr->red_mask;
|
|
|
|
pi->green_mask = imagePtr->green_mask;
|
|
|
|
pi->blue_mask = imagePtr->blue_mask;
|
|
|
|
pi->y_sample_bits = imagePtr->y_sample_bits;
|
|
|
|
pi->u_sample_bits = imagePtr->u_sample_bits;
|
|
|
|
pi->v_sample_bits = imagePtr->v_sample_bits;
|
|
|
|
pi->horz_y_period = imagePtr->horz_y_period;
|
|
|
|
pi->horz_u_period = imagePtr->horz_u_period;
|
|
|
|
pi->horz_v_period = imagePtr->horz_v_period;
|
|
|
|
pi->vert_y_period = imagePtr->vert_y_period;
|
|
|
|
pi->vert_u_period = imagePtr->vert_u_period;
|
|
|
|
pi->vert_v_period = imagePtr->vert_v_period;
|
|
|
|
memcpy(pi->component_order, imagePtr->component_order, 32);
|
|
|
|
pi->scanline_order = imagePtr->scanline_order;
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
pa->nImages = adaptorPtr->nImages;
|
|
|
|
pa->pImages = pImage;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(adaptorPtr->nAttributes &&
|
2010-05-05 20:44:06 +02:00
|
|
|
(pAttribute = calloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec))))
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2003-11-25 20:29:01 +01:00
|
|
|
for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0;
|
|
|
|
i < adaptorPtr->nAttributes; pat++, i++, attributePtr++)
|
|
|
|
{
|
2003-11-14 17:48:57 +01:00
|
|
|
pat->flags = attributePtr->flags;
|
|
|
|
pat->min_value = attributePtr->min_value;
|
|
|
|
pat->max_value = attributePtr->max_value;
|
2010-08-28 00:34:49 +02:00
|
|
|
pat->name = strdup(attributePtr->name);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
pa->nAttributes = adaptorPtr->nAttributes;
|
2003-11-25 20:29:01 +01:00
|
|
|
pa->pAttributes = pAttribute;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
totFormat = adaptorPtr->nFormats;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
if(!(pFormat = calloc(totFormat, sizeof(XvFormatRec)))) {
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVFreeAdaptor(pa);
|
|
|
|
continue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats;
|
|
|
|
i < adaptorPtr->nFormats; i++, formatPtr++)
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
numVisuals = pScreen->numVisuals;
|
2003-11-25 20:29:01 +01:00
|
|
|
pVisual = pScreen->visuals;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
while(numVisuals--) {
|
|
|
|
if((pVisual->class == formatPtr->class) &&
|
|
|
|
(pVisual->nplanes == formatPtr->depth)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(numFormat >= totFormat) {
|
2003-11-25 20:29:01 +01:00
|
|
|
void *moreSpace;
|
2003-11-14 17:48:57 +01:00
|
|
|
totFormat *= 2;
|
2010-05-05 20:44:06 +02:00
|
|
|
moreSpace = realloc(pFormat,
|
2003-11-14 17:48:57 +01:00
|
|
|
totFormat * sizeof(XvFormatRec));
|
|
|
|
if(!moreSpace) break;
|
|
|
|
pFormat = moreSpace;
|
|
|
|
pf = pFormat + numFormat;
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
pf->visual = pVisual->vid;
|
2003-11-14 17:48:57 +01:00
|
|
|
pf->depth = formatPtr->depth;
|
|
|
|
|
|
|
|
pf++;
|
|
|
|
numFormat++;
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
|
|
|
pVisual++;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
pa->nFormats = numFormat;
|
2003-11-25 20:29:01 +01:00
|
|
|
pa->pFormats = pFormat;
|
2003-11-14 17:48:57 +01:00
|
|
|
if(!numFormat) {
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVFreeAdaptor(pa);
|
|
|
|
continue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
if(!(adaptorPriv = calloc(1, sizeof(XvAdaptorRecPrivate)))) {
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVFreeAdaptor(pa);
|
|
|
|
continue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
adaptorPriv->flags = adaptorPtr->flags;
|
|
|
|
adaptorPriv->PutVideo = adaptorPtr->PutVideo;
|
|
|
|
adaptorPriv->PutStill = adaptorPtr->PutStill;
|
|
|
|
adaptorPriv->GetVideo = adaptorPtr->GetVideo;
|
|
|
|
adaptorPriv->GetStill = adaptorPtr->GetStill;
|
|
|
|
adaptorPriv->StopVideo = adaptorPtr->StopVideo;
|
|
|
|
adaptorPriv->SetPortAttribute = adaptorPtr->SetPortAttribute;
|
|
|
|
adaptorPriv->GetPortAttribute = adaptorPtr->GetPortAttribute;
|
|
|
|
adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
|
|
|
|
adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
|
|
|
|
adaptorPriv->PutImage = adaptorPtr->PutImage;
|
2010-11-02 15:04:36 +01:00
|
|
|
adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pa->devPriv.ptr = (pointer)adaptorPriv;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
if(!(pPort = calloc(adaptorPtr->nPorts, sizeof(XvPortRec)))) {
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVFreeAdaptor(pa);
|
|
|
|
continue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
for(pp = pPort, i = 0, numPort = 0;
|
2003-11-14 17:48:57 +01:00
|
|
|
i < adaptorPtr->nPorts; i++) {
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
if(!(pp->id = FakeClientID(0)))
|
2003-11-14 17:48:57 +01:00
|
|
|
continue;
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
if(!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
|
2003-11-14 17:48:57 +01:00
|
|
|
continue;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if(!AddResource(pp->id, PortResource, pp)) {
|
2010-05-05 20:44:06 +02:00
|
|
|
free(portPriv);
|
2003-11-14 17:48:57 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
pp->pAdaptor = pa;
|
|
|
|
pp->pNotify = (XvPortNotifyPtr)NULL;
|
|
|
|
pp->pDraw = (DrawablePtr)NULL;
|
|
|
|
pp->client = (ClientPtr)NULL;
|
|
|
|
pp->grab.client = (ClientPtr)NULL;
|
|
|
|
pp->time = currentTime;
|
|
|
|
pp->devPriv.ptr = portPriv;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
portPriv->pScrn = pScrn;
|
|
|
|
portPriv->AdaptorRec = adaptorPriv;
|
2003-11-25 20:29:01 +01:00
|
|
|
portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
|
|
|
|
|
|
|
|
pp++;
|
|
|
|
numPort++;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
pa->nPorts = numPort;
|
|
|
|
pa->pPorts = pPort;
|
|
|
|
if(!numPort) {
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVFreeAdaptor(pa);
|
|
|
|
continue;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pa->base_id = pPort->id;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
pa++;
|
|
|
|
numAdaptor++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(numAdaptor) {
|
|
|
|
pxvs->nAdaptors = numAdaptor;
|
|
|
|
pxvs->pAdaptors = pAdaptor;
|
|
|
|
} else {
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pAdaptor);
|
2003-11-14 17:48:57 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Video should be clipped to the intersection of the window cliplist
|
|
|
|
and the client cliplist specified in the GC for which the video was
|
|
|
|
initialized. When we need to reclip a window, the GC that started
|
|
|
|
the video may not even be around anymore. That's why we save the
|
|
|
|
client clip from the GC when the video is initialized. We then
|
|
|
|
use xf86XVUpdateCompositeClip to calculate the new composite clip
|
|
|
|
when we need it. This is different from what DEC did. They saved
|
|
|
|
the GC and used it's clip list when they needed to reclip the window,
|
|
|
|
even if the client clip was different from the one the video was
|
|
|
|
initialized with. If the original GC was destroyed, they had to stop
|
2003-11-25 20:29:01 +01:00
|
|
|
the video. I like the new method better (MArk).
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
This function only works for windows. Will need to rewrite when
|
|
|
|
(if) we support pixmap rendering.
|
|
|
|
*/
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static void
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
|
|
|
|
{
|
|
|
|
RegionPtr pregWin, pCompositeClip;
|
|
|
|
WindowPtr pWin;
|
2003-11-25 20:29:01 +01:00
|
|
|
Bool freeCompClip = FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(portPriv->pCompositeClip)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pWin = (WindowPtr)portPriv->pDraw;
|
|
|
|
|
|
|
|
/* get window clip list */
|
|
|
|
if(portPriv->subWindowMode == IncludeInferiors) {
|
|
|
|
pregWin = NotClippedByChildren(pWin);
|
|
|
|
freeCompClip = TRUE;
|
|
|
|
} else
|
|
|
|
pregWin = &pWin->clipList;
|
|
|
|
|
|
|
|
if(!portPriv->clientClip) {
|
|
|
|
portPriv->pCompositeClip = pregWin;
|
|
|
|
portPriv->FreeCompositeClip = freeCompClip;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
pCompositeClip = RegionCreate(NullBox, 1);
|
|
|
|
RegionCopy(pCompositeClip, portPriv->clientClip);
|
|
|
|
RegionTranslate(pCompositeClip,
|
2010-11-01 19:02:40 +01:00
|
|
|
portPriv->pDraw->x, portPriv->pDraw->y);
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionIntersect(pCompositeClip, pregWin, pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
portPriv->pCompositeClip = pCompositeClip;
|
|
|
|
portPriv->FreeCompositeClip = TRUE;
|
|
|
|
|
|
|
|
if(freeCompClip) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(pregWin);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Save the current clientClip and update the CompositeClip whenever
|
|
|
|
we have a fresh GC */
|
|
|
|
|
|
|
|
static void
|
|
|
|
xf86XVCopyClip(
|
2003-11-25 20:29:01 +01:00
|
|
|
XvPortRecPrivatePtr portPriv,
|
2003-11-14 17:48:57 +01:00
|
|
|
GCPtr pGC
|
|
|
|
){
|
|
|
|
/* copy the new clip if it exists */
|
|
|
|
if((pGC->clientClipType == CT_REGION) && pGC->clientClip) {
|
|
|
|
if(!portPriv->clientClip)
|
2010-05-22 00:05:48 +02:00
|
|
|
portPriv->clientClip = RegionCreate(NullBox, 1);
|
2003-11-14 17:48:57 +01:00
|
|
|
/* Note: this is in window coordinates */
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionCopy(portPriv->clientClip, pGC->clientClip);
|
2010-11-01 19:02:40 +01:00
|
|
|
RegionTranslate(portPriv->clientClip,
|
|
|
|
pGC->clipOrg.x, pGC->clipOrg.y);
|
2003-11-14 17:48:57 +01:00
|
|
|
} else if(portPriv->clientClip) { /* free the old clientClip */
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(portPriv->clientClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
portPriv->clientClip = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get rid of the old clip list */
|
|
|
|
if(portPriv->pCompositeClip && portPriv->FreeCompositeClip) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(portPriv->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
portPriv->pCompositeClip = pGC->pCompositeClip;
|
|
|
|
portPriv->FreeCompositeClip = FALSE;
|
|
|
|
portPriv->subWindowMode = pGC->subWindowMode;
|
|
|
|
}
|
|
|
|
|
2010-11-01 19:27:25 +01:00
|
|
|
static void
|
|
|
|
xf86XVCopyCompositeClip(XvPortRecPrivatePtr portPriv,
|
|
|
|
GCPtr pGC,
|
|
|
|
DrawablePtr pDraw)
|
|
|
|
{
|
|
|
|
if (!portPriv->clientClip)
|
|
|
|
portPriv->clientClip = RegionCreate(NullBox, 1);
|
|
|
|
/* Keep the original GC composite clip around for ReputImage */
|
|
|
|
RegionCopy(portPriv->clientClip, pGC->pCompositeClip);
|
|
|
|
RegionTranslate(portPriv->clientClip,
|
|
|
|
-pDraw->x, -pDraw->y);
|
|
|
|
|
|
|
|
/* get rid of the old clip list */
|
|
|
|
if (portPriv->pCompositeClip && portPriv->FreeCompositeClip)
|
|
|
|
RegionDestroy(portPriv->pCompositeClip);
|
|
|
|
|
|
|
|
portPriv->pCompositeClip = pGC->pCompositeClip;
|
|
|
|
portPriv->FreeCompositeClip = FALSE;
|
|
|
|
portPriv->subWindowMode = pGC->subWindowMode;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
|
|
|
xf86XVRegetVideo(XvPortRecPrivatePtr portPriv)
|
|
|
|
{
|
|
|
|
RegionRec WinRegion;
|
|
|
|
RegionRec ClipRegion;
|
|
|
|
BoxRec WinBox;
|
|
|
|
int ret = Success;
|
|
|
|
Bool clippedAway = FALSE;
|
|
|
|
|
|
|
|
xf86XVUpdateCompositeClip(portPriv);
|
|
|
|
|
|
|
|
/* translate the video region to the screen */
|
|
|
|
WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
|
|
|
|
WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
|
|
|
|
WinBox.x2 = WinBox.x1 + portPriv->drw_w;
|
|
|
|
WinBox.y2 = WinBox.y1 + portPriv->drw_h;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* clip to the window composite clip */
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&WinRegion, &WinBox, 1);
|
|
|
|
RegionNull(&ClipRegion);
|
|
|
|
RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* that's all if it's totally obscured */
|
2010-05-22 00:05:48 +02:00
|
|
|
if(!RegionNotEmpty(&ClipRegion)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
clippedAway = TRUE;
|
|
|
|
goto CLIP_VIDEO_BAILOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->pScrn,
|
|
|
|
portPriv->vid_x, portPriv->vid_y,
|
|
|
|
WinBox.x1, WinBox.y1,
|
|
|
|
portPriv->vid_w, portPriv->vid_h,
|
|
|
|
portPriv->drw_w, portPriv->drw_h,
|
2006-04-07 20:56:04 +02:00
|
|
|
&ClipRegion, portPriv->DevPriv.ptr,
|
|
|
|
portPriv->pDraw);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(ret == Success)
|
|
|
|
portPriv->isOn = XV_ON;
|
|
|
|
|
|
|
|
CLIP_VIDEO_BAILOUT:
|
|
|
|
|
|
|
|
if((clippedAway || (ret != Success)) && portPriv->isOn == XV_ON) {
|
|
|
|
(*portPriv->AdaptorRec->StopVideo)(
|
|
|
|
portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
|
|
|
|
portPriv->isOn = XV_PENDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This clip was copied and only good for one shot */
|
|
|
|
if(!portPriv->FreeCompositeClip)
|
|
|
|
portPriv->pCompositeClip = NULL;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(&WinRegion);
|
|
|
|
RegionUninit(&ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVReputVideo(XvPortRecPrivatePtr portPriv)
|
|
|
|
{
|
|
|
|
RegionRec WinRegion;
|
|
|
|
RegionRec ClipRegion;
|
|
|
|
BoxRec WinBox;
|
|
|
|
int ret = Success;
|
|
|
|
Bool clippedAway = FALSE;
|
|
|
|
|
|
|
|
xf86XVUpdateCompositeClip(portPriv);
|
|
|
|
|
|
|
|
/* translate the video region to the screen */
|
|
|
|
WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
|
|
|
|
WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
|
|
|
|
WinBox.x2 = WinBox.x1 + portPriv->drw_w;
|
|
|
|
WinBox.y2 = WinBox.y1 + portPriv->drw_h;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* clip to the window composite clip */
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&WinRegion, &WinBox, 1);
|
|
|
|
RegionNull(&ClipRegion);
|
|
|
|
RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/* clip and translate to the viewport */
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
|
|
|
|
RegionRec VPReg;
|
|
|
|
BoxRec VPBox;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
VPBox.x1 = portPriv->pScrn->frameX0;
|
2003-11-14 17:48:57 +01:00
|
|
|
VPBox.y1 = portPriv->pScrn->frameY0;
|
2009-12-14 18:19:01 +01:00
|
|
|
VPBox.x2 = portPriv->pScrn->frameX1 + 1;
|
|
|
|
VPBox.y2 = portPriv->pScrn->frameY1 + 1;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&VPReg, &VPBox, 1);
|
|
|
|
RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
|
|
|
|
RegionUninit(&VPReg);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* that's all if it's totally obscured */
|
2010-05-22 00:05:48 +02:00
|
|
|
if(!RegionNotEmpty(&ClipRegion)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
clippedAway = TRUE;
|
|
|
|
goto CLIP_VIDEO_BAILOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bailout if we have to clip but the hardware doesn't support it */
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
|
2010-05-22 00:05:48 +02:00
|
|
|
BoxPtr clipBox = RegionRects(&ClipRegion);
|
|
|
|
if( (RegionNumRects(&ClipRegion) != 1) ||
|
2003-11-25 20:29:01 +01:00
|
|
|
(clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
|
|
|
|
(clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
clippedAway = TRUE;
|
|
|
|
goto CLIP_VIDEO_BAILOUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->pScrn,
|
|
|
|
portPriv->vid_x, portPriv->vid_y,
|
2003-11-14 17:48:57 +01:00
|
|
|
WinBox.x1, WinBox.y1,
|
2003-11-25 20:29:01 +01:00
|
|
|
portPriv->vid_w, portPriv->vid_h,
|
|
|
|
portPriv->drw_w, portPriv->drw_h,
|
2006-04-07 20:56:04 +02:00
|
|
|
&ClipRegion, portPriv->DevPriv.ptr,
|
|
|
|
portPriv->pDraw);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(ret == Success) portPriv->isOn = XV_ON;
|
|
|
|
|
|
|
|
CLIP_VIDEO_BAILOUT:
|
|
|
|
|
|
|
|
if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
|
|
|
|
(*portPriv->AdaptorRec->StopVideo)(
|
|
|
|
portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
|
|
|
|
portPriv->isOn = XV_PENDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This clip was copied and only good for one shot */
|
|
|
|
if(!portPriv->FreeCompositeClip)
|
|
|
|
portPriv->pCompositeClip = NULL;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(&WinRegion);
|
|
|
|
RegionUninit(&ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-11-02 15:04:36 +01:00
|
|
|
/* Reput image/still */
|
2003-11-14 17:48:57 +01:00
|
|
|
static int
|
|
|
|
xf86XVReputImage(XvPortRecPrivatePtr portPriv)
|
|
|
|
{
|
|
|
|
RegionRec WinRegion;
|
|
|
|
RegionRec ClipRegion;
|
|
|
|
BoxRec WinBox;
|
|
|
|
int ret = Success;
|
|
|
|
Bool clippedAway = FALSE;
|
|
|
|
|
|
|
|
xf86XVUpdateCompositeClip(portPriv);
|
|
|
|
|
2010-11-01 19:27:25 +01:00
|
|
|
/* the clip can get smaller over time */
|
|
|
|
RegionCopy(portPriv->clientClip, portPriv->pCompositeClip);
|
|
|
|
RegionTranslate(portPriv->clientClip,
|
|
|
|
-portPriv->pDraw->x, -portPriv->pDraw->y);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* translate the video region to the screen */
|
|
|
|
WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
|
|
|
|
WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
|
|
|
|
WinBox.x2 = WinBox.x1 + portPriv->drw_w;
|
|
|
|
WinBox.y2 = WinBox.y1 + portPriv->drw_h;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* clip to the window composite clip */
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&WinRegion, &WinBox, 1);
|
|
|
|
RegionNull(&ClipRegion);
|
|
|
|
RegionIntersect(&ClipRegion, &WinRegion, portPriv->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/* clip and translate to the viewport */
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
|
|
|
|
RegionRec VPReg;
|
|
|
|
BoxRec VPBox;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
VPBox.x1 = portPriv->pScrn->frameX0;
|
2003-11-14 17:48:57 +01:00
|
|
|
VPBox.y1 = portPriv->pScrn->frameY0;
|
2009-12-14 18:19:01 +01:00
|
|
|
VPBox.x2 = portPriv->pScrn->frameX1 + 1;
|
|
|
|
VPBox.y2 = portPriv->pScrn->frameY1 + 1;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&VPReg, &VPBox, 1);
|
|
|
|
RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
|
|
|
|
RegionUninit(&VPReg);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* that's all if it's totally obscured */
|
2010-05-22 00:05:48 +02:00
|
|
|
if(!RegionNotEmpty(&ClipRegion)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
clippedAway = TRUE;
|
|
|
|
goto CLIP_VIDEO_BAILOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* bailout if we have to clip but the hardware doesn't support it */
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
|
2010-05-22 00:05:48 +02:00
|
|
|
BoxPtr clipBox = RegionRects(&ClipRegion);
|
|
|
|
if( (RegionNumRects(&ClipRegion) != 1) ||
|
2003-11-25 20:29:01 +01:00
|
|
|
(clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
|
|
|
|
(clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
|
|
|
clippedAway = TRUE;
|
|
|
|
goto CLIP_VIDEO_BAILOUT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn,
|
2010-11-02 15:05:13 +01:00
|
|
|
portPriv->vid_x, portPriv->vid_y,
|
2003-11-14 17:48:57 +01:00
|
|
|
WinBox.x1, WinBox.y1,
|
2010-11-02 15:05:13 +01:00
|
|
|
portPriv->vid_w, portPriv->vid_h,
|
|
|
|
portPriv->drw_w, portPriv->drw_h,
|
2006-04-07 20:56:04 +02:00
|
|
|
&ClipRegion, portPriv->DevPriv.ptr,
|
|
|
|
portPriv->pDraw);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
portPriv->isOn = (ret == Success) ? XV_ON : XV_OFF;
|
|
|
|
|
|
|
|
CLIP_VIDEO_BAILOUT:
|
|
|
|
|
|
|
|
if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
|
|
|
|
(*portPriv->AdaptorRec->StopVideo)(
|
|
|
|
portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
|
|
|
|
portPriv->isOn = XV_PENDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This clip was copied and only good for one shot */
|
|
|
|
if(!portPriv->FreeCompositeClip)
|
|
|
|
portPriv->pCompositeClip = NULL;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(&WinRegion);
|
|
|
|
RegionUninit(&ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVReputAllVideo(WindowPtr pWin, pointer data)
|
|
|
|
{
|
|
|
|
XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
|
|
|
|
|
|
|
|
while(WinPriv) {
|
|
|
|
if(WinPriv->PortRec->type == XvInputMask)
|
|
|
|
xf86XVReputVideo(WinPriv->PortRec);
|
|
|
|
else
|
|
|
|
xf86XVRegetVideo(WinPriv->PortRec);
|
|
|
|
WinPriv = WinPriv->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return WT_WALKCHILDREN;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
|
|
|
|
{
|
2003-11-25 20:29:01 +01:00
|
|
|
XF86XVWindowPtr winPriv, PrivRoot;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
winPriv = PrivRoot = GET_XF86XV_WINDOW(pWin);
|
|
|
|
|
|
|
|
/* Enlist our port in the window private */
|
|
|
|
while(winPriv) {
|
|
|
|
if(winPriv->PortRec == portPriv) /* we're already listed */
|
|
|
|
break;
|
|
|
|
winPriv = winPriv->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!winPriv) {
|
2010-05-05 20:44:06 +02:00
|
|
|
winPriv = calloc(1, sizeof(XF86XVWindowRec));
|
2003-11-14 17:48:57 +01:00
|
|
|
if(!winPriv) return BadAlloc;
|
|
|
|
winPriv->PortRec = portPriv;
|
|
|
|
winPriv->next = PrivRoot;
|
2007-08-28 15:28:25 +02:00
|
|
|
dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, winPriv);
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
2007-05-24 12:10:05 +02:00
|
|
|
|
|
|
|
portPriv->pDraw = (DrawablePtr)pWin;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
|
|
|
|
{
|
|
|
|
XF86XVWindowPtr winPriv, prevPriv = NULL;
|
|
|
|
winPriv = GET_XF86XV_WINDOW(pWin);
|
|
|
|
|
|
|
|
while(winPriv) {
|
|
|
|
if(winPriv->PortRec == portPriv) {
|
2003-11-25 20:29:01 +01:00
|
|
|
if(prevPriv)
|
2003-11-14 17:48:57 +01:00
|
|
|
prevPriv->next = winPriv->next;
|
2003-11-25 20:29:01 +01:00
|
|
|
else
|
2007-08-28 15:28:25 +02:00
|
|
|
dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
|
|
|
|
winPriv->next);
|
2010-05-05 20:44:06 +02:00
|
|
|
free(winPriv);
|
2003-11-14 17:48:57 +01:00
|
|
|
break;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
prevPriv = winPriv;
|
2003-11-14 17:48:57 +01:00
|
|
|
winPriv = winPriv->next;
|
|
|
|
}
|
|
|
|
portPriv->pDraw = NULL;
|
2011-01-17 15:58:00 +01:00
|
|
|
if (portPriv->ckeyFilled) {
|
|
|
|
RegionDestroy(portPriv->ckeyFilled);
|
|
|
|
portPriv->ckeyFilled = NULL;
|
|
|
|
}
|
2011-01-13 19:50:16 +01:00
|
|
|
portPriv->clipChanged = FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-10-29 15:51:24 +02:00
|
|
|
static void
|
|
|
|
xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
|
|
|
|
WindowPtr pWin,
|
2010-10-29 16:00:24 +02:00
|
|
|
Bool visible)
|
2010-10-29 15:51:24 +02:00
|
|
|
{
|
2010-10-29 16:00:24 +02:00
|
|
|
if (!visible) {
|
|
|
|
if (pPriv->isOn == XV_ON) {
|
|
|
|
(*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
|
|
|
|
pPriv->isOn = XV_PENDING;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pPriv->type) /* overlaid still/image*/
|
|
|
|
xf86XVRemovePortFromWindow(pWin, pPriv);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-29 15:51:24 +02:00
|
|
|
switch (pPriv->type) {
|
|
|
|
case XvInputMask:
|
|
|
|
xf86XVReputVideo(pPriv);
|
|
|
|
break;
|
|
|
|
case XvOutputMask:
|
|
|
|
xf86XVRegetVideo(pPriv);
|
|
|
|
break;
|
|
|
|
default: /* overlaid still/image*/
|
|
|
|
if (pPriv->AdaptorRec->ReputImage)
|
|
|
|
xf86XVReputImage(pPriv);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-29 16:31:14 +02:00
|
|
|
static void
|
2011-01-13 19:50:16 +01:00
|
|
|
xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
|
2010-10-29 16:31:14 +02:00
|
|
|
{
|
|
|
|
ScreenPtr pScreen = pScrn->pScreen;
|
|
|
|
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
|
|
|
XvAdaptorPtr pa;
|
|
|
|
int c, i;
|
|
|
|
|
|
|
|
for (c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) {
|
|
|
|
XvPortPtr pPort = pa->pPorts;
|
|
|
|
|
|
|
|
for (i = pa->nPorts; i > 0; i--, pPort++) {
|
|
|
|
XvPortRecPrivatePtr pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
|
|
|
|
WindowPtr pWin = (WindowPtr)pPriv->pDraw;
|
|
|
|
Bool visible;
|
|
|
|
|
|
|
|
if (pPriv->isOn == XV_OFF || !pWin)
|
|
|
|
continue;
|
|
|
|
|
2011-01-13 19:50:16 +01:00
|
|
|
if (onlyChanged && !pPriv->clipChanged)
|
|
|
|
continue;
|
|
|
|
|
2010-10-29 16:31:14 +02:00
|
|
|
visible = pWin->visibility == VisibilityUnobscured ||
|
|
|
|
pWin->visibility == VisibilityPartiallyObscured;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Stop and remove still/images if
|
|
|
|
* ReputImage isn't supported.
|
|
|
|
*/
|
|
|
|
if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
|
|
|
|
visible = FALSE;
|
|
|
|
|
|
|
|
xf86XVReputOrStopPort(pPriv, pWin, visible);
|
2011-01-13 19:50:16 +01:00
|
|
|
|
|
|
|
pPriv->clipChanged = FALSE;
|
2010-10-29 16:31:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/**** ScreenRec fields ****/
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
xf86XVDestroyWindow(WindowPtr pWin)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
|
|
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
XF86XVWindowPtr tmp, WinPriv = GET_XF86XV_WINDOW(pWin);
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
while(WinPriv) {
|
|
|
|
XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
|
|
|
|
|
|
|
|
if(pPriv->isOn > XV_OFF) {
|
|
|
|
(*pPriv->AdaptorRec->StopVideo)(
|
|
|
|
pPriv->pScrn, pPriv->DevPriv.ptr, TRUE);
|
|
|
|
pPriv->isOn = XV_OFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
pPriv->pDraw = NULL;
|
|
|
|
tmp = WinPriv;
|
|
|
|
WinPriv = WinPriv->next;
|
2010-05-05 20:44:06 +02:00
|
|
|
free(tmp);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2007-08-28 15:28:25 +02:00
|
|
|
dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey, NULL);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
|
|
|
|
ret = (*pScreen->DestroyWindow)(pWin);
|
|
|
|
pScreen->DestroyWindow = xf86XVDestroyWindow;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-01-13 19:50:16 +01:00
|
|
|
static void
|
|
|
|
xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen;
|
|
|
|
XF86XVScreenPtr ScreenPriv;
|
|
|
|
ScrnInfoPtr pScrn;
|
|
|
|
|
|
|
|
if (pWin)
|
|
|
|
pScreen = pWin->drawable.pScreen;
|
|
|
|
else
|
|
|
|
pScreen = pLayerWin->drawable.pScreen;
|
|
|
|
|
|
|
|
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
pScrn = xf86Screens[pScreen->myNum];
|
|
|
|
|
|
|
|
xf86XVReputOrStopAllPorts(pScrn, TRUE);
|
|
|
|
|
2011-01-14 14:03:28 +01:00
|
|
|
pScreen->PostValidateTree = ScreenPriv->PostValidateTree;
|
|
|
|
if (pScreen->PostValidateTree) {
|
2011-01-13 19:50:16 +01:00
|
|
|
(*pScreen->PostValidateTree)(pWin, pLayerWin, kind);
|
|
|
|
}
|
2011-01-14 14:03:28 +01:00
|
|
|
ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
|
2011-01-13 19:50:16 +01:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
static void
|
|
|
|
xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
|
|
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
|
|
|
|
XvPortRecPrivatePtr pPriv;
|
|
|
|
Bool AreasExposed;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
AreasExposed = (WinPriv && reg1 && RegionNotEmpty(reg1));
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pScreen->WindowExposures = ScreenPriv->WindowExposures;
|
|
|
|
(*pScreen->WindowExposures)(pWin, reg1, reg2);
|
|
|
|
pScreen->WindowExposures = xf86XVWindowExposures;
|
|
|
|
|
|
|
|
/* filter out XClearWindow/Area */
|
|
|
|
if (!pWin->valdata) return;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
while(WinPriv) {
|
2010-10-29 16:00:24 +02:00
|
|
|
Bool visible = TRUE;
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
pPriv = WinPriv->PortRec;
|
|
|
|
|
2010-10-29 16:00:24 +02:00
|
|
|
/*
|
|
|
|
* Stop and remove still/images if areas were exposed and
|
|
|
|
* ReputImage isn't supported.
|
|
|
|
*/
|
|
|
|
if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
|
|
|
|
visible = !AreasExposed;
|
|
|
|
|
2011-01-17 15:58:00 +01:00
|
|
|
/*
|
|
|
|
* Subtract exposed areas from overlaid image to match textured video
|
|
|
|
* behavior.
|
|
|
|
*/
|
|
|
|
if (!pPriv->type && pPriv->clientClip)
|
|
|
|
RegionSubtract(pPriv->clientClip, pPriv->clientClip, reg1);
|
|
|
|
|
|
|
|
if (visible && pPriv->ckeyFilled) {
|
|
|
|
RegionRec tmp;
|
|
|
|
RegionNull(&tmp);
|
|
|
|
RegionCopy(&tmp, reg1);
|
|
|
|
RegionTranslate(&tmp, pWin->drawable.x, pWin->drawable.y);
|
|
|
|
RegionSubtract(pPriv->ckeyFilled, pPriv->ckeyFilled, &tmp);
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
WinPriv = WinPriv->next;
|
2010-10-29 16:00:24 +02:00
|
|
|
xf86XVReputOrStopPort(pPriv, pWin, visible);
|
2011-01-13 19:50:16 +01:00
|
|
|
|
|
|
|
pPriv->clipChanged = FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static void
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen = pWin->drawable.pScreen;
|
|
|
|
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
|
|
|
|
XvPortRecPrivatePtr pPriv;
|
|
|
|
|
|
|
|
while(WinPriv) {
|
|
|
|
pPriv = WinPriv->PortRec;
|
|
|
|
|
|
|
|
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(pPriv->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pPriv->pCompositeClip = NULL;
|
|
|
|
|
2009-01-05 10:25:57 +01:00
|
|
|
if (pPriv->AdaptorRec->ClipNotify)
|
|
|
|
(*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
|
|
|
|
pWin, dx, dy);
|
|
|
|
|
2011-01-13 19:50:16 +01:00
|
|
|
pPriv->clipChanged = TRUE;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2011-01-14 14:03:28 +01:00
|
|
|
if (ScreenPriv->PostValidateTree == PostValidateTreeUndefined) {
|
|
|
|
ScreenPriv->PostValidateTree = pScreen->PostValidateTree;
|
|
|
|
pScreen->PostValidateTree = xf86XVPostValidateTree;
|
|
|
|
}
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
WinPriv = WinPriv->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ScreenPriv->ClipNotify) {
|
|
|
|
pScreen->ClipNotify = ScreenPriv->ClipNotify;
|
|
|
|
(*pScreen->ClipNotify)(pWin, dx, dy);
|
|
|
|
pScreen->ClipNotify = xf86XVClipNotify;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**** Required XvScreenRec fields ****/
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
xf86XVCloseScreen(int i, ScreenPtr pScreen)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
|
|
|
|
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
|
|
|
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
XvAdaptorPtr pa;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
if(!ScreenPriv) return TRUE;
|
|
|
|
|
|
|
|
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
|
|
|
|
pScreen->WindowExposures = ScreenPriv->WindowExposures;
|
|
|
|
pScreen->ClipNotify = ScreenPriv->ClipNotify;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
pScrn->EnterVT = ScreenPriv->EnterVT;
|
|
|
|
pScrn->LeaveVT = ScreenPriv->LeaveVT;
|
2003-11-14 17:48:57 +01:00
|
|
|
pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
|
2010-10-29 16:34:56 +02:00
|
|
|
pScrn->ModeSet = ScreenPriv->ModeSet;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVFreeAdaptor(pa);
|
|
|
|
}
|
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(pxvs->pAdaptors);
|
|
|
|
free(ScreenPriv);
|
2003-11-14 17:48:57 +01:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVQueryAdaptors(
|
|
|
|
ScreenPtr pScreen,
|
|
|
|
XvAdaptorPtr *p_pAdaptors,
|
|
|
|
int *p_nAdaptors
|
|
|
|
){
|
|
|
|
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
|
|
|
|
|
|
|
*p_nAdaptors = pxvs->nAdaptors;
|
|
|
|
*p_pAdaptors = pxvs->pAdaptors;
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return Success;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**** ScrnInfoRec fields ****/
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static Bool
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVEnterVT(int index, int flags)
|
|
|
|
{
|
2010-07-13 01:01:34 +02:00
|
|
|
ScrnInfoPtr pScrn = xf86Screens[index];
|
2003-11-14 17:48:57 +01:00
|
|
|
ScreenPtr pScreen = screenInfo.screens[index];
|
|
|
|
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
Bool ret;
|
|
|
|
|
2010-07-13 01:01:34 +02:00
|
|
|
pScrn->EnterVT = ScreenPriv->EnterVT;
|
2003-11-14 17:48:57 +01:00
|
|
|
ret = (*ScreenPriv->EnterVT)(index, flags);
|
2010-07-13 01:01:34 +02:00
|
|
|
ScreenPriv->EnterVT = pScrn->EnterVT;
|
|
|
|
pScrn->EnterVT = xf86XVEnterVT;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
if(ret) WalkTree(pScreen, xf86XVReputAllVideo, 0);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static void
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVLeaveVT(int index, int flags)
|
|
|
|
{
|
2010-07-13 01:01:34 +02:00
|
|
|
ScrnInfoPtr pScrn = xf86Screens[index];
|
2003-11-14 17:48:57 +01:00
|
|
|
ScreenPtr pScreen = screenInfo.screens[index];
|
|
|
|
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
|
|
|
|
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
XvAdaptorPtr pAdaptor;
|
|
|
|
XvPortPtr pPort;
|
|
|
|
XvPortRecPrivatePtr pPriv;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
for(i = 0; i < pxvs->nAdaptors; i++) {
|
|
|
|
pAdaptor = &pxvs->pAdaptors[i];
|
|
|
|
for(j = 0; j < pAdaptor->nPorts; j++) {
|
|
|
|
pPort = &pAdaptor->pPorts[j];
|
|
|
|
pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
|
|
|
|
if(pPriv->isOn > XV_OFF) {
|
|
|
|
|
|
|
|
(*pPriv->AdaptorRec->StopVideo)(
|
|
|
|
pPriv->pScrn, pPriv->DevPriv.ptr, TRUE);
|
|
|
|
pPriv->isOn = XV_OFF;
|
|
|
|
|
|
|
|
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionDestroy(pPriv->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
pPriv->pCompositeClip = NULL;
|
|
|
|
|
|
|
|
if(!pPriv->type && pPriv->pDraw) { /* still */
|
|
|
|
xf86XVRemovePortFromWindow((WindowPtr)pPriv->pDraw, pPriv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-13 01:01:34 +02:00
|
|
|
pScrn->LeaveVT = ScreenPriv->LeaveVT;
|
2003-11-14 17:48:57 +01:00
|
|
|
(*ScreenPriv->LeaveVT)(index, flags);
|
2010-07-13 01:01:34 +02:00
|
|
|
ScreenPriv->LeaveVT = pScrn->LeaveVT;
|
|
|
|
pScrn->LeaveVT = xf86XVLeaveVT;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
xf86XVAdjustFrame(int index, int x, int y, int flags)
|
|
|
|
{
|
|
|
|
ScrnInfoPtr pScrn = xf86Screens[index];
|
|
|
|
ScreenPtr pScreen = pScrn->pScreen;
|
|
|
|
XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if(ScreenPriv->AdjustFrame) {
|
|
|
|
pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
|
|
|
|
(*pScrn->AdjustFrame)(index, x, y, flags);
|
|
|
|
pScrn->AdjustFrame = xf86XVAdjustFrame;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2011-01-13 19:50:16 +01:00
|
|
|
xf86XVReputOrStopAllPorts(pScrn, FALSE);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-10-29 16:34:56 +02:00
|
|
|
static void
|
|
|
|
xf86XVModeSet(ScrnInfoPtr pScrn)
|
|
|
|
{
|
|
|
|
ScreenPtr pScreen = pScrn->pScreen;
|
|
|
|
XF86XVScreenPtr ScreenPriv;
|
|
|
|
|
|
|
|
/* Can be called before pScrn->pScreen is set */
|
|
|
|
if (!pScreen)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
|
|
|
|
|
|
|
|
if (ScreenPriv->ModeSet) {
|
|
|
|
pScrn->ModeSet = ScreenPriv->ModeSet;
|
|
|
|
(*pScrn->ModeSet)(pScrn);
|
|
|
|
pScrn->ModeSet = xf86XVModeSet;
|
|
|
|
}
|
|
|
|
|
2011-01-13 19:50:16 +01:00
|
|
|
xf86XVReputOrStopAllPorts(pScrn, FALSE);
|
2010-10-29 16:34:56 +02:00
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
/**** XvAdaptorRec fields ****/
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVAllocatePort(
|
|
|
|
unsigned long port,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
XvPortPtr *ppPort
|
|
|
|
){
|
|
|
|
*ppPort = pPort;
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVFreePort(XvPortPtr pPort)
|
|
|
|
{
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVPutVideo(
|
|
|
|
ClientPtr client,
|
|
|
|
DrawablePtr pDraw,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
GCPtr pGC,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16 vid_x, INT16 vid_y,
|
|
|
|
CARD16 vid_w, CARD16 vid_h,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16 drw_x, INT16 drw_y,
|
|
|
|
CARD16 drw_w, CARD16 drw_h
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
|
|
|
int result;
|
|
|
|
|
|
|
|
/* No dumping video to pixmaps... For now anyhow */
|
|
|
|
if(pDraw->type != DRAWABLE_WINDOW) {
|
|
|
|
pPort->pDraw = (DrawablePtr)NULL;
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* If we are changing windows, unregister our port in the old window */
|
|
|
|
if(portPriv->pDraw && (portPriv->pDraw != pDraw))
|
|
|
|
xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
|
|
|
|
|
|
|
|
/* Register our port with the new window */
|
|
|
|
result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
|
|
|
|
if(result != Success) return result;
|
|
|
|
|
|
|
|
portPriv->type = XvInputMask;
|
|
|
|
|
|
|
|
/* save a copy of these parameters */
|
|
|
|
portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
|
|
|
|
portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
|
|
|
|
portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
|
|
|
|
portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
|
|
|
|
|
|
|
|
/* make sure we have the most recent copy of the clientClip */
|
|
|
|
xf86XVCopyClip(portPriv, pGC);
|
|
|
|
|
|
|
|
/* To indicate to the DI layer that we were successful */
|
|
|
|
pPort->pDraw = pDraw;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
|
|
|
|
|
|
|
|
return(xf86XVReputVideo(portPriv));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVPutStill(
|
|
|
|
ClientPtr client,
|
|
|
|
DrawablePtr pDraw,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
GCPtr pGC,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16 vid_x, INT16 vid_y,
|
|
|
|
CARD16 vid_w, CARD16 vid_h,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16 drw_x, INT16 drw_y,
|
|
|
|
CARD16 drw_w, CARD16 drw_h
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
|
|
|
RegionRec WinRegion;
|
|
|
|
RegionRec ClipRegion;
|
|
|
|
BoxRec WinBox;
|
|
|
|
int ret = Success;
|
|
|
|
Bool clippedAway = FALSE;
|
|
|
|
|
|
|
|
if (pDraw->type != DRAWABLE_WINDOW)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
|
|
|
|
|
|
|
|
WinBox.x1 = pDraw->x + drw_x;
|
|
|
|
WinBox.y1 = pDraw->y + drw_y;
|
|
|
|
WinBox.x2 = WinBox.x1 + drw_w;
|
|
|
|
WinBox.y2 = WinBox.y1 + drw_h;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-11-01 19:27:25 +01:00
|
|
|
xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&WinRegion, &WinBox, 1);
|
|
|
|
RegionNull(&ClipRegion);
|
|
|
|
RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
|
|
|
|
RegionRec VPReg;
|
|
|
|
BoxRec VPBox;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
VPBox.x1 = portPriv->pScrn->frameX0;
|
2003-11-14 17:48:57 +01:00
|
|
|
VPBox.y1 = portPriv->pScrn->frameY0;
|
2009-12-14 18:19:01 +01:00
|
|
|
VPBox.x2 = portPriv->pScrn->frameX1 + 1;
|
|
|
|
VPBox.y2 = portPriv->pScrn->frameY1 + 1;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&VPReg, &VPBox, 1);
|
|
|
|
RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
|
|
|
|
RegionUninit(&VPReg);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->pDraw) {
|
|
|
|
xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
|
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if(!RegionNotEmpty(&ClipRegion)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
clippedAway = TRUE;
|
|
|
|
goto PUT_STILL_BAILOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
|
2010-05-22 00:05:48 +02:00
|
|
|
BoxPtr clipBox = RegionRects(&ClipRegion);
|
|
|
|
if( (RegionNumRects(&ClipRegion) != 1) ||
|
2003-11-25 20:29:01 +01:00
|
|
|
(clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
|
2003-11-14 17:48:57 +01:00
|
|
|
(clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
|
|
|
|
{
|
|
|
|
clippedAway = TRUE;
|
2003-11-25 20:29:01 +01:00
|
|
|
goto PUT_STILL_BAILOUT;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
ret = (*portPriv->AdaptorRec->PutStill)(portPriv->pScrn,
|
2003-11-14 17:48:57 +01:00
|
|
|
vid_x, vid_y, WinBox.x1, WinBox.y1,
|
|
|
|
vid_w, vid_h, drw_w, drw_h,
|
2006-04-07 20:56:04 +02:00
|
|
|
&ClipRegion, portPriv->DevPriv.ptr,
|
|
|
|
pDraw);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if((ret == Success) &&
|
|
|
|
(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_STILLS)) {
|
|
|
|
|
|
|
|
xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
|
|
|
|
portPriv->isOn = XV_ON;
|
2010-11-02 15:05:13 +01:00
|
|
|
portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
|
|
|
|
portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
|
2003-11-14 17:48:57 +01:00
|
|
|
portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
|
|
|
|
portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
|
|
|
|
portPriv->type = 0; /* no mask means it's transient and should
|
|
|
|
not be reput once it's removed */
|
|
|
|
pPort->pDraw = pDraw; /* make sure we can get stop requests */
|
|
|
|
}
|
|
|
|
|
|
|
|
PUT_STILL_BAILOUT:
|
|
|
|
|
|
|
|
if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
|
2003-11-25 20:29:01 +01:00
|
|
|
(*portPriv->AdaptorRec->StopVideo)(
|
|
|
|
portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
|
|
|
|
portPriv->isOn = XV_PENDING;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-11-01 19:27:25 +01:00
|
|
|
/* This clip was copied and only good for one shot */
|
|
|
|
if(!portPriv->FreeCompositeClip)
|
|
|
|
portPriv->pCompositeClip = NULL;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(&WinRegion);
|
|
|
|
RegionUninit(&ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVGetVideo(
|
|
|
|
ClientPtr client,
|
|
|
|
DrawablePtr pDraw,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
GCPtr pGC,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16 vid_x, INT16 vid_y,
|
|
|
|
CARD16 vid_w, CARD16 vid_h,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16 drw_x, INT16 drw_y,
|
|
|
|
CARD16 drw_w, CARD16 drw_h
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
|
|
|
int result;
|
|
|
|
|
|
|
|
/* No pixmaps... For now anyhow */
|
|
|
|
if(pDraw->type != DRAWABLE_WINDOW) {
|
|
|
|
pPort->pDraw = (DrawablePtr)NULL;
|
|
|
|
return BadAlloc;
|
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
/* If we are changing windows, unregister our port in the old window */
|
|
|
|
if(portPriv->pDraw && (portPriv->pDraw != pDraw))
|
|
|
|
xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
|
|
|
|
|
|
|
|
/* Register our port with the new window */
|
|
|
|
result = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
|
|
|
|
if(result != Success) return result;
|
|
|
|
|
|
|
|
portPriv->type = XvOutputMask;
|
|
|
|
|
|
|
|
/* save a copy of these parameters */
|
|
|
|
portPriv->vid_x = vid_x; portPriv->vid_y = vid_y;
|
|
|
|
portPriv->vid_w = vid_w; portPriv->vid_h = vid_h;
|
|
|
|
portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
|
|
|
|
portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
|
|
|
|
|
|
|
|
/* make sure we have the most recent copy of the clientClip */
|
|
|
|
xf86XVCopyClip(portPriv, pGC);
|
|
|
|
|
|
|
|
/* To indicate to the DI layer that we were successful */
|
|
|
|
pPort->pDraw = pDraw;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
|
|
|
|
|
|
|
|
return(xf86XVRegetVideo(portPriv));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVGetStill(
|
|
|
|
ClientPtr client,
|
|
|
|
DrawablePtr pDraw,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
GCPtr pGC,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16 vid_x, INT16 vid_y,
|
|
|
|
CARD16 vid_w, CARD16 vid_h,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16 drw_x, INT16 drw_y,
|
|
|
|
CARD16 drw_w, CARD16 drw_h
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
|
|
|
RegionRec WinRegion;
|
|
|
|
RegionRec ClipRegion;
|
|
|
|
BoxRec WinBox;
|
|
|
|
int ret = Success;
|
|
|
|
Bool clippedAway = FALSE;
|
|
|
|
|
|
|
|
if (pDraw->type != DRAWABLE_WINDOW)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
|
|
|
|
|
|
|
|
WinBox.x1 = pDraw->x + drw_x;
|
|
|
|
WinBox.y1 = pDraw->y + drw_y;
|
|
|
|
WinBox.x2 = WinBox.x1 + drw_w;
|
|
|
|
WinBox.y2 = WinBox.y1 + drw_h;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&WinRegion, &WinBox, 1);
|
|
|
|
RegionNull(&ClipRegion);
|
|
|
|
RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(portPriv->pDraw) {
|
|
|
|
xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
|
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if(!RegionNotEmpty(&ClipRegion)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
clippedAway = TRUE;
|
|
|
|
goto GET_STILL_BAILOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = (*portPriv->AdaptorRec->GetStill)(portPriv->pScrn,
|
|
|
|
vid_x, vid_y, WinBox.x1, WinBox.y1,
|
|
|
|
vid_w, vid_h, drw_w, drw_h,
|
2006-04-07 20:56:04 +02:00
|
|
|
&ClipRegion, portPriv->DevPriv.ptr,
|
|
|
|
pDraw);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
GET_STILL_BAILOUT:
|
|
|
|
|
|
|
|
if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
|
2003-11-25 20:29:01 +01:00
|
|
|
(*portPriv->AdaptorRec->StopVideo)(
|
|
|
|
portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
|
|
|
|
portPriv->isOn = XV_PENDING;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(&WinRegion);
|
|
|
|
RegionUninit(&ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVStopVideo(
|
|
|
|
ClientPtr client,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
DrawablePtr pDraw
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
|
|
|
|
|
|
|
if(pDraw->type != DRAWABLE_WINDOW)
|
|
|
|
return BadAlloc;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVRemovePortFromWindow((WindowPtr)pDraw, portPriv);
|
|
|
|
|
|
|
|
if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
|
|
|
|
|
|
|
|
/* Must free resources. */
|
|
|
|
|
|
|
|
if(portPriv->isOn > XV_OFF) {
|
|
|
|
(*portPriv->AdaptorRec->StopVideo)(
|
|
|
|
portPriv->pScrn, portPriv->DevPriv.ptr, TRUE);
|
|
|
|
portPriv->isOn = XV_OFF;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVSetPortAttribute(
|
|
|
|
ClientPtr client,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
Atom attribute,
|
|
|
|
INT32 value
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->pScrn,
|
2003-11-14 17:48:57 +01:00
|
|
|
attribute, value, portPriv->DevPriv.ptr));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVGetPortAttribute(
|
|
|
|
ClientPtr client,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
Atom attribute,
|
|
|
|
INT32 *p_value
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->pScrn,
|
2003-11-14 17:48:57 +01:00
|
|
|
attribute, p_value, portPriv->DevPriv.ptr));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
xf86XVQueryBestSize(
|
|
|
|
ClientPtr client,
|
|
|
|
XvPortPtr pPort,
|
|
|
|
CARD8 motion,
|
|
|
|
CARD16 vid_w, CARD16 vid_h,
|
|
|
|
CARD16 drw_w, CARD16 drw_h,
|
|
|
|
unsigned int *p_w, unsigned int *p_h
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
2003-11-25 20:29:01 +01:00
|
|
|
|
|
|
|
(*portPriv->AdaptorRec->QueryBestSize)(portPriv->pScrn,
|
2003-11-14 17:48:57 +01:00
|
|
|
(Bool)motion, vid_w, vid_h, drw_w, drw_h,
|
|
|
|
p_w, p_h, portPriv->DevPriv.ptr);
|
|
|
|
|
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static int
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVPutImage(
|
2003-11-25 20:29:01 +01:00
|
|
|
ClientPtr client,
|
|
|
|
DrawablePtr pDraw,
|
|
|
|
XvPortPtr pPort,
|
2003-11-14 17:48:57 +01:00
|
|
|
GCPtr pGC,
|
2003-11-25 20:29:01 +01:00
|
|
|
INT16 src_x, INT16 src_y,
|
|
|
|
CARD16 src_w, CARD16 src_h,
|
2003-11-14 17:48:57 +01:00
|
|
|
INT16 drw_x, INT16 drw_y,
|
|
|
|
CARD16 drw_w, CARD16 drw_h,
|
|
|
|
XvImagePtr format,
|
|
|
|
unsigned char* data,
|
|
|
|
Bool sync,
|
|
|
|
CARD16 width, CARD16 height
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
|
|
|
RegionRec WinRegion;
|
|
|
|
RegionRec ClipRegion;
|
|
|
|
BoxRec WinBox;
|
|
|
|
int ret = Success;
|
|
|
|
Bool clippedAway = FALSE;
|
|
|
|
|
|
|
|
if (pDraw->type != DRAWABLE_WINDOW)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
|
|
|
|
|
2010-11-01 19:27:25 +01:00
|
|
|
xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
|
|
|
|
|
2003-11-14 17:48:57 +01:00
|
|
|
WinBox.x1 = pDraw->x + drw_x;
|
|
|
|
WinBox.y1 = pDraw->y + drw_y;
|
|
|
|
WinBox.x2 = WinBox.x1 + drw_w;
|
|
|
|
WinBox.y2 = WinBox.y1 + drw_h;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&WinRegion, &WinBox, 1);
|
|
|
|
RegionNull(&ClipRegion);
|
|
|
|
RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) {
|
|
|
|
RegionRec VPReg;
|
|
|
|
BoxRec VPBox;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
VPBox.x1 = portPriv->pScrn->frameX0;
|
2003-11-14 17:48:57 +01:00
|
|
|
VPBox.y1 = portPriv->pScrn->frameY0;
|
2003-11-25 20:29:01 +01:00
|
|
|
VPBox.x2 = portPriv->pScrn->frameX1 + 1;
|
2003-11-14 17:48:57 +01:00
|
|
|
VPBox.y2 = portPriv->pScrn->frameY1 + 1;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&VPReg, &VPBox, 1);
|
|
|
|
RegionIntersect(&ClipRegion, &ClipRegion, &VPReg);
|
|
|
|
RegionUninit(&VPReg);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2006-10-15 16:48:59 +02:00
|
|
|
/* If we are changing windows, unregister our port in the old window */
|
|
|
|
if(portPriv->pDraw && (portPriv->pDraw != pDraw))
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
|
2006-10-15 16:48:59 +02:00
|
|
|
|
|
|
|
/* Register our port with the new window */
|
|
|
|
ret = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
|
|
|
|
if(ret != Success) goto PUT_IMAGE_BAILOUT;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
if(!RegionNotEmpty(&ClipRegion)) {
|
2003-11-14 17:48:57 +01:00
|
|
|
clippedAway = TRUE;
|
|
|
|
goto PUT_IMAGE_BAILOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) {
|
2010-05-22 00:05:48 +02:00
|
|
|
BoxPtr clipBox = RegionRects(&ClipRegion);
|
|
|
|
if( (RegionNumRects(&ClipRegion) != 1) ||
|
2003-11-25 20:29:01 +01:00
|
|
|
(clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) ||
|
2003-11-14 17:48:57 +01:00
|
|
|
(clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2))
|
|
|
|
{
|
|
|
|
clippedAway = TRUE;
|
2003-11-25 20:29:01 +01:00
|
|
|
goto PUT_IMAGE_BAILOUT;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) {
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionSubtract(&ClipRegion, &WinRegion, &ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
ret = (*portPriv->AdaptorRec->PutImage)(portPriv->pScrn,
|
2003-11-14 17:48:57 +01:00
|
|
|
src_x, src_y, WinBox.x1, WinBox.y1,
|
|
|
|
src_w, src_h, drw_w, drw_h, format->id, data, width, height,
|
2006-04-07 20:56:04 +02:00
|
|
|
sync, &ClipRegion, portPriv->DevPriv.ptr,
|
|
|
|
pDraw);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if((ret == Success) &&
|
|
|
|
(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
|
|
|
|
|
|
|
|
portPriv->isOn = XV_ON;
|
2010-11-02 15:05:13 +01:00
|
|
|
portPriv->vid_x = src_x; portPriv->vid_y = src_y;
|
|
|
|
portPriv->vid_w = src_w; portPriv->vid_h = src_h;
|
2003-11-14 17:48:57 +01:00
|
|
|
portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
|
|
|
|
portPriv->drw_w = drw_w; portPriv->drw_h = drw_h;
|
|
|
|
portPriv->type = 0; /* no mask means it's transient and should
|
|
|
|
not be reput once it's removed */
|
|
|
|
pPort->pDraw = pDraw; /* make sure we can get stop requests */
|
|
|
|
}
|
|
|
|
|
|
|
|
PUT_IMAGE_BAILOUT:
|
|
|
|
|
|
|
|
if((clippedAway || (ret != Success)) && (portPriv->isOn == XV_ON)) {
|
2003-11-25 20:29:01 +01:00
|
|
|
(*portPriv->AdaptorRec->StopVideo)(
|
|
|
|
portPriv->pScrn, portPriv->DevPriv.ptr, FALSE);
|
|
|
|
portPriv->isOn = XV_PENDING;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2010-11-01 19:27:25 +01:00
|
|
|
/* This clip was copied and only good for one shot */
|
|
|
|
if(!portPriv->FreeCompositeClip)
|
|
|
|
portPriv->pCompositeClip = NULL;
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(&WinRegion);
|
|
|
|
RegionUninit(&ClipRegion);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
static int
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVQueryImageAttributes(
|
2003-11-25 20:29:01 +01:00
|
|
|
ClientPtr client,
|
2003-11-14 17:48:57 +01:00
|
|
|
XvPortPtr pPort,
|
2003-11-25 20:29:01 +01:00
|
|
|
XvImagePtr format,
|
|
|
|
CARD16 *width,
|
|
|
|
CARD16 *height,
|
2003-11-14 17:48:57 +01:00
|
|
|
int *pitches,
|
|
|
|
int *offsets
|
|
|
|
){
|
|
|
|
XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr);
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->pScrn,
|
2003-11-14 17:48:57 +01:00
|
|
|
format->id, width, height, pitches, offsets);
|
|
|
|
}
|
|
|
|
|
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
|
2011-01-17 15:58:00 +01:00
|
|
|
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
|
2006-10-15 16:48:59 +02:00
|
|
|
{
|
|
|
|
ScreenPtr pScreen = pDraw->pScreen;
|
2010-05-08 23:10:51 +02:00
|
|
|
ChangeGCVal pval[2];
|
2011-01-17 15:58:00 +01:00
|
|
|
BoxPtr pbox = RegionRects(fillboxes);
|
|
|
|
int i, nbox = RegionNumRects(fillboxes);
|
2003-11-14 17:48:57 +01:00
|
|
|
xRectangle *rects;
|
2007-05-26 05:33:08 +02:00
|
|
|
GCPtr gc;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
if(!xf86Screens[pScreen->myNum]->vtSema) return;
|
|
|
|
|
2011-01-13 19:19:18 +01:00
|
|
|
gc = GetScratchGC(pDraw->depth, pScreen);
|
2010-05-08 23:10:51 +02:00
|
|
|
pval[0].val = key;
|
|
|
|
pval[1].val = IncludeInferiors;
|
2010-05-08 04:38:05 +02:00
|
|
|
(void) ChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval);
|
2011-01-13 19:19:18 +01:00
|
|
|
ValidateGC(pDraw, gc);
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
rects = malloc(nbox * sizeof(xRectangle));
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2007-05-26 05:33:08 +02:00
|
|
|
for(i = 0; i < nbox; i++, pbox++)
|
|
|
|
{
|
2011-01-13 19:19:18 +01:00
|
|
|
rects[i].x = pbox->x1 - pDraw->x;
|
|
|
|
rects[i].y = pbox->y1 - pDraw->y;
|
2003-11-14 17:48:57 +01:00
|
|
|
rects[i].width = pbox->x2 - pbox->x1;
|
|
|
|
rects[i].height = pbox->y2 - pbox->y1;
|
|
|
|
}
|
2007-05-26 05:33:08 +02:00
|
|
|
|
2011-01-13 19:19:18 +01:00
|
|
|
(*gc->ops->PolyFillRect)(pDraw, gc, nbox, rects);
|
2007-05-26 05:33:08 +02:00
|
|
|
|
2010-05-05 20:44:06 +02:00
|
|
|
free(rects);
|
2007-05-26 05:33:08 +02:00
|
|
|
FreeScratchGC (gc);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2011-01-13 19:19:18 +01:00
|
|
|
void
|
2011-01-17 15:58:00 +01:00
|
|
|
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes)
|
2011-01-13 19:19:18 +01:00
|
|
|
{
|
2011-01-17 15:58:00 +01:00
|
|
|
xf86XVFillKeyHelperDrawable (&pScreen->root->drawable, key, fillboxes);
|
2011-01-13 19:19:18 +01:00
|
|
|
}
|
|
|
|
|
2011-01-17 15:58:00 +01:00
|
|
|
void
|
|
|
|
xf86XVFillKeyHelperPort (DrawablePtr pDraw, pointer data, CARD32 key, RegionPtr clipboxes, Bool fillEverything)
|
|
|
|
{
|
|
|
|
WindowPtr pWin = (WindowPtr)pDraw;
|
|
|
|
XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
|
|
|
|
XvPortRecPrivatePtr portPriv = NULL;
|
|
|
|
RegionRec reg;
|
|
|
|
RegionPtr fillboxes;
|
|
|
|
|
|
|
|
while (WinPriv) {
|
|
|
|
XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
|
|
|
|
|
|
|
|
if (data == pPriv->DevPriv.ptr) {
|
|
|
|
portPriv = pPriv;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
WinPriv = WinPriv->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!portPriv)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!portPriv->ckeyFilled)
|
|
|
|
portPriv->ckeyFilled = RegionCreate(NULL, 0);
|
|
|
|
|
|
|
|
if (!fillEverything) {
|
|
|
|
RegionNull(®);
|
|
|
|
fillboxes = ®
|
|
|
|
RegionSubtract(fillboxes, clipboxes, portPriv->ckeyFilled);
|
|
|
|
|
|
|
|
if (!RegionNotEmpty(fillboxes))
|
|
|
|
goto out;
|
|
|
|
} else
|
|
|
|
fillboxes = clipboxes;
|
|
|
|
|
|
|
|
|
|
|
|
RegionCopy(portPriv->ckeyFilled, clipboxes);
|
|
|
|
|
|
|
|
xf86XVFillKeyHelperDrawable(pDraw, key, fillboxes);
|
|
|
|
out:
|
|
|
|
if (!fillEverything)
|
|
|
|
RegionUninit(®);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
/* xf86XVClipVideoHelper -
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
Takes the dst box in standard X BoxRec form (top and left
|
|
|
|
edges inclusive, bottom and right exclusive). The new dst
|
2003-11-25 20:29:01 +01:00
|
|
|
box is returned. The source boundaries are given (x1, y1
|
|
|
|
inclusive, x2, y2 exclusive) and returned are the new source
|
|
|
|
boundaries in 16.16 fixed point.
|
2003-11-14 17:48:57 +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
|
2003-11-14 17:48:57 +01:00
|
|
|
xf86XVClipVideoHelper(
|
|
|
|
BoxPtr dst,
|
|
|
|
INT32 *xa,
|
|
|
|
INT32 *xb,
|
|
|
|
INT32 *ya,
|
|
|
|
INT32 *yb,
|
|
|
|
RegionPtr reg,
|
|
|
|
INT32 width,
|
|
|
|
INT32 height
|
|
|
|
){
|
2003-11-25 20:29:01 +01:00
|
|
|
double xsw, xdw, ysw, ydw;
|
|
|
|
INT32 delta;
|
2010-05-22 00:05:48 +02:00
|
|
|
BoxPtr extents = RegionExtents(reg);
|
2003-11-14 17:48:57 +01:00
|
|
|
int diff;
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
xsw = (*xb - *xa) << 16;
|
|
|
|
xdw = dst->x2 - dst->x1;
|
|
|
|
ysw = (*yb - *ya) << 16;
|
|
|
|
ydw = dst->y2 - dst->y1;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
|
|
|
*xa <<= 16; *xb <<= 16;
|
|
|
|
*ya <<= 16; *yb <<= 16;
|
|
|
|
|
|
|
|
diff = extents->x1 - dst->x1;
|
2003-11-25 20:29:01 +01:00
|
|
|
if (diff > 0) {
|
|
|
|
dst->x1 = extents->x1;
|
|
|
|
*xa += (diff * xsw) / xdw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
diff = dst->x2 - extents->x2;
|
2003-11-25 20:29:01 +01:00
|
|
|
if (diff > 0) {
|
|
|
|
dst->x2 = extents->x2;
|
|
|
|
*xb -= (diff * xsw) / xdw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
diff = extents->y1 - dst->y1;
|
2003-11-25 20:29:01 +01:00
|
|
|
if (diff > 0) {
|
|
|
|
dst->y1 = extents->y1;
|
|
|
|
*ya += (diff * ysw) / ydw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
diff = dst->y2 - extents->y2;
|
2003-11-25 20:29:01 +01:00
|
|
|
if (diff > 0) {
|
|
|
|
dst->y2 = extents->y2;
|
|
|
|
*yb -= (diff * ysw) / ydw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
if (*xa < 0) {
|
|
|
|
diff = (((-*xa) * xdw) + xsw - 1) / xsw;
|
|
|
|
dst->x1 += diff;
|
|
|
|
*xa += (diff * xsw) / xdw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
delta = *xb - (width << 16);
|
2003-11-25 20:29:01 +01:00
|
|
|
if (delta > 0) {
|
|
|
|
diff = ((delta * xdw) + xsw - 1) / xsw;
|
|
|
|
dst->x2 -= diff;
|
|
|
|
*xb -= (diff * xsw) / xdw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
if (*xa >= *xb) return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
if (*ya < 0) {
|
|
|
|
diff = (((-*ya) * ydw) + ysw - 1) / ysw;
|
|
|
|
dst->y1 += diff;
|
|
|
|
*ya += (diff * ysw) / ydw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
delta = *yb - (height << 16);
|
2003-11-25 20:29:01 +01:00
|
|
|
if (delta > 0) {
|
|
|
|
diff = ((delta * ydw) + ysw - 1) / ysw;
|
|
|
|
dst->y2 -= diff;
|
|
|
|
*yb -= (diff * ysw) / ydw;
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
2003-11-25 20:29:01 +01:00
|
|
|
if (*ya >= *yb) return FALSE;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
if ((dst->x1 > extents->x1) || (dst->x2 < extents->x2) ||
|
|
|
|
(dst->y1 > extents->y1) || (dst->y2 < extents->y2))
|
2003-11-14 17:48:57 +01:00
|
|
|
{
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionRec clipReg;
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionInit(&clipReg, dst, 1);
|
|
|
|
RegionIntersect(reg, reg, &clipReg);
|
|
|
|
RegionUninit(&clipReg);
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVCopyYUV12ToPacked(
|
|
|
|
const void *srcy,
|
|
|
|
const void *srcv,
|
|
|
|
const void *srcu,
|
|
|
|
void *dst,
|
|
|
|
int srcPitchy,
|
|
|
|
int srcPitchuv,
|
|
|
|
int dstPitch,
|
|
|
|
int h,
|
|
|
|
int w
|
|
|
|
){
|
|
|
|
CARD32 *Dst;
|
|
|
|
const CARD8 *Y, *U, *V;
|
|
|
|
int i, j;
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
w >>= 1;
|
|
|
|
|
|
|
|
for (j = 0; j < h; j++) {
|
|
|
|
Dst = dst;
|
|
|
|
Y = srcy; V = srcv; U = srcu;
|
|
|
|
i = w;
|
|
|
|
while (i >= 4) {
|
|
|
|
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
|
|
|
|
Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
|
|
|
|
Dst[1] = Y[2] | (Y[3] << 16) | (U[1] << 8) | (V[1] << 24);
|
|
|
|
Dst[2] = Y[4] | (Y[5] << 16) | (U[2] << 8) | (V[2] << 24);
|
|
|
|
Dst[3] = Y[6] | (Y[7] << 16) | (U[3] << 8) | (V[3] << 24);
|
|
|
|
#else
|
|
|
|
/* This assumes a little-endian framebuffer */
|
2004-03-03 13:12:50 +01:00
|
|
|
Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
|
|
|
|
Dst[1] = (Y[2] << 24) | (Y[3] << 8) | (U[1] << 16) | V[1];
|
|
|
|
Dst[2] = (Y[4] << 24) | (Y[5] << 8) | (U[2] << 16) | V[2];
|
|
|
|
Dst[3] = (Y[6] << 24) | (Y[7] << 8) | (U[3] << 16) | V[3];
|
2003-11-25 20:29:01 +01:00
|
|
|
#endif
|
|
|
|
Dst += 4; Y += 8; V += 4; U += 4;
|
|
|
|
i -= 4;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
while (i--) {
|
|
|
|
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
|
|
|
|
Dst[0] = Y[0] | (Y[1] << 16) | (U[0] << 8) | (V[0] << 24);
|
|
|
|
#else
|
|
|
|
/* This assumes a little-endian framebuffer */
|
2004-03-03 13:12:50 +01:00
|
|
|
Dst[0] = (Y[0] << 24) | (Y[1] << 8) | (U[0] << 16) | V[0];
|
2003-11-25 20:29:01 +01:00
|
|
|
#endif
|
|
|
|
Dst++; Y += 2; V++; U++;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
|
2003-11-25 20:29:01 +01:00
|
|
|
dst = (CARD8 *)dst + dstPitch;
|
|
|
|
srcy = (const CARD8 *)srcy + srcPitchy;
|
|
|
|
if (j & 1) {
|
|
|
|
srcu = (const CARD8 *)srcu + srcPitchuv;
|
|
|
|
srcv = (const CARD8 *)srcv + srcPitchuv;
|
|
|
|
}
|
2003-11-14 17:48:57 +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
|
|
|
void
|
2003-11-25 20:29:01 +01:00
|
|
|
xf86XVCopyPacked(
|
|
|
|
const void *src,
|
|
|
|
void *dst,
|
|
|
|
int srcPitch,
|
|
|
|
int dstPitch,
|
|
|
|
int h,
|
|
|
|
int w
|
2003-11-14 17:48:57 +01:00
|
|
|
){
|
2003-11-25 20:29:01 +01:00
|
|
|
const CARD32 *Src;
|
|
|
|
CARD32 *Dst;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
w >>= 1;
|
|
|
|
while (--h >= 0) {
|
|
|
|
do {
|
|
|
|
Dst = dst; Src = src;
|
|
|
|
i = w;
|
|
|
|
while (i >= 4) {
|
|
|
|
Dst[0] = Src[0];
|
|
|
|
Dst[1] = Src[1];
|
|
|
|
Dst[2] = Src[2];
|
|
|
|
Dst[3] = Src[3];
|
|
|
|
Dst += 4; Src += 4; i -= 4;
|
|
|
|
}
|
|
|
|
if (!i) break;
|
|
|
|
Dst[0] = Src[0];
|
|
|
|
if (i == 1) break;
|
|
|
|
Dst[1] = Src[1];
|
|
|
|
if (i == 2) break;
|
|
|
|
Dst[2] = Src[2];
|
|
|
|
} while (0);
|
|
|
|
|
|
|
|
src = (const CARD8 *)src + srcPitch;
|
|
|
|
dst = (CARD8 *)dst + dstPitch;
|
|
|
|
}
|
2003-11-14 17:48:57 +01:00
|
|
|
}
|