diff --git a/protocol/wlr-export-dmabuf-unstable-v1.xml b/protocol/wlr-export-dmabuf-unstable-v1.xml index 6332b146..ab9694a6 100644 --- a/protocol/wlr-export-dmabuf-unstable-v1.xml +++ b/protocol/wlr-export-dmabuf-unstable-v1.xml @@ -24,7 +24,7 @@ DEALINGS IN THE SOFTWARE. - + An interface to capture surfaces in an efficient way. Overall usage: @@ -41,28 +41,27 @@ This object represents a frame which is ready to have its resources fetched and used. - The receive callback shall be called first, followed by either the - "dma_object" callback once per object or the "dma_layer" callback, - once per layer. The "dma_plane" callback shall only be called after - the "dma_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 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 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 + 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. 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. - + @@ -85,10 +84,10 @@ - - @@ -99,7 +98,7 @@ - + Callback which serves to supply the client with the file descriptors containing the data for each object. @@ -111,7 +110,7 @@ - + Callback which serves to supply the client with information on what's contained in each file descriptor and how its laid out. @@ -124,7 +123,7 @@ - + Callback which supplies the client with plane information for each layer. @@ -158,6 +157,21 @@ + + + + Indicates reason for aborting the frame. + + + + + + If the frame is no longer valid after the "frame" event has been called, @@ -167,6 +181,8 @@ This may get called if for instance the surface is in the process of resizing. + @@ -208,23 +224,29 @@ Request to start capturing from a surface with a given id. - If an ID becomes unavailable, a NULL will be returned. + - Request to start capturing from an entire wl_output. - If an output becomes unavailable, a NULL will be returned. - + + + + + + All objects created by the manager will still remain valid, until their + appropriate destroy request has been called. + diff --git a/types/wlr_export_dmabuf_v1.c b/types/wlr_export_dmabuf_v1.c index 2f1c88f2..4a7382a3 100644 --- a/types/wlr_export_dmabuf_v1.c +++ b/types/wlr_export_dmabuf_v1.c @@ -61,13 +61,13 @@ static struct wlr_export_dmabuf_manager_v1 *manager_from_resource( static void manager_handle_capture_client(struct wl_client *client, struct wl_resource *manager_resource, uint32_t id, - uint32_t client_id, int32_t overlay_cursor) { + 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, - struct wl_resource *output_resource) { + int32_t overlay_cursor, struct wl_resource *output_resource) { struct wlr_export_dmabuf_manager_v1 *manager = manager_from_resource(manager_resource); struct wlr_output *output = wlr_output_from_resource(output_resource); @@ -95,7 +95,9 @@ static void manager_handle_capture_output(struct wl_client *client, struct wlr_dmabuf_buffer_attribs attribs; if (!wlr_output_export_dmabuf(output, &attribs)) { - zwlr_export_dmabuf_frame_v1_send_abort(frame->resource); + wl_list_init(&frame->output_swap_buffers.link); + // TODO: abort reason + zwlr_export_dmabuf_frame_v1_send_abort(frame->resource, 0); return; } @@ -109,16 +111,16 @@ static void manager_handle_capture_output(struct wl_client *client, 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_dma_layer(frame->resource, 0, + zwlr_export_dmabuf_frame_v1_send_layer(frame->resource, 0, attribs.format, 1); 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_dma_object(frame->resource, i, + zwlr_export_dmabuf_frame_v1_send_object(frame->resource, i, attribs.fd[i], size); - zwlr_export_dmabuf_frame_v1_send_dma_plane(frame->resource, i, 0, i, + zwlr_export_dmabuf_frame_v1_send_plane(frame->resource, i, 0, i, attribs.offset[i], attribs.stride[i]); }