diff --git a/protocol/wlr-export-dmabuf-unstable-v1.xml b/protocol/wlr-export-dmabuf-unstable-v1.xml index ab9694a6..760345a7 100644 --- a/protocol/wlr-export-dmabuf-unstable-v1.xml +++ b/protocol/wlr-export-dmabuf-unstable-v1.xml @@ -42,26 +42,21 @@ fetched and used. The receive callback shall be called first, followed by the "object" - callback once per dmabuf object or the "layer" callback, once per dmabuf - layer. The "plane" callback shall only be called after the "layer" - callback corresponding to the layer the plane belongs to has been called - Finally, the "ready" event is called to indicate that all the data has + callback once per dmabuf object or the "plane" callback, once per dmabuf + plane. The "ready" event is called last to indicate that all the data has been made available for readout, as well as the time at which presentation happened at. The ownership of the frame is passed to the client, who's - responsible for destroying it via the "destroy" event once finished. - The data the API describes has been based off of what - VASurfaceAttribExternalBuffers contains. + responsible for destroying it via the "destroy" event once finished and + by calling close() on the file descriptors received. All frames are read-only and may not be written into or altered. - Special flags that must be respected by the client. - Transient frames indicate short lifetime frames (such as swapchain - images from external clients). Clients are advised to copy them and do - all processing outside of the "ready" event. + Special flags that should be respected by the client. - + @@ -79,24 +74,25 @@ summary="frame width, scaling factor included"/> - - + + + - + @@ -110,28 +106,13 @@ - - - Callback which serves to supply the client with information on what's - contained in each file descriptor and how its laid out. - Will be called after the main receive event, once per layer. - - - - - Callback which supplies the client with plane information for each - layer. + plane. - - - - Indicates reason for aborting the frame. + + + Indicates reason for cancelling the frame. - - - + + + - + If the frame is no longer valid after the "frame" event has been called, this callback will be used to inform the client to scrap the frame. @@ -181,57 +160,27 @@ This may get called if for instance the surface is in the process of resizing. - + Unreferences the frame, allowing it to be reused. Must be called as soon as its no longer used. + Can be called at any time by the client after the "frame" event, after + which the compositor will not call any other events unless the client + resubscribes to capture more. The client will still have to close any + FDs it has been given. - This object is a manager which informs clients about capturable windows - and is able to create callbacks from which to begin to receive content - from. The "title" argument in the "surface_info" event shall be used - to provide a user-readable identifier such as a window title or - program name. + This object is a manager with which to start capturing from sources. - - - This will be called whenever a surface that's able to be captured - appears. - - - - - - - Called if a surface becomes unavailable to capture, for example if has - been closed. - - - - - - - Request to start capturing from a surface with a given id. - - - - - Request to start capturing from an entire wl_output. diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c index 572da262..a2faf2ff 100644 --- a/types/wlr_export_dmabuf_v1.c +++ b/types/wlr_export_dmabuf_v1.c @@ -61,12 +61,6 @@ static struct wlr_export_dmabuf_manager_v1 *manager_from_resource( return wl_resource_get_user_data(resource); } -static void manager_handle_capture_client(struct wl_client *client, - struct wl_resource *manager_resource, uint32_t id, - int32_t overlay_cursor, uint32_t client_id) { - // TODO -} - static void manager_handle_capture_output(struct wl_client *client, struct wl_resource *manager_resource, uint32_t id, int32_t overlay_cursor, struct wl_resource *output_resource) { @@ -98,30 +92,27 @@ static void manager_handle_capture_output(struct wl_client *client, struct wlr_dmabuf_buffer_attribs *attribs = &frame->attribs; if (!wlr_output_export_dmabuf(output, attribs)) { - // TODO: abort reason - zwlr_export_dmabuf_frame_v1_send_abort(frame->resource, 0); + zwlr_export_dmabuf_frame_v1_send_cancel(frame->resource, + ZWLR_EXPORT_DMABUF_FRAME_V1_CANCEL_REASON_TEMPORARY); return; } assert(attribs->n_planes > 0); - uint32_t frame_flags = 0; + uint32_t frame_flags = ZWLR_EXPORT_DMABUF_FRAME_V1_FLAGS_TRANSIENT; uint32_t mod_high = attribs->modifier[0] >> 32; uint32_t mod_low = attribs->modifier[0] & 0xFFFFFFFF; zwlr_export_dmabuf_frame_v1_send_frame(frame->resource, - output->width, output->height, output->scale, output->transform, - attribs->flags, frame_flags, mod_high, mod_low, attribs->n_planes, 1); - - zwlr_export_dmabuf_frame_v1_send_layer(frame->resource, 0, - attribs->format, attribs->n_planes); + output->width, output->height, 0, 0, attribs->flags, frame_flags, + attribs->format, mod_high, mod_low, attribs->n_planes, + attribs->n_planes); for (int i = 0; i < attribs->n_planes; ++i) { - // TODO: what to do if the kernel doesn't support seek on buffer off_t size = lseek(attribs->fd[i], 0, SEEK_END); zwlr_export_dmabuf_frame_v1_send_object(frame->resource, i, attribs->fd[i], size); - zwlr_export_dmabuf_frame_v1_send_plane(frame->resource, i, 0, i, + zwlr_export_dmabuf_frame_v1_send_plane(frame->resource, i, i, attribs->offset[i], attribs->stride[i]); } @@ -131,7 +122,6 @@ static void manager_handle_capture_output(struct wl_client *client, } static const struct zwlr_export_dmabuf_manager_v1_interface manager_impl = { - .capture_client = manager_handle_capture_client, .capture_output = manager_handle_capture_output, };