wlmaker
Loading...
Searching...
No Matches
Classes | Functions | Variables
buffer.c File Reference
#include "buffer.h"
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <wayland-client.h>
Include dependency graph for buffer.c:

Classes

struct  buffer_t
 
struct  _wlclient_buffer_t
 

Functions

static void handle_wl_buffer_release (void *data_ptr, struct wl_buffer *wl_buffer_ptr)
 
static int shm_creat (const char *app_id_ptr, size_t size)
 
static buffer_tcreate_buffer (struct wl_shm_pool *wl_shm_pool_ptr, void *data_base_ptr, size_t ofs, unsigned width, unsigned height, unsigned bytes_per_line)
 
static void buffer_destroy (buffer_t *buffer_ptr)
 
wlclient_buffer_twlclient_buffer_create (const wlclient_t *wlclient_ptr, unsigned width, unsigned height, wlclient_buffer_ready_callback_t ready_callback, void *ready_callback_ud_ptr)
 
void wlclient_buffer_destroy (wlclient_buffer_t *client_buffer_ptr)
 
bs_gfxbuf_t * bs_gfxbuf_from_wlclient_buffer (wlclient_buffer_t *client_buffer_ptr)
 
void wlclient_buffer_attach_to_surface_and_commit (wlclient_buffer_t *client_buffer_ptr, struct wl_surface *wl_surface_ptr)
 

Variables

static const uint32_t SHM_OPEN_RETRIES = 256
 
static const struct wl_buffer_listener wl_buffer_listener
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ bs_gfxbuf_from_wlclient_buffer()

bs_gfxbuf_t * bs_gfxbuf_from_wlclient_buffer ( wlclient_buffer_t * buffer_ptr)

Returns thebs_gfxbuf_t corresponding to the client buffer.

Parameters
buffer_ptr
Returns
Pointer to the bs_gfxbuf_t. The bs_gfxbuf_t remains valid throughout the lifetime of buffer_ptr, and does not need to be released by the caller.

◆ buffer_destroy()

void buffer_destroy ( buffer_t * buffer_ptr)
static

Destroys the actual buffer.

◆ create_buffer()

buffer_t * create_buffer ( struct wl_shm_pool * wl_shm_pool_ptr,
void * data_base_ptr,
size_t ofs,
unsigned width,
unsigned height,
unsigned bytes_per_line )
static

Creates the actual buffer.

◆ handle_wl_buffer_release()

static void handle_wl_buffer_release ( void * data_ptr,
struct wl_buffer * wl_buffer_ptr )
static

Handles the release notification of the wl_buffer interface.

Parameters
data_ptr
wl_buffer_ptr

◆ shm_creat()

int shm_creat ( const char * app_id_ptr,
size_t size )
static

Creates a POSIX shared memory object and allocates size bytes to it.

Parameters
app_id_ptr
size
Returns
The file descriptor (a non-negative integer) on success, or -1 on failure. The file descriptor must be closed with close(2).

◆ wlclient_buffer_attach_to_surface_and_commit()

void wlclient_buffer_attach_to_surface_and_commit ( wlclient_buffer_t * buffer_ptr,
struct wl_surface * wl_surface_ptr )

Attaches the buffer to the surface and commits it.

Parameters
buffer_ptr
wl_surface_ptr

◆ wlclient_buffer_create()

wlclient_buffer_t * wlclient_buffer_create ( const wlclient_t * wlclient_ptr,
unsigned width,
unsigned height,
wlclient_buffer_ready_callback_t ready_callback,
void * ready_callback_ud_ptr )

Creates a wlclient wayland buffer with the given dimensions.

Parameters
wlclient_ptr
width
height
ready_callback
ready_callback_ud_ptr
Returns
A pointer to the created client buffer, or NULL on error. The buffer must be destroyed by calling wlclient_buffer_destroy.

◆ wlclient_buffer_destroy()

void wlclient_buffer_destroy ( wlclient_buffer_t * buffer_ptr)

Destroys the wlclient wayland buffer.

Parameters
buffer_ptr

Variable Documentation

◆ SHM_OPEN_RETRIES

const uint32_t SHM_OPEN_RETRIES = 256
static

How many attempts to try shm_open before giving up.

◆ wl_buffer_listener

const struct wl_buffer_listener wl_buffer_listener
static
Initial value:
= {
}
static void handle_wl_buffer_release(void *data_ptr, struct wl_buffer *wl_buffer_ptr)
Definition buffer.c:204

Listener implementation for the wl_buffer.