wlr_raster: Implement multi-renderer blits

We also need to introduce allocator variants to wlr_raster_upload_texture
and wlr_raster_attach so that the given allocator can be used to
allocate a stanging buffer to aid in blitting
This commit is contained in:
Alexander Orzechowski 2024-09-14 18:02:46 -04:00
parent 6caa8cd4f0
commit 5ac236085d
2 changed files with 185 additions and 12 deletions

View file

@ -18,12 +18,15 @@ struct wlr_texture;
struct wlr_renderer;
struct wlr_drm_syncobj_timeline;
struct wlr_surface;
struct wlr_allocator;
struct wlr_raster_source {
struct wlr_texture *texture;
struct wlr_allocator *allocator; // may be NULL
struct wl_list link;
struct wl_listener renderer_destroy;
struct wl_listener allocator_destroy;
};
struct wlr_raster {
@ -47,8 +50,6 @@ struct wlr_raster {
size_t n_locks;
struct wl_listener buffer_release;
struct wl_listener renderer_destroy;
};
struct wlr_raster_create_options {
@ -92,6 +93,20 @@ void wlr_raster_unlock(struct wlr_raster *raster);
struct wlr_texture *wlr_raster_obtain_texture(struct wlr_raster *raster,
struct wlr_renderer *renderer);
/**
* Returns the texture allocated for this renderer. If there is none,
* a new texture will be created and attached to this wlr_raster. Users do not
* own the texture returned by this function and can only be used for read-only
* purposes.
*
* An optional allocator can be provided which will be used to allocate staging
* buffers to blit between graphics devices if needed.
*
* Will return NULL if the creation was unsuccessful.
*/
struct wlr_texture *wlr_raster_obtain_texture_with_allocator(struct wlr_raster *raster,
struct wlr_renderer *renderer, struct wlr_allocator *allocator);
/**
* Creates a wlr_raster from a surface. This will automatically deduplicate
* rasters if multiple are consumed from the same surface so that redundant