Back to index

libdrm  2.4.37
Functions
gem_basic.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <errno.h>
#include <sys/stat.h>
#include "drm.h"
#include "i915_drm.h"

Go to the source code of this file.

Functions

static void test_bad_close (int fd)
static void test_create_close (int fd)
static void test_create_fd_close (int fd)
int main (int argc, char **argv)

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 87 of file gem_basic.c.

{
       int fd;

       fd = drm_open_matching("8086:*", 0);
       if (fd < 0) {
              fprintf(stderr, "failed to open intel drm device\n");
              return 0;
       }

       test_bad_close(fd);
       test_create_close(fd);
       test_create_fd_close(fd);

       return 0;
}

Here is the call graph for this function:

static void test_bad_close ( int  fd) [static]

Definition at line 40 of file gem_basic.c.

{
       struct drm_gem_close close;
       int ret;

       printf("Testing error return on bad close ioctl.\n");

       close.handle = 0x10101010;
       ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);

       assert(ret == -1 && errno == EINVAL);
}

Here is the caller graph for this function:

static void test_create_close ( int  fd) [static]

Definition at line 54 of file gem_basic.c.

{
       struct drm_i915_gem_create create;
       struct drm_gem_close close;
       int ret;

       printf("Testing creating and closing an object.\n");

       memset(&create, 0, sizeof(create));
       create.size = 16 * 1024;
       ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
       assert(ret == 0);

       close.handle = create.handle;
       ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
}

Here is the caller graph for this function:

static void test_create_fd_close ( int  fd) [static]

Definition at line 72 of file gem_basic.c.

{
       struct drm_i915_gem_create create;
       int ret;

       printf("Testing closing with an object allocated.\n");

       memset(&create, 0, sizeof(create));
       create.size = 16 * 1024;
       ret = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE, &create);
       assert(ret == 0);

       close(fd);
}

Here is the caller graph for this function: