From 1e8f8b36a56a884092ee01a0bb3f40436e30fa42 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Sat, 21 Jul 2007 18:22:20 +0200 Subject: [PATCH] works with no adaptors Debug the early code to make work when the host has no video adaptors --- hw/kdrive/ephyr/ephyrhostvideo.c | 2 +- hw/kdrive/ephyr/ephyrvideo.c | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/hw/kdrive/ephyr/ephyrhostvideo.c b/hw/kdrive/ephyr/ephyrhostvideo.c index 59a01bb20..d86f9761c 100644 --- a/hw/kdrive/ephyr/ephyrhostvideo.c +++ b/hw/kdrive/ephyr/ephyrhostvideo.c @@ -64,7 +64,7 @@ EphyrHostXVQueryAdaptors (EphyrHostXVAdaptorArray **a_adaptors) goto out ; ret = XvQueryAdaptors (hostx_get_display (), - DefaultRootWindow (hostx_get_display), + DefaultRootWindow (hostx_get_display ()), &result->nb_adaptors, &result->adaptors) ; if (ret != Success) { diff --git a/hw/kdrive/ephyr/ephyrvideo.c b/hw/kdrive/ephyr/ephyrvideo.c index d80dab320..c87af19ba 100644 --- a/hw/kdrive/ephyr/ephyrvideo.c +++ b/hw/kdrive/ephyr/ephyrvideo.c @@ -145,7 +145,7 @@ EphyrXVPrivNew (void) EPHYR_LOG_ERROR ("failed to query the host x for xv properties\n") ; goto error ; } - if (EphyrXVPrivSetAdaptorsHooks (xv_priv)) { + if (!EphyrXVPrivSetAdaptorsHooks (xv_priv)) { EPHYR_LOG_ERROR ("failed to set xv_priv hooks\n") ; goto error ; } @@ -232,7 +232,7 @@ EphyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this) EphyrHostEncoding *encodings=NULL ; EphyrHostAttribute *attributes=NULL ; EphyrHostImageFormat *image_formats=NULL ; - int num_video_formats=0, base_port_id=0, num_attributes=0, num_formats=0, res=0, i=0 ; + int num_video_formats=0, base_port_id=0, num_attributes=0, num_formats=0, i=0 ; unsigned num_encodings=0 ; Bool is_ok = FALSE ; @@ -240,22 +240,26 @@ EphyrXVPrivQueryHostAdaptors (EphyrXVPriv *a_this) 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) ; + if (!EphyrHostXVQueryAdaptors (&a_this->host_adaptors)) { + EPHYR_LOG_ERROR ("failed to query host adaptors\n") ; goto out ; } - a_this->num_adaptors = EphyrHostXVAdaptorArrayGetSize (a_this->host_adaptors) ; + if (a_this->host_adaptors) + a_this->num_adaptors = EphyrHostXVAdaptorArrayGetSize (a_this->host_adaptors) ; if (a_this->num_adaptors < 0) { EPHYR_LOG_ERROR ("failed to get number of host adaptors\n") ; goto out ; } + EPHYR_LOG ("host has %d adaptors\n", a_this->num_adaptors) ; /* * copy what we can from adaptors into a_this->adaptors */ - a_this->adaptors = xcalloc (a_this->num_adaptors, sizeof (KdVideoAdaptorRec)) ; - if (!a_this->host_adaptors) { - EPHYR_LOG_ERROR ("failed to create internal adaptors\n") ; - goto out ; + if (a_this->num_adaptors) { + a_this->adaptors = xcalloc (a_this->num_adaptors, sizeof (KdVideoAdaptorRec)) ; + if (!a_this->adaptors) { + EPHYR_LOG_ERROR ("failed to create internal adaptors\n") ; + goto out ; + } } for (i=0; i < a_this->num_adaptors; i++) { int j=0 ;