targets/pipe-loader: add driver specific drm_configuration
[mesa.git] / src / gallium / targets / pipe-loader / pipe_nouveau.c
1
2 #include "target-helpers/inline_debug_helper.h"
3 #include "state_tracker/drm_driver.h"
4 #include "nouveau/drm/nouveau_drm_public.h"
5
6 static struct pipe_screen *
7 create_screen(int fd)
8 {
9 struct pipe_screen *screen;
10
11 screen = nouveau_drm_screen_create(fd);
12 if (!screen)
13 return NULL;
14
15 screen = debug_screen_wrap(screen);
16
17 return screen;
18 }
19
20 static const struct drm_conf_ret throttle_ret = {
21 .type = DRM_CONF_INT,
22 .val.val_int = 2,
23 };
24
25 static const struct drm_conf_ret share_fd_ret = {
26 .type = DRM_CONF_BOOL,
27 .val.val_int = true,
28 };
29
30 static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
31 {
32 switch (conf) {
33 case DRM_CONF_THROTTLE:
34 return &throttle_ret;
35 case DRM_CONF_SHARE_FD:
36 return &share_fd_ret;
37 default:
38 break;
39 }
40 return NULL;
41 }
42
43 PUBLIC
44 DRM_DRIVER_DESCRIPTOR("nouveau", "nouveau", create_screen, drm_configuration)