mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
Redesign wlr_texture
- Textures are now immutable (apart from those created from raw pixels), no more invalid textures - Move all wl_drm stuff in wlr_renderer - Most of wlr_texture fields are now private - Remove some duplicated DMA-BUF code in the DRM backend - Add more assertions - Stride is now always given as bytes rather than pixels - Drop wl_shm functions Fun fact: this patch has been written 10,000 meters up in the air.
This commit is contained in:
parent
80d3561d32
commit
c63d94483b
24 changed files with 577 additions and 647 deletions
|
|
@ -181,9 +181,6 @@ void wlr_drm_resources_free(struct wlr_drm_backend *drm) {
|
|||
if (plane->cursor_bo) {
|
||||
gbm_bo_destroy(plane->cursor_bo);
|
||||
}
|
||||
if (plane->wlr_tex) {
|
||||
wlr_texture_destroy(plane->wlr_tex);
|
||||
}
|
||||
}
|
||||
|
||||
free(drm->crtcs);
|
||||
|
|
@ -586,12 +583,6 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
|
|||
wlr_output_transform_invert(output->transform);
|
||||
wlr_matrix_projection(plane->matrix, plane->surf.width,
|
||||
plane->surf.height, transform);
|
||||
|
||||
plane->wlr_tex =
|
||||
wlr_render_texture_create(plane->surf.renderer->wlr_rend);
|
||||
if (!plane->wlr_tex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
struct wlr_box hotspot = { .x = hotspot_x, .y = hotspot_y };
|
||||
|
|
@ -637,13 +628,18 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
|
|||
|
||||
wlr_drm_surface_make_current(&plane->surf, NULL);
|
||||
|
||||
wlr_texture_upload_pixels(plane->wlr_tex, WL_SHM_FORMAT_ARGB8888,
|
||||
stride, width, height, buf);
|
||||
|
||||
struct wlr_renderer *rend = plane->surf.renderer->wlr_rend;
|
||||
|
||||
struct wlr_texture *texture = wlr_texture_from_pixels(rend,
|
||||
WL_SHM_FORMAT_ARGB8888, stride, width, height, buf);
|
||||
if (texture == NULL) {
|
||||
wlr_log(L_ERROR, "Unable to create texture");
|
||||
return false;
|
||||
}
|
||||
|
||||
wlr_renderer_begin(rend, plane->surf.width, plane->surf.height);
|
||||
wlr_renderer_clear(rend, (float[]){ 0.0, 0.0, 0.0, 0.0 });
|
||||
wlr_render_texture(rend, plane->wlr_tex, plane->matrix, 0, 0, 1.0f);
|
||||
wlr_render_texture(rend, texture, plane->matrix, 0, 0, 1.0f);
|
||||
wlr_renderer_end(rend);
|
||||
|
||||
wlr_renderer_read_pixels(rend, WL_SHM_FORMAT_ARGB8888, bo_stride,
|
||||
|
|
@ -651,6 +647,7 @@ static bool wlr_drm_connector_set_cursor(struct wlr_output *output,
|
|||
|
||||
wlr_drm_surface_swap_buffers(&plane->surf, NULL);
|
||||
|
||||
wlr_texture_destroy(texture);
|
||||
gbm_bo_unmap(plane->cursor_bo, bo_data);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue