aboutsummaryrefslogtreecommitdiff
path: root/render/pixman
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-29 17:08:32 +0200
committerSimon Zeni <simon@bl4ckb0ne.ca>2021-09-10 13:16:10 -0400
commit4e7a8707cce75b4cdc046581ec0c1cc7c0c26e02 (patch)
tree34d086a258df5567d832e28d4622e19ec3517354 /render/pixman
parent105fdecd0cd893c4ae1e21f78c67404f70859af8 (diff)
buffer: add data_ptr access flags
This allows callers to specify the operations they'll perform on the returned data pointer. The motivations for this are: - The upcoming Linux MAP_NOSIGBUS flag may only be usable on read-only mappings. - gbm_bo_map with GBM_BO_TRANSFER_READ hurts performance.
Diffstat (limited to 'render/pixman')
-rw-r--r--render/pixman/renderer.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c
index e153cf00..4eb1bd3f 100644
--- a/render/pixman/renderer.c
+++ b/render/pixman/renderer.c
@@ -96,7 +96,9 @@ static struct wlr_pixman_buffer *create_buffer(
void *data = NULL;
uint32_t drm_format;
size_t stride;
- if (!buffer_begin_data_ptr_access(wlr_buffer, &data, &drm_format, &stride)) {
+ if (!buffer_begin_data_ptr_access(wlr_buffer,
+ WLR_BUFFER_DATA_PTR_ACCESS_READ | WLR_BUFFER_DATA_PTR_ACCESS_WRITE,
+ &data, &drm_format, &stride)) {
wlr_log(WLR_ERROR, "Failed to get buffer data");
goto error_buffer;
}
@@ -143,7 +145,9 @@ static void pixman_begin(struct wlr_renderer *wlr_renderer, uint32_t width,
void *data = NULL;
uint32_t drm_format;
size_t stride;
- buffer_begin_data_ptr_access(buffer->buffer, &data, &drm_format, &stride);
+ buffer_begin_data_ptr_access(buffer->buffer,
+ WLR_BUFFER_DATA_PTR_ACCESS_READ | WLR_BUFFER_DATA_PTR_ACCESS_WRITE,
+ &data, &drm_format, &stride);
// If the data pointer has changed, re-create the Pixman image. This can
// happen if it's a client buffer and the wl_shm_pool has been resized.
@@ -229,8 +233,8 @@ static bool pixman_render_subtexture_with_matrix(
void *data;
uint32_t drm_format;
size_t stride;
- if (!buffer_begin_data_ptr_access(texture->buffer, &data, &drm_format,
- &stride)) {
+ if (!buffer_begin_data_ptr_access(texture->buffer,
+ WLR_BUFFER_DATA_PTR_ACCESS_READ, &data, &drm_format, &stride)) {
return false;
}
@@ -376,7 +380,8 @@ static struct wlr_texture *pixman_texture_from_buffer(
void *data = NULL;
uint32_t drm_format;
size_t stride;
- if (!buffer_begin_data_ptr_access(buffer, &data, &drm_format, &stride)) {
+ if (!buffer_begin_data_ptr_access(buffer, WLR_BUFFER_DATA_PTR_ACCESS_READ,
+ &data, &drm_format, &stride)) {
return NULL;
}
buffer_end_data_ptr_access(buffer);