Enable more libdrm functions. Determine if modesetting is supported

based on a modesetting ioctl that checks the DRIVER_MODESET flag on
the kernel side instead of the sysfs approach linux takes.

ok mpi@
This commit is contained in:
jsg 2013-01-09 10:47:08 +00:00
parent a56cb7d9d2
commit 2a45c0933f
4 changed files with 19 additions and 14 deletions

View File

@ -1328,7 +1328,6 @@ drm_intel_gem_bo_subdata(drm_intel_bo *bo, unsigned long offset,
static int
drm_intel_gem_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)
{
#ifndef __OpenBSD__
drm_intel_bufmgr_gem *bufmgr_gem = (drm_intel_bufmgr_gem *) bufmgr;
struct drm_i915_get_pipe_from_crtc_id get_pipe_from_crtc_id;
int ret;
@ -1348,9 +1347,6 @@ drm_intel_gem_get_pipe_from_crtc_id(drm_intel_bufmgr *bufmgr, int crtc_id)
}
return get_pipe_from_crtc_id.pipe;
#endif
/* only needed for KMS */
return -1;
}
static int

View File

@ -1,2 +1,2 @@
major=3
minor=0
minor=1

View File

@ -819,7 +819,6 @@ drmVersionPtr drmGetLibVersion(int fd)
int drmGetCap(int fd, uint64_t capability, uint64_t *value)
{
#ifndef __OpenBSD__
struct drm_get_cap cap = { capability, 0 };
int ret;
@ -828,7 +827,6 @@ int drmGetCap(int fd, uint64_t capability, uint64_t *value)
return ret;
*value = cap.value;
#endif
return 0;
}

View File

@ -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