export-dmabuf: permanently fail if backend doesn't implement export_dmabuf

This commit is contained in:
emersion 2018-05-28 08:20:01 +01:00
parent f204a9127c
commit 2681352e04
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 7 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#include <assert.h> #include <assert.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <wlr/interfaces/wlr_output.h>
#include <wlr/types/wlr_export_dmabuf_v1.h> #include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_linux_dmabuf.h> #include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
@ -90,6 +91,12 @@ static void manager_handle_capture_output(struct wl_client *client,
wl_list_insert(&manager->frames, &frame->link); wl_list_insert(&manager->frames, &frame->link);
if (!output->impl->export_dmabuf) {
zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource,
ZWLR_EXPORT_DMABUF_FRAME_V1_CANCEL_REASON_PERNAMENT);
return;
}
struct wlr_dmabuf_buffer_attribs *attribs = &frame->attribs; struct wlr_dmabuf_buffer_attribs *attribs = &frame->attribs;
if (!wlr_output_export_dmabuf(output, attribs)) { if (!wlr_output_export_dmabuf(output, attribs)) {
zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource, zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource,