Use glamor_xv_core_init() returned value to disable Xv support early if glamor-xv is not usable.
Signed-off-by: Olivier Fourdan <[email protected]> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=100710 --- hw/kdrive/ephyr/ephyr.c | 16 ++++++++++++++-- hw/kdrive/ephyr/ephyr.h | 5 +++-- hw/kdrive/ephyr/ephyr_glamor_xv.c | 7 ++++--- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 546a76c..8c9b6d4 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -665,7 +665,7 @@ ephyrInitScreen(ScreenPtr pScreen) #ifdef XV if (!ephyrNoXV) { if (ephyr_glamor) - ephyr_glamor_xv_init(pScreen); + goto out; /* For glamor, we need the screen resources */ else if (!ephyrInitVideo(pScreen)) { EPHYR_LOG_ERROR("failed to initialize xvideo\n"); } @@ -675,6 +675,7 @@ ephyrInitScreen(ScreenPtr pScreen) } #endif /*XV*/ +out: return TRUE; } @@ -728,8 +729,19 @@ ephyrCreateResources(ScreenPtr pScreen) if (ephyr_glamor) { if (!ephyr_glamor_create_screen_resources(pScreen)) return FALSE; +#ifdef XV + /* ephyr_glamor_xv_init() needs GLAMOR screen resources */ + if (!ephyrNoXV) { + if (!ephyr_glamor_xv_init(pScreen)) { + EPHYR_LOG_ERROR("failed to initialize GLAMOR xvideo\n"); + } + else { + EPHYR_LOG("initialized GLAMOR xvideo okay\n"); + } + } +#endif /*XV*/ } -#endif +#endif /* GLAMOR */ return ephyrSetInternalDamage(pScreen); } } diff --git a/hw/kdrive/ephyr/ephyr.h b/hw/kdrive/ephyr/ephyr.h index b48a21c..1d64490 100644 --- a/hw/kdrive/ephyr/ephyr.h +++ b/hw/kdrive/ephyr/ephyr.h @@ -226,11 +226,12 @@ Bool ephyrInitVideo(ScreenPtr pScreen); /* ephyr_glamor_xv.c */ #ifdef GLAMOR -void ephyr_glamor_xv_init(ScreenPtr screen); +Bool ephyr_glamor_xv_init(ScreenPtr screen); #else /* !GLAMOR */ -static inline void +static inline Bool ephyr_glamor_xv_init(ScreenPtr screen) { + return FALSE; } #endif /* !GLAMOR */ diff --git a/hw/kdrive/ephyr/ephyr_glamor_xv.c b/hw/kdrive/ephyr/ephyr_glamor_xv.c index 4dd15cf..dc5f45a 100644 --- a/hw/kdrive/ephyr/ephyr_glamor_xv.c +++ b/hw/kdrive/ephyr/ephyr_glamor_xv.c @@ -105,7 +105,7 @@ ephyr_glamor_xv_put_image(KdScreenInfo *screen, id, buf, width, height, sync, clipBoxes); } -void +Bool ephyr_glamor_xv_init(ScreenPtr screen) { KdVideoAdaptorRec *adaptor; @@ -121,7 +121,8 @@ ephyr_glamor_xv_init(ScreenPtr screen) }; int i; - glamor_xv_core_init(screen); + if (!glamor_xv_core_init(screen)) + return FALSE; adaptor = xnfcalloc(1, sizeof(*adaptor)); @@ -157,5 +158,5 @@ ephyr_glamor_xv_init(ScreenPtr screen) adaptor->PutImage = ephyr_glamor_xv_put_image; adaptor->QueryImageAttributes = ephyr_glamor_xv_query_image_attributes; - KdXVScreenInit(screen, adaptor, 1); + return KdXVScreenInit(screen, adaptor, 1); } -- 2.9.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
