2024年1月12日发(作者:)

│ │ │ └── nir_to_spirv│ │ ├── include # Gallium3D header files which define the Gallium3D interfaces│ │ │ ├── pipe│ │ │ └── state_tracker│ │ ├── state_trackers # fontends? These implement various libraries using the device drivers│ │ │ ├── clover # OpenCL frontend│ │ │ │ ├── api│ │ │ │ ├── core│ │ │ │ ├── llvm│ │ │ │ │ └── codegen│ │ │ │ ├── nir│ │ │ │ ├── spirv│ │ │ │ └── util│ │ │ ├── dri # Meta frontend for DRI drivers, see mesa/state_tracker│ │ │ ├── glx # Meta frontend for GLX│ │ │ │ └── xlib│ │ │ ├── hgl # Haiku OpenGL│ │ │ ├── nine # D3D9 frontend, see targets/d3dadapter9│ │ │ ├── omx # OpenMAX Bellagio frontend│ │ │ │ ├── bellagio│ │ │ │ └── tizonia│ │ │ ├── osmesa # Off-screen OpenGL rendering library│ │ │ ├── va # VA-API frontend│ │ │ ├── vdpau # VDPAU frontend│ │ │ ├── wgl # Windows WGL frontend│ │ │ ├── xa # XA frontend│ │ │ └── xvmc # XvMC frontend│ │ ├── targets # These control how the Gallium code is compiled into different libraries.│ │ │ │ # Each of these roughly corresponds to one frontend.

│ │ │ ├── d3dadapter9 # for Wine│ │ │ ├── dri # libgallium_ loaded by │ │ │ ├── graw-gdi # 'graw' means ' raw Gallium interface without a frontend'│ │ │ ├── graw-null│ │ │ ├── graw-xlib│ │ │ ├── haiku-softpipe│ │ │ ├── libgl-gdi│ │ │ ├── libgl-xlib│ │ │ ├── omx│ │ │ ├── opencl│ │ │ ├── osmesa│ │ │ ├── pipe-loader│ │ │ ├── va│ │ │ ├── vdpau│ │ │ ├── xa│ │ │ └── xvmc│ │ ├── tools│ │ │ └── trace│ │ └── winsys # The device drivers are platform-independent, the winsys connects them to

│ │ │ # various platforms. There is usually one winsys per device family, and within│ │ │ # the winsys directory there can be multiple flavors connecting to different│ │ │ # platforms│ │ ├── amdgpu│ │ │ └── drm│ │ ├── etnaviv│ │ │ └── drm│ │ ├── freedreno│ │ │ └── drm│ │ ├── i915│ │ │ └── drm│ │ ├── iris│ │ │ └── drm│ │ ├── kmsro│ │ │ └── drm│ │ ├── lima│ │ │ └── drm│ │ ├── nouveau

│ │ ├── nouveau│ │ │ └── drm│ │ ├── panfrost│ │ │ └── drm│ │ ├── radeon│ │ │ └── drm│ │ ├── svga│ │ │ └── drm│ │ ├── sw│ │ │ ├── dri│ │ │ ├── gdi # Windows│ │ │ ├── hgl│ │ │ ├── kms-dri│ │ │ ├── null│ │ │ ├── wrapper│ │ │ └── xlib # indirect rendering on X Window System│ │ ├── tegra│ │ │ └── drm│ │ ├── v3d│ │ │ └── drm│ │ ├── vc4│ │ │ └── drm│ │ └── virgl│ │ ├── common│ │ └── drm│ ├── gbm # Generic Buffer Manager is memory allocator for device│ │ ├── backends│ │ │ └── dri│ │ └── main│ ├── getopt│ ├── glx # The GLX library code for building using DRI drivers.│ │ ├── apple│ │ └── windows│ ├── hgl│ ├── imgui│ ├── intel # Intel-specific source│ │ ├── blorp # BLit Or Resolve Pass is blit and HiZ resolve framework│ │ ├── common│ │ ├── compiler│ │ ├── dev│ │ ├── genxml│ │ ├── isl│ │ ├── perf│ │ ├── tools│ │ │ └── imgui│ │ └── vulkan # Anvil is a Vulkan implementation for Intel gen 7(Ivy Bridge) and newer│ ├── loader # Used by to find and load the appropriate DRI driver.│ ├── mapi # Mesa APIs│ │ ├── es1api│ │ ├── es2api│ │ ├── glapi # OpenGL API dispatch layer. This is where all the GL entrypoints like glClear,│ │ │ │ # glBegin, etc. are generated, as well as the GL dispatch table. All GL function│ │ │ │ # calls jump through the dispatch table to functions found in main/.│ │ │ │

