Commit Graph

2622 Commits

Author SHA1 Message Date
Ander Conselvan de Oliveira
f1c38a7426 compositor-drm: Don't do a mode set on drm_output_switch_mode()
At this point, we reallocated the gbm surface, but we don't have an
fb with the right size to use. If we're going to a larger mode, the fb
would be too small and the mode set would fail. Besides, the repaint
logic will already do a mode set if necessary, so rely on that instead.
2012-12-14 11:27:53 -05:00
Ander Conselvan de Oliveira
2e7a3ab7cd compositor-drm: Fix a return value check in drm_output_switch_mode()
gl_rederer_output_create() returns 0 on success, but drm compositor
would consider this a failure.
2012-12-14 11:27:50 -05:00
Ander Conselvan de Oliveira
2bbb2b8bac compositor: Don't let pointers get outside of an output on mode switch
When an output suffers a mode switch, it is possible that a pointer
was inside the old output area but falls outside of it with the new
size. In that case, move the cursor to the output's bottom-right
corner. Otherwise, there's a crash in clip_pointer_motion().
2012-12-14 11:27:44 -05:00
Ander Conselvan de Oliveira
5c38ef4d4a compositor: Update output state after mode switch
After a mode switch, the output region and transformation matrix need
to be updated. The call to weston_output_move() would do the former but
not the latter, but calling that when the output remains in the same
coordinate doesn't make much sense. Instead, update this state and the
transformation matrix in weston_output_mode_switch().
2012-12-14 11:27:40 -05:00
Ander Conselvan de Oliveira
b77aa062c9 transformed: Add options for using debuging driver fullscreen method
Add options for setting width, height and using the driver fullscreen
method.
2012-12-14 11:27:38 -05:00
Ander Conselvan de Oliveira
5403f5274d window: Allow clients to choose the fullscreen method 2012-12-14 11:27:34 -05:00
Kristian Høgsberg
038b9dc8ec clients: Add screenshooter-client-protocol.h to screenshooter sources 2012-12-14 10:18:39 -05:00
Pekka Paalanen
d56d4d5f44 tests: remove test logs on 'make clean'
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-13 13:10:06 -05:00
Pekka Paalanen
f2aa64f18a tests: check wl_display_roundtrip() for errors
Add a macro that wraps wl_display_roundtrip() and check for errors. It
is a macro, so that the assert would show the relevant file and line
number.

This will also catch protocol errors, that would go unnoticed otherwise.

All roundtrips in tests are replaced with the check.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:39:01 -05:00
Pekka Paalanen
07921d791a tests: set client log handler
Otherwise we cannot normally see protocol errors etc. in the test
output.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:38:48 -05:00
Pekka Paalanen
c660821918 update git ignores
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-12 10:38:45 -05:00
Pekka Paalanen
fd51796094 tests: write logs to files
This cleans up the 'make check' output considerably. When all goes well,
you will only see the "PASS" line for each of $TESTS.

Weston logs into a separate file than stdout and stderr, so server logs
end up in one file per test, and other output to another file per test.

'make distclean' does not remove the tests/logs/ directory.

Also changes the weston-tests-env interpreter to bash, since I think &>
and ${1/.la/.so} might be bashisms.
2012-12-12 10:38:38 -05:00
Kristian Høgsberg
15be01ebe6 tests: Convert remaining module tests to not use test-runner.c
The remaining module tests don't need to fork and talk to a test client,
so just convert them to regular modules and let them handle running their
tests themselves.  Then drop test-runner.[ch].
2012-12-11 23:22:16 -05:00
Kristian Høgsberg
cbc35ae281 tests: Remove client-test test
This test case is the last user of the test-client code and it only
tests launching the test-client.  In other words it's a minimal test
of the framework we're dropping, so just drop this test.
2012-12-11 23:16:11 -05:00
Kristian Høgsberg
1cb3df4e46 tests: Port text-test to new test framework
So much simpler this way and the test suite is now back too 100% pass.
2012-12-11 23:04:14 -05:00
Kristian Høgsberg
ba0cfdd284 tests: Drop yield() helper function
Remaining use case was when we move the pointer.  This doesn't change
geometry so we can just use a wl_display_roundtrip() to make sure
we get the request to the server and receive the resulting events.
2012-12-11 22:17:35 -05:00
Kristian Høgsberg
1f4d8e9def keyboard-test: Use wl_display_roundtrip() instead of yield()
As for button-test, a wl_display_roundtrip is sufficient here.  The
yield() between wl_test_activate_surface() and wl_test_send_key() is
also not needed, since the two requests will arrive at the server in
order, and will activate the surface first, then send a key event.
2012-12-11 22:00:54 -05:00
Kristian Høgsberg
f63fab7241 button-test: Use wl_display_roundtrip instead of yield()
A round trip is sufficient here.  We need to make sure that the server
has received the wl_test request and that we've received the event
that the request triggers.  The wl_display_roundtrip() helper does
exactly that: it sends a wl_display.sync request, which will hit the
server after the wl_test requests and thus the wl_callback.done event
will come back after the server has seen all the previous requests and
after we've handled all preceeding event.
2012-12-11 21:58:22 -05:00
Kristian Høgsberg
db6dc7d470 weston-test-client-helper: Use a frame callback to flush surface geometry
When moving a test surface, use a frame callback to make sure the
surface has been moved and the geometry updated.  The compositor may
delay updating the transform matrices, but once we get the frame
callback we know the surface has been repainted and the geometry
updated.
2012-12-11 21:50:14 -05:00
U. Artie Eoff
0a7d588740 tests: Convert button-test to new test extension
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56821

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:40 -05:00
U. Artie Eoff
84f9db5f90 tests: Convert event-test to new test extension
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56819

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:33 -05:00
U. Artie Eoff
1ba9b38ec6 tests: Convert keyboard-test to new test extension
This adds a weston-test-runner for the weston test extension and
some weston test client helper methods.

