summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@jsg.id.au>2012-11-18 10:29:56 +0000
committerMatthieu Herrb <matthieu.herrb@laas.fr>2012-11-19 11:25:35 +0000
commitff52d9a828cfe124708d7085f16281b9ee1d7af2 (patch)
treef8850f4446663fa00c0e24708180014f5404b431
parentc788dbfc116c62064c9e79d1ee9673e45e00cfa3 (diff)
Basic OpenBSD support for libkms.
So with the following diff on top of mpi's libdrm update I can use the modetest example I've ported from newer libdrm,
-rw-r--r--lib/libdrm/libkms/linux.c2
-rw-r--r--lib/libdrm/xf86drmMode.c25
2 files changed, 20 insertions, 7 deletions
diff --git a/lib/libdrm/libkms/linux.c b/lib/libdrm/libkms/linux.c
index 896ab1d48..415919e4c 100644
--- a/lib/libdrm/libkms/linux.c
+++ b/lib/libdrm/libkms/linux.c
@@ -99,6 +99,8 @@ linux_from_sysfs(int fd, struct kms_driver **out)
char *name;
int ret;
+return (intel_create(fd, out));
+
ret = linux_name_from_sysfs(fd, &name);
if (ret)
return ret;
diff --git a/lib/libdrm/xf86drmMode.c b/lib/libdrm/xf86drmMode.c
index a2603a806..e13dd3fbe 100644
--- a/lib/libdrm/xf86drmMode.c
+++ b/lib/libdrm/xf86drmMode.c
@@ -259,7 +259,6 @@ int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
return 0;
}
-#ifndef __OpenBSD__
int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
uint32_t pixel_format, uint32_t bo_handles[4],
uint32_t pitches[4], uint32_t offsets[4],
@@ -282,7 +281,6 @@ int drmModeAddFB2(int fd, uint32_t width, uint32_t height,
*buf_id = f.fb_id;
return 0;
}
-#endif
int drmModeRmFB(int fd, uint32_t bufferId)
{
@@ -315,7 +313,6 @@ drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
return r;
}
-#ifndef __OpenBSD__
int drmModeDirtyFB(int fd, uint32_t bufferId,
drmModeClipPtr clips, uint32_t num_clips)
{
@@ -327,7 +324,6 @@ int drmModeDirtyFB(int fd, uint32_t bufferId,
return DRM_IOCTL(fd, DRM_IOCTL_MODE_DIRTYFB, &dirty);
}
-#endif
/*
@@ -741,8 +737,25 @@ int drmCheckModesettingSupported(const char *busid)
if (found)
return 0;
#endif
- return -ENOSYS;
+#ifdef __OpenBSD__
+ int fd;
+ struct drm_mode_card_res res;
+ drmModeResPtr r = 0;
+
+ if ((fd = drmOpen(NULL, busid)) < 0)
+ return -EINVAL;
+
+ memset(&res, 0, sizeof(struct drm_mode_card_res));
+
+ if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {
+ drmClose(fd);
+ return -errno;
+ }
+ drmClose(fd);
+ return 0;
+#endif
+ return -ENOSYS;
}
int drmModeCrtcGetGamma(int fd, uint32_t crtc_id, uint32_t size,
@@ -824,7 +837,6 @@ int drmHandleEvent(int fd, drmEventContextPtr evctx)
return 0;
}
-#ifndef __OpenBSD__
int drmModePageFlip(int fd, uint32_t crtc_id, uint32_t fb_id,
uint32_t flags, void *user_data)
{
@@ -979,4 +991,3 @@ void drmModeFreePlaneResources(drmModePlaneResPtr ptr)
drmFree(ptr->planes);
drmFree(ptr);
}
-#endif