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