summaryrefslogtreecommitdiff
path: root/src/gbm/main/internal.h
blob: 146a98a109072828d7ae546a72217a80f6e62c93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef INTERNAL_H_
#define INTERNAL_H_

#include "gbm.h"

/* GCC visibility */
#if defined(__GNUC__) && __GNUC__ >= 4
#define GBM_EXPORT __attribute__ ((visibility("default")))
#else
#define GBM_EXPORT
#endif

struct gbm_device {
   /* Hack to make a gbm_device detectable by its first element. */
   struct gbm_device *(*dummy)(int);

   int fd;
   const char *name;

   void (*destroy)(struct gbm_device *gbm);

   struct gbm_bo *(*bo_create)(struct gbm_device *gbm,
                                uint32_t width, uint32_t height,
                                enum gbm_bo_format format,
                                uint32_t usage);

   struct gbm_bo *(*bo_create_from_egl_image)(struct gbm_device *gbm,
                                              void *egl_dpy, void *egl_img,
                                              uint32_t width, uint32_t height);

#if 0
   int (*bo_map)(struct gbm_bo *bo, void **out);
   int (*bo_unmap)(struct gbm_bo *bo);
#endif
   void (*bo_destroy)(struct gbm_bo *bo);
};

struct gbm_bo {
   struct gbm_device *gbm;
   uint32_t width;
   uint32_t height;
   uint32_t pitch;
   union gbm_bo_handle  handle;
};


struct gbm_backend {
   const char *class_name;
   const char *backend_name;
   int (*probe)(int fd);
   struct gbm_device *(*create_device)(int fd);
};

#if 0
struct gbm_device *
dri_device_create(int fd);

struct gbm_device *
gbm_gallium_drm_device_create(int fd);
#endif

#endif