1 // SPDX-FileCopyrightText: Copyright 2012 Intel Corporation
2 // SPDX-License-Identifier: BSD-2-Clause
6 #include "wcore_config_attrs.h"
7 #include "wcore_config.h"
8 #include "wcore_display.h"
9 #include "wcore_error.h"
10 #include "wcore_platform.h"
12 WAFFLE_API
struct waffle_config
*
14 struct waffle_display
*dpy
,
15 const int32_t attrib_list
[])
17 struct wcore_config
*wc_self
;
18 struct wcore_display
*wc_dpy
= wcore_display(dpy
);
19 struct wcore_config_attrs attrs
;
22 const struct api_object
*obj_list
[] = {
23 wc_dpy
? &wc_dpy
->api
: NULL
,
26 if (!api_check_entry(obj_list
, 1))
29 ok
= wcore_config_attrs_parse(attrib_list
, &attrs
);
33 wc_self
= api_platform
->vtbl
->config
.choose(api_platform
, wc_dpy
, &attrs
);
37 return waffle_config(wc_self
);
41 waffle_config_destroy(struct waffle_config
*self
)
43 struct wcore_config
*wc_self
= wcore_config(self
);
45 const struct api_object
*obj_list
[] = {
46 wc_self
? &wc_self
->api
: NULL
,
49 if (!api_check_entry(obj_list
, 1))
52 return api_platform
->vtbl
->config
.destroy(wc_self
);
55 WAFFLE_API
union waffle_native_config
*
56 waffle_config_get_native(struct waffle_config
*self
)
58 struct wcore_config
*wc_self
= wcore_config(self
);
60 const struct api_object
*obj_list
[] = {
61 wc_self
? &wc_self
->api
: NULL
,
64 if (!api_check_entry(obj_list
, 1))
67 if (api_platform
->vtbl
->config
.get_native
) {
68 return api_platform
->vtbl
->config
.get_native(wc_self
);
71 wcore_error(WAFFLE_ERROR_UNSUPPORTED_ON_PLATFORM
);