gitlab-ci: enable sanitizers for the meson builds
[mesa-waffle.git] / src / waffle / gbm / wgbm_platform.h
blob24fa1f931d305cf0db1abc247233db335ce13951
1 // SPDX-FileCopyrightText: Copyright 2012 Intel Corporation
2 // SPDX-License-Identifier: BSD-2-Clause
4 #pragma once
6 #include <stdbool.h>
7 #include <stdlib.h>
8 #include <gbm.h>
9 #include <xf86drm.h>
11 #undef linux
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
30 void *gbmHandle;
32 #define DECLARE(type, function, required, args) type (*function) args;
33 GBM_FUNCTIONS(DECLARE)
34 #undef DECLARE
36 struct {
37 void *handle;
39 int (*GetDevices2)(uint32_t flags, drmDevicePtr devices[],
40 int max_devices);
42 void (*FreeDevices)(drmDevicePtr devices[], int count);
43 } drm;
46 DEFINE_CONTAINER_CAST_FUNC(wgbm_platform,
47 struct wgbm_platform,
48 struct wegl_platform,
49 wegl)
51 struct wcore_platform *
52 wgbm_platform_create(void);