Merge branch 'single-pixel-optimize' into 'master'

Draft: wlr_renderer: Add single pixel optimization

See merge request wlroots/wlroots!3650
This commit is contained in:
Alexander Orzechowski 2022-08-11 11:28:57 +00:00
commit e3cc1dda94
39 changed files with 1149 additions and 972 deletions

View file

@ -16,6 +16,7 @@
#include <wlr/backend/interface.h>
#include <wlr/interfaces/wlr_output.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/util/box.h>
#include <wlr/util/log.h>
@ -1491,7 +1492,7 @@ static void handle_page_flip(int fd, unsigned seq,
* interface.
*/
if (!drm->parent && plane->current_fb &&
wlr_client_buffer_get(plane->current_fb->wlr_buf)) {
wlr_dmabuf_v1_buffer_is_buffer(plane->current_fb->wlr_buf)) {
present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
}

View file

@ -90,14 +90,14 @@ struct wlr_buffer *drm_surface_blit(struct wlr_drm_surface *surf,
return NULL;
}
struct wlr_texture *tex = wlr_texture_from_buffer(renderer, buffer);
if (tex == NULL) {
struct wlr_raster *raster = wlr_raster_create(buffer);
if (!raster) {
return NULL;
}
struct wlr_buffer *dst = wlr_swapchain_acquire(surf->swapchain, NULL);
if (!dst) {
wlr_texture_destroy(tex);
wlr_raster_unlock(raster);
return NULL;
}
@ -107,16 +107,15 @@ struct wlr_buffer *drm_surface_blit(struct wlr_drm_surface *surf,
if (!wlr_renderer_begin_with_buffer(renderer, dst)) {
wlr_buffer_unlock(dst);
wlr_texture_destroy(tex);
wlr_raster_unlock(raster);
return NULL;
}
wlr_renderer_clear(renderer, (float[]){ 0.0, 0.0, 0.0, 0.0 });
wlr_render_texture_with_matrix(renderer, tex, mat, 1.0f);
wlr_render_raster_with_matrix(renderer, raster, mat, 1.0f);
wlr_renderer_end(renderer);
wlr_texture_destroy(tex);
wlr_raster_unlock(raster);
return dst;
}