drmFree(ptr->connectors);
drmFree(ptr->encoders);
drmFree(ptr);
-
}
void drmModeFreeFB(drmModeFBPtr ptr)
return;
drmFree(ptr);
-
}
void drmModeFreeConnector(drmModeConnectorPtr ptr)
drmFree(ptr->props);
drmFree(ptr->modes);
drmFree(ptr);
-
}
void drmModeFreeEncoder(drmModeEncoderPtr ptr)
}
int drmModeAddFB(int fd, uint32_t width, uint32_t height, uint8_t depth,
- uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
+ uint8_t bpp, uint32_t pitch, uint32_t bo_handle,
uint32_t *buf_id)
{
struct drm_mode_fb_cmd f;
return DRM_IOCTL(fd, DRM_IOCTL_MODE_DIRTYFB, &dirty);
}
-
/*
* Crtc functions
*/
return r;
}
-
int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
- uint32_t x, uint32_t y, uint32_t *connectors, int count,
+ uint32_t x, uint32_t y, uint32_t *connectors, int count,
drmModeModeInfoPtr mode)
{
struct drm_mode_crtc crtc;
return DRM_IOCTL(fd, DRM_IOCTL_MODE_DETACHMODE, &res);
}
-
drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
{
struct drm_mode_get_property prop;
#elif defined(__DragonFly__)
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,
int len, i;
struct drm_event *e;
struct drm_event_vblank *vblank;
-
+
/* The DRM read semantics guarantees that we always get only
* complete events. */
break;
vblank = (struct drm_event_vblank *) e;
evctx->vblank_handler(fd,
- vblank->sequence,
+ vblank->sequence,
vblank->tv_sec,
vblank->tv_usec,
U642VOID (vblank->user_data));
uint32_t crtc_w, uint32_t crtc_h,
uint32_t src_x, uint32_t src_y,
uint32_t src_w, uint32_t src_h)
-
{
struct drm_mode_set_plane s;
return DRM_IOCTL(fd, DRM_IOCTL_MODE_SETPLANE, &s);
}
-
drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id)
{
struct drm_mode_get_plane ovr, counts;
{
drmModeAtomicReqPtr new;
+ if (!old)
+ return NULL;
+
new = drmMalloc(sizeof *new);
if (!new)
return NULL;
int drmModeAtomicMerge(drmModeAtomicReqPtr base, drmModeAtomicReqPtr augment)
{
+ if (!base)
+ return -EINVAL;
+
if (!augment || augment->cursor == 0)
return 0;
int drmModeAtomicGetCursor(drmModeAtomicReqPtr req)
{
+ if (!req)
+ return -EINVAL;
return req->cursor;
}
void drmModeAtomicSetCursor(drmModeAtomicReqPtr req, int cursor)
{
- req->cursor = cursor;
+ if (req)
+ req->cursor = cursor;
}
int drmModeAtomicAddProperty(drmModeAtomicReqPtr req,
uint32_t property_id,
uint64_t value)
{
+ if (!req)
+ return -EINVAL;
+
if (req->cursor >= req->size_items) {
drmModeAtomicReqItemPtr new;
int drmModeAtomicCommit(int fd, drmModeAtomicReqPtr req, uint32_t flags,
void *user_data)
{
- drmModeAtomicReqPtr sorted = drmModeAtomicDuplicate(req);
+ drmModeAtomicReqPtr sorted;
struct drm_mode_atomic atomic;
uint32_t *objs_ptr = NULL;
uint32_t *count_props_ptr = NULL;
int obj_idx = -1;
int ret = -1;
- if (!sorted)
+ if (!req)
+ return -EINVAL;
+
+ if (req->cursor == 0)
+ return 0;
+
+ sorted = drmModeAtomicDuplicate(req);
+ if (sorted == NULL)
return -ENOMEM;
memclear(atomic);