kdrive: Simplify the adaptor setup interface.
Now that we don't have to worry about the generic adaptors code, there's no need to have a list of pointers to different sets of adaptors. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
parent
55aad7399d
commit
a5662193f1
|
@ -613,8 +613,6 @@ static Bool
|
||||||
ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this, ScreenPtr a_screen)
|
ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this, ScreenPtr a_screen)
|
||||||
{
|
{
|
||||||
Bool is_ok = FALSE;
|
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_RETURN_VAL_IF_FAIL(a_this && a_screen, FALSE);
|
||||||
|
|
||||||
|
@ -623,28 +621,14 @@ ephyrXVPrivRegisterAdaptors(EphyrXVPriv * a_this, ScreenPtr a_screen)
|
||||||
if (!a_this->num_adaptors)
|
if (!a_this->num_adaptors)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
num_adaptors = a_this->num_adaptors;
|
if (!KdXVScreenInit(a_screen, a_this->adaptors, a_this->num_adaptors)) {
|
||||||
adaptors = calloc(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];
|
|
||||||
}
|
|
||||||
if (!KdXVScreenInit(a_screen, adaptors, num_adaptors)) {
|
|
||||||
EPHYR_LOG_ERROR("failed to register adaptors\n");
|
EPHYR_LOG_ERROR("failed to register adaptors\n");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
EPHYR_LOG("there are %d registered adaptors\n", num_adaptors);
|
EPHYR_LOG("there are %d registered adaptors\n", a_this->num_adaptors);
|
||||||
is_ok = TRUE;
|
is_ok = TRUE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(registered_adaptors);
|
|
||||||
registered_adaptors = NULL;
|
|
||||||
free(adaptors);
|
|
||||||
adaptors = NULL;
|
|
||||||
|
|
||||||
EPHYR_LOG("leave\n");
|
EPHYR_LOG("leave\n");
|
||||||
return is_ok;
|
return is_ok;
|
||||||
|
|
|
@ -98,7 +98,7 @@ static void KdXVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
|
||||||
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
|
static void KdXVClipNotify(WindowPtr pWin, int dx, int dy);
|
||||||
|
|
||||||
/* misc */
|
/* misc */
|
||||||
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr *, int);
|
static Bool KdXVInitAdaptors(ScreenPtr, KdVideoAdaptorPtr, int);
|
||||||
|
|
||||||
static DevPrivateKeyRec KdXVWindowKeyRec;
|
static DevPrivateKeyRec KdXVWindowKeyRec;
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * adaptors, int num)
|
KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr adaptors, int num)
|
||||||
{
|
{
|
||||||
KdXVScreenPtr ScreenPriv;
|
KdXVScreenPtr ScreenPriv;
|
||||||
XvScreenPtr pxvs;
|
XvScreenPtr pxvs;
|
||||||
|
@ -239,7 +239,7 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor)
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
|
KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
|
@ -268,7 +268,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr * infoPtr, int number)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
for (pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
|
for (pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) {
|
||||||
adaptorPtr = infoPtr[na];
|
adaptorPtr = &infoPtr[na];
|
||||||
|
|
||||||
if (!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
|
if (!adaptorPtr->StopVideo || !adaptorPtr->SetPortAttribute ||
|
||||||
!adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
|
!adaptorPtr->GetPortAttribute || !adaptorPtr->QueryBestSize)
|
||||||
|
|
|
@ -157,7 +157,7 @@ typedef struct {
|
||||||
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
|
} KdVideoAdaptorRec, *KdVideoAdaptorPtr;
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * Adaptors, int num);
|
KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr Adaptors, int num);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user