From 3e784832a52686cd29d62bdeac7b1c539c640c5b Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 1 Feb 2014 16:55:32 +0000 Subject: glamor: Enable Xv support In addition to the UXA texture paths (which in theory support VSync) and direct overlay support, create a textured video paths that utilize the glamor acceleration code. Requested-by: Fabio Pedretti Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74311 Signed-off-by: Chris Wilson --- configure.ac | 2 +- src/uxa/intel_glamor.c | 11 +++++++++++ src/uxa/intel_glamor.h | 4 ++++ src/uxa/intel_video.c | 13 +++++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 03134a05..4e93f95e 100644 --- a/configure.ac +++ b/configure.ac @@ -322,7 +322,7 @@ if test "x$GLAMOR" != "xno"; then if test "x$UXA" != "xyes"; then AC_MSG_ERROR([Glamor acceleration requested but UXA is not enabled]) fi - PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.3.1]) + PKG_CHECK_MODULES(LIBGLAMOR, [glamor >= 0.6.0]) PKG_CHECK_MODULES(LIBGLAMOR_EGL, [glamor-egl]) AC_DEFINE(USE_GLAMOR, 1, [Enable glamor acceleration]) fi diff --git a/src/uxa/intel_glamor.c b/src/uxa/intel_glamor.c index 4d1c7679..e1e2a742 100644 --- a/src/uxa/intel_glamor.c +++ b/src/uxa/intel_glamor.c @@ -52,6 +52,17 @@ intel_glamor_exchange_buffers(struct intel_screen_private *intel, glamor_egl_exchange_buffers(src, dst); } +XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports) +{ + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + intel_screen_private *intel = intel_get_screen_private(scrn); + + if ((intel->uxa_flags & UXA_USE_GLAMOR) == 0) + return NULL; + + return glamor_xv_init(screen, num_ports); +} + Bool intel_glamor_create_screen_resources(ScreenPtr screen) { diff --git a/src/uxa/intel_glamor.h b/src/uxa/intel_glamor.h index 46692bc8..2e305fc9 100644 --- a/src/uxa/intel_glamor.h +++ b/src/uxa/intel_glamor.h @@ -30,6 +30,8 @@ #ifndef INTEL_GLAMOR_H #define INTEL_GLAMOR_H +#include + #ifdef USE_GLAMOR Bool intel_glamor_pre_init(ScrnInfoPtr scrn); @@ -45,6 +47,7 @@ void intel_glamor_destroy_pixmap(PixmapPtr pixmap); PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int h, int depth, unsigned int usage); void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst); +XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports); #else static inline Bool intel_glamor_pre_init(ScrnInfoPtr scrn) { return TRUE; } @@ -62,6 +65,7 @@ static inline PixmapPtr intel_glamor_create_pixmap(ScreenPtr screen, int w, int int depth, unsigned int usage) { return NULL; } static inline void intel_glamor_exchange_buffers(struct intel_screen_private *intel, PixmapPtr src, PixmapPtr dst) {} +static inline XF86VideoAdaptorPtr intel_glamor_xv_init(ScreenPtr screen, int num_ports) { return NULL; } #endif #endif /* INTEL_GLAMOR_H */ diff --git a/src/uxa/intel_video.c b/src/uxa/intel_video.c index 238cd471..d1b98d47 100644 --- a/src/uxa/intel_video.c +++ b/src/uxa/intel_video.c @@ -78,6 +78,7 @@ #define _INTEL_XVMC_SERVER_ #include "intel_xvmc.h" #endif +#include "intel_glamor.h" #define OFF_DELAY 250 /* milliseconds */ @@ -331,13 +332,13 @@ void I830InitVideo(ScreenPtr screen) ScrnInfoPtr scrn = xf86ScreenToScrn(screen); intel_screen_private *intel = intel_get_screen_private(scrn); XF86VideoAdaptorPtr *adaptors = NULL, *newAdaptors = NULL; - XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL; + XF86VideoAdaptorPtr overlayAdaptor = NULL, texturedAdaptor = NULL, glamorAdaptor = NULL; int num_adaptors = xf86XVListGenericAdaptors(scrn, &adaptors); /* Give our adaptor list enough space for the overlay and/or texture video * adaptors. */ newAdaptors = realloc(adaptors, - (num_adaptors + 2) * sizeof(XF86VideoAdaptorPtr)); + (num_adaptors + 3) * sizeof(XF86VideoAdaptorPtr)); if (newAdaptors == NULL) { free(adaptors); return; @@ -378,12 +379,20 @@ void I830InitVideo(ScreenPtr screen) } } + glamorAdaptor = intel_glamor_xv_init(screen, 16); + if (glamorAdaptor != NULL) + xf86DrvMsg(scrn->scrnIndex, X_INFO, + "Set up textured video using glamor\n"); + if (overlayAdaptor && intel->XvPreferOverlay) adaptors[num_adaptors++] = overlayAdaptor; if (texturedAdaptor) adaptors[num_adaptors++] = texturedAdaptor; + if (glamorAdaptor) + adaptors[num_adaptors++] = glamorAdaptor; + if (overlayAdaptor && !intel->XvPreferOverlay) adaptors[num_adaptors++] = overlayAdaptor; -- cgit v1.2.3