mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-19 06:47:02 -04:00
Merge branch 'surface-texture-v2' into 'master'
Replace wlr_client_buffer with wlr_surface_texture, take 2 See merge request wlroots/wlroots!4437
This commit is contained in:
commit
8fa5b78f66
13 changed files with 209 additions and 225 deletions
|
|
@ -59,19 +59,4 @@ bool dmabuf_buffer_drop(struct wlr_dmabuf_buffer *buffer);
|
|||
*/
|
||||
bool buffer_is_opaque(struct wlr_buffer *buffer);
|
||||
|
||||
/**
|
||||
* Creates a struct wlr_client_buffer from a given struct wlr_buffer by creating
|
||||
* a texture from it, and copying its struct wl_resource.
|
||||
*/
|
||||
struct wlr_client_buffer *wlr_client_buffer_create(struct wlr_buffer *buffer,
|
||||
struct wlr_renderer *renderer);
|
||||
/**
|
||||
* Try to update the buffer's content.
|
||||
*
|
||||
* Fails if there's more than one reference to the buffer or if the texture
|
||||
* isn't mutable.
|
||||
*/
|
||||
bool wlr_client_buffer_apply_damage(struct wlr_client_buffer *client_buffer,
|
||||
struct wlr_buffer *next, const pixman_region32_t *damage);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,4 +7,8 @@ struct wlr_scene *scene_node_get_root(struct wlr_scene_node *node);
|
|||
|
||||
void scene_surface_set_clip(struct wlr_scene_surface *surface, struct wlr_box *clip);
|
||||
|
||||
void scene_buffer_set_buffer_and_texture(struct wlr_scene_buffer *scene_buffer,
|
||||
struct wlr_buffer *buffer, struct wlr_texture *texture,
|
||||
const pixman_region32_t *damage);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,6 +24,10 @@ struct wlr_texture {
|
|||
uint32_t width, height;
|
||||
|
||||
struct wlr_renderer *renderer;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
};
|
||||
|
||||
struct wlr_texture_read_pixels_options {
|
||||
|
|
|
|||
|
|
@ -132,33 +132,4 @@ bool wlr_buffer_begin_data_ptr_access(struct wlr_buffer *buffer, uint32_t flags,
|
|||
void **data, uint32_t *format, size_t *stride);
|
||||
void wlr_buffer_end_data_ptr_access(struct wlr_buffer *buffer);
|
||||
|
||||
/**
|
||||
* A client buffer.
|
||||
*/
|
||||
struct wlr_client_buffer {
|
||||
struct wlr_buffer base;
|
||||
|
||||
/**
|
||||
* The buffer's texture, if any. A buffer will not have a texture if the
|
||||
* client destroys the buffer before it has been released.
|
||||
*/
|
||||
struct wlr_texture *texture;
|
||||
/**
|
||||
* The buffer this client buffer was created from. NULL if destroyed.
|
||||
*/
|
||||
struct wlr_buffer *source;
|
||||
|
||||
// private state
|
||||
|
||||
struct wl_listener source_destroy;
|
||||
|
||||
size_t n_ignore_locks;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a client buffer from a generic buffer. If the buffer isn't a client
|
||||
* buffer, returns NULL.
|
||||
*/
|
||||
struct wlr_client_buffer *wlr_client_buffer_get(struct wlr_buffer *buffer);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -119,16 +119,29 @@ struct wlr_surface_output {
|
|||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
struct wlr_surface_texture {
|
||||
struct wlr_texture *texture;
|
||||
// The buffer this surface texture was created from. NULL if released.
|
||||
struct wlr_buffer *buffer;
|
||||
// True if the texture won't be mutated by client surface commits.
|
||||
bool locked;
|
||||
|
||||
// private state
|
||||
|
||||
struct wl_listener buffer_release;
|
||||
bool dropped;
|
||||
};
|
||||
|
||||
struct wlr_surface {
|
||||
struct wl_resource *resource;
|
||||
struct wlr_renderer *renderer; // may be NULL
|
||||
/**
|
||||
* The surface's buffer, if any. A surface has an attached buffer when it
|
||||
* The surface's texture, if any. A surface has an attached buffer when it
|
||||
* commits with a non-null buffer in its pending state. A surface will not
|
||||
* have a buffer if it has never committed one, has committed a null buffer,
|
||||
* or something went wrong with uploading the buffer.
|
||||
* have a texture if it has never committed one, has committed a null
|
||||
* buffer, or something went wrong with uploading the buffer.
|
||||
*/
|
||||
struct wlr_client_buffer *buffer;
|
||||
struct wlr_surface_texture *texture;
|
||||
/**
|
||||
* The last commit's buffer damage, in buffer-local coordinates. This
|
||||
* contains both the damage accumulated by the client via
|
||||
|
|
@ -257,6 +270,9 @@ struct wlr_compositor {
|
|||
typedef void (*wlr_surface_iterator_func_t)(struct wlr_surface *surface,
|
||||
int sx, int sy, void *data);
|
||||
|
||||
void wlr_surface_texture_lock(struct wlr_surface_texture *surf_tex);
|
||||
void wlr_surface_texture_unlock(struct wlr_surface_texture *surf_tex);
|
||||
|
||||
/**
|
||||
* Set the lifetime role for this surface.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ struct wlr_scene_buffer {
|
|||
|
||||
uint64_t active_outputs;
|
||||
struct wlr_texture *texture;
|
||||
bool own_texture;
|
||||
struct wlr_linux_dmabuf_feedback_v1_init_options prev_feedback_options;
|
||||
|
||||
bool own_buffer;
|
||||
|
|
@ -191,6 +192,7 @@ struct wlr_scene_buffer {
|
|||
bool buffer_is_opaque;
|
||||
|
||||
struct wl_listener buffer_release;
|
||||
struct wl_listener texture_destroy;
|
||||
};
|
||||
|
||||
/** A viewport for an output in the scene-graph */
|
||||
|
|
@ -399,6 +401,12 @@ void wlr_scene_buffer_set_buffer(struct wlr_scene_buffer *scene_buffer,
|
|||
void wlr_scene_buffer_set_buffer_with_damage(struct wlr_scene_buffer *scene_buffer,
|
||||
struct wlr_buffer *buffer, const pixman_region32_t *region);
|
||||
|
||||
/**
|
||||
* Sets the buffer's backing texture.
|
||||
*/
|
||||
void wlr_scene_buffer_set_texture(struct wlr_scene_buffer *scene_buffer,
|
||||
struct wlr_texture *texture);
|
||||
|
||||
/**
|
||||
* Sets the buffer's opaque region. This is an optimization hint used to
|
||||
* determine if buffers which reside under this one need to be rendered or not.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue