Commit Graph

71 Commits

Author SHA1 Message Date
Tomohito Esaki 9054e4c8c4 screenshooter: correct output ordering of screencast recording when Y-flip is off
The screenshooter encoder wrote the output from either top-to-bottom or
bottom-to-top, depending on the Y-flip setting, but wcap-decode only
decodes from bottom-to-top. Make the encoder always output from
bottom-to-top, to match the decoder, and flip the input (source)
according to the Y-flip setting.

Signed-off-by: Tomohito Esaki <etom@igel.co.jp>
Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com>
2015-10-14 16:09:52 -07:00
Derek Foreman 8ae2db5b0c input: Pass the appropriate pointer type to bindings instead of a seat
Normally we need to check if a seat's [device_type]_count is > 0 before
we can use the associated pointer.  However, in a binding you're
guaranteed that the seat has a device of that type.  If we pass in
that type instead of the seat, it's obvious we don't have to test it.

The bindings can still get the seat pointer via whatever->seat if they
need it.

This is preparation for a follow up patch that prevents direct access
to seat->device_type pointers, and this will save us a few tests at
that point.

Reviewed-by: Jonas Ådahl <jadahl@gmail.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-07-16 19:03:43 -07:00
Jon Cruz 867d50eea7 Unified multiple definitions of container_of() macro.
Removed duplicate definitions of the container_of() macro and
refactored sources to use the single implementation.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:58 -07:00
Jon Cruz 4678bab13c Remove redundant #include path component.
Using the parent '../' path component in #include statements makes
the codebase more rigid and is redundant due to proper -I use.

Signed-off-by: Jon A. Cruz <jonc@osg.samsung.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-15 17:11:09 -07:00
Bryce Harrington a0bbfea64b src: Update boilerplate from MIT X11 license to MIT Expat license 2015-06-15 13:04:18 -07:00
Derek Foreman 2a746a52d4 screenshooter: clean up recorder_binding a little
We already have a pointer to the compositor so change seat->compositor to ec

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-04 13:44:01 -07:00
Derek Foreman aff7c334fa screenshooter: remove useless cast
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
2015-02-02 14:58:46 -08:00
Marek Chalupa ab9285bf8a screenshooter: fix various memory handling
There were unchecked malloc and no free for this memory.
Also simplify error handling in one function.

v2. remove check if memory is NULL, according to man pages,
    free(NULL) is a no-op

Signed-off-by: Marek Chalupa <mchqwerty@gmail.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-12-12 14:52:29 +02:00
Bryce Harrington de44761a1a Use zalloc rather than malloc and manually setting members to 0
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-11-28 16:05:39 +02:00
Pekka Paalanen 974c094060 fix asprintf warnings
Fix recently introduced compiler warnings:

desktop-shell/shell.c: In function 'shell_configuration':
desktop-shell/shell.c:588:10: warning: ignoring return value of
'asprintf', declared with attribute warn_unused_result [-Wunused-result]

src/screenshooter.c: In function ‘screenshooter_binding’:
src/screenshooter.c:291:10: warning: ignoring return value of
‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]

src/text-backend.c: In function ‘text_backend_configuration’:
src/text-backend.c:944:10: warning: ignoring return value of ‘asprintf’,
declared with attribute warn_unused_result [-Wunused-result]

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-09-05 14:45:09 +03:00
Derek Foreman c7210434d4 tests: allow running make check without make install
desktop shell and weston keyboard both refer to themselves prefixed by
LIBEXECDIR, however this is only valid once installed.  make check will
currently either fail or run pre-existing versions.

This patch adds a way to override that location by setting the env var
WESTON_BUILD_DIR - which is then set by the test env script so make check
will test the versions in the build directory regardless of whether they're
installed or not.

Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-08-22 17:47:33 +03:00
Jasper St. Pierre 886b0098c3 screenshooter: Add a missing return; in an error path 2014-08-08 14:59:48 -07:00
Jasper St. Pierre c91408f3fb Don't bother destroying resources after sending an error
An error makes the client exit, which cleans up the resources anyway.

