Commit Graph

7 Commits

Author SHA1 Message Date
Pekka Paalanen
de685b8843 compositor: introduce weston_buffer_reference
The wl_buffer reference counting API has been inconsistent. You would
manually increment the refcount and register a destroy listener, as
opposed to calling weston_buffer_post_release(), which internally
decremented the refcount, and then removing a list item.

Replace both cases with a single function:
weston_buffer_reference(weston_buffer_reference *ref, wl_buffer *buffer)

Buffer is assigned to ref->buffer, while taking care of all the refcounting
and release posting. You take a reference by passing a non-NULL buffer, and
release a reference by passing NULL as buffer. The function uses an
internal wl_buffer destroy listener, so the pointer gets reset on
destruction automatically.

This is inspired by the pipe_resource_reference() of Mesa, and modified
by krh's suggestion to add struct weston_buffer_reference.

Additionally, when a surface gets destroyed, the associated wl_buffer
will send a release event. Often the buffer is already destroyed on
client side, so the event will be discarded by libwayland-client.

Compositor-drm.c is converted to use weston_buffer_reference.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 16:07:43 -05:00
Ander Conselvan de Oliveira
03fb4ef41e gl-renderer: Force call to glUseProgram() when activating debug binding
When redrawing surfaces, use_shader() checks if the desired shader is
already in use to avoid a call to glUseProgram(). However, once the
debug binding is activated, that same check would prevent the usage of
the recompiled shaders until something cause a different shader to be
passed to use_shader().
2012-12-03 10:30:51 -05:00
Ander Conselvan de Oliveira
0396ba204d compositor: Fix rendering with shm transformed buffers
The implementation of buffer transformation didn't handle transformed
shm buffers properly. The partial texture upload was broken since the
damage is in surface coordinates that don't necessarily match the
buffer's coordinates. It also wouldn't handle the buffer stride
properly, resulting in incorrect rendering if it didn't match the
buffer's width.

The logic used for converting texture coordinates was generalized and
moved out of the renderer, since this conversion may be useful in other
places, such as the backends.
2012-11-30 14:15:23 -05:00
Ander Conselvan de Oliveira
012b4c78c9 compositor: Implement buffer transformation
Implement the wl_surface.set_buffer_transform request. This includes
tracking the double-buffered buffer transformation parameter and making
the gl renderer able to handle transformed buffers.
2012-11-27 11:29:31 -05:00
Pekka Paalanen
326529f900 gl, rpi: consolidate print_egl_error_state()
Rename print_egl_error_state() to gl_renderer_print_egl_error_state()
and exports it.

Remove the copy of that function from the rpi backend, and call
the exported function instead.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-27 11:12:48 -05:00
Ander Conselvan de Oliveira
b8fcca915b compositor: Move buffer damage fields from weston_output to gl-renderer
Move fields current_buffer and buffer_damage out of weston_output into
gl_output_state, since they are actually specific to the renderer.

Also bring back the previous_damage field so that the screenshooter
can get the damage for the previous frame in a renderer independent
way.
2012-11-16 19:00:03 -05:00
John Kåre Alsaker
779b52ac3a Rename gles2-renderer to gl-renderer. 2012-11-13 17:06:19 -05:00