Commit Graph

26 Commits

Author SHA1 Message Date
John Kåre Alsaker
320711db0a Move weston_compositor GL and EGL state into gles2-renderer. 2012-11-13 17:03:33 -05:00
John Kåre Alsaker
75cc571839 Move weston_surface GL and EGL state into gles2-renderer. 2012-11-13 17:03:08 -05:00
John Kåre Alsaker
4068414a32 Moved shader state into gles2-renderer. 2012-11-13 17:02:38 -05:00
John Kåre Alsaker
d615980b6b gles2-renderer: Renaming some functions. 2012-11-13 17:02:14 -05:00
John Kåre Alsaker
878f44969d compositor: Move surface color state to gles2-renderer.
This moves the surface color state into gles2-renderer. To do this it
adds two new weston_renderer functions. create_surface to be able to
create per-surface renderer state, and surface_set_color to set the
color of a surface and changes it to a color surface.
2012-11-13 17:01:59 -05:00
John Kåre Alsaker
f9e710b57c screenshooter: Use the renderer function for reading out pixels
This also changes the compositor's read_format to a pixman format.
2012-11-13 17:01:02 -05:00
John Kåre Alsaker
a95b2d6d41 compositor: Add a renderer function to read out pixels 2012-11-13 17:00:06 -05:00
John Kåre Alsaker
4415450ef1 Move compositor-wayland border drawing into gles2-renderer. 2012-11-13 16:59:01 -05:00
John Kåre Alsaker
1b7ad160a3 Move EGLConfig, EGLContext and EGLDisplay fields into gles2-renderer.
This moves the EGLConfig, EGLContext and EGLDisplay fields into
gles2-renderer. It also moves EGLDisplay creation and EGLConfig
selection into gles2-renderer.
2012-11-13 16:56:28 -05:00
John Kåre Alsaker
94659274b4 Move weston_output EGL state into gles2-renderer.
This introduces callbacks for output creation and destruction for the
gles2-renderer. This enables the gles2-renderer to have per-output
state. EGL surface creation is now done by the output_create callback
and the EGL surface is stored in the new per-output gles2-renderer
state. On the first output_create call, the gles2-renderer will setup
it's GL context. This is because EGL requires a EGL surface to be able
to use the GL context.
2012-11-13 16:30:27 -05:00
Pekka Paalanen
bcdd579a58 gles2: update texture only if needed
When a surface is on a non-primary plane (overlay), we do not need to
keep the GL texture up-to-date, since we are not using it. Avoid calling
glTex(Sub)Image2D in that case, and accumulate the texture damage
separately.

This is especially useful for backends, that can put wl_shm buffers into
overlays.

The empty damage check has to be moved from surface_accumulate_damage()
into gles2_renderer_flush_damage(), because it really needs to check the
accumulated damage, not only the current damage. Otherwise, if a surface
migrates from a plane to the primary plane, and does not have new
damage, the texture would not be updated even for accumulated damage.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-11-08 16:56:26 -05:00
Ander Conselvan de Oliveira
27508c2045 gles2: Add a debug binding for highlighting shaded content
Pressing mode-shift-space s will cause the fragment shaders to be
recompiled, adding a green tint to all composited content.
2012-11-08 16:56:25 -05:00
Pekka Paalanen
035a0323ef gles2: check eglBindWaylandDisplayWL return value
If the bind fails, do not bother pretending the EGL Wayland extension
is usable, and no need to unbind, either.

Print some important details about the GLESv2 renderer configuration
into the log.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-25 14:58:59 -04:00
Pekka Paalanen
9c3fe25b4d gles2: log EGL config info
Interesting in new environments.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-10-25 14:57:17 -04:00
Ander Conselvan de Oliveira
8ea818fb00 compositor: Generalize output previous damage into per buffer damage
This is a more generic fix for the issue solved in 4f521731 where
damage obscured by overlays could be lost in one of the output buffers
due to rapid move of a surface in an overlay plane.

This changes the renderer so it keeps track of the damage in each
buffer. Every time a new frame is drawn, the damage of the frame is
added to all the buffers and the rendered regions are cleared from
the current buffer's damage.
2012-09-14 13:40:08 -04:00
Pekka Paalanen
0d64a0fa29 compositor: new intersection algorithm
The existing algorithm had some corner cases (pun!), where it failed to
produce correct vertices in the right order. This appeared only when the
surface was transformed (rotated). It also produced degenerate polygons
(3 or more vertices with zero polygon area) for non-transformed cases
where the clipping and surface rectangles were adjacent but not
overlapping.

Introduce a new algorithm for finding the boundary vertices of the
intersection of a coordinate axis aligned rectangle and an arbitrary
polygon (here a quadrilateral). The code is based on the
Sutherland-Hodgman algorithm, where a polygon is clipped by infinite
lines one at a time.

This new algorithm should always produce the correct vertices in the
clockwise winding order, and discard duplicate vertices and degenerate
polygons. It retains the fast paths of the existing algorithm for the
no-hit and non-transformed cases.

Benchmarking with earlier versions showed that the new algorithm is
a little slower (56 vs. 68 us/call) than the existing algorithm, for
the transformed case.  The 'cliptest f' command before and after this
commit can be used to compare the speed of the transformed case only.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Acked-by: Rob Clark <rob.clark@linaro.org>
2012-09-12 12:27:35 -04:00
Kristian Høgsberg
4226385e53 compositor: Destroy gles2 resource for weston_surface in gles2-renderer.c
This moves the last gles2 call out of compositor.c.
2012-09-06 21:59:33 -04:00
Kristian Høgsberg
3a0de88abf compositor: Move unbind_display call into gles2-renderer.c 2012-09-06 21:44:24 -04:00
Kristian Høgsberg
9793fc7a4e compositor: Move EGL context creation to gles2-renderer.c 2012-09-06 21:08:14 -04:00
Kristian Høgsberg
2bc5e8eaf8 compositor: Create outputs before initializing GLES2 state
This way we can just use the first weston_output EGLSurface to make a
context current.
2012-09-06 21:08:13 -04:00
Kristian Høgsberg
fa1be023a2 compositor: Introduce a weston_renderer object
Move the gles2 render functions to vfuncs on the renderer object.
2012-09-06 21:08:13 -04:00
Kristian Høgsberg
b7b77e6f8f compositor: Move EGL/GLES2 parts of weston_surface_attach to gles2-renderer.c 2012-09-06 21:08:13 -04:00
Kristian Høgsberg
b1fd2d6dd8 compositor: Move update_shm_texture() to gles2-renderer.c
We rename it flush_damage() as it's the point where we update our rendering
API source (eg, the gles2 texture) according to the accumulated damage,
if necessary.
2012-09-06 21:08:13 -04:00
Kristian Høgsberg
25894fc920 compositor: Move gles2 initialization to gles2-renderer.h 2012-09-06 21:08:13 -04:00
Kristian Høgsberg
ecf6edec1f compositor: Move surface repaint code to gles2-renderer.c 2012-09-06 21:08:12 -04:00
Kristian Høgsberg
d7c172648d compositor: Consolidate output repaint logic
We move the EGL and GLES2 output repaint code into a new gles2-render.c
file.  The eglMakeCurrent, glViewPort, surface loop etc was duplicated
across all backends, but this patch moves it to a new file.
2012-09-06 21:08:12 -04:00