• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "util/xmlpool.h"
8 
9 static struct pipe_screen *
create_screen(int fd,const struct pipe_screen_config * config)10 create_screen(int fd, const struct pipe_screen_config *config)
11 {
12    struct radeon_winsys *rw;
13 
14    /* First, try amdgpu. */
15    rw = amdgpu_winsys_create(fd, config, radeonsi_screen_create);
16 
17    if (!rw)
18       rw = radeon_drm_winsys_create(fd, config, radeonsi_screen_create);
19 
20    return rw ? debug_screen_wrap(rw->screen) : NULL;
21 }
22 
23 static const struct drm_conf_ret throttle_ret = {
24    .type = DRM_CONF_INT,
25    .val.val_int = 2,
26 };
27 
28 static const struct drm_conf_ret share_fd_ret = {
29    .type = DRM_CONF_BOOL,
30    .val.val_bool = true,
31 };
32 
drm_configuration(enum drm_conf conf)33 static const struct drm_conf_ret *drm_configuration(enum drm_conf conf)
34 {
35    static const struct drm_conf_ret xml_options_ret = {
36       .type = DRM_CONF_POINTER,
37       .val.val_pointer =
38 #include "radeonsi/si_driinfo.h"
39    };
40 
41    switch (conf) {
42    case DRM_CONF_THROTTLE:
43       return &throttle_ret;
44    case DRM_CONF_SHARE_FD:
45       return &share_fd_ret;
46    case DRM_CONF_XML_OPTIONS:
47       return &xml_options_ret;
48    default:
49       break;
50    }
51    return NULL;
52 }
53 
54 PUBLIC
55 DRM_DRIVER_DESCRIPTOR("radeonsi", create_screen, drm_configuration)
56