Back to index

libdrm  2.4.37
Defines | Functions | Variables
main.c File Reference
#include <stdio.h>
#include <string.h>
#include "xf86drm.h"
#include "libkms.h"

Go to the source code of this file.

Defines

#define CHECK_RET_RETURN(ret, str)

Functions

int test_bo (struct kms_driver *kms)
int main (int argc, char **argv)

Variables

char * drivers []

Define Documentation

#define CHECK_RET_RETURN (   ret,
  str 
)
Value:
if (ret < 0) { \
              printf("%s: %s (%s)\n", __func__, str, strerror(-ret)); \
              return ret; \
       }

Definition at line 34 of file main.c.


Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 67 of file main.c.

{
       struct kms_driver *kms;
       int ret, fd, i;

       for (i = 0, fd = -1; fd < 0 && drivers[i]; i++)
              fd = drmOpen(drivers[i], NULL);
       CHECK_RET_RETURN(fd, "Could not open device");

       ret = kms_create(fd, &kms);
       CHECK_RET_RETURN(ret, "Failed to create kms driver");

       ret = test_bo(kms);
       if (ret)
              goto err;

       printf("%s: All ok!\n", __func__);

       kms_destroy(&kms);
       return 0;

err:
       kms_destroy(&kms);
       return ret;
}

Here is the call graph for this function:

int test_bo ( struct kms_driver kms)

Definition at line 40 of file main.c.

{
       struct kms_bo *bo;
       int ret;
       unsigned attrs[7] = {
              KMS_WIDTH, 1024,
              KMS_HEIGHT, 768,
              KMS_BO_TYPE, KMS_BO_TYPE_SCANOUT_X8R8G8B8,
              KMS_TERMINATE_PROP_LIST,
       };

       ret = kms_bo_create(kms, attrs, &bo);
       CHECK_RET_RETURN(ret, "Could not create bo");

       kms_bo_destroy(&bo);

       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char* drivers[]
Initial value:
 {
       "i915",
       "radeon",
       "nouveau",
       "vmwgfx",
       NULL
}

Definition at line 59 of file main.c.