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