Converted keyboard-test to use the new test interface, runner,
and helper methods.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=56822

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:25 -05:00
U. Artie Eoff
617f478df3 tests: Allow weston-tests-env to process different test types
The weston-tests-env script needs to be able to handle weston
test extension style tests as well as module style tests.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:30:05 -05:00
U. Artie Eoff
e491b13d0a tests: Rename weston-test to weston-tests-env
Renamed weston-test test environment script to weston-tests-env
to avoid ambiguity with weston-test.c (the weston test extension).

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:29:58 -05:00
U. Artie Eoff
65e7e7a65b tests: Define and implement a test protocol extension.
The weston test extension, called weston-test.so, can be loaded
from the "modules" configuration option on the command line
or in the .ini file.

Clients can bind to the "wl_test" interface to interact with
the weston test extension.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2012-12-11 15:29:52 -05:00
Kristian Høgsberg
bc2312c7c6 simple-egl: Remove old obsolete fbo and color_rbo fields
Finally a commit that actually makes simple-egl simpler.
2012-12-11 15:23:22 -05:00
Kristian Høgsberg
3a8d3f2e98 Link matrix.c into weston again
We want to make sure that the matrix symbols are exported from weston and
that modules get them from there.  To do that, we pull matrix.[ch] out of
libshared and back into weston.  calibrator now also links to matrix.[ch]
and we add a IN_WESTON define to enable the WL_EXPORT macro when compiled
inside weston.
2012-12-07 15:00:36 -05:00
Kristian Høgsberg
a2f84cc333 compositor-drm: Dont pass ARGB format to addfb2 for primary fbs
Trying to create a ARGB framebuffer for scanout results in EINVAL when
trying to queue the pageflip.  This patch overrides the format we pass
to addfb2 in case of primary buffers like we do for sprites.

Since we always have to inspect and override the format, don't try to
look up the format in drm_fb_get_from_bo().  Instead return format from
drm_output_check_scanout_format().

Rename drm_surface_format_supported() to drm_output_check_sprite_format()
and make it follow the same convention.

We started scanning out ARGB surfaces in commit e920941032.
2012-12-07 13:01:26 -05:00
Ander Conselvan de Oliveira
ca5c6ae08d compositor-drm: Use overlays for ARGB surfaces if they are opaque
Since the call to drmModeSetPlane() fails with EINVAL if the supplied
fb has an unsupported format (which is the case of ARGB8888), the fb
format needs to be overridden.
2012-12-07 10:28:09 -05:00
Rob Bradford
db9993875e shell: Remove confusing case fall-through
This avoids calling weston_surface_set_position twice on the same surface. The
second call has no effect in many cases because sx and sy
are usually zero on this path.