│ │ │ ├── gen│ │ │ └──registry│ │ ├── new│ │ └── shared-glapi│ ├── mesa # Main Mesa sources│ │ ├── drivers # Mesa drivers(not used with Gallium)│ │ │ ├── common # code which may be shared by all drivers│ │ │ ├── dri # Direct Rendering Infrastructure drivers│ │ │ │ ├── common # code shared by all DRI drivers│ │ │ │ ├── i915 # driver for Intel i915/i945│ │ │ │ ├── i965 # driver for Intel i965│ │ │ │ ├── nouveau # driver for nVidia nv04/nv10/nv20

src/gallium/winsys/vc4/drm/vc4_drm_4_drm_screen_create -> vc4_screen_createvc4_drm_screen_create_renderonlysrc/gallium/drivers/vc4/vc4_4_screen_createsrc/gallium/auxiliary/target-helpers/drm__vc4_create_screen -> vc4_drm_screen_createsrc/gallium/auxiliary/pipe-loader/pipe_loader_c const struct drm_driver_descriptor driver_descriptors[] = {//

省略 { .driver_name = "vc4", .create_screen = pipe_vc4_create_screen, .driconf_xml = &v3d_driconf_xml, },//

省略};static const struct drm_driver_descriptor *get_driver_descriptor(const char *driver_name, struct util_dl_library **plib){#ifdef GALLIUM_STATIC_TARGETS for (int i = 0; i < ARRAY_SIZE(driver_descriptors); i++) { if (strcmp(driver_descriptors[i].driver_name, driver_name) == 0) return &driver_descriptors[i]; } return &default_driver_descriptor;#else//

省略}static boolpipe_loader_drm_probe_fd_nodup(struct pipe_loader_device **dev, int fd){ struct pipe_loader_drm_device *ddev = CALLOC_STRUCT(pipe_loader_drm_device); int vendor_id, chip_id; if (!ddev) return false; if (loader_get_pci_id_for_fd(fd, &vendor_id, &chip_id)) { ddev-> = PIPE_LOADER_DEVICE_PCI; ddev->_id = vendor_id; ddev->_id = chip_id; } else { ddev-> = PIPE_LOADER_DEVICE_PLATFORM; } ddev-> = &pipe_loader_drm_ops; ddev->fd = fd; ddev->_name = loader_get_driver_for_fd(fd); if (!ddev->_name) goto fail;

/* For the closed source AMD OpenGL driver, we want libgbm to load * "amdgpu_", but we want Gallium multimedia drivers to load * "radeonsi". So change amdgpu to radeonsi for Gallium. */ if (strcmp(ddev->_name, "amdgpu") == 0) { FREE(ddev->_name); ddev->_name = strdup("radeonsi"); } struct util_dl_library **plib = NULL;#ifndef GALLIUM_STATIC_TARGETS plib = &ddev->lib;#endif ddev->dd = get_driver_descriptor(ddev->_name, plib); /* kmsro supports lots of drivers, try as a fallback */ if (!ddev->dd) ddev->dd = get_driver_descriptor("kmsro", plib); if (!ddev->dd) goto fail; *dev = &ddev->base; return true; fail:#ifndef GALLIUM_STATIC_TARGETS if (ddev->lib) util_dl_close(ddev->lib);#endif FREE(ddev->_name); FREE(ddev); return false;}boolpipe_loader_drm_probe_fd(struct pipe_loader_device **dev, int fd){ bool ret; int new_fd; if (fd < 0 || (new_fd = fcntl(fd, F_DUPFD_CLOEXEC, 3)) < 0) return false; ret = pipe_loader_drm_probe_fd_nodup(dev, new_fd); if (!ret) close(new_fd); return ret;}src/gallium/auxiliary/pipe-loader/pipe_loader.c

static int (*backends[])(struct pipe_loader_device **, int) = {#ifdef HAVE_LIBDRM &pipe_loader_drm_probe,#endif &pipe_loader_sw_probe};const char gallium_driinfo_xml[] = DRI_CONF_BEGIN#include "driinfo_gallium.h" DRI_CONF_END;intpipe_loader_probe(struct pipe_loader_device **devs, int ndev){ int i, n = 0; for (i = 0; i < ARRAY_SIZE(backends); i++) n += backends[i](&devs[n], MAX2(0, ndev - n)); return n;}src/gallium/state_trackers/clover/core/tform::platform() : adaptor_range(evals(), devs) { int n = pipe_loader_probe(NULL, 0); std::vector ldevs(n); pipe_loader_probe(&(), n); for (pipe_loader_device *ldev : ldevs) { try { if (ldev) _back(create(*this, ldev)); } catch (error &) { pipe_loader_release(&ldev, 1); } }}OSMesasrc/gallium/state_trackers/osmesa/de/GL/osmesa.h