Bug 73507

Summary: intel xorg driver does not support DRI2DriverVDPAU name
Product: xorg Reporter: Rinat <ibragimovrinat>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: enhancement    
Priority: medium CC: nikoli
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Rinat 2014-01-11 19:51:06 UTC
Since 2010, DRI2 supports multiple driver names. That was added to ease
selection of appropriate driver by libvdpau. As for today, intel driver
support only DRI2DriverDRI (== 0), but not DRI2DriverVDPAU (== 1).

Although there is no any hardware-specific VDPAU driver for intel video
adapters at the moment, it would be easier to use generic drivers like
libvdpau-va-gl by creating symlink named libvdpau_i965.so.1. That way
appropriate driver will be selected in run time automatically:
libvdpau_i965.so.1 on i965 equipped machines, and libvdpau_nvidia.so.1 on
nvidia equipped ones.

Signed-off-by: Rinat <ibragimovrinat@mail.ru>
---
 src/sna/sna_dri.c   | 5 +++--
 src/uxa/intel_dri.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/sna/sna_dri.c b/src/sna/sna_dri.c
index fedf263..ba705ec 100644
--- a/src/sna/sna_dri.c
+++ b/src/sna/sna_dri.c
@@ -2463,7 +2463,7 @@ bool sna_dri_open(struct sna *sna, ScreenPtr screen)
 	DRI2InfoRec info;
 	int major = 1, minor = 0;
 #if DRI2INFOREC_VERSION >= 4
-	const char *driverNames[1];
+	const char *driverNames[2];
 #endif
 
 	DBG(("%s()\n", __FUNCTION__));
@@ -2507,9 +2507,10 @@ bool sna_dri_open(struct sna *sna, ScreenPtr screen)
 	info.ScheduleSwap = sna_dri_schedule_swap;
 	info.GetMSC = sna_dri_get_msc;
 	info.ScheduleWaitMSC = sna_dri_schedule_wait_msc;
-	info.numDrivers = 1;
+	info.numDrivers = 2;
 	info.driverNames = driverNames;
 	driverNames[0] = info.driverName;
+	driverNames[1] = info.driverName;
 #endif
 
 #if DRI2INFOREC_VERSION >= 6
diff --git a/src/uxa/intel_dri.c b/src/uxa/intel_dri.c
index 1d7efab..ca58052 100644
--- a/src/uxa/intel_dri.c
+++ b/src/uxa/intel_dri.c
@@ -1567,7 +1567,7 @@ Bool I830DRI2ScreenInit(ScreenPtr screen)
 	int dri2scr_major = 1;
 	int dri2scr_minor = 0;
 #if DRI2INFOREC_VERSION >= 4
-	const char *driverNames[1];
+	const char *driverNames[2];
 #endif
 
 	if (intel->force_fallback) {
@@ -1634,9 +1634,10 @@ Bool I830DRI2ScreenInit(ScreenPtr screen)
 	info.ScheduleSwap = I830DRI2ScheduleSwap;
 	info.GetMSC = I830DRI2GetMSC;
 	info.ScheduleWaitMSC = I830DRI2ScheduleWaitMSC;
-	info.numDrivers = 1;
+	info.numDrivers = 2;
 	info.driverNames = driverNames;
 	driverNames[0] = info.driverName;
+	driverNames[1] = info.driverName;
 #endif
 
 	return DRI2ScreenInit(screen, &info);
-- 
1.8.5.2
Comment 1 Chris Wilson 2014-01-17 10:55:02 UTC
commit f23ab963c4f4ada2051588dfc85264aa2798dbf7
Author: Rinat <ibragimovrinat@mail.ru>
Date:   Fri Jan 17 10:47:44 2014 +0000

    Provide DRI2DriverVDPAU for future compatibility
    
    Since 2010, DRI2 supports multiple driver names. That was added to ease
    selection of appropriate driver by libvdpau. As for today, intel driver
    support only DRI2DriverDRI (== 0), but not DRI2DriverVDPAU (== 1).
    
    Although there is no any hardware-specific VDPAU driver for intel video
    adapters at the moment, it would be easier to use generic drivers like
    libvdpau-va-gl by creating symlink named libvdpau_i965.so.1. That way
    appropriate driver will be selected in run time automatically:
    libvdpau_i965.so.1 on i965 equipped machines, and libvdpau_nvidia.so.1
    on nvidia equipped ones.
    
    [ickle: Whilst I think this is a workaround for a brainfart in libvdpau
    that it defaults to libvdpau_nvidia.so rather than first to
    libdvpau_${DRI2DriverDRI} and then to a hardcoded libvdpau_backend.so,
    I have no better solution, and this does seem in accordance with the
    spec.]
    
    Signed-off-by: Rinat <ibragimovrinat@mail.ru>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=73507

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.