Note (Jason Ekstrand):
This is safe for two reasons.  First, we should be handling object
destruction nicely anyway.  Second, in each of these cases, the resources
don't have any implementation or destruction set so it has absolutely no
effect on the rest of weston whether we destroy it now or later.
2014-08-08 14:57:17 -07:00
Bryce W. Harrington bfd74f40f3 Check zalloc return for out of memory situation
Most zalloc calls in weston are checked, this fixes a handful that were
being ignored.  As found by `grep -EIsr "[^x]zalloc\(" . -A1`

Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
2014-04-25 13:19:51 -07:00
Giulio Camuffo c6ab3d52f5 compositor: let the shells create the screenshooter 2014-04-02 11:39:19 -07:00
Giulio Camuffo e9022e79c8 compositor: add an exported function to take a screenshot of an output
This allows other screenshooter protocols to use the same code to copy
the screen to a buffer.
2014-04-02 11:27:42 -07:00
U. Artie Eoff 13708a4d67 screenshooter: check for NULL malloc and fix memleaks
Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2014-01-19 22:00:39 -08:00
Pekka Paalanen 2d91ee171b screenshooter: silence a warning
screenshooter.c: In function ‘recorder_binding’:
screenshooter.c:509:5: warning: ‘listener’ may be used uninitialized in
this function [-Wuninitialized]

This was not really a problem so far, because the variable was
uninitialized only in the case where Weston had no outputs.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2014-01-08 21:27:53 -08:00
Ander Conselvan de Oliveira 41b829c025 screenshooter: Choose output to record from based on keyboard focus
Record from the output of the surface that has keyboard focus for the
seat used to activate the recorder key binding. If there is no focused
surface, record from the first one.

Also, use the weston_transformed_region() to transform the damage
region of the output into the coordinates expected by read_pixels().

https://bugs.freedesktop.org/show_bug.cgi?id=71401
2013-12-19 21:49:18 -08:00
Ander Conselvan de Oliveira e22f3bb5da screenshooter: Record one extra frame when recording stops
If the compositor hasn't been rendering for a while when the recording
stops, the time difference between the last rendered frame and that
moment won't be in the encoded video. Fix that by forcing one extra
frame to be recorded when the user presses the recorder key binding.

https://bugs.freedesktop.org/show_bug.cgi?id=71142
2013-12-17 10:59:06 -08:00
Neil Roberts e505171a32 Add calls to wl_shm_buffer_begin/end_access
This wraps all accesses to an SHM buffer between wl_shm_buffer_begin
and end so that wayland-shm can install a handler for SIGBUS and catch
attempts to pass the compositor a buffer that is too small.
2013-11-13 16:32:58 -08:00
Hardening ff39efa5c0 Rename current, origin, scale, origin_scale
This patch renames that fields to have consistent names.
2013-09-21 11:40:17 -07:00
Kristian Høgsberg 08b58c7c12 compositor: Handle OOM in weston_buffer_from_resource()
Handle NULL-return in call-sites as well.
2013-08-15 12:26:42 -07:00
Peter Hutterer f3d62276d2 malloc + memset -> zalloc
And for clients using the xmalloc helper, use xzalloc.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2013-08-08 13:46:13 -07:00
Kristian Høgsberg 919cddb0ab Convert to wl_global_create/destroy() 2013-07-09 02:02:11 -04:00
Jason Ekstrand a85118c1b8 Use wl_resource_create() for creating resources
This commit sets the version numbers for all added/created objects.  The
wl_compositor.create_surface implementation was altered to create a surface
with the same version as the underlying wl_compositor.  Since no other
"child interfaces" have version greater than 1, they were all hard-coded to
version 1.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-07-03 14:52:06 -04:00
Kristian Høgsberg 4c6ddf102c compositor: Remove a few legacy uses of wl_object 2013-06-25 15:34:59 -04:00
Jason Ekstrand 6bd6294f4a Add a weston_buffer structure to replace wl_buffer
This commit adds a weston_buffer structure to replace wl_buffer.  This way
we can hold onto buffers by just their resource.  In order to do this, the
every renderer.attach function has to fill in the weston_buffer.width and
weston_buffer.height fields.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-21 23:22:30 -04:00
Jason Ekstrand a0d2dde6cd output: Use wl_resource_get accessors for weston_output resources
Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
2013-06-14 16:51:20 -04:00
Daniel Stone c228e23b05 configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

