Return a buffer to the producer


#include <screen/screen.h>
int screen_release_buffer(screen_buffer_t buf)


The buffer that needs to be released.




Function Type: Flushing Execution

This function is typically used by consumers to indicate that they are no longer using a buffer. This function returns the buffer to the producer and it becomes available the next time the producer posts a frame. If the producer is blocked waiting for a render buffer, it will unblock after the last of the consumers, that have acquired this buffer, have released the buffer.

Note that acquiring a buffer doesn't implicitly release the previously acquired buffer. Each consumer is responsible for calling screen_release_buffer() each time it's finished with a buffer. The consumer can call screen_release_buffer() immediately after using the buffer one time, or it can release the buffer only when it has acquired a new buffer to replace the old one. Consumers of single-buffered streams must call screen_release_buffer() immediately after using the latest frame.

This function returns an error when it's called with a buffer that wasn't previously acquired, or with a buffer that has already been released.


0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).