1 // SPDX-FileCopyrightText: Copyright 2012 Intel Corporation
2 // SPDX-License-Identifier: BSD-2-Clause
13 #include "wegl_platform.h"
14 #include "wcore_util.h"
16 #define GBM_FUNCTIONS(f) \
17 f(struct gbm_device * , gbm_create_device , true, (int fd)) \
18 f(int , gbm_device_get_fd , true, (struct gbm_device *dev)) \
19 f(void , gbm_device_destroy , true, (struct gbm_device *gbm)) \
20 f(struct gbm_surface *, gbm_surface_create , true, (struct gbm_device *gbm, uint32_t width, uint32_t height, uint32_t format, uint32_t flags)) \
21 f(void , gbm_surface_destroy , true, (struct gbm_surface *surface)) \
22 f(struct gbm_bo * , gbm_surface_lock_front_buffer , true, (struct gbm_surface *surface)) \
23 f(void , gbm_surface_release_buffer , true, (struct gbm_surface *surface, struct gbm_bo *bo)) \
24 f(struct gbm_surface *, gbm_surface_create_with_modifiers, false, (struct gbm_device *gbm, uint32_t width, uint32_t height, uint32_t format, const uint64_t *modifiers, const unsigned int count))
26 struct wgbm_platform
{
27 struct wegl_platform wegl
;
29 // GBM function pointers
32 #define DECLARE(type, function, required, args) type (*function) args;
33 GBM_FUNCTIONS(DECLARE
)
39 int (*GetDevices2
)(uint32_t flags
, drmDevicePtr devices
[],
42 void (*FreeDevices
)(drmDevicePtr devices
[], int count
);
46 DEFINE_CONTAINER_CAST_FUNC(wgbm_platform
,
51 struct wcore_platform
*
52 wgbm_platform_create(void);