/* This file contains a bunch of wrapper functions to directly use gem ioctls.
* Mostly useful to write kernel tests. */
+drm_intel_bo *
+gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd, const char *name, uint32_t handle)
+{
+ struct drm_gem_flink flink;
+ int ret;
+ drm_intel_bo *bo;
+
+ flink.handle = handle;
+ ret = ioctl(fd, DRM_IOCTL_GEM_FLINK, &flink);
+ assert(ret == 0);
+
+ bo = drm_intel_bo_gem_create_from_name(bufmgr, name, flink.name);
+ assert(bo);
+
+ return bo;
+}
+
static int
is_intel(int fd)
{
cairo_status_t status;
cairo_t *cr;
char buf[128];
- int ret;
unsigned int fb_id;
surface = paint_allocate_surface(fd, width, height, depth, bpp,
#include "xf86drmMode.h"
#include "intel_batchbuffer.h"
+drm_intel_bo * gem_handle_to_libdrm_bo(drm_intel_bufmgr *bufmgr, int fd,
+ const char *name, uint32_t handle);
+
int drm_get_card(int master);
int drm_open_any(void);
int drm_open_any_master(void);