link and init xv
This commit is contained in:
parent
50a64c84e1
commit
8426eb2433
|
@ -723,6 +723,7 @@ if test "x$XV" = xyes; then
|
|||
AC_DEFINE(XV, 1, [Support Xv extension])
|
||||
AC_DEFINE(XvExtension, 1, [Build Xv extension])
|
||||
REQUIRED_MODULES="$REQUIRED_MODULES videoproto"
|
||||
PKG_CHECK_MODULES(XV, [xv >= 0.22])
|
||||
else
|
||||
XVMC=no
|
||||
fi
|
||||
|
@ -1860,9 +1861,9 @@ if test "$KDRIVE" = yes; then
|
|||
KDRIVE_OS_INC='-I$(top_srcdir)/hw/kdrive/linux'
|
||||
KDRIVE_INCS="$KDRIVE_PURE_INCS $KDRIVE_OS_INC"
|
||||
|
||||
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS"
|
||||
KDRIVE_CFLAGS="$XSERVER_CFLAGS -DHAVE_KDRIVE_CONFIG_H $TSLIB_CFLAGS $XV_CFLAGS"
|
||||
|
||||
KDRIVE_PURE_LIBS="$FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB"
|
||||
KDRIVE_PURE_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $XV_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $OS_LIB"
|
||||
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
|
||||
case $host_os in
|
||||
*linux*)
|
||||
|
|
|
@ -23,11 +23,6 @@
|
|||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
*
|
||||
* o Support multiple screens, shouldn't be hard just alot of rejigging.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <kdrive-config.h>
|
||||
#endif
|
||||
|
@ -35,6 +30,7 @@
|
|||
|
||||
#include "inputstr.h"
|
||||
#include "scrnintstr.h"
|
||||
#include "ephyrlog.h"
|
||||
|
||||
extern int KdTsPhyScreen;
|
||||
KdKeyboardInfo *ephyrKbd;
|
||||
|
@ -209,7 +205,7 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
|||
KdPointerMatrix m;
|
||||
int buffer_height;
|
||||
|
||||
EPHYR_DBG("screen->width: %d, screen->height: %d index=%d",
|
||||
EPHYR_LOG("screen->width: %d, screen->height: %d index=%d",
|
||||
screen->width, screen->height, screen->mynum);
|
||||
|
||||
KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
|
||||
|
@ -245,7 +241,7 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
|||
/* Rotated/Reflected so we need to use shadow fb */
|
||||
scrpriv->shadow = TRUE;
|
||||
|
||||
EPHYR_DBG("allocing shadow");
|
||||
EPHYR_LOG("allocing shadow");
|
||||
|
||||
KdShadowFbAlloc (screen, 0,
|
||||
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
|
||||
|
@ -296,7 +292,7 @@ ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf)
|
|||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
|
||||
EPHYR_DBG("slow paint");
|
||||
EPHYR_LOG("slow paint");
|
||||
|
||||
/* FIXME: Slow Rotated/Reflected updates could be much
|
||||
* much faster efficiently updating via tranforming
|
||||
|
@ -410,7 +406,7 @@ ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
|||
Rotation randr;
|
||||
int n = 0;
|
||||
|
||||
EPHYR_DBG("mark");
|
||||
EPHYR_LOG("mark");
|
||||
|
||||
struct { int width, height; } sizes[] =
|
||||
{
|
||||
|
@ -563,7 +559,7 @@ ephyrRandRSetConfig (ScreenPtr pScreen,
|
|||
return TRUE;
|
||||
|
||||
bail4:
|
||||
EPHYR_DBG("bailed");
|
||||
EPHYR_LOG("bailed");
|
||||
|
||||
ephyrUnmapFramebuffer (screen);
|
||||
*scrpriv = oldscr;
|
||||
|
@ -606,10 +602,17 @@ ephyrInitScreen (ScreenPtr pScreen)
|
|||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
|
||||
EPHYR_DBG ("pScreen->myNum:%d\n", pScreen->myNum) ;
|
||||
EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ;
|
||||
hostx_set_screen_number (screen, pScreen->myNum);
|
||||
hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ;
|
||||
pScreen->CreateColormap = ephyrCreateColormap;
|
||||
#ifdef XV
|
||||
if (!ephyrInitVideo (pScreen)) {
|
||||
EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ;
|
||||
} else {
|
||||
EPHYR_LOG_ERROR ("initialized xvideo okay\n") ;
|
||||
}
|
||||
#endif /*XV*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -637,7 +640,7 @@ ephyrCreateResources (ScreenPtr pScreen)
|
|||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
EphyrScrPriv *scrpriv = screen->driver;
|
||||
|
||||
EPHYR_DBG("mark pScreen=%p mynum=%d shadow=%d",
|
||||
EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d",
|
||||
pScreen, pScreen->myNum, scrpriv->shadow);
|
||||
|
||||
if (scrpriv->shadow)
|
||||
|
@ -809,20 +812,20 @@ ephyrPoll(void)
|
|||
case EPHYR_EV_MOUSE_MOTION:
|
||||
if (!ephyrMouse ||
|
||||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
|
||||
EPHYR_DBG ("skipping mouse motion:%d\n", ephyrCurScreen) ;
|
||||
EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ;
|
||||
continue;
|
||||
}
|
||||
{
|
||||
if (ephyrCurScreen != ev.data.mouse_motion.screen)
|
||||
{
|
||||
EPHYR_DBG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
|
||||
EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
|
||||
ephyrWarpCursor(screenInfo.screens[ev.data.mouse_motion.screen],
|
||||
ev.data.mouse_motion.x,
|
||||
ev.data.mouse_motion.y );
|
||||
}
|
||||
else
|
||||
{
|
||||
EPHYR_DBG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
|
||||
EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState,
|
||||
ev.data.mouse_motion.x,
|
||||
ev.data.mouse_motion.y,
|
||||
|
@ -834,10 +837,10 @@ ephyrPoll(void)
|
|||
case EPHYR_EV_MOUSE_PRESS:
|
||||
if (!ephyrMouse ||
|
||||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) {
|
||||
EPHYR_DBG ("skipping mouse press:%d\n", ephyrCurScreen) ;
|
||||
EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ;
|
||||
continue;
|
||||
}
|
||||
EPHYR_DBG ("enqueuing mouse press:%d\n", ephyrCurScreen) ;
|
||||
EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ;
|
||||
ephyrUpdateModifierState(ev.key_state);
|
||||
mouseState |= ev.data.mouse_down.button_num;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
|
||||
|
@ -849,7 +852,7 @@ ephyrPoll(void)
|
|||
continue;
|
||||
ephyrUpdateModifierState(ev.key_state);
|
||||
mouseState &= ~ev.data.mouse_up.button_num;
|
||||
EPHYR_DBG ("enqueuing mouse release:%d\n", ephyrCurScreen) ;
|
||||
EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ;
|
||||
KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
|
||||
break;
|
||||
|
||||
|
@ -886,7 +889,7 @@ ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
|||
{
|
||||
/* XXX Not sure if this is right */
|
||||
|
||||
EPHYR_DBG("mark");
|
||||
EPHYR_LOG("mark");
|
||||
|
||||
while (n--)
|
||||
{
|
||||
|
|
|
@ -50,6 +50,8 @@ static EphyrXVPriv* EphyrXVPrivNew (void) ;
|
|||
static void EphyrXVPrivDelete (EphyrXVPriv *a_this) ;
|
||||
static Bool EphyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this) ;
|
||||
static Bool EphyrXVPrivSetAdaptorsHooks (EphyrXVPriv *a_this) ;
|
||||
static Bool EphyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
|
||||
ScreenPtr a_screen) ;
|
||||
|
||||
static void EphyrStopVideo (KdScreenInfo *a_info,
|
||||
pointer a_xv_priv,
|
||||
|
@ -106,9 +108,6 @@ ephyrInitVideo (ScreenPtr pScreen)
|
|||
KdScreenPriv(pScreen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
EphyrXVPriv *xv_priv = NULL ;
|
||||
KdVideoAdaptorPtr *adaptors, *newAdaptors = NULL;
|
||||
KdVideoAdaptorPtr newAdaptor = NULL;
|
||||
int num_adaptors=0;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
|
@ -123,38 +122,10 @@ ephyrInitVideo (ScreenPtr pScreen)
|
|||
return FALSE ;
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* queried host adaptors, now get xv_priv->adaptors and.
|
||||
* add it to those already existing.
|
||||
*/
|
||||
num_adaptors = KdXVListGenericAdaptors (screen, &adaptors);
|
||||
|
||||
if (newAdaptor) {
|
||||
if (!num_adaptors) {
|
||||
num_adaptors = 1;
|
||||
adaptors = &newAdaptor;
|
||||
} else {
|
||||
newAdaptors = xalloc ((num_adaptors + 1) * sizeof(KdVideoAdaptorPtr*));
|
||||
if (newAdaptors) {
|
||||
memcpy (newAdaptors,
|
||||
adaptors,
|
||||
num_adaptors * sizeof(KdVideoAdaptorPtr));
|
||||
newAdaptors[num_adaptors] = newAdaptor;
|
||||
adaptors = newAdaptors;
|
||||
num_adaptors++;
|
||||
if (EphyrXVPrivRegisterAdaptors (xv_priv, pScreen)) {
|
||||
EPHYR_LOG_ERROR ("failed to register adaptors\n") ;
|
||||
return FALSE ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num_adaptors) {
|
||||
KdXVScreenInit (pScreen, adaptors, num_adaptors);
|
||||
} else {
|
||||
EPHYR_LOG_ERROR ("XVideo not initialised\n") ;
|
||||
}
|
||||
|
||||
if (newAdaptors)
|
||||
xfree (newAdaptors);
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
|
@ -267,6 +238,8 @@ EphyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this)
|
|||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_this, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
if (!EphyrHostXVQueryAdaptors (&a_this->host_adaptors) || !a_this->host_adaptors) {
|
||||
EPHYR_LOG_ERROR ("failed to query host adaptors: %d\n", res) ;
|
||||
goto out ;
|
||||
|
@ -346,6 +319,7 @@ out:
|
|||
xfree (image_formats) ;
|
||||
image_formats = NULL ;
|
||||
}
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
|
@ -356,6 +330,8 @@ EphyrXVPrivSetAdaptorsHooks (EphyrXVPriv *a_this)
|
|||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_this, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
for (i=0; i < a_this->num_adaptors; i++) {
|
||||
a_this->adaptors[i].StopVideo = EphyrStopVideo ;
|
||||
a_this->adaptors[i].SetPortAttribute = EphyrSetPortAttribute ;
|
||||
|
@ -364,9 +340,53 @@ EphyrXVPrivSetAdaptorsHooks (EphyrXVPriv *a_this)
|
|||
a_this->adaptors[i].PutImage = EphyrPutImage;
|
||||
a_this->adaptors[i].QueryImageAttributes = EphyrQueryImageAttributes ;
|
||||
}
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
static Bool
|
||||
EphyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this,
|
||||
ScreenPtr a_screen)
|
||||
{
|
||||
KdScreenPriv(a_screen);
|
||||
KdScreenInfo *screen = pScreenPriv->screen;
|
||||
Bool is_ok = FALSE ;
|
||||
KdVideoAdaptorPtr *adaptors=NULL, *registered_adaptors=NULL ;
|
||||
int num_registered_adaptors=0, i=0, num_adaptors=0 ;
|
||||
|
||||
EPHYR_RETURN_VAL_IF_FAIL (a_this && a_screen, FALSE) ;
|
||||
|
||||
EPHYR_LOG ("enter\n") ;
|
||||
|
||||
if (!a_this->num_adaptors)
|
||||
goto out ;
|
||||
num_registered_adaptors = KdXVListGenericAdaptors (screen, ®istered_adaptors);
|
||||
num_adaptors = num_registered_adaptors + a_this->num_adaptors ;
|
||||
adaptors = xcalloc (num_adaptors, sizeof (KdVideoAdaptorPtr)) ;
|
||||
if (!adaptors) {
|
||||
EPHYR_LOG_ERROR ("failed to allocate adaptors tab\n") ;
|
||||
goto out ;
|
||||
}
|
||||
memmove (adaptors, registered_adaptors, num_registered_adaptors) ;
|
||||
for (i=0 ; i < a_this->num_adaptors; i++) {
|
||||
*(adaptors + num_registered_adaptors + i) = &a_this->adaptors[i] ;
|
||||
}
|
||||
KdXVScreenInit (a_screen, adaptors, num_adaptors);
|
||||
is_ok = TRUE ;
|
||||
|
||||
out:
|
||||
if (registered_adaptors) {
|
||||
xfree (registered_adaptors) ;
|
||||
registered_adaptors = NULL ;
|
||||
}
|
||||
if (adaptors) {
|
||||
xfree (adaptors) ;
|
||||
adaptors=NULL ;
|
||||
}
|
||||
EPHYR_LOG ("leave\n") ;
|
||||
return is_ok ;
|
||||
}
|
||||
|
||||
static void
|
||||
EphyrStopVideo (KdScreenInfo *a_info, pointer a_xv_priv, Bool a_exit)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue