nouveau: accept both 0.0.16 and 1.x.x
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>main
parent
b04515c5d6
commit
b61e81a191
|
@ -26,10 +26,6 @@
|
||||||
|
|
||||||
#include "nouveau_private.h"
|
#include "nouveau_private.h"
|
||||||
|
|
||||||
#if NOUVEAU_DRM_HEADER_PATCHLEVEL != 16
|
|
||||||
#error nouveau_drm.h does not match expected patchlevel, update libdrm.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
nouveau_device_open_existing(struct nouveau_device **dev, int close,
|
nouveau_device_open_existing(struct nouveau_device **dev, int close,
|
||||||
int fd, drm_context_t ctx)
|
int fd, drm_context_t ctx)
|
||||||
|
@ -42,11 +38,6 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
|
||||||
if (!dev || *dev)
|
if (!dev || *dev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ver = drmGetVersion(fd);
|
|
||||||
if (!ver || ver->version_patchlevel != NOUVEAU_DRM_HEADER_PATCHLEVEL)
|
|
||||||
return -EINVAL;
|
|
||||||
drmFreeVersion(ver);
|
|
||||||
|
|
||||||
nvdev = calloc(1, sizeof(*nvdev));
|
nvdev = calloc(1, sizeof(*nvdev));
|
||||||
if (!nvdev)
|
if (!nvdev)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -54,6 +45,18 @@ nouveau_device_open_existing(struct nouveau_device **dev, int close,
|
||||||
nvdev->ctx = ctx;
|
nvdev->ctx = ctx;
|
||||||
nvdev->needs_close = close;
|
nvdev->needs_close = close;
|
||||||
|
|
||||||
|
ver = drmGetVersion(fd);
|
||||||
|
if (!ver)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if ((ver->version_major == 0 && ver->version_patchlevel != 16) &&
|
||||||
|
ver->version_major != 1) {
|
||||||
|
nouveau_device_close((void *)&nvdev);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
drmFreeVersion(ver);
|
||||||
|
|
||||||
ret = nouveau_device_get_param(&nvdev->base,
|
ret = nouveau_device_get_param(&nvdev->base,
|
||||||
NOUVEAU_GETPARAM_VM_VRAM_BASE, &value);
|
NOUVEAU_GETPARAM_VM_VRAM_BASE, &value);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
|
Loading…
Reference in New Issue