aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs2010-08-17 21:06:48 -0500
committerBen Skeggs2010-08-17 21:06:48 -0500
commitb61e81a191d3a5c269c5f7c40199aebc9ebc034c (patch)
tree12452dcfff649665294affd66d6fc8b5c278ac9c /nouveau
parentb04515c5d6c95f573457a94267b855cceb639105 (diff)
downloadlibdrm-b61e81a191d3a5c269c5f7c40199aebc9ebc034c.tar.gz
libdrm-b61e81a191d3a5c269c5f7c40199aebc9ebc034c.tar.xz
libdrm-b61e81a191d3a5c269c5f7c40199aebc9ebc034c.zip
nouveau: accept both 0.0.16 and 1.x.x
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'nouveau')
-rw-r--r--nouveau/nouveau_device.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/nouveau/nouveau_device.c b/nouveau/nouveau_device.c
index c5253914..f450e303 100644
--- a/nouveau/nouveau_device.c
+++ b/nouveau/nouveau_device.c
@@ -26,10 +26,6 @@
26 26
27#include "nouveau_private.h" 27#include "nouveau_private.h"
28 28
29#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 16
30#error nouveau_drm.h does not match expected patchlevel, update libdrm.
31#endif
32
33int 29int
34nouveau_device_open_existing(struct nouveau_device **dev, int close, 30nouveau_device_open_existing(struct nouveau_device **dev, int close,
35 int fd, drm_context_t ctx) 31 int fd, drm_context_t ctx)
@@ -42,11 +38,6 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
42 if (!dev || *dev) 38 if (!dev || *dev)
43 return -EINVAL; 39 return -EINVAL;
44 40
45 ver = drmGetVersion(fd);
46 if (!ver || ver->version_patchlevel != NOUVEAU_DRM_HEADER_PATCHLEVEL)
47 return -EINVAL;
48 drmFreeVersion(ver);
49
50 nvdev = calloc(1, sizeof(*nvdev)); 41 nvdev = calloc(1, sizeof(*nvdev));
51 if (!nvdev) 42 if (!nvdev)
52 return -ENOMEM; 43 return -ENOMEM;
@@ -54,6 +45,18 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
54 nvdev->ctx = ctx; 45 nvdev->ctx = ctx;
55 nvdev->needs_close = close; 46 nvdev->needs_close = close;
56 47
48 ver = drmGetVersion(fd);
49 if (!ver)
50 return -EINVAL;
51
52 if ((ver->version_major == 0 && ver->version_patchlevel != 16) &&
53 ver->version_major != 1) {
54 nouveau_device_close((void *)&nvdev);
55 return -EINVAL;
56 }
57
58 drmFreeVersion(ver);
59
57 ret = nouveau_device_get_param(&nvdev->base, 60 ret = nouveau_device_get_param(&nvdev->base,
58 NOUVEAU_GETPARAM_VM_VRAM_BASE, &value); 61 NOUVEAU_GETPARAM_VM_VRAM_BASE, &value);
59 if (ret) { 62 if (ret) {