Add new struct wlr_multi_gpu

For development to continue on systems (such as optimus laptops) that
have multiple GPUs, we need a way to reference all of the renderers
that have been created for devices in the system. A wlr_multi_gpu
struct holds renderers coming from two different sources:
1. the primary renderer (given to us by the compositor)
2. drm sub backends, each of which has a renderer created for
   cross-GPU copies.

This change provides a way to access all of these from the same
place.
This commit is contained in:
Austin Shafer 2022-07-27 16:07:21 -04:00
parent ed8961b309
commit 5a38cc57c8
7 changed files with 142 additions and 4 deletions

View file

@ -25,6 +25,7 @@
#endif // WLR_HAS_VULKAN_RENDERER
#include "backend/backend.h"
#include "backend/multi.h"
#include "render/pixel_format.h"
#include "render/wlr_renderer.h"
#include "util/env.h"
@ -285,6 +286,13 @@ out:
if (own_drm_fd && drm_fd >= 0) {
close(drm_fd);
}
// If we have a multi GPU environment, then track this renderer
// for cross-GPU imports.
if (renderer && backend && wlr_backend_is_multi(backend)) {
struct wlr_multi_backend *multi = (struct wlr_multi_backend *)backend;
renderer->multi_gpu = multi->multi_gpu;
}
return renderer;
}