This change now means that any sx/sy values passed into ::attach will be
ignored on the first attach for popup surfaces. This similar to the behaviour
for other surface types.
2012-12-06 22:34:20 -05:00
Rob Bradford
40be7b467f weston-launch: Add some error reporting for weston-launch
This also avoids us passing (size_t)(-1 * sizeof(gid_t)) into malloc
2012-12-06 22:33:25 -05:00
Rob Bradford
c9e64abc5c compositor: Cleanup if we can't find the symbol in the module 2012-12-06 22:33:08 -05:00
Rob Bradford
546c856ade backlight: Revamp error handling code to not leak the directory
To neatly free the directory pointer allocated by opendir(), adjust the error
handling paths to go through to the err label.
2012-12-06 22:33:01 -05:00
Rob Bradford
acfb712127 tty: Clean up completely if switching vt fails
The code under the "err" label closes the file descriptor and frees the
allocated memory.
2012-12-06 22:32:37 -05:00
Rob Bradford
ef94085ff1 xwayland: Close fd opened for lockfile on error path 2012-12-06 22:32:25 -05:00
Rob Bradford
0b0be8eaf7 backlight: Remove unnecessary and confusing NULL checks
At this point path must point to an allocated string since otherwise the
asprintf that makes the allocation would have failed and we would have
returned earlier.
2012-12-06 22:32:07 -05:00
Rob Bradford
26e009cd9c compositor: Avoid sending event for invalid point
Avoid sending a touch down event using uninitialised surface x/y co-ordinates.
Instead present a log message about this unexpected case.
2012-12-06 22:31:50 -05:00
Rob Bradford
ba1e292779 screenshooter: Report an error if we fail to open the file 2012-12-06 22:31:22 -05:00
Rob Bradford
4988703086 screenshooter: Abandon recording rather than use unitialised format
Abandon the recording if the format is not known - this prevents the use of an
unitialised member is the header struct.
2012-12-06 22:30:49 -05:00
Ander Conselvan de Oliveira
3050d8fa94 rpi: Don't assign planes for surfaces with transformed buffers
Reported-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 22:27:04 -05:00
Ander Conselvan de Oliveira
409eebf34f compositor-drm: Support overlays with transformed buffers
Make overlays work when the client uses a buffer with the same
transformation as the output.

In order to calculate the destination rectangle, the same logic in
weston_surface_to_buffer_float() is needed, but with the output
dimensions instead. For that reason, this patch generalizes this
function into weston_transformed_{coord,rect} and moves it to util.c.
The surface functions are then implemented using those.
2012-12-06 21:56:14 -05:00
Pekka Paalanen
4dd0c412db window: add a note about freeing shm buffers
After a client has been double-buffering, and then switches to
single-buffering, it should release the 2nd buffer. That never happens
in practice here, so just add a comment and a check in case it ever
occurs in the future.

If we implemented the releasing now, it would be difficult to test.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 17:02:13 -05:00
Pekka Paalanen
aac1c13332 clients: destroy wl_registry on exit
Plug an insignificant memory leak in demo programs that bother to clean
up at all.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 17:02:00 -05:00
Pekka Paalanen
81ee3f50c3 compositor: move texture_damage into renderer private
Only the gl_renderer uses this field.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 16:56:04 -05:00
Pekka Paalanen
68033ac353 compositor: move pitch into renderer private
It is not used by anything but the gl-renderer.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 16:55:54 -05:00
Pekka Paalanen
ccfeae2ad7 compositor: add early wl_buffer.release
A client can reliably avoid allocating a second buffer per surface, if
the compositor sends the wl_buffer.release event before the frame
callback. To enable clients' single-buffering, release the wl_buffer
early if possible. Otherwise clients will double-buffer.

Releasing early is not possible, if the backend needs the buffer for
migrating a surface to or from a non-primary weston_plane. In that case,
a new buffer must arrive, before the old can be released. Backends will
indicate this by setting weston_surface:keep_buffer to 1 in
assign_planes().

A proper buffer reference in the backends would be better than the
keep_buffer flag, but that would require a per-surface backend private.

The rpi and DRM backends are updated to set keep_buffer, other backends
do not support planes, so do not have to set it.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 16:55:41 -05:00
Pekka Paalanen
fb003d3457 gl: take, hold, and release a buffer reference
Instead of relying on the compositor core to keep the wl_buffer around
and unreleased, take a new reference to it in gl-renderer. This makes
sure in the future, that the gl-renderer always has the buffer at hand,
client misbehaviour excluded.

The reference is taken in the attach callback, and released in the
flush_damage callback after copy to texture, or when the next attach
callback with a different buffer occurs.

If the surface is not on the primary plane, the buffer is not released
in flush_damage. This ensures, that the buffer stays valid in case the
surface migrates to the primary plane later.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 16:55:36 -05:00
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
Pekka Paalanen
aecd3ec54f compositor: do not flush shm buffer on destroy
The protocol does not require us to flush_damage() on wl_buffer
destruction. In fact, by the time the server receives this request, the
client may have already clobbered the buffer's storage, so we could be
reading undefined data. Instead, just forget about the buffer. The
protocol already says, that a client must not destroy a buffer that is
being read by the server, or the window contents become undefined.

The practical reason for this change is that the following commit can
consolidate wl_buffer destruction listener handlers.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 15:57:38 -05:00
Pekka Paalanen
a6421c4ea8 compositor: do not release if re-attaching buffer
If a client called wl_surface.attach with the same wl_buffer as
previously, the compositor would mistakenly send a release on that
buffer. This will cause problems only when clients start to properly use
the wl_buffer.release event.

Do not send wl_buffer.release if the same buffer is attached again.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
2012-12-06 15:57:12 -05:00