Since this goes into config.h rather than the command line, ensure all
source is consistently including config.h before anything else,
including system libraries.  This doesn't need to be guarded by a
HAVE_CONFIG_H ifdef, which was only ever a hangover from the X.Org
modular transition.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>

[pq: rebased and converted more files]
2013-06-05 01:16:34 -04:00
Alexander Larsson b846a8d45e screenshooter: Scale damage by output scale in screen recorder
The damage region is in compositor coords, we need to scale it by
the output scale when using the damage to read output buffer data.
2013-05-29 10:22:15 -04:00
Alexander Larsson 5576546e3d screenshoter: Make recorder handle PIXMAN_x8r8g8b8
This is what the pixman renderer reports for the read format.
2013-05-29 10:21:58 -04:00
Pekka Paalanen d0cbf18d83 screenshooter: print info to log
Print the recording info to Weston log, not stderr.

Also fix the frame counter.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 18:07:30 -04:00
Pekka Paalanen 4fc5dd0099 compositor: add capability CAPTURE_YFLIP
Both GL and pixman renderer (pixman probably only because GL did?)
return the screen capture image as y-flipped, therefore Weston y-flips
it again. However, the future rpi-renderer can produce only right-way-up
(non-flipped) screen captures, and does not need an y-flip.

Add a capability flag for y-flip, which the rpi-renderer will not set,
to get screen captures the right way up.

The wcap recording code needs yet another temporary buffer for the
non-flipped case, since the WCAP format is flipped, and the code
normally overwrites the input image as it compresses it. This becomes
difficult, if the compressor is supposed to flip while processing.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
2013-05-22 16:56:58 -04:00
Kristian Høgsberg e314875d00 input: Merge wl_seat into weston_seat 2013-05-07 09:07:43 -04:00
Rob Bradford e6675c28b5 screenshooter: Free allocated memory where missing from some return paths 2013-01-10 16:06:51 -05:00
Vasily Khoruzhick 2617185b74 screenshoter: add cases for x8r8g8b8 and x8b8g8r8 formats
These formats are used by pixman renderer for framebuffer surface, without
this patch screenshoter produces empty image.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2013-01-07 09:40:42 -05:00
Vasily Khoruzhick 094ca1d1ed screenshoter: don't use hardcoded bpp value
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2013-01-07 09:40:42 -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 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
Kristian Høgsberg f0377dd3a7 wcap: Transform damage rectangles according to output tranform
https://bugs.freedesktop.org/show_bug.cgi?id=56697
2012-11-14 20:28:30 -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
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
Kristian Høgsberg 79af73e313 compositor-drm: Disable planes when zoomed or capturing
When the entire output is transformed or we're capturing the output
for screenshot or video, disable all output specific overlays
(drm planes, hw cursors etc) and move all surfaces into the primary
plane.
2012-08-03 16:33:42 -04:00
Kristian Høgsberg 49952d1f12 compositor: Introduce weston_output_schedule_repaint()
This lets us schedule a repaint on just the output that needs it.
2012-06-20 00:38:20 -04:00
Kristian Høgsberg 9c9b3a4b46 recorder: Always initialize prev when computing the run-length
We need to initialize prev when we handle the initial pixel in a
rectangle, or we may detect the following pixel as identical or different
when it's not.  This causes the top-left pixel in a rectangle to
occasionally be wrong leaving a trail of "dirty pixels" in the capture.
2012-06-20 00:28:19 -04:00
Kristian Høgsberg e0f832b4f0 compositor: Pass weston_output as the frame_signal argument
The frame time is in weston_output, so passing weston_output itself is
more useful.
2012-06-20 00:13:18 -04:00
Kristian Høgsberg ae2ba9b01b screenshooter: Just use frame signal for screenshots too
We'll remove the odd do_read_pixels callback next.
2012-06-20 00:05:46 -04:00
Kristian Høgsberg e9d0492419 compositor: Emit frame_signal from weston_output_do_read_pixels()
This is the point where we have just finished rendering the new scene
but before we swap it to the front buffer.  At this point, the
output->previous_damage region exactly corresponds to what was just
renders, as compared to previous frame.
2012-06-19 23:54:26 -04:00