backend/drm: Report ZERO_COPY hint when direct scanning a client dmabuf.

Since wlr_client_buffer is gone, we are now dealing with client dmabufs
directly.
This commit is contained in:
Alexander Orzechowski 2022-06-24 23:31:20 -04:00
parent ba8230b00a
commit 45ad3d47ad
3 changed files with 13 additions and 1 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>
@ -1508,7 +1509,8 @@ static void handle_page_flip(int fd, unsigned seq,
* data between the GPUs, even if we were using the direct scanout
* interface.
*/
if (!drm->parent && plane->current_fb && false) {
if (!drm->parent && plane->current_fb &&
wlr_dmabuf_v1_buffer_is_buffer(plane->current_fb->wlr_buf)) {
present_flags |= WLR_OUTPUT_PRESENT_ZERO_COPY;
}

View file

@ -34,6 +34,12 @@ struct wlr_dmabuf_v1_buffer {
*/
bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource);
/**
* Returns true if the given buffer was created via the linux-dmabuf
* buffer protocol, false otherwise
*/
bool wlr_dmabuf_v1_buffer_is_buffer(struct wlr_buffer *buffer);
/**
* Returns the struct wlr_dmabuf_buffer if the given resource was created
* via the linux-dmabuf buffer protocol.

View file

@ -86,6 +86,10 @@ struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource(
static const struct wlr_buffer_impl buffer_impl;
bool wlr_dmabuf_v1_buffer_is_buffer(struct wlr_buffer *buffer) {
return buffer->impl == &buffer_impl;
}
static struct wlr_dmabuf_v1_buffer *dmabuf_v1_buffer_from_buffer(
struct wlr_buffer *buffer) {
assert(buffer->impl == &buffer_impl);