aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ecore_x/xlib/ecore_x_vsync.c
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-28 11:34:40 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-09-28 11:34:40 +0900
commit60bc2cc1cec9ddc48c8e7133d3fab1f0f18ae00a (patch)
tree28237b333a56e10af176d4b415796a66e7da6ff0 /src/lib/ecore_x/xlib/ecore_x_vsync.c
parenteolian-cxx: Replace old eo_add with eo_add_ref. (diff)
downloadefl-60bc2cc1cec9ddc48c8e7133d3fab1f0f18ae00a.tar.gz
ecore vsync - fix up dual nvidia + dri/drm driver discovery
this fixes drm vsync discovery when you have both drm and nvidia drivers seemingly present in /dev but the intel drivers are the dri ones and nvidiactl is there (who knows if it's used). keep the nvidia drivers working too with a name/desc check on drm driver as the drm driver is in fact nvidia's own and set flags appropriately @fix
Diffstat (limited to 'src/lib/ecore_x/xlib/ecore_x_vsync.c')
-rw-r--r--src/lib/ecore_x/xlib/ecore_x_vsync.c63
1 files changed, 53 insertions, 10 deletions
diff --git a/src/lib/ecore_x/xlib/ecore_x_vsync.c b/src/lib/ecore_x/xlib/ecore_x_vsync.c
index 98fbc210e9..112d476a0d 100644
--- a/src/lib/ecore_x/xlib/ecore_x_vsync.c
+++ b/src/lib/ecore_x/xlib/ecore_x_vsync.c
@@ -380,8 +380,10 @@ _drm_link(void)
return 1;
}
+#define DRM_HAVE_NVIDIA 1
+
static int
-_drm_init(void)
+_drm_init(int *flags)
{
struct stat st;
char buf[512];
@@ -491,12 +493,13 @@ _drm_init(void)
if (getenv("ECORE_VSYNC_DRM_VERSION_DEBUG"))
fprintf(stderr, "Whitelisted intel OK\n");
ok = EINA_TRUE;
+ goto checkdone;
}
}
- else if ((drmverbroken->version_major >= 1) &&
- (drmverbroken->version_minor >= 6) &&
- (drmverbroken->name > (char *)4000L) &&
- (drmverbroken->date_len < 200))
+ if ((drmverbroken->version_major >= 1) &&
+ (drmverbroken->version_minor >= 6) &&
+ (drmverbroken->name > (char *)4000L) &&
+ (drmverbroken->date_len < 200))
{
// whitelist of known-to-work drivers
if ((!strcmp(drmverbroken->name, "i915")) &&
@@ -505,8 +508,34 @@ _drm_init(void)
if (getenv("ECORE_VSYNC_DRM_VERSION_DEBUG"))
fprintf(stderr, "Whitelisted intel OK\n");
ok = EINA_TRUE;
+ goto checkdone;
}
}
+ if ((drmver->version_major >= 0) &&
+ (drmver->version_minor >= 0) &&
+ (drmver->name > (char *)4000L) &&
+ (drmver->date_len < 200))
+ {
+ if ((!strcmp(drmver->name, "nvidia-drm")) &&
+ (strstr(drmver->desc, "NVIDIA DRM driver")))
+ {
+ *flags |= DRM_HAVE_NVIDIA;
+ goto checkdone;
+ }
+ }
+ if ((drmverbroken->version_major >= 0) &&
+ (drmverbroken->version_minor >= 0) &&
+ (drmverbroken->name > (char *)4000L) &&
+ (drmverbroken->date_len < 200))
+ {
+ if ((!strcmp(drmverbroken->name, "nvidia-drm")) &&
+ (strstr(drmverbroken->desc, "NVIDIA DRM driver")))
+ {
+ *flags |= DRM_HAVE_NVIDIA;
+ goto checkdone;
+ }
+ }
+checkdone:
sym_drmFreeVersion(drmver);
if (!ok)
{
@@ -712,6 +741,7 @@ _vsync_init(void)
{
static int done = 0;
struct stat stb;
+ int flags = 0;
if (done) return;
@@ -724,19 +754,32 @@ _vsync_init(void)
{
if (_drm_link())
{
- if (_drm_init())
- {
- mode = 1;
- }
+ if (_drm_init(&flags)) mode = 1;
}
}
#endif
// nvidia gl vsync slave mode
if (mode == 0)
{
+ // we appear to have an nvidia driver running
if (!stat("/dev/nvidiactl", &stb))
{
- mode = 2;
+ if (getenv("ECORE_VSYNC_DRM_VERSION_DEBUG"))
+ fprintf(stderr, "We appear to have an nvidia driver: drm flags %i\n", flags);
+ if (
+ // we have dri device AND it's an nvidia one
+ ((!stat("/dev/dri/card0", &stb)) &&
+ (flags & DRM_HAVE_NVIDIA))
+ ||
+ // or we have no dri device, and no nvidia flags
+ ((stat("/dev/dri/card0", &stb)) &&
+ (flags == 0))
+ )
+ {
+ if (getenv("ECORE_VSYNC_DRM_VERSION_DEBUG"))
+ fprintf(stderr, "Using nvidia vsync slave proc\n");
+ mode = 2;
+ }
}
}
}