Re: [Intel-gfx] gitlab.fd.o financial situation and impact on services

2020-02-28 Thread Kristian Høgsberg
On Thu, Feb 27, 2020 at 7:38 PM Dave Airlie  wrote:
>
> On Fri, 28 Feb 2020 at 07:27, Daniel Vetter  wrote:
> >
> > Hi all,
> >
> > You might have read the short take in the X.org board meeting minutes
> > already, here's the long version.
> >
> > The good news: gitlab.fd.o has become very popular with our
> > communities, and is used extensively. This especially includes all the
> > CI integration. Modern development process and tooling, yay!
> >
> > The bad news: The cost in growth has also been tremendous, and it's
> > breaking our bank account. With reasonable estimates for continued
> > growth we're expecting hosting expenses totalling 75k USD this year,
> > and 90k USD next year. With the current sponsors we've set up we can't
> > sustain that. We estimate that hosting expenses for gitlab.fd.o
> > without any of the CI features enabled would total 30k USD, which is
> > within X.org's ability to support through various sponsorships, mostly
> > through XDC.
> >
> > Note that X.org does no longer sponsor any CI runners themselves,
> > we've stopped that. The huge additional expenses are all just in
> > storing and serving build artifacts and images to outside CI runners
> > sponsored by various companies. A related topic is that with the
> > growth in fd.o it's becoming infeasible to maintain it all on
> > volunteer admin time. X.org is therefore also looking for admin
> > sponsorship, at least medium term.
> >
> > Assuming that we want cash flow reserves for one year of gitlab.fd.o
> > (without CI support) and a trimmed XDC and assuming no sponsor payment
> > meanwhile, we'd have to cut CI services somewhere between May and June
> > this year. The board is of course working on acquiring sponsors, but
> > filling a shortfall of this magnitude is neither easy nor quick work,
> > and we therefore decided to give an early warning as soon as possible.
> > Any help in finding sponsors for fd.o is very much appreciated.
>
> a) Ouch.
>
> b) we probably need to take a large step back here.

If we're taking a step back here, I also want to recognize what a
tremendous success this has been so far and thank everybody involved
for building something so useful. Between gitlab and the CI, our
workflow has improved and code quality has gone up.  I don't have
anything useful to add to the technical discussion, except that that
it seems pretty standard engineering practice to build a system,
observe it and identify and eliminate bottlenecks. Planning never
hurts, of course, but I don't think anybody could have realistically
modeled and projected the cost of this infrastructure as it's grown
organically and fast.

Kristian

> Look at this from a sponsor POV, why would I give X.org/fd.o
> sponsorship money that they are just giving straight to google to pay
> for hosting credits? Google are profiting in some minor way from these
> hosting credits being bought by us, and I assume we aren't getting any
> sort of discounts here. Having google sponsor the credits costs google
> substantially less than having any other company give us money to do
> it.
>
> If our current CI architecture is going to burn this amount of money a
> year and we hadn't worked this out in advance of deploying it then I
> suggest the system should be taken offline until we work out what a
> sustainable system would look like within the budget we have, whether
> that be never transferring containers and build artifacts from the
> google network, just having local runner/build combos etc.
>
> Dave.
> ___
> Intel-gfx mailing list
> intel-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Migrating Wayland & Weston to GitLab

2018-05-31 Thread Kristian Høgsberg
On Thu, May 31, 2018 at 3:53 AM Pekka Paalanen  wrote:
>
> On Thu, 31 May 2018 08:47:48 +0100
> Daniel Stone  wrote:
>
> > Hi all,
> >
> > On 29 May 2018 at 10:59, Daniel Stone  wrote:
> > > I intend to migrate the wayland/wayland-protocols/wayland-web/weston
> > > repository hosting only (issues disabled, MR submission disabled) this
> > > evening. Anyone trying to push to git.fd.o will get an error message
> > > pointing them to the wiki page telling them how to configure their
> > > remotes and set up their accounts. Anyone having trouble with this is
> > > welcome to contact me and I can help figure it out.
> > >
> > > This leaves the wayland-build-tools and wayland-java repositories
> > > orphaned in cgit; both have been inactive for quite some time.
> >
> > I've done this now. For the meantime, I've left wayland-protocols back
> > on the old infrastructure; given the discussion about what we should
> > be doing with wayland-protocols, it seemed prudent to wait.
> >
> > The following people have access from the Wayland group as it stands:
> >   daniels, anholt, derek, bryce, whot, pq, krh, jwrdegoede, tomeu,
> > nroberts, dvdhrm, jadahl, jekstrand, rdp.effort, zubzub, sardemff7,
> > iksaif, bnf, uartie, darxus, sree
> >
> > I would propose to prune the following developers who are no longer
> > (TTBOMK) active in Wayland and haven't been for at least a couple of
> > years:
> >   anholt
> >   tomeu
> >   nroberts
> >   dvdhrm
> >   jekstrand
> >   iksaif
> >   bnf
> >   uartie
> >   darxus
> >   sree
> >
> > Pruning people wouldn't at all be a one-way process; everyone would of
> > course be more than welcome back if they rejoined, and I'd be happy to
> > see them keep contributing.
>
> Sounds good to me.
>
> > I also propose to give the following people 'master' permission,
> > allowing them to add/remove people from the project, as well as do
> > special things like force-push: myself, Derek, Kristian, and Pekka.
> >
> > Does anyone have any thoughts at all on this, or alternative
> > suggestions, or?
>
> Fine by me. I wonder if Kristian wants it, he has been totally silent
> on the Wayland side for years now, but I do like having one more admin
> there.

Silent, but still here :) I don't mind helping out with the admin role.

Kristian

> Thanks,
> pq
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [Mesa-dev] [ANNOUNCE] Wayland/Weston/Mesa HDR support (proof of concept)

2017-12-22 Thread Kristian Høgsberg
On Thu, Dec 21, 2017 at 6:21 AM, Ville Syrjälä
 wrote:
> Here's a quick proof of concept implementation of HDR support
> for Wayland/Weston/Mesa.
>
> I'm not posting this as patches right now because I'm not sure
> that would do much good given how rough this is. But here are
> all the repos/branches:
> git://github.com/vsyrjala/wayland.git hdr_poc
> git://github.com/vsyrjala/wayland-protocols.git hdr_poc
> git://github.com/vsyrjala/weston.git hdr_poc
> git://github.com/vsyrjala/mesa.git hdr_poc
> git://github.com/vsyrjala/linux.git hdr_poc
>
> The kernel HDR bits were partially done by Uma Shankar, the rest
> I hacked together myself.

Hi Ville,

This looks really interesting, thanks for the heads up.

Kristian

> As far as Wayland protocol goes I'm adding three new
> extensions (should probably just have one with several requests?):
> - zwp_colorspace_v1 - Specify the primaries/whitepoint chromacities
>   and transfer function for a surface
> - zwp_ycbcr_encoding_v1 - Specify the encoding for YCbCr surfaces
> - zwp_hdr_metadata_v1 - Allow the client to pass HDR metadata to
>   the compositor
> Note that I've not given any thought to how the compositor might
> advertize its capabilities.
>
> I also hacked in a bunch of 10bpc+ YCbCr support to the protocol and
> Weston so that I can actually get some HDR video onto the screen.
>
> On the Mesa side I've crudely implementated the following egl/vk
> extesions:
> - EXT_gl_colorspace_*
> - EXT_surface_SMPTE2086_metadata
> - EXT_surface_CTA861_3_metadata
>   (sidenote: these egl extension don't seem to match CTA-861.3 nicely
>when it comes to the min/max luminance stuff)
> - VK_EXT_hdr_metadata
>
> VK_EXT_hdr_metadata I plugged in for anv only, but the implementation
> is in the common wayland wsi code. Note that I haven't actually tested
> the vulkan stuff at all because I don't talk Vulkan (at least not yet).
>
> Also note that I've not connected up the HDR metadata pipeline
> properly. The client can provide the metadata, but the compositor
> doesn't actually pass it on to the display. For the time being the
> HDR metadata that gets passed to the display is partially specified
> in weston.ini and partially just hardocded (see
> libweston/compositor-drm.c).
>
> The Weston implementation involves a bunch of shaders and matrices to
> do the ycbcr->rgb, "degamma", csc for each surface, blend it all as
> linear RGB into an fp16 fbo, and finally blit that out to the final
> framebuffer while applying the ST2084 PQ transfer function in the
> process.
>
> The reason for the fp16 fbo is that we store the full 1 nits of
> linear RGB. That needs plenty of precisions in the low end so your
> regular 10bpc fb doesn't seem to cut it. And also the display gamma LUT
> doesn't have enough input precision for it either. Sadly there's no
> fixed function hardware in the GPU to do the ST2084 PQ when blending.
> When the output is not HDR I do skip the fp16 fbo step and use the
> gamma LUT in the display engine instead.
>
> Another approach to the precisions problem might be to not store the
> entire 1 nits of linear, and just cut off the super bright stuff
> (your display can't show it anyway). But I've not really bothered to
> figure out how low in nits we'd have to go here, probably too low.
> Maybe blending as sRGB and the doing sRGB->PQ with the gamma LUT might
> help a little bit?
>
> Ideally we would bypass this all for a single fullscreen HDR surface
> and just pass the PQ encoded data directly through. But I've not
> implemented that. In fact I even disable the buffer_age damage stuff
> when using the fp16 fbo, so we'll recompose the entire screen every
> time. Yeah, I'm lazy.
>
> Another thought that occurred to me was that it shouldn't be too hard
> to make Weston do some tone mapping when there's a HDR client and no
> HDR screen. To that end I included the ACES colorspaces in my
> colorspace list, but I didn't actually look into plugging the ACES tone
> mapping curve into the shaders. Might be a fun excercise, even though
> the practical applications might be close to nil. Probably better to
> not advertize HDR/wide gamuts when we can't actually output the stuff,
> and instead let the client do its own tone mapping.
>
> OK, so what can you do with this? I've included a few test clients:
> - simple-colorspace
>   Just a copy of simple-egl but it uses the egl extension to specify
>   the colorspace, and produces ST2084 PQ encoded data when asked
> - simple-hdr-video
>   Uses ffmpeg to decode video into shm buffers, and sets the
>   colorspace/ycbcr encoding etc. appropriately. Ie. this one can
>   actually output HDR video
>
> Here's a weston.ini snippet that gets you outputting HDR:
> [core]
> gbm-format=xrgb2101010
>
> [output]
> name=HDMI-A-2
> colorspace=BT.2020
> gamma=ST2084
> max_sdr_nits=100
>
> Hardware wise you'll need a HDR capable display obviously, and
> you'll need an Intel Geminilake GPU. Older Intel platforms 

Re: [PATCH weston] make error() portable

2017-05-04 Thread Kristian Høgsberg
On Sat, May 30, 2015 at 12:02 PM, Jon A. Cruz  wrote:
> On 05/29/2015 09:14 PM, Khem Raj wrote:
>> error() is not posix but gnu extension so may not be available on all
>> kind of systemsi e.g. musl.
>
> Hi,
>
> Just including a few low-level notes.
>
>>
>> Signed-off-by: Khem Raj 
>> ---
>>  configure.ac|  2 ++
>>  src/weston-error.h  | 20 
>>  src/weston-launch.c |  2 +-
>>  3 files changed, 23 insertions(+), 1 deletion(-)
>>  create mode 100644 src/weston-error.h
>>
>> diff --git a/configure.ac b/configure.ac
>> index 263fc22..f52cd62 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -57,6 +57,8 @@ AC_CHECK_DECL(CLOCK_MONOTONIC,[],
>> [[#include ]])
>>  AC_CHECK_HEADERS([execinfo.h])
>>
>> +AC_CHECK_HEADERS([error.h])
>> +
>
> A check should probably also be added for err.h also since its functions
> are non-standard BSD extensions.
>
>>  AC_CHECK_FUNCS([mkostemp strchrnul initgroups posix_fallocate])
>>
>>  COMPOSITOR_MODULES="wayland-server >= 1.7.93 pixman-1 >= 0.25.2"
>> diff --git a/src/weston-error.h b/src/weston-error.h
>> new file mode 100644
>> index 000..2089d02
>> --- /dev/null
>> +++ b/src/weston-error.h
>> @@ -0,0 +1,20 @@
>> +#ifndef _WESTON_ERROR_H
>> +#define _WESTON_ERROR_H
>
> Identifiers starting with an underscore followed by a capital letter are
> reserved. Just drop the leading '_'
>
>> +
>> +#if defined(HAVE_ERROR_H)
>
> A question: is it better to use "#if HAVE_ERROR_H"? I know that in
> theory one could #define HAVE_ERROR_H 0, but the use in weston seems
> half-and-half between bare #if and #if defined().
>
>> +#include 
>> +#else
>> +#include 
>> +#include 
>> +#define _weston_error(S, E, F, ...) do { \
>
> I believe that anything here in the global scope that starts with an
> underscore is also technically reserved. So again, the leading '_' is a
> potential problem.
>
> Additionally macros in the weston codebase use lower-case for parameter
> names.
>
>> + if (E) \
>> + err(S, F ": %s", ##__VA_ARGS__, strerror(E)); \
>> + else \
>> + err(S, F, ##__VA_ARGS__); \
>
> For safety, the uses of S and F should probably be wrapped in
> parenthesis. e.g. "err((S), (F) " or rather "err((s), (f) "
>
> I believe that these should use the 'x' variants to avoid duplication of
> messages (errx()). Also if S is zero error() will not exit so this macro
> should call warnx() in those cases.

Make it a static inline function, there's no need for a macro here.
Also, if you have to reimplement it, just fall all the way back to
fprintf, don't use another non-standard function.

Kristian

>> +} while(0)
>> +
>> +#define error _weston_error
>> +#endif
>> +
>> +#endif
>> +
>> diff --git a/src/weston-launch.c b/src/weston-launch.c
>> index 10c66de..3e6d30a 100644
>> --- a/src/weston-launch.c
>> +++ b/src/weston-launch.c
>> @@ -30,7 +30,6 @@
>>  #include 
>>  #include 
>>
>> -#include 
>>  #include 
>>
>>  #include 
>> @@ -56,6 +55,7 @@
>>  #endif
>>
>>  #include "weston-launch.h"
>> +#include "weston-error.h"
>>
>>  #define DRM_MAJOR 226
>>
>>
>
> Functionally it seems to make sense. Do you happen to know which
> platforms/scenarios need this?
>
> --
> Jon A. Cruz - Senior Open Source Developer
> Samsung Open Source Group
> j...@osg.samsung.com
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Skylane - implementation of Wayland in Rust

2017-05-04 Thread Kristian Høgsberg
On Thu, May 4, 2017 at 8:59 AM, Wojciech Kluczka
 wrote:
> Hello,
>
> This was supposed to be only a short announcement of Skylane -
> implementation of Wayland in Rust - but it was pointed to me that one can
> not use hardware acceleration without original libwayland so I have to also
> ask some questions.
>
> On client side there's not much to worry about (as far as I could see) but
> server has to use mesa extension which adds global object to display,
> relying on concrete implementation.
>  - I can guess but was the reason to make such dependence?

The idea is that the EGL driver, Mesa or any other driver, could
implement the Wayland server side extension with whatever protocol
necessary. Mesa uses wl_drm, but other drivers can use a different
protocol or a shared-memory section or such. The EGL extension
provides a high-enough level of abstraction that a wide range of
drivers should be able to implement it. If you want an EGL driver to
talk to Wayland, you need the driver and the server to share a C
implementation of the protocol library.

>  - Would that be feasible to add another more generic extension providing
> data needed to create wl_drm global by server instead of implicitly adding
> it in mesa?

Not sure what you have in mind here, but...

>  - I didn't look at details of implementation. Probably not, but would it be
> feasible to provide wl_drm global without any extension, using only
> available drm/gbm API?

Yes, you don't need to use the EGL extension. You can implement wl_drm
or the dma-buf extension directly in your rust based compositor. Then
use

https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import.txt
https://www.khronos.org/registry/EGL/extensions/EXT/EGL_EXT_image_dma_buf_import_modifiers.txt

to import the dma buf fd as an EGLImage.

Kristian

> In many places Wayland (not only Weston) is referred as "reference
> implementation" so I didn't really expect such obstacles.
>
> I guess questions like "why new implementation?" or "why not bindings?" will
> appear, so here are some words in advance. There is one project aiming to
> create Rust bindings, but at the time I started there was no support for
> server side (I don't know how about now) and whole think was about adding
> another complicated abstraction layer dumping straightforwardness (and
> performance). On the other hand Rust provides great support for
> multi-threading so it would be wasteful to impose on users how they create
> wayland thread. Removing that what left is creating sockets, dispatching and
> generating some marshaling code. Not much. And without using libwayland this
> can be clean and slick.
>
> For interested ones, links to skylane and perceptia (window manager /
> compositor in Rust using it):
> https://github.com/perceptia/skylane
> https://github.com/perceptia/perceptia
>
> Best regards,
> Wojciech Kluczka
>
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] Introduce keyboard grabbing protocol for Xwayland

2017-04-24 Thread Kristian Høgsberg
On Fri, Apr 21, 2017 at 5:50 AM Olivier Fourdan  wrote:

>
> Hi Jonas,
>
> > > [...]
> > > For that last point, I'd rather use:
> > >
> > > * does not guarantee that events sent to this client are
> continuous,
> > >   a compositor may change and reroute keyboard events while the
> grab
> > >   is nominally active.
> > >
> > > > hmm, and thinking about the last point: do we need to specify what
> the
> > > > focus
> > > > behaviour is if a grab is active? I'm assuming 'no' because there is
> no
> > > > notification whatsoever whether it ever activates anyway, but...
> > >
> > > No, indeed, that's precisely the main difference with the shortcuts
> > > inhibitor logic for the wayland native apps.
> > >
> > > Here, keyboards events are routed to the surface regardless of the
> focus,
> > > just like an X11 grab.
> >
> > Should this part really be respected though? In what circumstances does
> > it make sense to route input events to Xwayland when a Wayland client is
> > the one focused?
>
> Yes, that's precisely the whole point of this protocol (and grabs in
> general) :)
>
> Take the attached sample code for example, it maps a single override
> redirect window (one that no X11 window manager would focus, because it's
> an O-R) and issues an active keyboard grab to get all keyboard events.
>

What is the use case that this is trying to support though? Which Xwayland
apps are you trying to support with this?


> While that works fine in X11 native, that won't work in Wayland/Xwayland
> without this protocol and the ability to route keyboard events even when
> the surface is not focused.
>
> > > > Last question: how will you deal with XGrabKeyboard() requests on
> already
> > > > grabbed keyboards? I can send that request twice with different grab
> > > > windows
> > > > and it'll change the grab over (iirc). Xwayland will destroy the
> current
> > > > grab and request a new one?
> > >
> > > Yeap, good point, "XGrabKeyboard overrides any active keyboard grab by
> the
> > > client" so Xwayland needs to destroy any current grab before setting a
> new
> > > one in this case.
> > >
> >
> > FWIW, this will create a minor race, where any key presses between the
> > .destroy and .grab requests will be ungrabbed.
>
> Yeah, you're right, but I reckon it's acceptable.
>
> Cheers,
> Olivier
>
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [RFC PATCH 0/8] Meson build system

2016-11-30 Thread Kristian Høgsberg
Hi Daniel,

Thanks for doing this!

I share a lot of the same background - I've worked with autotools for many
years, know them well and have also been hesitant to move away. I've
recently ported a small personal project from autotools to meson and I
found it very nice and easy to work with. It feels like a better fit for
the kind of workflow that I'm used to with autotools than many of the other
newer build systems out there.

In terms of speed, it's certainly nice that meson ends up using ninja, but
the much faster configure step is what I'm excited about. Especially on a
multicore system where the configure step runs single-threaded and
bottlenecks the rest of the otherwise parallelizable build process. And the
fact that meson is fast enough that there's no point in a separate
autogen.sh step, make the overall system much simpler and faster.

Of course, one of the points of the generate step in autotools is that you
ship the generated files with your tarballs and the end results only
requires standard sh and make. I don't think meson has a similar feature,
but I'd argue that today requiring python isn't going to limit you any more
than requiring sh and make.

I think having both meson and autotools side by side for a bit would be a
good way to start and I'd be in favor of moving to meson exclusively a few
releases down the road.

Kristian

On Tue, Nov 29, 2016 at 9:00 AM Daniel Stone  wrote:

> Hi all,
> Whilst working on the atomic series, and the recent review spree, I
> started to really lose patience with how incredibly slow our build
> system is.
>
> This patchset provides a working port to Meson, a Python-based build
> system with a Ninja backend. Whilst autotools runs a combination of
> shell and Perl (aclocal/automake/autoconf) to generate the build files
> and Make and shell to run it, Meson runs its configuration step in
> Python, and outputs Ninja build files.
>
> (tl;dr: smaller platforms 3-6x quicker, bigger platforms 2-4x quicker)
>
> There are a few things which attracted me to Meson. It's really,
> mindblowingly, fast. There's no artificial split between configure and
> build stages (i.e. configure.ac vs. Makefile.am). Its dependencies are
> quite lightweight. It has first-class support for pkg-config, and I've
> not had a problem with executables, shared libraries, modules, static
> helper libraries, binaries to install to libexec, tests[0], etc etc.
>
> I've been keeping an eye on it for a while as it matures; one of the
> things which interested me was seeing GStreamer and GNOME start to
> migrate some of their projects towards it. Not because they're
> incredible and we should blindly follow everything they do, but because
> they have a very similar set of build-system requirements to us, and
> they have also been very conservative in migrating away from autotools
> to date.
>
> I'm incredibly familiar with autotools, dating back to 2004 when I
> started experimenting with converting the X server to use it, which
> later grew into the xserver module we have today. As new build systems
> have come around, I've made a point of looking into them, and trying to
> use them.
>
> SCons and waf were immediately disqualified, because I think writing
> your entire build in actual Python is insane, and too large a barrier to
> entry. CMake is brutally slow[1], I find its interface very unintuitive,
> and cmake --help-full splits out a 37,399-line Markup file to stdout. GN
> (used for Chrome) is very nice, and I prefer its system of 'configs' to
> Meson's per-target flags, but isn't really portable. Most of the rest
> focus on languages we don't use, and/or bring massive dependencies.
>
> Meson's the first one I've found that strikes the right balance (not
> perfect, but within striking distance) of lightweight DSL vs. useful
> programming language. And, it's really incredibly fast. It has far
> better support for cross-compilation and sysroots than autotools can
> ever hope to have. And it's got quite a good upstream community behind
> it, and solid documentation.
>
> I've done a port for Meson, with the full range of options and
> configuration available in autotools today. Currently we're missing
> Doxygen support (because I haven't got around to it) in Wayland, plus I
> haven't been able to test the Weston RDP backend (because it doesn't
> build in Fedora 25) or the fbdev backend (because it's 2016), but they
> are there. There's also currently no support for 'auto' build options; I
> need to look into how best to do that. A couple of the tests in Weston
> are missing, and I think also PAM support for weston-launch.
>
> There are also some inefficiencies: currently, for some reason, Meson
> will run wayland-scanner once for every generated file _for every
> target_. So xdg-shell-unstable-v5-client-protocol.h, for example, gets
> built a bazillion times. Fixing that upstream would actually visibly cut
> the build times. We could also get a speed boost by moving away 

Re: Introduction and updates from NVIDIA

2016-05-12 Thread Kristian Høgsberg
On Wed, May 11, 2016 at 4:08 PM, James Jones  wrote:
> On 05/11/2016 02:31 PM, Daniel Stone wrote:
>>
>> Hi James,
>>
>> On 11 May 2016 at 21:43, James Jones  wrote:
>>>
>>> On 05/04/2016 08:56 AM, Daniel Stone wrote:

 Right - but as with the point I was making below, GBM _right now_ is
 more capable than Streams _right now_. GBM right now would require API
 additions to match EGLStreams + EGLSwitch + Streams/KMS-interop, but
 the last two aren't written either, so. (More below.)
>>>
>>>
>>> The current behavior that enables this, where basically all Wayland
>>> buffers
>>> must be allocated as scanout-capable, isn't reasonable on NVIDIA
>>> hardware.
>>> The requirements for scanout are too onerous.
>>
>>
>> I think we're talking past each other, so I'd like to pare the
>> discussion down to these two sentences, and my two resultant points,
>> for now:
>>
>> I posit that the Streams proposal you (plural) have put forward is, at
>> best, no better at meeting these criteria:
>>- there is currently no support for direct scanout from client
>> buffers in Streams, so it must always pessimise towards GPU
>> composition
>>- GBM stacks can obviously do the same: implement a no-op
>> gbm_bo_import, and have your client always allocate non-scanout
>> buffers - presto, you've matched Streams
>>
>> I posit that GBM _can_ match the capability of a hypothetical
>> EGLStreams/EGLSwitch implementation. Current _implementations_ of GBM
>> cannot, but I posit that it is not a limitation of the API it exposes,
>> and unlike Streams, the capability can be plumbed in with no new
>> external API required.
>>
>> These seem pretty fundamental, so ... am I missing something? :\ If
>> so, can you please outline fairly specifically how you think
>> non-Streams implementations are not capable of meeting the criteria in
>> your two sentences?
>
>
> I respect the need to rein in the discussion, but I think several
> substantive aspects have been lost here.  I typed up a much longer response
> below, but I'll try to summarize in 4 sentences:
>
> GBM could match the allocation aspects of streams used in Miguel's first
> round of patches.  However, I disagree that its core API is sufficient to
> match the allocation capabilities of EGLStream+EGLSwitch where all producing
> and consuming devices+engines are known at allocation time. Further, streams
> have additional equally valuable functionality beyond allocation that GBM
> does not seem intended to address.  Absent agreement, I believe co-existence
> of EGLStreams and GBM+wl_drm in Wayland/Weston is a reasonable path forward
> in the short term.
>
> The longer version:
>
> GBM alone can not perform as well as EGLStreams unless it is extended into
> something more or less the same as EGLStreams, where it knows exactly what
> engines are being used to produce the buffer content (along with their
> current configuration), and exactly what engines/configuration are being
> used to consume it.  This implies allocating against multiple specific
> objects, rather than a device and a set of allocation modifier flags, and/or
> importing an external allocation and hoping it meets the current
> requirements.  From what I can see, GBM fundamentally understands at most
> the consumer side of the equation.
>
> Suppose however, GBM was taught everything streams know implicitly about all
> users of the buffers at allocation time.  After allocation, GBM is done with
> its job, but streams & drivers aren't.
>
> The act of transitioning a buffer from optimal "producer mode" to optimal
> "consumer mode" relies on all the device & config information as well,
> meaning it would need to be fed into the graphics driver (EGL or whatever
> window system binding is used) by each window system the graphics driver was
> running on to achieve equivalent capabilities to EGLStream.
>
> Fundamentally, the API-level view of individual graphics buffers as raw
> globally coherent & accessible stores of pixels with static layout is
> flawed.  Images on a GPU are more of a mutating spill space for a collection
> of state describing the side effects of various commands than a 2D array of
> pixels.  Forcing GPUs to resolve an image to a 2D array of pixels in any
> particular layout can be very inefficient.  The GL+GLX/EGL/etc. driver model
> hides this well, but it breaks down in a few cases like EGLImage and
> GLX_EXT_texture_from_pixmap, the former not really living up to its implied
> potential because of this, and the latter mostly working only because it has
> a very limited domain where things can be shared, but still requires a lot
> of platform-specific code to support properly.  Vulkan brings a lot more of
> this out into the open with its very explicit image state transitions and
> limitations on which engines can access an image in any given state, but
> that's just within the Vulkan API itself (I.e., strictly on a single GPU and
> optionally an 

Re: Introduction and updates from NVIDIA

2016-05-03 Thread Kristian Høgsberg
On Tue, May 3, 2016 at 11:58 AM, James Jones  wrote:
> On 05/03/2016 09:58 AM, Daniel Stone wrote:
>>
>> Hi James,
>>
>> On 3 May 2016 at 17:29, James Jones  wrote:
>>>
>>> Given Wayland is designed such that clients drive buffer allocation
>>
>>
>> I'd just note that this isn't strictly true. I've personally
>> implemented Wayland support for platforms (media playback on an
>> extremely idiosyncratic platform) where server-side buffer allocation
>> was required for optimal performance, and that's what was done. wl_drm
>> is not exemplary for these platforms as it does not have a protocol
>> concept of a swapchain, but you can add one to your own private
>> protocol implementation (analagous to wl_eglstream) and it works with
>> no changes required to external clients or compositors.
>
>
> Indeed, streams blur this a bit as well.  What I meant to way is that
> clients drive the timing of when new buffers are available for compositing.
> Perhaps the server could perform a non-destructive reallocation to avoid
> this though if the cost of such an operation were not considered
> prohibitive?
>
>>> , and I
>>> tend to agree that the compositor (along with its access to drivers like
>>> KMS) is the component uniquely able to optimize the scene, I think the
>>> best
>>> that can be achieved is a system that gravitates toward the optimal
>>> solution
>>> in the steady state.  Therefore, it seems that KMS should optimize
>>> display
>>> engine resources assuming the Wayland compositor and its clients will
>>> adjust
>>> to meet KMS' suggestions over time, where "time" would hopefully be only
>>> a
>>> small number of additional frames. Streams will perform quite well in
>>> such a
>>> design.
>>
>>
>> It is unfortunate that you seem to discuss 'Streams' as an abstract
>> concept of a cross-process swapchain which can be infinitely adjusted
>> to achieve perfection, and yet 'GBM' gets discussed as a singular
>> fixed-in-time thing which has all the flaws of just one of its
>> particular platform implementations.
>
>
> I have a stronger understanding of the design direction for streams than I
> do for GBM, and EGLStream is indeed intended to evolve towards the best
> abstraction of a swapchain possible.  My views of GBM are based on the
> current API.  I'm not that familiar with the Mesa implementation details.
> I'd be happy to learn more about the direction the GBM API is taking in the
> future, and that's half of what I was attempting to do in my
> responses/questions here.
>
>> I don't see how GBM could really perform any worse in such a design.
>
>
> The current GBM API is not expressive enough to support optimal buffer
> allocation (at least on our hardware) in such a design.

I'm curious about the performance concern. What exactly is missing?

Kristian
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 01/11] COPYING: Update to MIT Expat License rather than MIT X License

2015-06-11 Thread Kristian Høgsberg
On Thu, Jun 11, 2015 at 3:58 AM, Daniel Stone dan...@fooishbar.org wrote:
 Hi Bryce,

 On 10 June 2015 at 19:55, Bryce Harrington br...@osg.samsung.com wrote:
 MIT has released software under several slightly different licenses,
 including the old 'X11 License' or 'MIT License'.  Some code under this
 license was in fact included in X.org's Xserver in the past.  However,
 X.org now prefers the MIT Expat License as the standard (which,
 confusingly, is also referred to as the 'MIT License').  See
 http://cgit.freedesktop.org/xorg/xserver/tree/COPYING

 When Wayland started, it was Kristian Høgsberg's intent to license it
 compatibly with X.org.  I wanted Wayland to be usable (license-wise)
 whereever X was usable.  But, the text of the older X11 License was
 taken for Wayland, rather than X11's current standard.  This patch
 corrects this by swapping in the intended text.

 In practical terms, the most notable change is the dropping of the
 no-advertising clause.

 Signed-off-by: Bryce Harrington br...@osg.samsung.com

 Thanks for these. For all code copyright to myself or Collabora, Ltd.,
 as well as the code written by myself and copyright Intel Corporation,
 this patch is:
 Signed-off-by: Daniel Stone dani...@collabora.com

Thanks Bryce.

Signed-off-by: Kristian Høgsberg k...@bitplanet.net

 Cheers,
 Daniel
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Wayland not MIT-licensed / FAQ wrong

2015-05-28 Thread Kristian Høgsberg
Yes, it appears you're correct. The HPND license is widely used in X
(even new additions such as
http://cgit.freedesktop.org/xorg/xserver/tree/dri3/dri3.c) and I think
I assumed it was the most recent/modern version of the MIT license. It
was certainly the intention to change the license to MIT and that's
what all contributors acknowledged when we relicensed. Let's wait a
few days and see if anybody objects, but otherwise I think it'd be
fine to just change the Wayland and Weston licenses to the actual MIT
license.

Kristian

On Thu, May 28, 2015 at 5:06 AM, Markus Slopianka kamika...@gmx.de wrote:
 Hi there.
 I'm one of the authors of Wayland's Wikipedia article
 https://en.wikipedia.org/wiki/Wayland_%28display_server_protocol%29.
 While writing it we noticed some discrepancies in your licensing.

 Your FAQ states that Wayland is MIT-licensed
 http://wayland.freedesktop.org/faq.html#heading_toc_j_1 although the actual
 license text http://cgit.freedesktop.org/wayland/wayland/tree/COPYING uses
 the wording from the deprecated Historical Permission Notice and Disclaimer
 (HPND) license http://opensource.org/licenses/HPND.

 This, btw, also leads to the weird situation that this particular wording has
 not been declared a Free Software license and GPL-compatible by the FSF (even
 though there are no clauses that would prevent that).

 The HPND is also not just a simple re-wording of the MIT license because the
 HPND carries a no-promotion clause like §3 of the 3-clause BSD license
 https://en.wikipedia.org/wiki/BSD_licenses#3-clause.

 The easy but still awkward solution (because the HPND is deprecated) is to
 simply fix the FAQ.
 However, I'd suggest to replace the HPND text with the 3-clause BSD license.
 The 3-clause BSD license is functionally the same, just with different 
 wording.
 As such replacing the license text would IMO not be a re-licensing of Wayland
 in the sense that each developer (or 95%, according to Mozilla
 https://blogs.fsfe.org/ciaran/?p=58) would have to agree with it.
 As I see it, it would merely be a editorial change like correcting bad grammar
 or a typo.

 Markus

 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] desktop-shell: Don't assume there is a pointer when resizing

2014-06-23 Thread Kristian Høgsberg
On Mon, Jun 23, 2014 at 4:18 AM, Emilio Pozuelo Monfort
poch...@gmail.com wrote:
 Hi Kristian,

 On 19/06/14 07:37, Kristian Høgsberg wrote:
 On Wed, Jun 18, 2014 at 05:48:58PM +0200, Emilio Pozuelo Monfort wrote:
 From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk

 Fixes a crash on touch devices without a pointer, when touching
 the window frame of a client.

 Thanks, applied.  At some point we'll get rid of all these pointer
 assumptions.

 I don't see this in master or 1.5. Maybe you forgot to push or something?

I did... should be out there now.

Kristian

 Regards,
 Emilio

 Kristian

 Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk
 ---
  desktop-shell/shell.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 84f5c83..d965618 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -1784,7 +1784,8 @@ common_surface_resize(struct wl_resource *resource,
  struct shell_surface *shsurf = wl_resource_get_user_data(resource);
  struct weston_surface *surface;

 -if (seat-pointer-button_count == 0 ||
 +if (seat-pointer == NULL ||
 +seat-pointer-button_count == 0 ||
  seat-pointer-grab_serial != serial ||
  seat-pointer-focus == NULL)
  return;
 --
 2.0.0

 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] Apply output transform to the cursor while copying into a plane

2014-06-18 Thread Kristian Høgsberg
On Wed, May 21, 2014 at 07:36:21PM +0100, Neil Roberts wrote:
 Previously if the output had a transform then the cursor plane would
 be disabled. However as we have to copy the cursor image into a buffer
 with the CPU anyway it probably won't cost much extra to also apply
 the transform in the process and then we can avoid disabling the
 plane.
 
 If the transform is either normal or flipped-180 then a slightly
 faster path is used that still copies the lines one at a time with
 memcpy. Otherwise there is a slower path which copies one pixel at a
 time.
 
 Previously the check for whether to disable the plane was only looking
 at whether the output has a transform. However it should probably have
 also been disabled if the surface has a transform. This patch changes
 it to just look at the surface transform instead. It could be possible
 to work out a relative transform and apply that so that any
 combinations of transforms will work, but this patch doesn't attempt
 that.

Could we just use pixman here?  We could also scale up the cursor image
when possible with that.

Kristian

 ---
  src/compositor-drm.c | 120 
 ---
  1 file changed, 113 insertions(+), 7 deletions(-)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 7d514e4..553454d 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -958,7 +958,7 @@ drm_output_prepare_cursor_view(struct weston_output 
 *output_base,
  
   if (c-gbm == NULL)
   return NULL;
 - if (output-base.transform != WL_OUTPUT_TRANSFORM_NORMAL)
 + if (viewport-buffer.transform != WL_OUTPUT_TRANSFORM_NORMAL)
   return NULL;
   if (viewport-buffer.scale != output_base-current_scale)
   return NULL;
 @@ -979,6 +979,102 @@ drm_output_prepare_cursor_view(struct weston_output 
 *output_base,
  }
  
  static void
 +transform_cursor_buffer_slow(enum wl_output_transform transform,
 +  uint32_t *buf,
 +  unsigned char *s,
 +  int32_t width,
 +  int32_t height,
 +  int stride)
 +{
 + int angle = transform  3;
 + int swap_xy = transform  1;
 + int flip_x, flip_y;
 + int buf_x_increment, buf_y_increment;
 + int s_y_increment;
 + int sx, sy;
 +
 + /* Flip here means we flip the direction of the destination
 +  * iterators */
 + flip_x = (angle  1) ^ (angle  1);
 + flip_y = (angle  1);
 +
 + if (swap_xy) {
 + if (transform  4)
 + flip_y = !flip_y;
 +
 + if (flip_y) {
 + buf += (width - 1) * 64;
 + buf_x_increment = -64;
 + } else {
 + buf_x_increment = 64;
 + }
 +
 + if (flip_x) {
 + buf += height - 1;
 + buf_y_increment = -1 - buf_x_increment * width;
 + } else {
 + buf_y_increment = 1 - buf_x_increment * width;
 + }
 + } else {
 + if (transform  4)
 + flip_x = !flip_x;
 +
 + if (flip_x) {
 + buf += width - 1;
 + buf_x_increment = -1;
 + } else {
 + buf_x_increment = 1;
 + }
 +
 + if (flip_y) {
 + buf += (height - 1) * 64;
 + buf_y_increment = -64 - buf_x_increment * width;
 + } else {
 + buf_y_increment = 64 - buf_x_increment * width;
 + }
 + }
 +
 + s_y_increment = stride - width * 4;
 +
 + for (sy = 0; sy  height; sy++) {
 + for (sx = 0; sx  width; sx++) {
 + memcpy(buf, s, 4);
 + s += 4;
 + buf += buf_x_increment;
 + }
 + s += s_y_increment;
 + buf += buf_y_increment;
 + }
 +}
 +
 +static void
 +transform_cursor_buffer(enum wl_output_transform transform,
 + uint32_t *buf,
 + unsigned char *s,
 + int32_t width,
 + int32_t height,
 + int stride)
 +{
 + int y;
 +
 + switch (transform) {
 + case WL_OUTPUT_TRANSFORM_NORMAL:
 + for (y = 0; y  height; y++)
 + memcpy(buf + y * 64, s + y * stride, width * 4);
 + break;
 + case WL_OUTPUT_TRANSFORM_FLIPPED_180:
 + for (y = 0; y  height; y++)
 + memcpy(buf + y * 64, s + (height - 1 - y) * stride,
 +width * 4);
 + break;
 + default:
 + transform_cursor_buffer_slow(transform,
 +  buf, s, width, height, stride);
 + break;
 + }
 +}
 +
 +static void
  drm_output_set_cursor(struct drm_output *output)
  {
  

Re: [PATCH] protocol: remove redundant 'the' in description

2014-06-18 Thread Kristian Høgsberg
On Fri, May 23, 2014 at 07:26:56AM +0200, Silvan Jegen wrote:
 Signed-off-by: Silvan Jegen s.je...@gmail.com

Thanks, applied.

Kristian

 ---
  protocol/wayland.xml | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/protocol/wayland.xml b/protocol/wayland.xml
 index 22eb6e7..113c7b7 100644
 --- a/protocol/wayland.xml
 +++ b/protocol/wayland.xml
 @@ -550,8 +550,8 @@
   The current and pending input regions of the icon wl_surface are
   cleared, and wl_surface.set_input_region is ignored until the
   wl_surface is no longer used as the icon surface. When the use
 - as an icon ends, the the current and pending input regions
 - become undefined, and the wl_surface is unmapped.
 + as an icon ends, the current and pending input regions become
 + undefined, and the wl_surface is unmapped.
/description
arg name=source type=object interface=wl_data_source 
 allow-null=true/
arg name=origin type=object interface=wl_surface/
 -- 
 1.9.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] exposay: fix crash when navigating with the keyboard

2014-06-18 Thread Kristian Høgsberg
On Sat, May 24, 2014 at 02:43:04AM +0200, Emilio Pozuelo Monfort wrote:
 From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk
 
 Commit a7592019 introduced an optimization that caused some
 exposay struct members to not be properly initialized, particularly
 cur_output, leading to crashes in some circumstances (e.g. pressing
 the down arrow key after going to exposay).
 
 Signed-off-by: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk

Thanks, I see the problem, and this fixes it.  Committed.

Kristian

 ---
  desktop-shell/exposay.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
 index 1d8b40e..104b9d9 100644
 --- a/desktop-shell/exposay.c
 +++ b/desktop-shell/exposay.c
 @@ -323,8 +323,10 @@ exposay_layout(struct desktop_shell *shell, struct 
 shell_output *shell_output)
   i++;
   }
  
 - if (highlight)
 + if (highlight) {
 + shell-exposay.focus_current = NULL;
   exposay_highlight_surface(shell, highlight);
 + }
  
   weston_compositor_schedule_repaint(shell-compositor);
  
 -- 
 2.0.0.rc2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 1/5] animation: fix move scale animation

2014-06-18 Thread Kristian Høgsberg
On Thu, May 22, 2014 at 10:41:30PM +0200, Jonny Lamb wrote:
 Both weston_move_scale_run() and weston_slide_run() were broken in
 commit 3a869019. Commit a4a6f161 fixed and explained the problem for
 weston_slide_run() but weston_move_scale_run() remained broken.
 
 To fix weston_move_scale_run(), weston_view_animation_run() is also
 required. It was removed when _run() was split into two functions
 _create() and _run() in commit f5cc2b56, but _run() was not added in
 this commit.

Thanks, that fixes exposay, applied.

Kristian

 ---
  src/animation.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/src/animation.c b/src/animation.c
 index a29b34a..392e32d 100644
 --- a/src/animation.c
 +++ b/src/animation.c
 @@ -458,8 +458,10 @@ weston_move_scale_run(struct weston_view *view, int dx, 
 int dy,
   if (animation == NULL)
   return NULL;
  
 - weston_spring_init(animation-spring, 400.0, start, end);
 + weston_spring_init(animation-spring, 400.0, 0.0, 1.0);
   animation-spring.friction = 1150;
  
 + weston_view_animation_run(animation);
 +
   return animation;
  }
 -- 
 2.0.0.rc2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 3/5] desktop-shell: use panel location to calculate correct sizes and ranges

2014-06-18 Thread Kristian Høgsberg
On Thu, May 22, 2014 at 10:41:32PM +0200, Jonny Lamb wrote:
 Now the client can let us know where the panel is using
 desktop_shell.set_panel_position, we can correctly calculate where to
 put new views and how big maximized views should be.
 ---
  desktop-shell/shell.c | 229 
 ++
  1 file changed, 173 insertions(+), 56 deletions(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index e586922..51683ee 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -251,9 +251,10 @@ shell_fade_startup(struct desktop_shell *shell);
  static struct shell_seat *
  get_shell_seat(struct weston_seat *seat);
  
 -static int
 -get_output_panel_height(struct desktop_shell *shell,
 - struct weston_output *output);
 +static void
 +get_output_panel_size(struct desktop_shell *shell,
 +   struct weston_output *output,
 +   int *width, int *height);
  
  static void
  shell_surface_update_child_surface_layers(struct shell_surface *shsurf);
 @@ -351,24 +352,54 @@ shell_grab_start(struct shell_grab *grab,
   }
  }
  
 -static int
 -get_output_panel_height(struct desktop_shell *shell,
 - struct weston_output *output)
 +static void
 +get_output_panel_size(struct desktop_shell *shell,
 +   struct weston_output *output,
 +   int *width,
 +   int *height)
  {
   struct weston_view *view;
 - int panel_height = 0;
  
 - if (!output)
 - return 0;
 + if (output) {
 + wl_list_for_each(view, shell-panel_layer.view_list, 
 layer_link) {
 + if (view-surface-output == output) {
 + float x, y;

Can we do 

  if (view-surface-output != output)
continue;

instead to avoid the 4 level indent here?

  
 - wl_list_for_each(view, shell-panel_layer.view_list, layer_link) {
 - if (view-surface-output == output) {
 - panel_height = view-surface-height;
 - break;
 + if (shell-panel_position ==
 + DESKTOP_SHELL_PANEL_POSITION_TOP ||
 + shell-panel_position ==
 + DESKTOP_SHELL_PANEL_POSITION_BOTTOM) {
 +
 + weston_view_to_global_float(view,
 + 
 view-surface-width, 0,
 + x, y);
 +
 + *width = (int) x;
 + *height = view-surface-height + (int) 
 y;
 +
 + return;
 +
 + } else if (shell-panel_position ==
 +DESKTOP_SHELL_PANEL_POSITION_LEFT ||
 +shell-panel_position ==
 +DESKTOP_SHELL_PANEL_POSITION_RIGHT) {
 +
 + weston_view_to_global_float(view,
 + 0, 
 view-surface-height,
 + x, y);
 +
 + *width = view-surface-width + (int) x;
 + *height = (int) y;
 +
 + return;

It'll be cleaner and easier to read if we do this as a case statement:

  switch (shell-panel_position) {
  case DESKTOP_SHELL_PANEL_POSITION_TOP:
  case DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
..
  }


 + }
 + }
   }
   }
  
 - return panel_height;
 + /* output is NULL or the correct view wasn't found */
 + *width = 0;
 + *height = 0;
  }
  
  static void
 @@ -389,13 +420,20 @@ send_configure_for_surface(struct shell_surface *shsurf)
   height = shsurf-output-height;
   } else if (state-maximized) {
   struct desktop_shell *shell;
 - uint32_t panel_height = 0;
 + int32_t panel_width = 0, panel_height = 0;
  
   shell = shell_surface_get_shell(shsurf);
 - panel_height = get_output_panel_height(shell, shsurf-output);
 + get_output_panel_size(shell, shsurf-output,
 +   panel_width, panel_height);
  
   width = shsurf-output-width;
   height = shsurf-output-height - panel_height;
 +
 + if (shell-panel_position == DESKTOP_SHELL_PANEL_POSITION_LEFT 
 ||
 + shell-panel_position == 
 DESKTOP_SHELL_PANEL_POSITION_RIGHT) {
 + width = shsurf-output-width - panel_width;
 + height = shsurf-output-height;
 + }
   } else {
   width = 0;
   

Re: [PATCH weston 4/5] animation: ensure repaints are always scheduled during animations

2014-06-18 Thread Kristian Høgsberg
On Thu, May 22, 2014 at 10:41:33PM +0200, Jonny Lamb wrote:
 Animations are run off the repaint cycle so if there's nothing to
 repaint, an animation will stop running. This is usually not a problem
 as each frame function of an animation causes something to change and
 therefore a repaint to happen. This patch helps detect when the
 animation isn't in said case and triggers a repaint to keep the
 animation running.
 
 This problem was found by using weston_move_scale_run() to move a view
 onscreen from completely off. The very first time the animation frame
 function was called the progress wasn't enough to move it into
 view. The compositor saw there was nothing to repaint and stopped
 doing anything else. When something else (like a pointer move) forced
 a redraw, the view's position was very much onscreen and jumped into
 view in an ugly way.

Yup, this should work.

Kristian

 ---
  src/animation.c   | 11 +++
  src/spring-tool.c |  5 +
  2 files changed, 16 insertions(+)
 
 diff --git a/src/animation.c b/src/animation.c
 index 392e32d..5ded3ad 100644
 --- a/src/animation.c
 +++ b/src/animation.c
 @@ -161,6 +161,8 @@ weston_view_animation_frame(struct weston_animation *base,
   struct weston_view_animation *animation =
   container_of(base,
struct weston_view_animation, animation);
 + struct weston_compositor *compositor =
 + animation-view-surface-compositor;
  
   if (base-frame_counter = 1)
   animation-spring.timestamp = msecs;
 @@ -178,6 +180,15 @@ weston_view_animation_frame(struct weston_animation 
 *base,
  
   weston_view_geometry_dirty(animation-view);
   weston_view_schedule_repaint(animation-view);
 +
 + /* The view's output_mask will be zero if its position is
 +  * offscreen. Animations should always run but as they are also
 +  * run off the repaint cycle, if there's nothing to repaint
 +  * the animation stops running. Therefore if we catch this situation
 +  * and schedule a repaint on all outputs it will be avoided.
 +  */
 + if (animation-view-output_mask == 0)
 + weston_compositor_schedule_repaint(compositor);
  }
  
  static struct weston_view_animation *
 diff --git a/src/spring-tool.c b/src/spring-tool.c
 index 41cc52c..685bfd9 100644
 --- a/src/spring-tool.c
 +++ b/src/spring-tool.c
 @@ -40,6 +40,11 @@ weston_view_schedule_repaint(struct weston_view *view)
  {
  }
  
 +WL_EXPORT void
 +weston_compositor_schedule_repaint(struct weston_compositor *compositor)
 +{
 +}
 +
  int
  main(int argc, char *argv[])
  {
 -- 
 2.0.0.rc2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 5/5] desktop-shell: make background applications less dark

2014-06-18 Thread Kristian Høgsberg
On Thu, May 22, 2014 at 10:41:34PM +0200, Jonny Lamb wrote:

Patch applied.

Kristian

 ---
  desktop-shell/shell.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 51683ee..a5886d7 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -911,21 +911,21 @@ animate_focus_change(struct desktop_shell *shell, 
 struct workspace *ws,
   if (focus_surface_created) {
   ws-focus_animation = weston_fade_run(
   ws-fsurf_front-view,
 - ws-fsurf_front-view-alpha, 0.6, 300,
 + ws-fsurf_front-view-alpha, 0.4, 300,
   focus_animation_done, ws);
   } else if (from) {
   wl_list_insert(from-layer_link,
  ws-fsurf_back-view-layer_link);
   ws-focus_animation = weston_stable_fade_run(
   ws-fsurf_front-view, 0.0,
 - ws-fsurf_back-view, 0.6,
 + ws-fsurf_back-view, 0.4,
   focus_animation_done, ws);
   } else if (to) {
   wl_list_insert(ws-layer.view_list,
  ws-fsurf_back-view-layer_link);
   ws-focus_animation = weston_stable_fade_run(
   ws-fsurf_front-view, 0.0,
 - ws-fsurf_back-view, 0.6,
 + ws-fsurf_back-view, 0.4,
   focus_animation_done, ws);
   }
  }
 -- 
 2.0.0.rc2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] compositor-wayland: Fix compiler warning

2014-06-18 Thread Kristian Høgsberg
On Tue, May 27, 2014 at 09:08:29AM +0200, Thierry Reding wrote:
 From: Thierry Reding tred...@nvidia.com
 
 sizeof returns size_t, for which the correct printf specifier is %zu.
 Fixes the following warning when building for ARMv7.
 
   src/compositor-wayland.c: In function 'wayland_output_get_shm_buffer':
   src/compositor-wayland.c:260:3: warning: format '%ld' expects argument 
 of type 'long int', but argument 2 has type 'unsigned int' [-Wformat=]
  weston_log(could not zalloc %ld memory for sb: %m\n, sizeof *sb);
  ^
 
 Signed-off-by: Thierry Reding tred...@nvidia.com

Thanks, patch applied.

Kristian

 ---
  src/compositor-wayland.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
 index 76e5396f4215..a4dcec272233 100644
 --- a/src/compositor-wayland.c
 +++ b/src/compositor-wayland.c
 @@ -257,7 +257,7 @@ wayland_output_get_shm_buffer(struct wayland_output 
 *output)
  
   sb = zalloc(sizeof *sb);
   if (sb == NULL) {
 - weston_log(could not zalloc %ld memory for sb: %m\n, sizeof 
 *sb);
 + weston_log(could not zalloc %zu memory for sb: %m\n, sizeof 
 *sb);
   close(fd);
   free(data);
   return NULL;
 -- 
 1.9.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] weston: Fix memleak issue in compositor.c

2014-06-18 Thread Kristian Høgsberg
On Tue, May 27, 2014 at 02:30:59PM +0530, Srivardhan Hebbar wrote:
 This fix is upon Hardening rdp.eff...@gmail.com patch. [PATCH 2/2] Handle 
 OOM with signal events.

Thanks, applied.  I edited the commit message to wrap at 72 columns.

Kristian

 
 Signed-off-by: Srivardhan Hebbar sri.heb...@samsung.com
 ---
  src/compositor.c |   23 +--
  1 file changed, 17 insertions(+), 6 deletions(-)
 
 diff --git a/src/compositor.c b/src/compositor.c
 index 574db2d..f233101 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -4207,6 +4207,11 @@ int main(int argc, char *argv[])
   signals[3] = wl_event_loop_add_signal(loop, SIGCHLD, sigchld_handler,
 NULL);
  
 + if (!signals[0] || !signals[1] || !signals[2] || !signals[3]) {
 + ret = EXIT_FAILURE;
 + goto out_signals;
 + }
 +
   if (noconfig == 0)
   config = weston_config_parse(weston.ini);
   if (config != NULL) {
 @@ -4234,13 +4239,16 @@ int main(int argc, char *argv[])
  
   backend_init = weston_load_module(backend, backend_init);
   free(backend);
 - if (!backend_init)
 - exit(EXIT_FAILURE);
 + if (!backend_init) {
 + ret = EXIT_FAILURE;
 + goto out_signals;
 + }
  
   ec = backend_init(display, argc, argv, config);
   if (ec == NULL) {
   weston_log(fatal: failed to create compositor\n);
 - exit(EXIT_FAILURE);
 + ret = EXIT_FAILURE;
 + goto out_signals;
   }
  
   catch_signals();
 @@ -4321,12 +4329,15 @@ int main(int argc, char *argv[])
  
   wl_signal_emit(ec-destroy_signal, ec);
  
 - for (i = ARRAY_LENGTH(signals); i;)
 - wl_event_source_remove(signals[--i]);
 -
   weston_compositor_xkb_destroy(ec);
  
   ec-destroy(ec);
 +
 +out_signals:
 + for (i = ARRAY_LENGTH(signals) - 1; i = 0; i--)
 + if (signals[i])
 + wl_event_source_remove(signals[i]);
 +
   wl_display_destroy(display);
  
   weston_log_file_close();
 -- 
 1.7.9.5
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston client window] Fixed the input region of the popup menu

2014-06-18 Thread Kristian Høgsberg
On Mon, Jun 02, 2014 at 01:53:38PM +0200, Tomek Obrebski wrote:
 Changed the input region of the menu popup window to exclude the shadow and 
 border regions and set to frame's internal region only.

This is a good patch but there are a few stylistic issues.  First, the
commit message is usually written in present tense, ie what the patch
*does* not what you did.  Also the body should be wrapped at around 72
columns.

 
 Regards,
 blsd
 
 ---
  clients/window.c | 9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/clients/window.c b/clients/window.c
 index b82a93e..9a6e8be 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -4615,7 +4615,8 @@ window_show_menu(struct display *display,
  {
   struct menu *menu;
   struct window *window;
 - int32_t ix, iy;
 +struct wl_region *input_region;
 +int32_t ix, iy, ih, iw;

We use 8-space tabs for indent, as you can see right here in the patch, the
indention of the lines you added don't match the indention of the lines
already there.

Other than the stylistic issues, the patch is good and fixes the problem.

Kristian

  
   menu = create_menu(display, input, time, func, entries, count, parent);
  
 @@ -4630,7 +4631,11 @@ window_show_menu(struct display *display,
   window-x = x;
   window-y = y;
  
 - frame_interior(menu-frame, ix, iy, NULL, NULL);
 +frame_interior(menu-frame, ix, iy, iw, ih);
 +input_region = wl_compositor_create_region(display-compositor);
 +wl_region_add(input_region, ix, iy, iw, ih);
 +wl_surface_set_input_region(window-main_surface-surface, input_region);
 +wl_region_destroy(input_region);
  
   window-xdg_popup = xdg_shell_get_xdg_popup(display-xdg_shell,
   
 window-main_surface-surface,
 -- 
 1.9.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] connection: remove unreached code

2014-06-18 Thread Kristian Høgsberg
On Wed, Jun 04, 2014 at 11:39:08AM +0800, Boyan Ding wrote:

Heh, oops, that was silly.  Patch committed, thanks.

Kristian

 ---
  src/connection.c | 2 --
  1 file changed, 2 deletions(-)
 
 diff --git a/src/connection.c b/src/connection.c
 index 47ee556..f292853 100644
 --- a/src/connection.c
 +++ b/src/connection.c
 @@ -379,8 +379,6 @@ wl_connection_queue(struct wl_connection *connection,
   }
  
   return wl_buffer_put(connection-out, data, count);
 -
 - return 0;
  }
  
  static int
 -- 
 1.9.3
 
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] protocol: remove redundant 'the' in description

2014-05-23 Thread Kristian Høgsberg
On Fri, May 23, 2014 at 2:31 AM, Hardening rdp.eff...@gmail.com wrote:
 Le 23/05/2014 09:14, Pekka Paalanen a écrit :

 On Fri, 23 May 2014 03:04:29 -0400
 Jasper St. Pierre jstpie...@mecheye.net wrote:

 On Fri, May 23, 2014 at 2:49 AM, Pekka Paalanen ppaala...@gmail.com
 wrote:


 [...]



 This is obviously correct.

 Can I push this, or shall we reserve the right to push to libwayland
 for Kristian only, even for obviously trivial patches?


 If you received permissions to push, I don't see why you shouldn't.
 Kristian trusts you enough to add you to the list of committers, so I
 think
 he can trust your judgement on stuff like this.


 The talk was only about Weston AFAIU. I don't know if libwayland is
 actually open for the group 'wayland' to push. Even if it was open
 by access permissions on the server, I still want to be sure that I am
 allowed (in the social sense) to push.

 Like I have access to the Mesa repo from years ago, but I'm still not
 allowed to push without proper review process which is defined by the
 Mesa project.

 The process for libwayland is still unclear to me, hence my question.



 Hello Pekka,

 quotes from the 1.5 release mail:
 Being able to review *and* commit a patch will hopefully increase the
 incentive to review and I won't need to be around all the time for
 things to move forwards.  I think everybody has enough common sense to
 decide when something is a quick fix that can be committed right away
 and when something needs wider discussion and concensus.  For anything
 that touches core weston and in particular, anything that adds
 protocol, we still want to see patches, reviews and discussion the
 list before committing.

 So I think you can go with this trivial fix.

Yeah, that's fine, thanks Pekka.

 Regards.

 PS: does someone know how to check if write access to a git repo is
 effective without doing some changes in it ?

Not that I know.  If you clone it through ssh and your freedesktop.org
user is in the wayland unix group, you can push to it.  Ping me on IRC
if you need help or want to double check the commands to push.

Kristian


 --
 David FORT
 website: http://www.hardening-consulting.com/

 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] shell: Tiling wm proof of concept

2014-05-21 Thread Kristian Høgsberg
---

Jasper and have been talking about how one could implement a tiling wm by
using the 'maximized' state in xdg-shell and I decided to give it a quick try.
This is obviously a bit crude, but it was done in a couple of hours.  It
supports two tiling layouts: all vertical split:

  http://people.freedesktop.org/~krh/layout-1.png

or rows of three windows:

  http://people.freedesktop.org/~krh/layout-2.png

which can be chosen by mod-1 and mod-2, respectively.  One of the questions
we need to figure out is whether reusing the 'maximized' state is ok or if we
need a specific 'tiled' state.

There are lots of loose ends with this code, but I don't intend to
develop this much further.  If somebody wants to pick this up and develop
it into a more complete, polished feature, that would fun.

Kristian

 clients/window.c  |  10 +--
 desktop-shell/shell.c | 196 +-
 desktop-shell/shell.h |   1 +
 shared/cairo-util.c   |   2 +-
 shared/frame.c|   2 +-
 5 files changed, 187 insertions(+), 24 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 7cb4b27..3df7394 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3814,10 +3814,12 @@ window_schedule_resize(struct window *window, int 
width, int height)
window-min_allocation.height = height;
}
 
-   if (window-pending_allocation.width  window-min_allocation.width)
-   window-pending_allocation.width = window-min_allocation.width;
-   if (window-pending_allocation.height  window-min_allocation.height)
-   window-pending_allocation.height = 
window-min_allocation.height;
+   if (!window-maximized) {
+   if (window-pending_allocation.width  
window-min_allocation.width)
+   window-pending_allocation.width = 
window-min_allocation.width;
+   if (window-pending_allocation.height  
window-min_allocation.height)
+   window-pending_allocation.height = 
window-min_allocation.height;
+   }
 
window-resize_needed = 1;
window_schedule_redraw(window);
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index dd0b2f9..52d0f61 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -153,6 +153,11 @@ struct shell_surface {
struct weston_view *black_view;
} fullscreen;
 
+   struct {
+   int x, y, width, height;
+   struct wl_list link;
+   } tile;
+
struct weston_transform workspace_transform;
 
struct weston_output *fullscreen_output;
@@ -251,6 +256,9 @@ shell_fade_startup(struct desktop_shell *shell);
 static struct shell_seat *
 get_shell_seat(struct weston_seat *seat);
 
+static struct shell_output *
+get_shell_output(struct weston_output *output);
+
 static int
 get_output_panel_height(struct desktop_shell *shell,
struct weston_output *output);
@@ -388,14 +396,8 @@ send_configure_for_surface(struct shell_surface *shsurf)
width = shsurf-output-width;
height = shsurf-output-height;
} else if (state-maximized) {
-   struct desktop_shell *shell;
-   uint32_t panel_height = 0;
-
-   shell = shell_surface_get_shell(shsurf);
-   panel_height = get_output_panel_height(shell, shsurf-output);
-
-   width = shsurf-output-width;
-   height = shsurf-output-height - panel_height;
+   width = shsurf-tile.width;
+   height = shsurf-tile.height;
} else {
width = 0;
height = 0;
@@ -405,6 +407,141 @@ send_configure_for_surface(struct shell_surface *shsurf)
 }
 
 static void
+layout_tiles0(struct shell_output *output)
+{
+   struct shell_surface *s;
+   int32_t panel_height, x, y, width, height;
+   int i, count, remainder;
+
+   count = wl_list_length(output-tile_list);
+   panel_height = get_output_panel_height(output-shell, output-output);
+   x = 0;
+   y = output-output-y + panel_height;
+   width = output-output-width / count;
+   height = output-output-height - panel_height;
+   remainder = output-output-width - count * width;
+
+   i = 0;
+   wl_list_for_each(s, output-tile_list, tile.link) {
+   s-tile.x = x;
+   s-tile.y = y;
+   s-tile.width = width + (i  remainder);
+   s-tile.height = height;
+   x += s-tile.width;
+
+   send_configure_for_surface(s);
+   }
+}
+
+static void
+layout_tiles1(struct shell_output *output)
+{
+   struct shell_surface *s;
+   int32_t panel_height, x, y, next_x, next_y, width, height, 
output_height;
+   int i, count, rows;
+   const int grid_width = 3;
+
+   count = wl_list_length(output-tile_list);
+   panel_height = get_output_panel_height(output-shell, output-output);
+   output_height = 

Wayland and Weston 1.5.0 is released

2014-05-20 Thread Kristian Høgsberg
Hi,

I tagged 1.5.0 of Wayland and Weston and uploaded tar balls last
night.  Tarballs available from
http://wayland.freedesktop.org/releases.html as usual.  Magic SHA1
number for the tags and tar balls:

  bace08b4a531ea4b80b4cf4e953320bc48ed7efe  wayland-1.5.0.tar.xz
  3ac62cd6b6012f40e37b1bd7fc1e8178585905ca  wayland 1.5.0 tag

  42939c536bcdfbd92edb5e51af76ce7f0a4c6ed7  weston-1.5.0.tar.xz
  880193622024d7dc2b36421251d97b08da324570  weston 1.5.0 tag

In retrospect, this release was pretty quiet.  We ended up not merging
a whole lot of features, but we did fix a lot of bugs and at one point
the bug count [1] hit 14, the lowest in a long time.  I think that's a
pretty good feautre in itself.

Wayland

 • Use an internal event queue for wl_display events.  This allows the
   client library to dispatch delete_id and error events immediately,
   even if the default queue is not dispatched.

 • Wayland now uses non-recursive Makefiles.

Weston:

 • More work on xdg-shell, still not complete.  We did add the long
   missing minimize feature thought.  We expect to finalize the
   xdg-shell interface in time for 1.6, which will come out in time
   for GNOME Shell 3.14 to use.

 • The weston input stack was split out as a new library, libinput.
   Weston can be configured to link to libinput for input but defaults
   to the built in input code for now.  As the libinput API
   stabilizes, we'll remove the in-weston input code and make libinput
   a hard requirement.

 • Weston now uses the new Xwayland server.  The Xwayland code was
   refactored to be its own X server in the Xorg tree, similar to how
   Xwin and Xquartz and Xnest work.  A lot of the complexity and hacks
   in the old Xorg based Xwayland was about fighting Xorg trying to be
   a native display server, discovering input devices and driving the
   outputs.  The goal was to be able to reuse the 2D acceleration code
   from the various Xorg DDX drivers.  With glamor becoming a credible
   acceleration architecture, we no longer need to jump through those
   hoops and the new code base is much simpler and cleaner as a
   result.  Xwayland is upstream now and will be released with the
   1.16 Xorg release.

 • Animate window closing.  A minor feature, but it validates the
   mechanism for keeping surfaces around after the client that created
   them goes away.

 • Fullscreen shell.  The fullscreen shell provides a mechanism for a
   single client to provide a fullscreen surface, for kiosk-mode or
   appliance type use cases.

 • Weston now supports different color dephts on different outputs.

 • Weston now uses non-recursive Makefiles.

As I mentioned in the RC2 notes, we have a few things lined up for a
1.5.1 release and we'll try to get that out in a few weeks.  As for
1.6, we'll try to do four months from now, so something like this:

 • Mid August: alpha release, all big features landed, only minor,
   contained features after this.

 • Early September: RC1, only bug fixes after this.

 • One week later: RC2, only critical fixes.

 • Mid September: Release 1.6 should be RC2 ideally.

Going forward, for master, I'd like to change the work flow a bit.
The biggest problem with how we work today is me being a bottleneck at
best or flat out dropping patches.  So I'd like to open up commit
access to some of the key contributors.  Either people that have their
corner of weston that they maintain (for example Pekka and the
Raspberry Pi backend or Hardening and the RDP backend) or contributors
who have been part of the project for a while and understands the code
base well - or both.

Being able to review *and* commit a patch will hopefully increase the
incentive to review and I won't need to be around all the time for
things to move forwards.  I think everybody has enough common sense to
decide when something is a quick fix that can be committed right away
and when something needs wider discussion and concensus.  For anything
that touches core weston and in particular, anything that adds
protocol, we still want to see patches, reviews and discussion the
list before committing.

Thanks to everybody who contributed to 1.5, let's start talking about
what we want to do for 1.6.

Kristian

[1] 
https://bugs.freedesktop.org/buglist.cgi?list_id=279166bug_severity=blockerbug_severity=criticalbug_severity=majorbug_severity=normalbug_severity=minorbug_severity=trivialquery_format=advancedbug_status=UNCONFIRMEDbug_status=NEWbug_status=ASSIGNEDbug_status=REOPENEDbug_status=NEEDINFObug_status=PLEASETESTproduct=Wayland
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] desktop-shell: Fix order of desktop_shell messages

2014-05-12 Thread Kristian Høgsberg
On Sat, May 10, 2014 at 10:43:34AM +0200, Jonas Ådahl wrote:
 There was a bug in wayland-scanner that failed to detect when an
 message with implicitly set version (i.e. version 1) came after a
 message with a newer version. This patch fixes the weston desktop shell
 protocol to pass again.
 
 Signed-off-by: Jonas Ådahl jad...@gmail.com

Got it, thanks

Kristian

 ---
  protocol/desktop-shell.xml | 25 ++---
  1 file changed, 14 insertions(+), 11 deletions(-)
 
 diff --git a/protocol/desktop-shell.xml b/protocol/desktop-shell.xml
 index 65e44a7..fdcb17b 100644
 --- a/protocol/desktop-shell.xml
 +++ b/protocol/desktop-shell.xml
 @@ -33,17 +33,6 @@
arg name=surface type=object interface=wl_surface/
  /request
  
 -request name=desktop_ready since=2
 -  description summary=desktop is ready to be shown
 - Tell the server, that enough desktop elements have been drawn
 - to make the desktop look ready for use. During start-up, the
 - server can wait for this request with a black screen before
 - starting to fade in the desktop, for instance. If the client
 - parts of a desktop take a long time to initialize, we avoid
 - showing temporary garbage.
 -  /description
 -/request
 -
  !-- We'll fold most of wl_shell into this interface and then
   they'll share the configure event.  --
  event name=configure
 @@ -91,6 +80,20 @@
  
entry name=busy value=11/
  /enum
 +
 +!-- Version 2 additions --
 +
 +request name=desktop_ready since=2
 +  description summary=desktop is ready to be shown
 + Tell the server, that enough desktop elements have been drawn
 + to make the desktop look ready for use. During start-up, the
 + server can wait for this request with a black screen before
 + starting to fade in the desktop, for instance. If the client
 + parts of a desktop take a long time to initialize, we avoid
 + showing temporary garbage.
 +  /description
 +/request
 +
/interface
  
interface name=screensaver version=1
 -- 
 1.9.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 2/2] build: let 'make clean' remove logs/ again

2014-05-12 Thread Kristian Høgsberg
On Mon, May 12, 2014 at 10:08:57AM +0300, Pekka Paalanen wrote:
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 Before in the recursive automake setting, we had tests/logs/ for
 explicitly created test log files. There is a Makefile rule to
 remove the logs directory on 'make clean'. The rule broke on moving to
 non-recursive make, since now we have logs/, not tests/logs/.
 
 Fix the rule to remove the intended directory.
 
 Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk

Thanks, both applied.

Kristian

 ---
  Makefile.am | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/Makefile.am b/Makefile.am
 index 177ce2e..343adc6 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -828,7 +828,7 @@ LA_LOG_COMPILER = $(srcdir)/tests/weston-tests-env
  WESTON_LOG_COMPILER = $(srcdir)/tests/weston-tests-env
  
  clean-local:
 - -rm -rf tests/logs
 + -rm -rf logs
  
  # To remove when automake 1.11 support is dropped
  export abs_builddir
 -- 
 1.8.5.5
 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH V2] event: assert wl_event_source pointer is NULL.

2014-05-12 Thread Kristian Høgsberg
On Mon, May 12, 2014 at 08:31:14AM +, Bryce W. Harrington wrote:
 On Mon, May 12, 2014 at 11:26:01AM +0530, Srivardhan Hebbar wrote:
  Signed-off-by: Srivardhan Hebbar sri.heb...@samsung.com
  ---
   src/event-loop.c |6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)
  
  diff --git a/src/event-loop.c b/src/event-loop.c
  index 9790cde..57e3fed 100644
  --- a/src/event-loop.c
  +++ b/src/event-loop.c
  @@ -312,7 +312,11 @@ wl_event_source_check(struct wl_event_source *source)
   WL_EXPORT int
   wl_event_source_remove(struct wl_event_source *source)
   {
  -   struct wl_event_loop *loop = source-loop;
  +   struct wl_event_loop *loop;
  +
  +   assert(!source);
 
 While I notice event-loop.c does include assert.h, there are no other
 asserts in this file; most other calls are returning NULL or -1 on error
 conditions, which I'm guessing might be better?  Especially for cleanup
 routines, it's not uncommon to return success when the provided object
 is already null or otherwise doesn't need cleanup.  Generally in library
 you want to bubble errors up for the library user to decide how to
 handle rather than exiting or asserting.
 
 Also, looking through event-loop.c there's many other routines that take
 a pointer argument to a struct and reference members without first
 checking the pointer's validity.  So I'm gathering that this code
 expects source's validity to be verified before calling into
 wl_event_source_remove()?  In which case, there's no need for a NULL
 pointer check.  (Or, conversely, all the incoming pointers in
 event-loop.c need checked.)

Yes, we expect the input to be non-NULL, will crash the caller if they
pass a NULL (or otherwise invalid) pointer.  Similar to strdup, for example.

 I'd hazard a guess that the reason the functions in event-loop.c don't
 validate their inputs is for performance reasons.

Not really, it's not a hotpath at all, it's just redundant.  Of course,
asserts are always redundant, that's the point, but we don't generally use
many asserts in the code.

Kristian

  /* We need to explicitly remove the fd, since closing the fd
   * isn't enough in case we've dup'ed the fd. */
  -- 
  1.7.9.5
  
  ___
  wayland-devel mailing list
  wayland-devel@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/wayland-devel
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] doc: Remove obsolete doxygen tags

2014-05-12 Thread Kristian Høgsberg
On Mon, May 12, 2014 at 08:40:03PM +0800, Boyan Ding wrote:
 ---
  doc/doxygen/wayland.doxygen.in | 28 
  1 file changed, 28 deletions(-)
 
 diff --git a/doc/doxygen/wayland.doxygen.in b/doc/doxygen/wayland.doxygen.in
 index dd98594..e64512f 100644
 --- a/doc/doxygen/wayland.doxygen.in
 +++ b/doc/doxygen/wayland.doxygen.in
 @@ -310,22 +310,6 @@ INLINE_SIMPLE_STRUCTS  = NO
  
  TYPEDEF_HIDES_STRUCT   = NO
  
 -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
 -# determine which symbols to keep in memory and which to flush to disk.
 -# When the cache is full, less often used symbols will be written to disk.
 -# For small to medium size projects (1000 input files) the default value is
 -# probably good enough. For larger projects a too small cache size can cause
 -# doxygen to be busy swapping symbols to and from disk most of the time
 -# causing a significant performance penalty.
 -# If the system has enough physical memory increasing the cache will improve 
 the
 -# performance by keeping more symbols in memory. Note that the value works on
 -# a logarithmic scale so increasing the size by one will roughly double the
 -# memory usage. The cache size is given by this formula:
 -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
 -# corresponding to a cache size of 2^16 = 65536 symbols.
 -
 -SYMBOL_CACHE_SIZE  = 0

Jonas already removed the SYMBOL_CACHE_SIZE symbol, but the rest of you
patch applied just fine.

Kristian

 -
  # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
  # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
  # their name and scope. Since this can be an expensive process and often the
 @@ -1371,18 +1355,6 @@ GENERATE_XML   = NO
  
  XML_OUTPUT = xml
  
 -# The XML_SCHEMA tag can be used to specify an XML schema,
 -# which can be used by a validating XML parser to check the
 -# syntax of the XML files.
 -
 -XML_SCHEMA =
 -
 -# The XML_DTD tag can be used to specify an XML DTD,
 -# which can be used by a validating XML parser to check the
 -# syntax of the XML files.
 -
 -XML_DTD=
 -
  # If the XML_PROGRAMLISTING tag is set to YES Doxygen will
  # dump the program listings (including syntax highlighting
  # and cross-referencing information) to the XML output. Note that
 -- 
 1.9.2
 
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] Do not distribute generated headers

2014-05-12 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 02:09:35PM +0200, Thierry Reding wrote:
 From: Thierry Reding tred...@nvidia.com
 
 The wayland-server-protocol.h and wayland-client-protocol.h headers are
 currently being shipped in tarballs created using make dist. This causes
 out-of-tree builds to fail since make will detect that the headers exist
 by looking at the source directory (via VPATH) and not regenerate them.
 But as opposed to ${top_builddir}/protocol, ${top_srcdir}/protocol is
 not part of the include path and therefore the shipped files can't be
 found during compilation.
 
 Two solutions exist to this problem: 1) add ${top_srcdir}/protocol to
 the include path to allow shipped files to be used if available or 2)
 don't ship these generated files in release tarballs. The latter seems
 the most appropriate. wayland-scanner is already a prerequisite in order
 to generate wayland-protocol.c, so it is either built as part of the
 package or provided externally. Generating all files from the protocol
 definition at build time also ensures that they don't get out of sync.
 
 Both of the generated headers are already listed in Makefile.am as
 nodist_*_SOURCES, but at the same time they appear in include_HEADERS,
 which will cause them to be added to the list of distributable files
 after all. To prevent that, split them off into nodist_include_HEADERS.

Yes, that how that was supposed to work, and we did this for weston,
but we need it for wayland too.  Thanks, patch applied.
 
 Note that this problem will be hidden if a previous version of wayland
 has been installed, since these files will exist in /usr/include and be
 included from there. So this build error will only show for out-of-tree
 builds on systems that don't have wayland installed yet.

We could move the headers into a pkg include dir, eg

  /usr/include/wayland/wayland-server.h

etc, which takes them out of the default include path.  The only supported
way to locate the package file is pkg-config anyway, so nothing should
break.  Something for the next release.

Kristian

 Signed-off-by: Thierry Reding tred...@nvidia.com
 ---
  Makefile.am | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/Makefile.am b/Makefile.am
 index f1584d5bfc12..0ec6f47ab2c7 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -20,13 +20,15 @@ noinst_LTLIBRARIES = libwayland-util.la
  
  include_HEADERS =\
   src/wayland-util.h  \
 - protocol/wayland-server-protocol.h  \
   src/wayland-server.h\
 - protocol/wayland-client-protocol.h  \
   src/wayland-client.h\
   src/wayland-egl.h   \
   src/wayland-version.h
  
 +nodist_include_HEADERS = \
 + protocol/wayland-server-protocol.h  \
 + protocol/wayland-client-protocol.h
 +
  libwayland_util_la_SOURCES = \
   src/connection.c\
   src/wayland-util.c  \
 -- 
 1.9.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] window: Ignore input events from subsurfaces

2014-05-12 Thread Kristian Høgsberg
On Tue, May 06, 2014 at 03:25:40PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 Toytoolkit was not designed to handle input from subsurfaces and
 instead it expects subsurfaces to have an empty input region. That way
 input events for subsurfaces are generated on the main surface and
 there is no need to convert coordinates before reporting the event to
 the user.
 
 However it is possible that a subsurface has a non-empty input region,
 but in that case those events aren't properly processed. The function
 window_find_widget() assumes the coordinates are in the main surface
 coordinate space, and ends up chosing the wrong widget.
 
 This patch changes the input code to completely ignore input events from
 subsurfaces. This option was chosen instead of ensuring that the input
 region on those surfaces is always empty since there's no enforcement
 that a subsurface should completely overlap with the main surface. If
 an event happens in the area of the surface that doesn't overlap, the
 event could cause a completely unrelated surface to be picked.

Let's go with this for now.

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=78207
 ---
  clients/window.c | 21 -
  1 file changed, 16 insertions(+), 5 deletions(-)
 
 diff --git a/clients/window.c b/clients/window.c
 index b7febed..3b57264 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -2605,10 +2605,15 @@ pointer_handle_enter(void *data, struct wl_pointer 
 *pointer,
   return;
   }
  
 + window = wl_surface_get_user_data(surface);
 + if (surface != window-main_surface-surface) {
 + DBG(Ignoring input event from subsurface %p\n, surface);
 + return;
 + }
 +
   input-display-serial = serial;
   input-pointer_enter_serial = serial;
 - input-pointer_focus = wl_surface_get_user_data(surface);
 - window = input-pointer_focus;
 + input-pointer_focus = window;
  
   if (window-resizing) {
   window-resizing = 0;
 @@ -2644,12 +2649,12 @@ pointer_handle_motion(void *data, struct wl_pointer 
 *pointer,
   float sx = wl_fixed_to_double(sx_w);
   float sy = wl_fixed_to_double(sy_w);
  
 - input-sx = sx;
 - input-sy = sy;
 -
   if (!window)
   return;
  
 + input-sx = sx;
 + input-sy = sy;
 +
   /* when making the window smaller - e.g. after a unmaximise we might
* still have a pending motion event that the compositor has picked
* based on the old surface dimensions
 @@ -2979,6 +2984,12 @@ touch_handle_down(void *data, struct wl_touch 
 *wl_touch,
   return;
   }
  
 + if (surface != input-touch_focus-main_surface-surface) {
 + DBG(Ignoring input event from subsurface %p\n, surface);
 + input-touch_focus = NULL;
 + return;
 + }
 +
   if (input-grab)
   widget = input-grab;
   else
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Second and final release candidate for 1.5 (1.4.93)

2014-05-12 Thread Kristian Høgsberg
Hi,

Here's the second release candidate for Wayland and Weston 1.5:

  ee6d6367ef6c3f6b46e39ce6b4568f316e2d1667  wayland-1.4.93.tar.xz
  8511544e6be4385a87d2111c87f7f397c63c43ff  wayland 1.4.93 tag

  9d81584d203cc10ad7d9c49b18ffe2642ee5d7d4  weston-1.4.93.tar.xz
  7098948463836104c28f6adc0b41cd08462873a7  weston 1.4.93 tag

One small wrinkle with this release is that the tag for wayland 1.4.93
isn't the commit that bumps the configure.ac version, it's the commit
just after that which downgrades the wayland-scanner error to a warning.

We have around 30 commits since 1.4.92 most of which are bug fixes, some
documentation and test suite tweaks.  In wayland we have a few static
analysis fixes and a build fix, but not a whole lot there.

If all goes well, we'll ship this as 1.5 in a few days.  I expect we'll do a
1.5.1 release a few weeks later (beginning of June), mostly to pull in
Tanibatas ivi-shell, Andrews west.ini key for screen-share and Giullio's
clipping feature.

With this, I've also branched off a 1.5 branch and we can start merging
work for master again.

Kristian


___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] clients: Initialize label in keyboard handling code

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 01:11:07AM +, Bryce W. Harrington wrote:
 Quells warning:
   clients/keyboard.c: In function ‘keyboard_handle_key.isra.5’:
   clients/keyboard.c:556:11: warning: ‘label’ may be used uninitialized in
   this function [-Wuninitialized]
 
 Signed-off-by: Bryce Harrington b.harring...@samsung.com

Thanks Bryce, patch applied.

Kristian

 ---
  clients/keyboard.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/clients/keyboard.c b/clients/keyboard.c
 index cd1ad58..7c11cec 100644
 --- a/clients/keyboard.c
 +++ b/clients/keyboard.c
 @@ -530,7 +530,7 @@ append(char *s1, const char *s2)
  static void
  keyboard_handle_key(struct keyboard *keyboard, uint32_t time, const struct 
 key *key, struct input *input, enum wl_pointer_button_state state)
  {
 - const char *label;
 + const char *label = NULL;
  
   switch(keyboard-state) {
   case KEYBOARD_STATE_DEFAULT :
 -- 
 1.7.9.5
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 3/5] clients: Use calloc instead of malloc/memset=0

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 02:13:11AM +, Bryce W. Harrington wrote:
 
 Signed-off-by: Bryce Harrington b.harring...@samsung.com
 ---
  clients/editor.c  |4 +---
  clients/subsurfaces.c |8 ++--
  clients/window.c  |   13 ++---
  3 files changed, 5 insertions(+), 20 deletions(-)
 
 diff --git a/clients/editor.c b/clients/editor.c
 index 6ed76d4..b439d9e 100644
 --- a/clients/editor.c
 +++ b/clients/editor.c
 @@ -559,9 +559,7 @@ text_entry_create(struct editor *editor, const char *text)
  {
   struct text_entry *entry;
  
 - entry = xmalloc(sizeof *entry);
 - memset(entry, 0, sizeof *entry);
 -
 + entry = xcalloc(1, sizeof *entry);

We have zalloc for when we just want malloc+memset.

Kristian

   entry-widget = widget_add_widget(editor-widget, entry);
   entry-window = editor-window;
   entry-text = strdup(text);
 diff --git a/clients/subsurfaces.c b/clients/subsurfaces.c
 index 15af9aa..a683787 100644
 --- a/clients/subsurfaces.c
 +++ b/clients/subsurfaces.c
 @@ -492,9 +492,7 @@ triangle_create(struct window *window, struct egl_state 
 *egl)
  {
   struct triangle *tri;
  
 - tri = xmalloc(sizeof *tri);
 - memset(tri, 0, sizeof *tri);
 -
 + tri = xcalloc(1, sizeof *tri);
   tri-egl = egl;
   tri-widget = window_add_subsurface(window, tri,
   int_to_mode(option_triangle_mode));
 @@ -714,9 +712,7 @@ demoapp_create(struct display *display)
  {
   struct demoapp *app;
  
 - app = xmalloc(sizeof *app);
 - memset(app, 0, sizeof *app);
 -
 + app = xcalloc(1, sizeof *app);
   app-egl = egl_state_create(display_get_display(display));
  
   app-display = display;
 diff --git a/clients/window.c b/clients/window.c
 index cfc1260..2212351 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -1139,12 +1139,7 @@ shm_surface_create(struct display *display, struct 
 wl_surface *wl_surface,
   struct shm_surface *surface;
   DBG_OBJ(wl_surface, \n);
  
 - surface = xmalloc(sizeof *surface);
 - memset(surface, 0, sizeof *surface);
 -
 - if (!surface)
 - return NULL;
 -
 + surface = xcalloc(1, sizeof *surface);
   surface-base.prepare = shm_surface_prepare;
   surface-base.swap = shm_surface_swap;
   surface-base.acquire = shm_surface_acquire;
 @@ -4336,11 +4331,7 @@ surface_create(struct window *window)
   struct display *display = window-display;
   struct surface *surface;
  
 - surface = xmalloc(sizeof *surface);
 - memset(surface, 0, sizeof *surface);
 - if (!surface)
 - return NULL;
 -
 + surface = xcalloc(1, sizeof *surface);
   surface-window = window;
   surface-surface = wl_compositor_create_surface(display-compositor);
   surface-buffer_scale = 1;
 -- 
 1.7.9.5
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 4/5] clients: Use xzalloc instead of xcalloc when allocating single element

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 02:13:11AM +, Bryce W. Harrington wrote:
 
 Signed-off-by: Bryce Harrington b.harring...@samsung.com
 ---
  clients/desktop-shell.c |2 +-
  clients/editor.c|2 +-
  clients/fullscreen.c|2 +-
  clients/subsurfaces.c   |6 +++---
  clients/window.c|4 ++--
  clients/wscreensaver.c  |2 +-
  6 files changed, 9 insertions(+), 9 deletions(-)

Oh, didn't see this one when I replied to the earlier xcalloc patch.
I don't think we have a single place where we actually need xcalloc, so
I'd rather not add it at all.

Kristian

 diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
 index a3b2534..0b8d08b 100644
 --- a/clients/desktop-shell.c
 +++ b/clients/desktop-shell.c
 @@ -1217,7 +1217,7 @@ create_output(struct desktop *desktop, uint32_t id)
  {
   struct output *output;
  
 - output = xcalloc(1, sizeof *output);
 + output = xzalloc(sizeof *output);
   output-output =
   display_bind(desktop-display, id, wl_output_interface, 2);
   output-server_output_id = id;
 diff --git a/clients/editor.c b/clients/editor.c
 index b439d9e..bda3e91 100644
 --- a/clients/editor.c
 +++ b/clients/editor.c
 @@ -559,7 +559,7 @@ text_entry_create(struct editor *editor, const char *text)
  {
   struct text_entry *entry;
  
 - entry = xcalloc(1, sizeof *entry);
 + entry = xzalloc(sizeof *entry);
   entry-widget = widget_add_widget(editor-widget, entry);
   entry-window = editor-window;
   entry-text = strdup(text);
 diff --git a/clients/fullscreen.c b/clients/fullscreen.c
 index ad7c703..8f41455 100644
 --- a/clients/fullscreen.c
 +++ b/clients/fullscreen.c
 @@ -480,7 +480,7 @@ output_handler(struct output *output, void *data)
   if (fsout-output == output)
   return;
  
 - fsout = xcalloc(1, sizeof *fsout);
 + fsout = xzalloc(sizeof *fsout);
   fsout-output = output;
   wl_list_insert(fullscreen-output_list, fsout-link);
  }
 diff --git a/clients/subsurfaces.c b/clients/subsurfaces.c
 index a683787..1ed698b 100644
 --- a/clients/subsurfaces.c
 +++ b/clients/subsurfaces.c
 @@ -212,7 +212,7 @@ egl_state_create(struct wl_display *display)
   EGLint major, minor, n;
   EGLBoolean ret;
  
 - egl = xcalloc(1, sizeof *egl);
 + egl = xzalloc(sizeof *egl);
   egl-dpy = eglGetDisplay(display);
   assert(egl-dpy);
  
 @@ -492,7 +492,7 @@ triangle_create(struct window *window, struct egl_state 
 *egl)
  {
   struct triangle *tri;
  
 - tri = xcalloc(1, sizeof *tri);
 + tri = xzalloc(sizeof *tri);
   tri-egl = egl;
   tri-widget = window_add_subsurface(window, tri,
   int_to_mode(option_triangle_mode));
 @@ -712,7 +712,7 @@ demoapp_create(struct display *display)
  {
   struct demoapp *app;
  
 - app = xcalloc(1, sizeof *app);
 + app = xzalloc(sizeof *app);
   app-egl = egl_state_create(display_get_display(display));
  
   app-display = display;
 diff --git a/clients/window.c b/clients/window.c
 index 2212351..a103530 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -1139,7 +1139,7 @@ shm_surface_create(struct display *display, struct 
 wl_surface *wl_surface,
   struct shm_surface *surface;
   DBG_OBJ(wl_surface, \n);
  
 - surface = xcalloc(1, sizeof *surface);
 + surface = xzalloc(sizeof *surface);
   surface-base.prepare = shm_surface_prepare;
   surface-base.swap = shm_surface_swap;
   surface-base.acquire = shm_surface_acquire;
 @@ -4331,7 +4331,7 @@ surface_create(struct window *window)
   struct display *display = window-display;
   struct surface *surface;
  
 - surface = xcalloc(1, sizeof *surface);
 + surface = xzalloc(sizeof *surface);
   surface-window = window;
   surface-surface = wl_compositor_create_surface(display-compositor);
   surface-buffer_scale = 1;
 diff --git a/clients/wscreensaver.c b/clients/wscreensaver.c
 index 1070c07..d87d040 100644
 --- a/clients/wscreensaver.c
 +++ b/clients/wscreensaver.c
 @@ -175,7 +175,7 @@ create_wscreensaver_instance(struct wscreensaver 
 *screensaver,
   struct ModeInfo *mi;
   struct rectangle drawarea;
  
 - mi = xcalloc(1, sizeof *mi);
 + mi = xzalloc(sizeof *mi);
  
   if (demo_mode)
   mi-window = window_create(screensaver-display);
 -- 
 1.7.9.5
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 5/5] clients: Use xstrdup instead of strdup

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 02:13:11AM +, Bryce W. Harrington wrote:
 
 Signed-off-by: Bryce Harrington b.harring...@samsung.com
 ---
  clients/editor.c   |   12 ++--
  clients/image.c|4 ++--
  clients/keyboard.c |   12 ++--
  clients/terminal.c |2 +-
  4 files changed, 15 insertions(+), 15 deletions(-)
 

This one looks good, but doesn't apply without the rest of the series.

Kristian

 diff --git a/clients/editor.c b/clients/editor.c
 index bda3e91..ece8b1d 100644
 --- a/clients/editor.c
 +++ b/clients/editor.c
 @@ -258,7 +258,7 @@ text_input_preedit_string(void *data,
   }
  
   text_entry_set_preedit(entry, text, entry-preedit_info.cursor);
 - entry-preedit.commit = strdup(commit);
 + entry-preedit.commit = xstrdup(commit);
   entry-preedit.attr_list = 
 pango_attr_list_ref(entry-preedit_info.attr_list);
  
   clear_pending_preedit(entry);
 @@ -562,7 +562,7 @@ text_entry_create(struct editor *editor, const char *text)
   entry = xzalloc(sizeof *entry);
   entry-widget = widget_add_widget(editor-widget, entry);
   entry-window = editor-window;
 - entry-text = strdup(text);
 + entry-text = xstrdup(text);
   entry-active = 0;
   entry-cursor = strlen(text);
   entry-anchor = entry-cursor;
 @@ -686,7 +686,7 @@ text_entry_update_layout(struct text_entry *entry)
   strcpy(text + entry-cursor + strlen(entry-preedit.text),
  entry-text + entry-cursor);
   } else {
 - text = strdup(entry-text);
 + text = xstrdup(entry-text);
   }
  
   if (entry-cursor != entry-anchor) {
 @@ -809,7 +809,7 @@ text_entry_commit_and_reset(struct text_entry *entry)
   char *commit = NULL;
  
   if (entry-preedit.commit)
 - commit = strdup(entry-preedit.commit);
 + commit = xstrdup(entry-preedit.commit);
  
   text_entry_reset_preedit(entry);
   if (commit) {
 @@ -832,7 +832,7 @@ text_entry_set_preedit(struct text_entry *entry,
   if (!preedit_text)
   return;
  
 - entry-preedit.text = strdup(preedit_text);
 + entry-preedit.text = xstrdup(preedit_text);
   entry-preedit.cursor = preedit_cursor;
  
   text_entry_update_layout(entry);
 @@ -1345,7 +1345,7 @@ main(int argc, char *argv[])
   editor.entry = text_entry_create(editor, Entry);
   editor.entry-click_to_show = click_to_show;
   if (preferred_language)
 - editor.entry-preferred_language = strdup(preferred_language);
 + editor.entry-preferred_language = xstrdup(preferred_language);
   editor.editor = text_entry_create(editor, Numeric);
   editor.editor-content_purpose = WL_TEXT_INPUT_CONTENT_PURPOSE_NUMBER;
   editor.editor-click_to_show = click_to_show;
 diff --git a/clients/image.c b/clients/image.c
 index cba68c5..b4a7bb8 100644
 --- a/clients/image.c
 +++ b/clients/image.c
 @@ -362,12 +362,12 @@ image_create(struct display *display, const char 
 *filename,
  
   image = xzalloc(sizeof *image);
  
 - copy = strdup(filename);
 + copy = xstrdup(filename);
   b = basename(copy);
   snprintf(title, sizeof title, Wayland Image - %s, b);
   free(copy);
  
 - image-filename = strdup(filename);
 + image-filename = xstrdup(filename);
   image-image = load_cairo_surface(filename);
  
   if (!image-image) {
 diff --git a/clients/keyboard.c b/clients/keyboard.c
 index cd1ad58..6b1e7a0 100644
 --- a/clients/keyboard.c
 +++ b/clients/keyboard.c
 @@ -440,12 +440,12 @@ virtual_keyboard_commit_preedit(struct virtual_keyboard 
 *keyboard)
   keyboard-surrounding_text = surrounding_text;
   keyboard-surrounding_cursor += 
 strlen(keyboard-preedit_string);
   } else {
 - keyboard-surrounding_text = strdup(keyboard-preedit_string);
 + keyboard-surrounding_text = xstrdup(keyboard-preedit_string);
   keyboard-surrounding_cursor = strlen(keyboard-preedit_string);
   }
  
   free(keyboard-preedit_string);
 - keyboard-preedit_string = strdup();
 + keyboard-preedit_string = xstrdup();
  }
  
  static void
 @@ -757,7 +757,7 @@ handle_surrounding_text(void *data,
   struct virtual_keyboard *keyboard = data;
  
   free(keyboard-surrounding_text);
 - keyboard-surrounding_text = strdup(text);
 + keyboard-surrounding_text = xstrdup(text);
  
   keyboard-surrounding_cursor = cursor;
  }
 @@ -772,7 +772,7 @@ handle_reset(void *data,
  
   if (strlen(keyboard-preedit_string)) {
   free(keyboard-preedit_string);
 - keyboard-preedit_string = strdup();
 + keyboard-preedit_string = xstrdup();
   }
  }
  
 @@ -840,7 +840,7 @@ handle_preferred_language(void *data,
   keyboard-preferred_language = NULL;
  
   if (language)
 - keyboard-preferred_language = strdup(language);
 + keyboard-preferred_language = xstrdup(language);
  }
  
  

Re: [PATCH v2] doc: Added API documentation for wl_display_create function.

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 09:37:45AM +0530, Srivardhan Hebbar wrote:
 Signed-off-by: Srivardhan Hebbar sri.heb...@samsung.com
 ---
  src/wayland-server.c |9 +
  1 file changed, 9 insertions(+)
 
 diff --git a/src/wayland-server.c b/src/wayland-server.c
 index f2b1b42..57b65ce 100644
 --- a/src/wayland-server.c
 +++ b/src/wayland-server.c
 @@ -788,6 +788,15 @@ bind_display(struct wl_client *client,
  destroy_client_display_resource);
  }
  
 +/** Create Wayland display object.
 + *
 + * \param None
 + * \return The Wayland display object. Null if failed to create
 + *
 + * This creates the wl_display object.
 + *
 + * \memberof wl_display
 + */

That's better thanks.  Patch applied.

Kristian

  WL_EXPORT struct wl_display *
  wl_display_create(void)
  {
 -- 
 1.7.9.5
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] window.c: Set the input region of the tooltip to empty

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 11:47:08AM +0300, Pekka Paalanen wrote:
 On Tue, 6 May 2014 14:40:53 -0700
 Kristian Høgsberg hoegsb...@gmail.com wrote:
 
  On Mon, May 05, 2014 at 05:02:15PM +0300, Ander Conselvan de Oliveira
  wrote:
   From: Ander Conselvan de Oliveira
   ander.conselvan.de.olive...@intel.com
   
   Otherwise it might receive touch events.
  
  I think a better approach is to just hide the tooltip if it (or the
  panel) gets touch events.  I don't think I agree with Pekka that we
  can't use subsurfaces for this, but I guess I'm not sure what the
  problem he sees there is.
 
 The panel is not a window, so sub-surfaces can be made to work there
 well enough.
 
 It is for normal windows like registered with xdg_shell where
 sub-surfaces are not suitable for tooltips. A sub-surface is a part of
 the window, not another window. A tooltip is not expected to change the
 window geometry, but a sub-surface does count into the window geometry.
 Extruding sub-surfaces therefore affect the (parent) window geometry. It
 is in the protocol spec.

No, sure if no other geometry information is available.  For xdg-shell
windows, the window geometry overrides that though.  And I don't think
there's a clear distinction between being part of the window or being
a separate window here, and I don't see why it would useful...

Kristian

 
 
 Thanks,
 pq
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 3/3] shell: Fix crash when restoring focus state during workspace change

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 11:57:28AM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 The check to avoid calling weston_keyboard_set_focus() for a seat that
 didn't have a keyboard in restore_focus_state() was cheking the wrong
 seat (the one from the previous loop). That caused a crash when
 switching workspaces if there was an extra seat that didn't have a
 keyboard.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=78349

Thanks Ander, all three committed.

Kristian

 ---
  desktop-shell/shell.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index fac3120..ea7b3cd 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -731,7 +731,7 @@ restore_focus_state(struct desktop_shell *shell, struct 
 workspace *ws)
   wl_list_for_each_safe(seat, next_seat, pending_seat_list, link) {
   wl_list_insert(shell-compositor-seat_list, seat-link);
  
 - if (state-seat-keyboard == NULL)
 + if (seat-keyboard == NULL)
   continue;
  
   weston_keyboard_set_focus(seat-keyboard, NULL);
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] shell: Don't allow maximized surfaces to be moved with touch

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 02:22:23PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 Moving a maximized surface with the pointer is already not possible,
 so make the behavior with touch consistent.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=78208

Thanks, committed.

Kristian

 ---
  desktop-shell/shell.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index ea7b3cd..db55ea9 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -1453,7 +1453,7 @@ surface_touch_move(struct shell_surface *shsurf, struct 
 weston_seat *seat)
   if (!shsurf)
   return -1;
  
 - if (shsurf-state.fullscreen)
 + if (shsurf-state.fullscreen || shsurf-state.maximized)
   return 0;
  
   move = malloc(sizeof *move);
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] desktop-shell: Fix black edges on scaled desktop pattern

2014-05-09 Thread Kristian Høgsberg
On Thu, May 08, 2014 at 08:00:35PM -0700, Bill Spitzak wrote:
 Filter sampling outside the source image can leak black into the edges of
 the
 desktop image. This is most easily seen by scaling the default tiled image
 with this weston.ini:
 
   # no background-image and no background-color
   background-type=scale-crop

Thanks, that's a nice detail to get right.  Patch applied.

Kristian

 ---
  clients/desktop-shell.c |2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
 index 4880888..e121cc7 100644
 --- a/clients/desktop-shell.c
 +++ b/clients/desktop-shell.c
 @@ -724,6 +724,7 @@ background_draw(struct widget *widget, void *data)
   case BACKGROUND_SCALE:
   cairo_matrix_init_scale(matrix, sx, sy);
   cairo_pattern_set_matrix(pattern, matrix);
 + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD);
   break;
   case BACKGROUND_SCALE_CROP:
   s = (sx  sy) ? sx : sy;
 @@ -733,6 +734,7 @@ background_draw(struct widget *widget, void *data)
   cairo_matrix_init_translate(matrix, tx, ty);
   cairo_matrix_scale(matrix, s, s);
   cairo_pattern_set_matrix(pattern, matrix);
 + cairo_pattern_set_extend(pattern, CAIRO_EXTEND_PAD);
   break;
   case BACKGROUND_TILE:
   cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
 -- 
 1.7.9.5
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] event: Cheking for NULL before dereferencing the pointer.

2014-05-09 Thread Kristian Høgsberg
On Fri, May 09, 2014 at 02:56:14PM +0530, Srivardhan wrote:
 
 
  -Original Message-
  From: wayland-devel [mailto:wayland-devel-
  boun...@lists.freedesktop.org] On Behalf Of Hardening
  Sent: Friday, May 09, 2014 1:08 PM
  To: wayland-devel@lists.freedesktop.org
  Subject: Re: [PATCH] event: Cheking for NULL before dereferencing the
  pointer.
  
  Le 09/05/2014 08:43, Srivardhan Hebbar a écrit :
   Checking for NULL before dereferencing the wl_event_source pointer so
   as to avoid crash.
  
   Signed-off-by: Srivardhan Hebbar sri.heb...@samsung.com
   ---
 src/event-loop.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)
  
   diff --git a/src/event-loop.c b/src/event-loop.c index
   9790cde..b62d16e 100644
   --- a/src/event-loop.c
   +++ b/src/event-loop.c
   @@ -312,7 +312,12 @@ wl_event_source_check(struct wl_event_source
  *source)
 WL_EXPORT int
 wl_event_source_remove(struct wl_event_source *source)
 {
   - struct wl_event_loop *loop = source-loop;
   + struct wl_event_loop *loop;
   +
   + if (source == NULL)
   + return 0;
   +
   + loop = source-loop;
  
 /* We need to explicitly remove the fd, since closing the fd
  * isn't enough in case we've dup'ed the fd. */
  
  
  Hello Srivardhan,
  
  do you have a case where this check is hit ? I may be wrong but having no
  loop associated with a source event is not supposed to happen. So my guess
  is that a caller of wl_event_source_remove has forgotten to nullify the
 event
  source after the call.
 
 Hi,
 
 I was going through the code of Weston. In the main function in compositor.c
 wl_event_loop_add_signal() is called to allocate the memory for
 signals[](Line no: 4196. struct wl_event_source *signals[4]). The function
 returns NULL if memory allocation failed. After that there is no NULL check
 for 'signals'. In the end while clearing up, this function is called. So if
 memory allocation failed then a NULL is passed to this function. Hence
 adding code to check for the NULL.

You caught a problem here, but the issue is that we don't check for NULL
where we allocate the source.  Passing a NULL pointer to
wl_event_source_remove() is a programmer error and we don't want to
silently fail.

Kristian


 Thank-you,
 Hebbar
  
  Regards.
  
  --
  David FORT
  website: http://www.hardening-consulting.com/
  ___
  wayland-devel mailing list
  wayland-devel@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/wayland-devel
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] rpi: build fix for compute_rects debug

2014-05-09 Thread Kristian Høgsberg
On Fri, May 09, 2014 at 03:08:06PM +0300, Pekka Paalanen wrote:
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 See 918f2dd4cfb8b177f67b45653efbbe4325cbe9dc

Thanks Pekka, applied.

Kristian

 Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
 ---
  src/rpi-renderer.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/rpi-renderer.c b/src/rpi-renderer.c
 index 3a7f65c..c222eb6 100644
 --- a/src/rpi-renderer.c
 +++ b/src/rpi-renderer.c
 @@ -858,8 +858,8 @@ rpir_view_compute_rects(struct rpir_view *view,
   src_height = int_max(src_height, 0);
  
   DBG(rpir_view %p %dx%d: p1 %f, %f; p2 %f, %f\n, view,
 - view-view-geometry.width,
 - view-view-geometry.height,
 + view-view-surface-width,
 + view-view-surface-height,
   p1.f[0], p1.f[1], p2.f[0], p2.f[1]);
   DBG(src rect %d;%d, %d;%d, %d;%dx%d;%d\n,
   src_x  16, src_x  0x,
 -- 
 1.8.5.5
 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] vaapi-recorder: Don't loop trying to write on out of space condition

2014-05-09 Thread Kristian Høgsberg
On Fri, May 09, 2014 at 03:57:38PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 The error handling for the function that writes the encoded frame on
 the disk was bogus, always assuming the buffer supplied to the encoder
 was too small. That would cause a bigger buffer to be allocated and
 another attempt to encode the frame was done. In the case of a failure
 to write to disk (due to ENOSPC, for instance) that would cause an
 endless loop.

Thanks committed.  I added the bugzilla link to the commit message for
reference.

Kristian

 ---
 Possibly related to
 https://bugs.freedesktop.org/show_bug.cgi?id=69330
 ---
  src/compositor-drm.c | 27 +++
  src/vaapi-recorder.c | 42 +-
  src/vaapi-recorder.h |  2 +-
  3 files changed, 53 insertions(+), 18 deletions(-)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 5f59789..7d514e4 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -2558,6 +2558,18 @@ planes_binding(struct weston_seat *seat, uint32_t 
 time, uint32_t key, void *data
  
  #ifdef BUILD_VAAPI_RECORDER
  static void
 +recorder_destroy(struct drm_output *output)
 +{
 + vaapi_recorder_destroy(output-recorder);
 + output-recorder = NULL;
 +
 + output-base.disable_planes--;
 +
 + wl_list_remove(output-recorder_frame_listener.link);
 + weston_log([libva recorder] done\n);
 +}
 +
 +static void
  recorder_frame_notify(struct wl_listener *listener, void *data)
  {
   struct drm_output *output;
 @@ -2579,7 +2591,12 @@ recorder_frame_notify(struct wl_listener *listener, 
 void *data)
   return;
   }
  
 - vaapi_recorder_frame(output-recorder, fd, output-current-stride);
 + ret = vaapi_recorder_frame(output-recorder, fd,
 +output-current-stride);
 + if (ret  0) {
 + weston_log([libva recorder] aborted: %m\n);
 + recorder_destroy(output);
 + }
  }
  
  static void *
 @@ -2637,13 +2654,7 @@ recorder_binding(struct weston_seat *seat, uint32_t 
 time, uint32_t key,
  
   weston_log([libva recorder] initialized\n);
   } else {
 - vaapi_recorder_destroy(output-recorder);
 - output-recorder = NULL;
 -
 - output-base.disable_planes--;
 -
 - wl_list_remove(output-recorder_frame_listener.link);
 - weston_log([libva recorder] done\n);
 + recorder_destroy(output);
   }
  }
  #else
 diff --git a/src/vaapi-recorder.c b/src/vaapi-recorder.c
 index 0095a42..921494d 100644
 --- a/src/vaapi-recorder.c
 +++ b/src/vaapi-recorder.c
 @@ -50,6 +50,7 @@
  #include string.h
  #include unistd.h
  #include assert.h
 +#include errno.h
  
  #include sys/types.h
  #include sys/stat.h
 @@ -93,6 +94,7 @@ struct vaapi_recorder {
   int width, height;
   int frame_count;
  
 + int error;
   int destroying;
   pthread_t worker_thread;
   pthread_mutex_t mutex;
 @@ -761,7 +763,13 @@ encoder_create_output_buffer(struct vaapi_recorder *r)
   return VA_INVALID_ID;
  }
  
 -static int
 +enum output_write_status {
 + OUTPUT_WRITE_SUCCESS,
 + OUTPUT_WRITE_OVERFLOW,
 + OUTPUT_WRITE_FATAL
 +};
 +
 +static enum output_write_status
  encoder_write_output(struct vaapi_recorder *r, VABufferID output_buf)
  {
   VACodedBufferSegment *segment;
 @@ -770,19 +778,22 @@ encoder_write_output(struct vaapi_recorder *r, 
 VABufferID output_buf)
  
   status = vaMapBuffer(r-va_dpy, output_buf, (void **) segment);
   if (status != VA_STATUS_SUCCESS)
 - return -1;
 + return OUTPUT_WRITE_FATAL;
  
   if (segment-status  VA_CODED_BUF_STATUS_SLICE_OVERFLOW_MASK) {
   r-encoder.output_size *= 2;
   vaUnmapBuffer(r-va_dpy, output_buf);
 - return -1;
 + return OUTPUT_WRITE_OVERFLOW;
   }
  
   count = write(r-output_fd, segment-buf, segment-size);
  
   vaUnmapBuffer(r-va_dpy, output_buf);
  
 - return count;
 + if (count  0)
 + return OUTPUT_WRITE_FATAL;
 +
 + return OUTPUT_WRITE_SUCCESS;
  }
  
  static void
 @@ -792,9 +803,8 @@ encoder_encode(struct vaapi_recorder *r, VASurfaceID 
 input)
  
   VABufferID buffers[8];
   int count = 0;
 -
 - int slice_type;
 - int ret, i;
 + int i, slice_type;
 + enum output_write_status ret;
  
   if ((r-frame_count % r-encoder.intra_period) == 0)
   slice_type = SLICE_TYPE_I;
 @@ -829,7 +839,10 @@ encoder_encode(struct vaapi_recorder *r, VASurfaceID 
 input)
   output_buf = VA_INVALID_ID;
  
   vaDestroyBuffer(r-va_dpy, buffers[--count]);
 - } while (ret  0);
 + } while (ret == OUTPUT_WRITE_OVERFLOW);
 +
 + if (ret == OUTPUT_WRITE_FATAL)
 + r-error = errno;
  
   for (i = 0; i  count; i++)
   

Re: [PATCH 1/2] Set to NULL event source after a call to wl_event_source_remove

2014-05-09 Thread Kristian Høgsberg
On Fri, May 09, 2014 at 04:03:51PM +0200, Hardening wrote:
 This patch sets to NULL event sources after a call to wl_event_source_remove()
 has been made.

We don't generally set freed memory to NULL, unless we rely on testing that
to decide whether the pointer points to an object or not.

Kristian

 ---
  src/clipboard.c  | 3 ++-
  src/compositor-drm.c | 3 +++
  src/compositor-rpi.c | 1 +
  src/compositor-x11.c | 2 ++
  src/compositor.c | 6 +-
  src/evdev-touchpad.c | 1 +
  src/evdev.c  | 4 +++-
  src/libinput-seat.c  | 1 +
  src/logind-util.c| 2 ++
  xwayland/launcher.c  | 6 +-
  xwayland/selection.c | 9 +++--
  11 files changed, 32 insertions(+), 6 deletions(-)
 
 diff --git a/src/clipboard.c b/src/clipboard.c
 index 5a3a02d..0e25dc1 100644
 --- a/src/clipboard.c
 +++ b/src/clipboard.c
 @@ -61,6 +61,7 @@ clipboard_source_unref(struct clipboard_source *source)
  
   if (source-event_source) {
   wl_event_source_remove(source-event_source);
 + source-event_source = NULL;
   close(source-fd);
   }
   wl_signal_emit(source-base.destroy_signal,
 @@ -90,8 +91,8 @@ clipboard_source_data(int fd, uint32_t mask, void *data)
   len = read(fd, p, size);
   if (len == 0) {
   wl_event_source_remove(source-event_source);
 - close(fd);
   source-event_source = NULL;
 + close(fd);
   } else if (len  0) {
   clipboard_source_unref(source);
   clipboard-source = NULL;
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 5f59789..0110f41 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -2379,7 +2379,9 @@ drm_destroy(struct weston_compositor *ec)
   udev_input_destroy(d-input);
  
   wl_event_source_remove(d-udev_drm_source);
 + d-udev_drm_source = NULL;
   wl_event_source_remove(d-drm_source);
 + d-drm_source = NULL;
  
   destroy_sprites(d);
  
 @@ -2849,6 +2851,7 @@ drm_compositor_create(struct wl_display *display,
  
  err_udev_monitor:
   wl_event_source_remove(ec-udev_drm_source);
 + ec-udev_drm_source = NULL;
   udev_monitor_unref(ec-udev_monitor);
  err_drm_source:
   wl_event_source_remove(ec-drm_source);
 diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
 index 287451d..cbfb770 100644
 --- a/src/compositor-rpi.c
 +++ b/src/compositor-rpi.c
 @@ -213,6 +213,7 @@ static void
  rpi_flippipe_release(struct rpi_flippipe *flippipe)
  {
   wl_event_source_remove(flippipe-source);
 + flippipe-source = NULL;
   close(flippipe-readfd);
   close(flippipe-writefd);
  }
 diff --git a/src/compositor-x11.c b/src/compositor-x11.c
 index 56b3228..9f171e7 100644
 --- a/src/compositor-x11.c
 +++ b/src/compositor-x11.c
 @@ -485,6 +485,7 @@ x11_output_destroy(struct weston_output *output_base)
   (struct x11_compositor *)output-base.compositor;
  
   wl_event_source_remove(output-finish_frame_timer);
 + output-finish_frame_timer = NULL;
  
   if (compositor-use_pixman) {
   pixman_renderer_output_destroy(output_base);
 @@ -1424,6 +1425,7 @@ x11_destroy(struct weston_compositor *ec)
   struct x11_compositor *compositor = (struct x11_compositor *)ec;
  
   wl_event_source_remove(compositor-xcb_source);
 + compositor-xcb_source = NULL;
   x11_input_destroy(compositor);
  
   weston_compositor_shutdown(ec); /* destroys outputs, too */
 diff --git a/src/compositor.c b/src/compositor.c
 index cd1ca9a..6ad3387 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -3736,8 +3736,12 @@ weston_compositor_shutdown(struct weston_compositor 
 *ec)
   struct weston_output *output, *next;
  
   wl_event_source_remove(ec-idle_source);
 - if (ec-input_loop_source)
 + ec-idle_source = NULL;
 +
 + if (ec-input_loop_source) {
   wl_event_source_remove(ec-input_loop_source);
 + ec-input_loop_source = NULL;
 + }
  
   /* Destroy all outputs associated with this compositor */
   wl_list_for_each_safe(output, next, ec-output_list, link)
 diff --git a/src/evdev-touchpad.c b/src/evdev-touchpad.c
 index 69f913a..360f87f 100644
 --- a/src/evdev-touchpad.c
 +++ b/src/evdev-touchpad.c
 @@ -663,6 +663,7 @@ touchpad_destroy(struct evdev_dispatch *dispatch)
  
   touchpad-filter-interface-destroy(touchpad-filter);
   wl_event_source_remove(touchpad-fsm.timer_source);
 + touchpad-fsm.timer_source = NULL;
   free(dispatch);
  }
  
 diff --git a/src/evdev.c b/src/evdev.c
 index 888dfbd..a1bce2c 100644
 --- a/src/evdev.c
 +++ b/src/evdev.c
 @@ -697,8 +697,10 @@ evdev_device_destroy(struct evdev_device *device)
   if (dispatch)
   dispatch-interface-destroy(dispatch);
  
 - if (device-source)
 + if (device-source) {
   wl_event_source_remove(device-source);
 + device-source = NULL;
 + }
   if (device-output)
   

Re: [PATCH 2/2] Handle OOM with signal events

2014-05-09 Thread Kristian Høgsberg
On Fri, May 09, 2014 at 04:03:52PM +0200, Hardening wrote:
 This patch handles the case where a signal event source can not be created.
 ---
  src/compositor.c | 11 +--
  1 file changed, 9 insertions(+), 2 deletions(-)
 
 diff --git a/src/compositor.c b/src/compositor.c
 index 6ad3387..047df8a 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -4197,6 +4197,7 @@ int main(int argc, char *argv[])
   display = wl_display_create();
  
   loop = wl_display_get_event_loop(display);
 + memset(signals, 0, sizeof(signals));

We set all entries of signals[4], and they're going to be valid
signal source pointers or NULL if the allocation fails.  No need to memset.

   signals[0] = wl_event_loop_add_signal(loop, SIGTERM, on_term_signal,
 display);
   signals[1] = wl_event_loop_add_signal(loop, SIGINT, on_term_signal,
 @@ -4208,6 +4209,9 @@ int main(int argc, char *argv[])
   signals[3] = wl_event_loop_add_signal(loop, SIGCHLD, sigchld_handler,
 NULL);
  
 + if (!signals[0] || !signals[1] || !signals[2] || !signals[3])
 + goto out_signals;
 +
   config = weston_config_parse(weston.ini);
   if (config != NULL) {
   weston_log(Using config file '%s'\n,
 @@ -4321,8 +4325,11 @@ int main(int argc, char *argv[])
  
   wl_signal_emit(ec-destroy_signal, ec);
  
 - for (i = ARRAY_LENGTH(signals); i;)
 - wl_event_source_remove(signals[--i]);
 + out_signals:
 + for (i = ARRAY_LENGTH(signals); i; i--) {
 + if (signals[i-1])

We can just add the if condition to the existing loop, no need to
iterate in reverse.

Kristian

 + wl_event_source_remove(signals[i-1]);
 + }
  
   weston_compositor_xkb_destroy(ec);
  
 -- 
 1.8.1.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] libinput-seat: literal values for WESTON_LIBINPUT_LOG_PRIORITY

2014-05-09 Thread Kristian Høgsberg
On Fri, May 09, 2014 at 11:24:40AM -0700, U. Artie Eoff wrote:
 Only accept specific literal values from the environment variable
 WESTON_LIBINPUT_LOG_PRIORITY... debug, info, or error.
 
 Signed-off-by: U. Artie Eoff ullysses.a.e...@intel.com

Thanks Artie, I think we can squeeze that in with the RC2.

Kristian

 ---
  src/libinput-seat.c | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)
 
 diff --git a/src/libinput-seat.c b/src/libinput-seat.c
 index a38d470..d59ae42 100644
 --- a/src/libinput-seat.c
 +++ b/src/libinput-seat.c
 @@ -271,8 +271,15 @@ udev_input_init(struct udev_input *input, struct 
 weston_compositor *c, struct ud
   libinput_log_set_handler(libinput_log_func, NULL);
  
   log_priority = getenv(WESTON_LIBINPUT_LOG_PRIORITY);
 +
   if (log_priority) {
 - libinput_log_set_priority(strtol(log_priority, NULL, 10));
 + if (strcmp(log_priority, debug) == 0) {
 + libinput_log_set_priority(LIBINPUT_LOG_PRIORITY_DEBUG);
 + } else if (strcmp(log_priority, info) == 0) {
 + libinput_log_set_priority(LIBINPUT_LOG_PRIORITY_INFO);
 + } else if (strcmp(log_priority, error) == 0) {
 + libinput_log_set_priority(LIBINPUT_LOG_PRIORITY_ERROR);
 + }
   }
  
   input-libinput = libinput_udev_create_for_seat(libinput_interface, 
 input,
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] desktop-shell: Fix black edges on scaled desktop pattern

2014-05-09 Thread Kristian Høgsberg
On Fri, May 09, 2014 at 01:52:33PM -0700, Bill Spitzak wrote:
 Thanks, it looks like that setup worked, patch sent correctly now.

Great, it's good to have git send-email working.  As it turns out, I
didn't have any problems applying your initial email, but I do have the
fix whitespace option Pekka mentioned in my git config.

Kristian

 On 05/09/2014 11:52 AM, Jonas Ådahl wrote:
 If you are using gmail, you can just use Googles SMTP server directly.
 The example configuration in the manual [0] even is a @gmail.com
 address setup.
 
 Jonas
 
 [0] http://git-scm.com/docs/git-send-email
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland 6/6] scanner: Generate macros for getting the 'since' version of an event

2014-05-09 Thread Kristian Høgsberg
On Thu, May 08, 2014 at 11:39:49PM +0200, Jonas Ådahl wrote:
 This could be useful for compositors who need to be able to not send
 events if the client bound a version lower than the newest provided.
 
 Event version numbers are exposed as
 [INTERFACE_NAME]_[EVENT_NAME]_SINCE_VERSION for example wl_output.scale
 will have the version macro WL_OUTPUT_SCALE_SINCE_VERSION.

Yeah, that's a little more readable I guess.  This and previous patches
applied, thanks.

Kristian

 
 Signed-off-by: Jonas Ådahl jad...@gmail.com
 ---
  src/scanner.c | 13 +
  1 file changed, 13 insertions(+)
 
 diff --git a/src/scanner.c b/src/scanner.c
 index 28fadb0..80c466e 100644
 --- a/src/scanner.c
 +++ b/src/scanner.c
 @@ -579,6 +579,18 @@ emit_opcodes(struct wl_list *message_list, struct 
 interface *interface)
  }
  
  static void
 +emit_opcode_versions(struct wl_list *message_list, struct interface 
 *interface)
 +{
 + struct message *m;
 +
 + wl_list_for_each(m, message_list, link)
 + printf(#define %s_%s_SINCE_VERSION\t%d\n,
 +interface-uppercase_name, m-uppercase_name, m-since);
 +
 + printf(\n);
 +}
 +
 +static void
  emit_type(struct arg *a)
  {
   switch (a-type) {
 @@ -1004,6 +1016,7 @@ emit_header(struct protocol *protocol, int server)
   if (server) {
   emit_structs(i-request_list, i);
   emit_opcodes(i-event_list, i);
 + emit_opcode_versions(i-event_list, i);
   emit_event_wrappers(i-event_list, i);
   } else {
   emit_structs(i-event_list, i);
 -- 
 1.9.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 5/5] tests: rename xwayland test

2014-05-09 Thread Kristian Høgsberg
On Wed, May 07, 2014 at 04:26:29PM +0300, Pekka Paalanen wrote:
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 If the test is named xwayland.weston, then the automake test harness
 keys it off xwayland.log. Making xwayland.log runs the test.
 The test harness has implicit rules to create a %.log from all of
 %$TEST_EXTENSIONS. So we have implicit rules to create %.log from %.la
 and %.log from %.weston.
 
 We also build xwayland.so, which produces xwayland.la.
 
 When the test harness goes running the xwayland test, it ends up using
 the %.la rule, which is wrong. It passes xwayland.la as the test name to
 weston-tests-env, which then loads it as a plugin into Weston and waits
 for Weston to exit. Which it never does.
 
 Fix this by making the test have a different name than the Xwayland
 plugin.
 
 Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk

All applied, thanks Pekka.

Kristian

 ---
  Makefile.am | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/Makefile.am b/Makefile.am
 index a247c3d..177ce2e 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -927,10 +927,10 @@ buffer_count_weston_LDADD = libtest-client.la 
 $(EGL_TESTS_LIBS)
  endif
  
  if ENABLE_XWAYLAND_TEST
 -weston_tests +=  xwayland.weston
 -xwayland_weston_SOURCES = tests/xwayland-test.c
 -xwayland_weston_CFLAGS = $(GCC_CFLAGS) $(XWAYLAND_TEST_CFLAGS)
 -xwayland_weston_LDADD = libtest-client.la $(XWAYLAND_TEST_LIBS)
 +weston_tests +=  xwayland-test.weston
 +xwayland_test_weston_SOURCES = tests/xwayland-test.c
 +xwayland_test_weston_CFLAGS = $(GCC_CFLAGS) $(XWAYLAND_TEST_CFLAGS)
 +xwayland_test_weston_LDADD = libtest-client.la $(XWAYLAND_TEST_LIBS)
  endif
  
  matrix_test_SOURCES =\
 -- 
 1.8.5.5
 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] editor: Fix cursor positioning with pointer and touch

2014-05-09 Thread Kristian Høgsberg
On Thu, May 08, 2014 at 02:55:50PM +0300, Ander Conselvan de Oliveira wrote:
 The calculation off the vertical offset between the widget coordinates
 and where the text was rendered was wrong. It was using the constant for
 horizontal offset for that too.
 ---
  clients/editor.c | 33 +++--
  1 file changed, 23 insertions(+), 10 deletions(-)

That fixes it here, thanks.  I added

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

to the commit message.

Kristian

 
 diff --git a/clients/editor.c b/clients/editor.c
 index 3b00833..f3f6141 100644
 --- a/clients/editor.c
 +++ b/clients/editor.c
 @@ -1011,7 +1011,17 @@ text_entry_draw_cursor(struct text_entry *entry, 
 cairo_t *cr)
   cairo_stroke(cr);
  }
  
 -static const int text_offset_left = 10;
 +static int
 +text_offset_left(struct rectangle *allocation)
 +{
 + return 10;
 +}
 +
 +static int
 +text_offset_top(struct rectangle *allocation)
 +{
 + return allocation-height / 2;
 +}
  
  static void
  text_entry_redraw_handler(struct widget *widget, void *data)
 @@ -1048,7 +1058,9 @@ text_entry_redraw_handler(struct widget *widget, void 
 *data)
  
   cairo_set_source_rgba(cr, 0, 0, 0, 1);
  
 - cairo_translate(cr, text_offset_left, allocation.height / 2);
 + cairo_translate(cr,
 + text_offset_left(allocation),
 + text_offset_top(allocation));
  
   if (!entry-layout)
   entry-layout = pango_cairo_create_layout(cr);
 @@ -1075,6 +1087,7 @@ text_entry_motion_handler(struct widget *widget,
  {
   struct text_entry *entry = data;
   struct rectangle allocation;
 + int tx, ty;
  
   if (!entry-button_pressed) {
   return CURSOR_IBEAM;
 @@ -1082,10 +1095,10 @@ text_entry_motion_handler(struct widget *widget,
  
   widget_get_allocation(entry-widget, allocation);
  
 - text_entry_set_cursor_position(entry,
 -x - allocation.x - text_offset_left,
 -y - allocation.y - text_offset_left,
 -false);
 + tx = x - allocation.x - text_offset_left(allocation);
 + ty = y - allocation.y - text_offset_top(allocation);
 +
 + text_entry_set_cursor_position(entry, tx, ty, false);
  
   return CURSOR_IBEAM;
  }
 @@ -1105,8 +1118,8 @@ text_entry_button_handler(struct widget *widget,
   widget_get_allocation(entry-widget, allocation);
   input_get_position(input, x, y);
  
 - x -= allocation.x + text_offset_left;
 - y -= allocation.y + text_offset_left;
 + x -= allocation.x + text_offset_left(allocation);
 + y -= allocation.y + text_offset_top(allocation);
  
   editor = window_get_user_data(entry-window);
  
 @@ -1149,8 +1162,8 @@ text_entry_touch_handler(struct widget *widget, struct 
 input *input,
  
   widget_get_allocation(entry-widget, allocation);
  
 - x = tx - (allocation.x + text_offset_left);
 - y = ty - (allocation.y + text_offset_left);
 + x = tx - (allocation.x + text_offset_left(allocation));
 + y = ty - (allocation.y + text_offset_top(allocation));
  
   editor = window_get_user_data(entry-window);
   text_entry_activate(entry, seat);
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland 2/2] connection-test: check malloc result

2014-05-06 Thread Kristian Høgsberg
On Mon, May 05, 2014 at 02:45:20PM -0700, U. Artie Eoff wrote:
 Signed-off-by: U. Artie Eoff ullysses.a.e...@intel.com

Applied, thanks.

 ---
  tests/connection-test.c | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/tests/connection-test.c b/tests/connection-test.c
 index 1213875..659bf68 100644
 --- a/tests/connection-test.c
 +++ b/tests/connection-test.c
 @@ -516,6 +516,8 @@ TEST(connection_marshal_too_big)
   struct marshal_data data;
   char *big_string = malloc(5000);
  
 + assert(big_string);
 +
   memset(big_string, ' ', 4999);
   big_string[4999] = '\0';
  
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] server: fix potential memleak and NULL deref

2014-05-06 Thread Kristian Høgsberg
On Mon, May 05, 2014 at 04:28:26PM -0700, U. Artie Eoff wrote:
 If for some reason that errno is neither value (ENOMEM or
 EINVAL), then prior to this patch, there would be a NULL
 deref in wl_closure_lookup(...) at the else if conditional
 when closure == NULL. Also, closure might not be NULL but still
 fall into the block due to the wl_closure_lookup  0 condition...
 in that case, we need to destroy the closure to avoid a memory
 leak.
 
 Currently, wl_connection_demarshal only sets errno to ENOMEM
 or EINVAL... we've already checked for ENOMEM so remove check
 for EINVAL (just assume it).  Also, call wl_closure_destroy(...)
 unconditionally in the else if block (assume it can handle
 NULL closure, too, which it does right now).

Yup, that looks good, thanks.

Kristian

 
 Signed-off-by: U. Artie Eoff ullysses.a.e...@intel.com
 ---
  src/wayland-server.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/src/wayland-server.c b/src/wayland-server.c
 index f2b1b42..e850d48 100644
 --- a/src/wayland-server.c
 +++ b/src/wayland-server.c
 @@ -313,7 +313,7 @@ wl_client_connection_data(int fd, uint32_t mask, void 
 *data)
   if (closure == NULL  errno == ENOMEM) {
   wl_resource_post_no_memory(resource);
   break;
 - } else if ((closure == NULL  errno == EINVAL) ||
 + } else if (closure == NULL ||
  wl_closure_lookup_objects(closure, client-objects) 
  0) {
   wl_resource_post_error(client-display_resource,
  WL_DISPLAY_ERROR_INVALID_METHOD,
 @@ -321,6 +321,7 @@ wl_client_connection_data(int fd, uint32_t mask, void 
 *data)
  object-interface-name,
  object-id,
  message-name);
 + wl_closure_destroy(closure);
   break;
   }
  
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] doc: Added API documentation for wl_display_create function.

2014-05-06 Thread Kristian Høgsberg
On Tue, May 06, 2014 at 03:52:12PM +0530, Srivardhan Hebbar wrote:
 Signed-off-by: Srivardhan Hebbar sri.heb...@samsung.com
 ---
  src/wayland-server.c |9 +
  1 file changed, 9 insertions(+)
 
 diff --git a/src/wayland-server.c b/src/wayland-server.c
 index f2b1b42..7b32848 100644
 --- a/src/wayland-server.c
 +++ b/src/wayland-server.c
 @@ -788,6 +788,15 @@ bind_display(struct wl_client *client,
  destroy_client_display_resource);
  }
  
 +/** Create Wayland display object.
 + *
 + * \param None
 + * \return The Wayland display object. Null if failed to create
 + *
 + * This creates the wl_display object for the client.

Thanks for adding documentation for this function.  The display object isn't
specific to any client though, so I wouldn't write for the client.

Kristian

 + *
 + * \memberof wl_display
 + */
  WL_EXPORT struct wl_display *
  wl_display_create(void)
  {
 -- 
 1.7.9.5
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] wcap: Check for mmap and malloc return value in wcap decode module

2014-05-06 Thread Kristian Høgsberg
On Tue, May 06, 2014 at 03:54:49PM +0530, vivek wrote:
 Checking for return value in main.c for wcap_decoder_create function
 and mmap, malloc return value in wcap_decoder_create function to avoid
 crashes

Thanks, that looks better.

Kristian

 Signed-off-by: vivek vivek.el...@samsung.com
 ---
  wcap/main.c|4 
  wcap/wcap-decode.c |9 +
  2 files changed, 13 insertions(+)
 
 diff --git a/wcap/main.c b/wcap/main.c
 index 29bb9c3..16d37f0 100644
 --- a/wcap/main.c
 +++ b/wcap/main.c
 @@ -251,6 +251,10 @@ int main(int argc, char *argv[])
   }
  
   decoder = wcap_decoder_create(argv[1]);
 + if (decoder == NULL) {
 + fprintf(stderr, Creating wcap decoder failed\n);
 + exit(EXIT_FAILURE);
 + }
  
   if (yuv4mpeg2  isatty(1)) {
   fprintf(stderr, Not dumping yuv4mpeg2 data to terminal.  Pipe 
 output to a file or a process.\n);
 diff --git a/wcap/wcap-decode.c b/wcap/wcap-decode.c
 index 87d9337..76ecc2f 100644
 --- a/wcap/wcap-decode.c
 +++ b/wcap/wcap-decode.c
 @@ -126,6 +126,11 @@ wcap_decoder_create(const char *filename)
   decoder-size = buf.st_size;
   decoder-map = mmap(NULL, decoder-size,
   PROT_READ, MAP_PRIVATE, decoder-fd, 0);
 + if (decoder-map == MAP_FAILED) {
 + fprintf(stderr, mmap failed\n);
 + free(decoder);
 + return NULL;
 + }
   
   header = decoder-map;
   decoder-format = header-format;
 @@ -137,6 +142,10 @@ wcap_decoder_create(const char *filename)
  
   frame_size = header-width * header-height * 4;
   decoder-frame = malloc(frame_size);
 + if (decoder-frame == NULL) {
 + free(decoder);
 + return NULL;
 + }
   memset(decoder-frame, 0, frame_size);
  
   return decoder;
 -- 
 1.7.9.5
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland-web 6/6] xwayland: add xserver build options

2014-05-06 Thread Kristian Høgsberg
On Tue, May 06, 2014 at 04:25:40PM +0300, Pekka Paalanen wrote:
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 With these, it will only install the Xwayland binary. No Xorg, no
 modules, no cruft. Just 4 files in total here.

Thanks for updating that, all applied.

Kristian

 ---
  xserver.html | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/xserver.html b/xserver.html
 index bd4abb7..dd8ff30 100644
 --- a/xserver.html
 +++ b/xserver.html
 @@ -63,7 +63,9 @@ and is first released with xserver 1.16. The separate X.org 
 video DDXes
  are not needed anymore./p
  pre$ git clone git://anongit.freedesktop.org/xorg/xserver
  $ cd xserver
 -$ ./autogen.sh --prefix=$WLD
 +$ ./autogen.sh --prefix=$WLD --disable-docs --disable-devel-docs \
 +  --enable-xwayland --disable-xorg --disable-xvfb --disable-xnest \
 +  --disable-xquartz --disable-xwin
  $ make
  $ make install
  $ cd ..
 -- 
 1.8.5.5
 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-drm: Don't use vaapi recorder with unsupported formats

2014-05-06 Thread Kristian Høgsberg
On Tue, May 06, 2014 at 04:49:06PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 We only support recording with GBM_FORMAT_XRGB888 format, so don't try
 to record if the output has a differnt format.

That looks good, applied.

Kristian

 
 https://bugs.freedesktop.org/show_bug.cgi?id=78199
 ---
  src/compositor-drm.c | 6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 4441308..5f59789 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -2611,6 +2611,12 @@ recorder_binding(struct weston_seat *seat, uint32_t 
 time, uint32_t key,
 struct drm_output, base.link);
  
   if (!output-recorder) {
 + if (output-format != GBM_FORMAT_XRGB) {
 + weston_log(failed to start vaapi recorder: 
 +output format not supported\n);
 + return;
 + }
 +
   width = output-base.current_mode-width;
   height = output-base.current_mode-height;
  
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] Apply the zoom transformation before the output transformation

2014-05-06 Thread Kristian Høgsberg
On Tue, May 06, 2014 at 07:04:15PM +0100, Neil Roberts wrote:
 The zoom translation is just a scale and a translate. The translation
 is calculated based on the coordinates of the pointer which are in
 global space. Previously the calculated translation was transformed by
 the output transformation so that when the zoom transform is applied
 after the output transform then it will be correct. However if we just
 apply the zoom transformation first then we get the same result
 without the zoom code having to be aware of the output transformation.
 
 This also fixes weston_output_transform_coordinate which was applying
 the output and zoom transforms in the wrong order.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=78211
 ---
  src/compositor.c |  4 ++--
  src/zoom.c   | 47 ---

I love it:

  2 files changed, 2 insertions(+), 49 deletions(-)

Best bug fix ever.  Thanks, applied.

Kristian
 
 diff --git a/src/compositor.c b/src/compositor.c
 index 3d65e4c..cd1ca9a 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -3198,8 +3198,6 @@ weston_output_update_matrix(struct weston_output 
 *output)
   2.0 / output-width,
   -2.0 / output-height, 1);
  
 - weston_output_compute_transform(output);
 -
   if (output-zoom.active) {
   magnification = 1 / (1 - output-zoom.spring_z.current);
   weston_output_update_zoom(output);
 @@ -3209,6 +3207,8 @@ weston_output_update_matrix(struct weston_output 
 *output)
   magnification, 1.0);
   }
  
 + weston_output_compute_transform(output);
 +
   output-dirty = 0;
  }
  
 diff --git a/src/zoom.c b/src/zoom.c
 index 622c0d7..7553849 100644
 --- a/src/zoom.c
 +++ b/src/zoom.c
 @@ -111,50 +111,6 @@ zoom_area_center_from_pointer(struct weston_output 
 *output,
  }
  
  static void
 -weston_zoom_apply_output_transform(struct weston_output *output,
 - float *x, float *y)
 -{
 - float tx, ty;
 -
 - switch(output-transform) {
 - case WL_OUTPUT_TRANSFORM_NORMAL:
 - default:
 - return;
 - case WL_OUTPUT_TRANSFORM_90:
 - tx = -*y;
 - ty = *x;
 - break;
 - case WL_OUTPUT_TRANSFORM_180:
 - tx = -*x;
 - ty = -*y;
 - break;
 - case WL_OUTPUT_TRANSFORM_270:
 - tx = *y;
 - ty = -*x;
 - break;
 - case WL_OUTPUT_TRANSFORM_FLIPPED:
 - tx = -*x;
 - ty = *y;
 - break;
 - case WL_OUTPUT_TRANSFORM_FLIPPED_90:
 - tx = -*y;
 - ty = -*x;
 - break;
 - case WL_OUTPUT_TRANSFORM_FLIPPED_180:
 - tx = *x;
 - ty = -*y;
 - break;
 - case WL_OUTPUT_TRANSFORM_FLIPPED_270:
 - tx = *y;
 - ty = *x;
 - break;
 - }
 -
 - *x = tx;
 - *y = ty;
 -}
 -
 -static void
  weston_output_update_zoom_transform(struct weston_output *output)
  {
   float global_x, global_y;
 @@ -183,9 +139,6 @@ weston_output_update_zoom_transform(struct weston_output 
 *output)
   global_y - output-y) / output-height) *
   (level * 2)) - level) * ratio;
  
 - weston_zoom_apply_output_transform(output, output-zoom.trans_x,
 -output-zoom.trans_y);
 -
   trans_max = level * 2 - level;
   trans_min = -trans_max;
  
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 3/3] compositor-wayland: avoid possible NULL deref in handle_keymap

2014-05-06 Thread Kristian Høgsberg
On Tue, May 06, 2014 at 02:50:03PM -0700, U. Artie Eoff wrote:
 If data is NULL, then we jumped to error which attempts to
 dereference data.  Instead, just close(fd) and return when
 data is NULL.
 
 Signed-off-by: U. Artie Eoff ullysses.a.e...@intel.com

All three look good, applied.

Kristian

 ---
  src/compositor-wayland.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)
 
 diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
 index 3cd308f..a08b71a 100644
 --- a/src/compositor-wayland.c
 +++ b/src/compositor-wayland.c
 @@ -1424,8 +1424,10 @@ input_handle_keymap(void *data, struct wl_keyboard 
 *keyboard, uint32_t format,
   struct xkb_keymap *keymap;
   char *map_str;
  
 - if (!data)
 - goto error;
 + if (!data) {
 + close(fd);
 + return;
 + }
  
   if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
   map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] Take into account the zoom when applying the output transform

2014-05-01 Thread Kristian Høgsberg
On Thu, May 01, 2014 at 04:13:55PM +0100, Neil Roberts wrote:
 When converting output-relative coordinates (such as from an input
 event) to global coordinates it now takes into account the zoom
 transform. Previously this would only work for the primary pointer
 because the transform doesn't affect the primary pointer position due
 to that way zoom follows the mouse. Touch events and multiple pointers
 were not working correctly.

Wonderful, thanks Neil, it works here.  Patch applied.

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=68620
 ---
  src/compositor.c | 20 ++--
  1 file changed, 18 insertions(+), 2 deletions(-)
 
 diff --git a/src/compositor.c b/src/compositor.c
 index ee8dc24..3d65e4c 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -,6 +,7 @@ weston_output_transform_coordinate(struct weston_output 
 *output,
  {
   wl_fixed_t tx, ty;
   wl_fixed_t width, height;
 + float zoom_scale, zx, zy;
  
   width = wl_fixed_from_int(output-width * output-current_scale - 1);
   height = wl_fixed_from_int(output-height * output-current_scale - 1);
 @@ -3373,8 +3374,23 @@ weston_output_transform_coordinate(struct 
 weston_output *output,
   break;
   }
  
 - *x = tx / output-current_scale + wl_fixed_from_int(output-x);
 - *y = ty / output-current_scale + wl_fixed_from_int(output-y);
 + tx /= output-current_scale;
 + ty /= output-current_scale;
 +
 + if (output-zoom.active) {
 + zoom_scale = output-zoom.spring_z.current;
 + zx = (wl_fixed_to_double(tx) * (1.0f - zoom_scale) +
 +   output-width / 2.0f *
 +   (zoom_scale + output-zoom.trans_x));
 + zy = (wl_fixed_to_double(ty) * (1.0f - zoom_scale) +
 +   output-height / 2.0f *
 +   (zoom_scale + output-zoom.trans_y));
 + tx = wl_fixed_from_double(zx);
 + ty = wl_fixed_from_double(zy);
 + }
 +
 + *x = tx + wl_fixed_from_int(output-x);
 + *y = ty + wl_fixed_from_int(output-y);
  }
  
  static void
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] drm: Don't use the cursor overlay if the scale doesn't match

2014-05-01 Thread Kristian Høgsberg
On Thu, May 01, 2014 at 06:00:41PM +0100, Neil Roberts wrote:
 If the scale for the cursor surface doesn't match that of the output
 then we shouldn't use the cursor overlay because otherwise it will be
 drawn at the wrong size. This problem is particularly noticable with
 multiple pointers because it randomly alternates between drawing one
 cursor or the other at a larger size depending on which one gets put
 in the cursor overlay.

Thanks, applied.

Kristian

 ---
  src/compositor-drm.c | 3 +++
  1 file changed, 3 insertions(+)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 9d293bc..4441308 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -953,12 +953,15 @@ drm_output_prepare_cursor_view(struct weston_output 
 *output_base,
  {
   struct drm_compositor *c =
   (struct drm_compositor *) output_base-compositor;
 + struct weston_buffer_viewport *viewport = ev-surface-buffer_viewport;
   struct drm_output *output = (struct drm_output *) output_base;
  
   if (c-gbm == NULL)
   return NULL;
   if (output-base.transform != WL_OUTPUT_TRANSFORM_NORMAL)
   return NULL;
 + if (viewport-buffer.scale != output_base-current_scale)
 + return NULL;
   if (output-cursor_view)
   return NULL;
   if (ev-output_mask != (1u  output_base-id))
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Release candidate 1 out for 1.5 (1.4.92)

2014-05-01 Thread Kristian Høgsberg
Hi all,

I've just tagged the 1.4.92 release candidate in git and uploaded tarballs:

  0dbe48041a90b8f62993270ca11d29b84c9fe12f  wayland-1.4.92.tar.xz
  4a4523fa92e8a1110b84d3595a2467bd16dc22af  wayland 1.4.92 tag

  2afea6c88f796c03ba924f67f8fff38b89e8276a  weston-1.4.92.tar.xz
  d7d71e8d962d7d82f0d1419a163e1fb6e024f749  weston 1.4.92 tag

We're at a historic low in terms of open bugs - as of this writing we have
15 bugs in wayland/weston bugzilla.  There are a few more bugs we can fix
and I expect more will come in as we start testing, but right now it's
looking pretty good.  We'll do another release candidate a week from now
and then release 1.5 a week after that.  If everything looks super-duper
for RC1 we might even just release that, but lets see how it goes.

Kristian
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v2] screen-share: Don't unset server environment variables

2014-04-30 Thread Kristian Høgsberg
On Wed, Apr 30, 2014 at 10:53:30AM -0500, Jason Ekstrand wrote:
 Looks good to me.
 
 Reviewed-by: Jason Ekstrand ja...@jlekstrand.net

Thanks, committed.

Kristian

 On Apr 30, 2014 3:52 AM, Andrew Wedgbury andrew.wedgb...@realvnc.com
 wrote:
 
  There is no need to unset WAYLAND_DISPLAY and WAYLAND_SOCKET when
  screen-share
  launches the fullscreen shell server. This was done originally in case the
  launched server decided to use the wayland backend based on the presence of
  these. However, we pass a command line argument telling it to use the RDP
  backend, which overrides the automatic backend selection based on the
  environment.
 
  Keeping these environment variables allows the launched fullscreen shell
  server
  to know the original server's display name, which it may need in order to
  show
  a configuration UI.
 
  Signed-off-by: Andrew Wedgbury andrew.wedgb...@realvnc.com
  ---
   src/screen-share.c | 4 
   1 file changed, 4 deletions(-)
 
  diff --git a/src/screen-share.c b/src/screen-share.c
  index d3e3f05..6f60b81 100644
  --- a/src/screen-share.c
  +++ b/src/screen-share.c
  @@ -1005,10 +1005,6 @@ weston_output_share(struct weston_output *output,
  }
 
  if (pid == 0) {
  -   /* We don't want anything circular */
  -   unsetenv(WAYLAND_DISPLAY);
  -   unsetenv(WAYLAND_SOCKET);
  -
  /* do not give our signal mask to the new process */
  sigfillset(allsigs);
  sigprocmask(SIG_UNBLOCK, allsigs, NULL);
  --
  1.9.2
 
  ___
  wayland-devel mailing list
  wayland-devel@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/wayland-devel
 

 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/6] compositor: Fix the documentation for surface-configure

2014-04-30 Thread Kristian Høgsberg
On Mon, Apr 28, 2014 at 11:19:27AM -0400, Jasper St. Pierre wrote:
 It's called on commit, not on attach. Additionally, correct the
 interface name to be wl_surface, not surface.
 ---
  src/compositor.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/compositor.h b/src/compositor.h
 index 03d8992..c913f54 100644
 --- a/src/compositor.h
 +++ b/src/compositor.h
 @@ -908,9 +908,9 @@ struct weston_surface {
   } pending;
  
   /*
 -  * If non-NULL, this function will be called on surface::attach after
 +  * If non-NULL, this function will be called on wl_surface::commit after
* a new buffer has been set up for this surface. The integer params
 -  * are the sx and sy paramerters supplied to surface::attach .
 +  * are the sx and sy paramerters supplied to wl_surface::attach .

Applied and I squashed in a typo fix for paramerters.

Kristian

*/
   void (*configure)(struct weston_surface *es, int32_t sx, int32_t sy);
   void *configure_private;
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 4/6] cairo-util: Don't show a resize cursor on edges when we're maximized

2014-04-30 Thread Kristian Høgsberg
On Mon, Apr 28, 2014 at 11:19:30AM -0400, Jasper St. Pierre wrote:
 This is substantially confusing to users, namely me.

That is indeed confusing.  However, I edited the patch to just set grip_size
to 0 if we're maximized.

Kristian

 ---
  shared/cairo-util.c | 13 -
  1 file changed, 8 insertions(+), 5 deletions(-)
 
 diff --git a/shared/cairo-util.c b/shared/cairo-util.c
 index a1568ff..a77d0b6 100644
 --- a/shared/cairo-util.c
 +++ b/shared/cairo-util.c
 @@ -487,11 +487,14 @@ enum theme_location
  theme_get_location(struct theme *t, int x, int y,
   int width, int height, int flags)
  {
 + int maximized;
   int vlocation, hlocation, location;
   const int grip_size = 8;
   int margin, top_margin;
  
 - margin = (flags  THEME_FRAME_MAXIMIZED) ? 0 : t-margin;
 + maximized = (flags  THEME_FRAME_MAXIMIZED);
 +
 + margin = maximized ? 0 : t-margin;
  
   if (flags  THEME_FRAME_NO_TITLE)
   top_margin = t-width;
 @@ -500,22 +503,22 @@ theme_get_location(struct theme *t, int x, int y,
  
   if (x  margin)
   hlocation = THEME_LOCATION_EXTERIOR;
 - else if (x  margin + grip_size)
 + else if (!maximized  x  margin + grip_size)
   hlocation = THEME_LOCATION_RESIZING_LEFT;
   else if (x  width - margin - grip_size)
   hlocation = THEME_LOCATION_INTERIOR;
 - else if (x  width - margin)
 + else if (!maximized  x  width - margin)
   hlocation = THEME_LOCATION_RESIZING_RIGHT;
   else
   hlocation = THEME_LOCATION_EXTERIOR;
  
   if (y  margin)
   vlocation = THEME_LOCATION_EXTERIOR;
 - else if (y  margin + grip_size)
 + else if (!maximized  y  margin + grip_size)
   vlocation = THEME_LOCATION_RESIZING_TOP;
   else if (y  height - margin - grip_size)
   vlocation = THEME_LOCATION_INTERIOR;
 - else if (y  height - margin)
 + else if (!maximized  y  height - margin)
   vlocation = THEME_LOCATION_RESIZING_BOTTOM;
   else
   vlocation = THEME_LOCATION_EXTERIOR;
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 6/6] window: Add a simple getenv to force SHM rendering

2014-04-30 Thread Kristian Høgsberg
On Mon, Apr 28, 2014 at 11:19:32AM -0400, Jasper St. Pierre wrote:

Yeah, that's useful, applied.

Kristian

 ---
  clients/window.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/clients/window.c b/clients/window.c
 index d822af7..3897440 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -4338,11 +4338,11 @@ surface_create(struct window *window)
   return surface;
  }
  
 -static window_buffer_type
 +static enum window_buffer_type
  get_preferred_buffer_type(struct display *display)
  {
  #ifdef HAVE_CAIRO_EGL
 - if (display-argb_device)
 + if (display-argb_device  !getenv(TOYTOOLKIT_NO_EGL))
   return WINDOW_BUFFER_TYPE_EGL_WINDOW;
  #endif
  
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 6/6] window: Add a simple getenv to force SHM rendering

2014-04-29 Thread Kristian Høgsberg
On Tue, Apr 29, 2014 at 5:35 AM, Pekka Paalanen ppaala...@gmail.com wrote:
 On Mon, 28 Apr 2014 11:19:32 -0400
 Jasper St. Pierre jstpie...@mecheye.net wrote:

 ---
  clients/window.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/clients/window.c b/clients/window.c
 index d822af7..3897440 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -4338,11 +4338,11 @@ surface_create(struct window *window)
   return surface;
  }

 -static window_buffer_type
 +static enum window_buffer_type
  get_preferred_buffer_type(struct display *display)
  {
  #ifdef HAVE_CAIRO_EGL
 - if (display-argb_device)
 + if (display-argb_device  !getenv(TOYTOOLKIT_NO_EGL))
   return WINDOW_BUFFER_TYPE_EGL_WINDOW;
  #endif


 Nice.

 I wonder, would it be time to finally just drop cairo-egl completely?
 It does raise the question on what to do with weston-gears and
 weston-screensaver. ISTR that krh was not fond of using sub-surfaces
 for them, so... just turn them into simple-egl kind of clients? Did we
 already have the decorations code easily integrable to non-cairo GL
 apps, maybe stemming from the wayland-backend work?

I'd like to drop cairo-egl, but not in a way that makes window.c shm
only.  I'd like it to use GL by default and use cairo for rendering
assets, for example, render the frame in cairo, but use gl to stretch
and scale it and composite the title on top.

Kristian

 That might be a nice newbie task.


 Thanks,
 pq
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 3/3] clients: Check zalloc return for out of memory situation

2014-04-29 Thread Kristian Høgsberg
On Mon, Apr 28, 2014 at 06:43:43PM +, Bryce W. Harrington wrote:
 On Thu, Apr 24, 2014 at 04:26:20PM +0300, Pekka Paalanen wrote:
  On Mon, 21 Apr 2014 23:51:03 +
  Bryce W. Harrington b.harring...@samsung.com wrote:
 terminal = xzalloc(sizeof *terminal);
   + if (terminal == NULL)
   + return NULL;
  
  No need to check 'terminal', xzalloc() will exit() if it ever goes NULL.
  
  I'd be fine with converting all the *allocs to the x*alloc which checks
  for NULL and exits. All programs using window.h can do that.
 
 Kristian writes:
  In the clients we use the x*alloc functions which abort on allocation 
  failure.
 
 
 Okay, I'll respin the patch to use the x*alloc functions for terminal.c.
 
 I notice that other clients are using the regular alloc functions,
 would you be open to a review of these and possibly a patch to convert
 them to x*alloc where appropriate?

Yeah, that'd be fine.

Kristian

 $ grep -I alloc * --exclude window.* | egrep -v 
 (x.alloc|allocat|zalloc|xrealloc) | wc -l
 46
 
 Bryce
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] Wrong bo handles can be referenced in func call, drmModeAddFB2 due to uninitialized array elements in handles[4]

2014-04-29 Thread Kristian Høgsberg
On Mon, Apr 28, 2014 at 03:26:18PM -0700, Dongwon Kim wrote:
 Need all bo handles in the array, handles[4] to be initialized with integer 
 value that
 indicates NOT VALID handle to prevent any of those uninitialized from being 
 processed as
 VALID handles.

The format code determines which bo handles are used.  For non-planar formats
only the first handle is used and the rest can be uninitialized.

Kristian

 If any of these incorrect handles are passed to the Kernel, it either returns 
 error saying
 invalid bo from userspace if the handle doesn't exist or returns wrong 
 resource if it
 exists but is not for the current task.
 
 Signed-off-by: Dongwon Kim dongwon@intel.com
 ---
  src/compositor-drm.c |3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 9d293bc..6aa405d 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -328,7 +328,8 @@ drm_fb_get_from_bo(struct gbm_bo *bo,
  {
   struct drm_fb *fb = gbm_bo_get_user_data(bo);
   uint32_t width, height;
 - uint32_t handles[4], pitches[4], offsets[4];
 + uint32_t handles[4] = {0};
 + uint32_t pitches[4], offsets[4];
   int ret;
  
   if (fb)
 -- 
 1.7.9.5
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] terminal: Convert all *alloc's to x*alloc's.

2014-04-29 Thread Kristian Høgsberg
On Mon, Apr 28, 2014 at 06:44:08PM +, Bryce W. Harrington wrote:
 This ensures the allocation results are checked for NULL (out of
 memory), and terminates the program in such a case.
 
 Signed-off-by: Bryce Harrington b.harring...@samsung.com

Applied, thanks.

Kristian

 ---
  clients/terminal.c |6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
 
 diff --git a/clients/terminal.c b/clients/terminal.c
 index 5931ce2..924549e 100644
 --- a/clients/terminal.c
 +++ b/clients/terminal.c
 @@ -772,10 +772,10 @@ terminal_resize_cells(struct terminal *terminal,
   } else {
   terminal-max_width = width;
   data_pitch = width * sizeof(union utf8_char);
 - data = zalloc(data_pitch * terminal-buffer_height);
 + data = xzalloc(data_pitch * terminal-buffer_height);
   attr_pitch = width * sizeof(struct attr);
 - data_attr = malloc(attr_pitch * terminal-buffer_height);
 - tab_ruler = zalloc(width);
 + data_attr = xmalloc(attr_pitch * terminal-buffer_height);
 + tab_ruler = xzalloc(width);
   attr_init(data_attr, terminal-curr_attr,
 width * terminal-buffer_height);
  
 -- 
 1.7.9.5
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 2/2] shell: Fix crash when a client is destroyed during the resize grab

2014-04-29 Thread Kristian Høgsberg
On Tue, Apr 29, 2014 at 05:54:03PM +0300, Ander Conselvan de Oliveira wrote:
 If a client exists during a resize grab, the resource for the shell
 surface being resized is destroyed. The shell surface is not destroyed
 immediately, however, because of the window close animation. In that
 case, the compositor would crash trying to send configure events to
 the surface being resized, since it would pass a NULL pointer to
 wl_resource_post_event().
 
 The code for the resize grab was already able to handle the surface
 going away, so expand it to also handle the resource going away and
 fix the crash.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=77344

Thanks, both patches applied.

Kristian 

 ---
  desktop-shell/shell.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 6fc797b..82d8166 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -1594,7 +1594,7 @@ resize_grab_motion(struct weston_pointer_grab *grab, 
 uint32_t time,
  
   weston_pointer_move(pointer, x, y);
  
 - if (!shsurf)
 + if (!shsurf || !shsurf-resource)
   return;
  
   weston_view_from_global_fixed(shsurf-view,
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] desktop-shell: Properly handle lowered fullscreen surfaces

2014-04-29 Thread Kristian Høgsberg
On Thu, Jan 30, 2014 at 02:01:10PM +0100, poch...@gmail.com wrote:
 From: Emilio Pozuelo Monfort emilio.pozu...@collabora.co.uk
 
 lower_fullscreen_surface() was removing fullscreen surfaces from
 the fullscreen layer and inserting them in the normal workspace
 layer. However, those fullscreen surfaces were never put back in
 the fullscreen layer, causing bugs such as unrelated surfaces
 being drawn between a fullscreen surface and its black view.
 
 Change the lower_fullscreen_surface() logic so that it lowers
 fullscreen surfaces to the workspace layer *and* hides the
 black views. Make this reversible by re-configuring the lowered
 fullscreen surface: when it is re-configured, the black view
 will be shown again and the surface will be restacked in the
 fullscreen layer.

Hi Emilio,

Sorry for the looong delay in looking at this.  The patch looks good and
fixes the issues below.  Applied - I do feel like we should try to come
up with a better mechanism for highlighting a window on hover instead of
reusing activate with a configure flag.  Once we finish the xdg-shell
changes, we'll have an 'active' surface state, that we can use for this,
so let's revisit this when we land that.

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=73575
 https://bugs.freedesktop.org/show_bug.cgi?id=74221
 https://bugs.freedesktop.org/show_bug.cgi?id=74222
 ---
  desktop-shell/exposay.c |  8 +++
  desktop-shell/shell.c   | 56 
 +
  desktop-shell/shell.h   |  5 +
  3 files changed, 42 insertions(+), 27 deletions(-)
 
 diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
 index fe7a3a7..f09224f 100644
 --- a/desktop-shell/exposay.c
 +++ b/desktop-shell/exposay.c
 @@ -141,7 +141,7 @@ exposay_highlight_surface(struct desktop_shell *shell,
   shell-exposay.row_current = esurface-row;
   shell-exposay.column_current = esurface-column;
  
 - activate(shell, view-surface, shell-exposay.seat);
 + activate(shell, view-surface, shell-exposay.seat, false);
   shell-exposay.focus_current = view;
  }
  
 @@ -283,8 +283,6 @@ exposay_layout(struct desktop_shell *shell)
   if (shell-exposay.focus_current == esurface-view)
   highlight = esurface;
  
 - set_alpha_if_fullscreen(get_shell_surface(view-surface));
 -
   exposay_animate_in(esurface);
  
   i++;
 @@ -502,10 +500,10 @@ exposay_transition_inactive(struct desktop_shell 
 *shell, int switch_focus)
* to the new. */
   if (switch_focus  shell-exposay.focus_current)
   activate(shell, shell-exposay.focus_current-surface,
 -  shell-exposay.seat);
 +  shell-exposay.seat, true);
   else if (shell-exposay.focus_prev)
   activate(shell, shell-exposay.focus_prev-surface,
 -  shell-exposay.seat);
 +  shell-exposay.seat, true);
  
   wl_list_for_each(esurface, shell-exposay.surface_list, link)
   exposay_animate_out(esurface);
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 3087042..a8a0537 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -173,6 +173,7 @@ struct shell_surface {
   struct {
   bool maximized;
   bool fullscreen;
 + bool lowered; /* fullscreen but lowered, see 
 lower_fullscreen_layer() */
   bool relative;
   } state, next_state; /* surface states */
   bool state_changed;
 @@ -223,13 +224,6 @@ struct shell_seat {
   } popup_grab;
  };
  
 -void
 -set_alpha_if_fullscreen(struct shell_surface *shsurf)
 -{
 - if (shsurf  shsurf-state.fullscreen)
 - shsurf-fullscreen.black_view-alpha = 0.25;
 -}
 -
  static struct desktop_shell *
  shell_surface_get_shell(struct shell_surface *shsurf);
  
 @@ -611,7 +605,7 @@ focus_state_surface_destroy(struct wl_listener *listener, 
 void *data)
   shell = state-seat-compositor-shell_interface.shell;
   if (next) {
   state-keyboard_focus = NULL;
 - activate(shell, next, state-seat);
 + activate(shell, next, state-seat, true);
   } else {
   if (shell-focus_animation_type == ANIMATION_DIM_LAYER) {
   if (state-ws-focus_animation)
 @@ -1762,10 +1756,10 @@ busy_cursor_grab_button(struct weston_pointer_grab 
 *base,
   struct weston_seat *seat = grab-grab.pointer-seat;
  
   if (shsurf  button == BTN_LEFT  state) {
 - activate(shsurf-shell, shsurf-surface, seat);
 + activate(shsurf-shell, shsurf-surface, seat, true);
   surface_move(shsurf, seat);
   } else if (shsurf  button == BTN_RIGHT  state) {
 - activate(shsurf-shell, shsurf-surface, seat);
 + activate(shsurf-shell, shsurf-surface, seat, true);
   surface_rotate(shsurf, seat);
   }
  }
 @@ -2036,7 +2030,7 @@ 

Re: [PATCH] desktop-shell: Properly handle seat hotplugging

2014-04-29 Thread Kristian Høgsberg
On Mon, Apr 21, 2014 at 07:42:58PM -0500, Jason Ekstrand wrote:
 Previously, desktop-shell would only create its internal shell_seat object
 for each seat available when the desktop-shell module is loaded.  This is a
 problem any time seats are created dynamically.  In particular, the Wayland
 and RDP backends create seats on an as-needed basis and they weren't
 getting picked up proprely by desktop-shell.
 
 This fixes bug #77649

Thanks Jason, that's better.  Patch committed.

Kristian

 ---
  desktop-shell/shell.c | 84 
 +++
  desktop-shell/shell.h |  1 +
  2 files changed, 53 insertions(+), 32 deletions(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 0e4329b..ac03a15 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -211,6 +211,10 @@ struct shell_seat {
   struct wl_listener seat_destroy_listener;
   struct weston_surface *focused_surface;
  
 + struct wl_listener caps_changed_listener;
 + struct wl_listener pointer_focus_listener;
 + struct wl_listener keyboard_focus_listener;
 +
   struct {
   struct weston_pointer_grab grab;
   struct wl_list surfaces_list;
 @@ -1918,19 +1922,6 @@ handle_pointer_focus(struct wl_listener *listener, 
 void *data)
  }
  
  static void
 -create_pointer_focus_listener(struct weston_seat *seat)
 -{
 - struct wl_listener *listener;
 -
 - if (!seat-pointer)
 - return;
 -
 - listener = malloc(sizeof *listener);
 - listener-notify = handle_pointer_focus;
 - wl_signal_add(seat-pointer-focus_signal, listener);
 -}
 -
 -static void
  shell_surface_lose_keyboard_focus(struct shell_surface *shsurf)
  {
   if (--shsurf-focus_count == 0)
 @@ -1968,19 +1959,6 @@ handle_keyboard_focus(struct wl_listener *listener, 
 void *data)
  }
  
  static void
 -create_keyboard_focus_listener(struct weston_seat *seat)
 -{
 - struct wl_listener *listener;
 -
 - if (!seat-keyboard)
 - return;
 -
 - listener = malloc(sizeof *listener);
 - listener-notify = handle_keyboard_focus;
 - wl_signal_add(seat-keyboard-focus_signal, listener);
 -}
 -
 -static void
  shell_client_pong(struct shell_client *sc, uint32_t serial)
  {
   if (sc-ping_serial != serial)
 @@ -2771,6 +2749,30 @@ destroy_shell_seat(struct wl_listener *listener, void 
 *data)
   free(shseat);
  }
  
 +static void
 +shell_seat_caps_changed(struct wl_listener *listener, void *data)
 +{
 + struct shell_seat *seat;
 +
 + seat = container_of(listener, struct shell_seat, caps_changed_listener);
 +
 + if (seat-seat-keyboard 
 + wl_list_empty(seat-keyboard_focus_listener.link)) {
 + wl_signal_add(seat-seat-keyboard-focus_signal,
 +   seat-keyboard_focus_listener);
 + } else if (!seat-seat-keyboard) {
 + wl_list_init(seat-keyboard_focus_listener.link);
 + }
 +
 + if (seat-seat-pointer 
 + wl_list_empty(seat-pointer_focus_listener.link)) {
 + wl_signal_add(seat-seat-pointer-focus_signal,
 +   seat-pointer_focus_listener);
 + } else if (!seat-seat-pointer) {
 + wl_list_init(seat-pointer_focus_listener.link);
 + }
 +}
 +
  static struct shell_seat *
  create_shell_seat(struct weston_seat *seat)
  {
 @@ -2789,6 +2791,17 @@ create_shell_seat(struct weston_seat *seat)
   wl_signal_add(seat-destroy_signal,
 shseat-seat_destroy_listener);
  
 + shseat-keyboard_focus_listener.notify = handle_keyboard_focus;
 + wl_list_init(shseat-keyboard_focus_listener.link);
 +
 + shseat-pointer_focus_listener.notify = handle_pointer_focus;
 + wl_list_init(shseat-pointer_focus_listener.link);
 +
 + shseat-caps_changed_listener.notify = shell_seat_caps_changed;
 + wl_signal_add(seat-updated_caps_signal,
 +   shseat-caps_changed_listener);
 + shell_seat_caps_changed(shseat-caps_changed_listener, NULL);
 +
   return shseat;
  }
  
 @@ -2798,8 +2811,7 @@ get_shell_seat(struct weston_seat *seat)
   struct wl_listener *listener;
  
   listener = wl_signal_get(seat-destroy_signal, destroy_shell_seat);
 - if (listener == NULL)
 - return create_shell_seat(seat);
 + assert(listener != NULL);
  
   return container_of(listener,
   struct shell_seat, seat_destroy_listener);
 @@ -5916,6 +5928,14 @@ shell_add_bindings(struct weston_compositor *ec, 
 struct desktop_shell *shell)
 debug_binding, shell);
  }
  
 +static void
 +handle_seat_created(struct wl_listener *listener, void *data)
 +{
 + struct weston_seat *seat = data;
 +
 + create_shell_seat(seat);
 +}
 +
  WL_EXPORT int
  module_init(struct weston_compositor *ec,
   int *argc, char *argv[])
 @@ -6015,10 +6035,10 @@ module_init(struct weston_compositor *ec,
   shell-screensaver.timer =
  

Re: [PATCH 1/3] Check zalloc return for out of memory situation

2014-04-25 Thread Kristian Høgsberg
On Mon, Apr 21, 2014 at 11:51:02PM +, Bryce W. Harrington wrote:
 Most zalloc calls in weston are checked, this fixes a handful that were
 being ignored.  As found by `grep -EIsr [^x]zalloc\( . -A1`

Thanks Bryce, applied with once change as mentioned below.

Kristian

 Signed-off-by: Bryce Harrington b.harring...@samsung.com
 ---
  src/compositor-wayland.c |6 ++
  src/libinput-seat.c  |2 +-
  src/screen-share.c   |8 +++-
  src/screenshooter.c  |   33 -
  src/udev-seat.c  |2 +-
  5 files changed, 35 insertions(+), 16 deletions(-)
 
 diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
 index f35db9c..67f15be 100644
 --- a/src/compositor-wayland.c
 +++ b/src/compositor-wayland.c
 @@ -256,6 +256,12 @@ wayland_output_get_shm_buffer(struct wayland_output 
 *output)
   }
  
   sb = zalloc(sizeof *sb);
 + if (sb == NULL) {
 + weston_log(could not zalloc %ld memory for sb: %m\n, sizeof 
 *sb);
 + close(fd);
 + free(data);
 + return NULL;
 + }
  
   sb-output = output;
   wl_list_init(sb-free_link);
 diff --git a/src/libinput-seat.c b/src/libinput-seat.c
 index b6adc76..b2090fa 100644
 --- a/src/libinput-seat.c
 +++ b/src/libinput-seat.c
 @@ -313,9 +313,9 @@ udev_seat_create(struct udev_input *input, const char 
 *seat_name)
   struct udev_seat *seat;
  
   seat = zalloc(sizeof *seat);
 -
   if (!seat)
   return NULL;
 +
   weston_seat_init(seat-base, c, seat_name);
   seat-base.led_update = udev_seat_led_update;
  
 diff --git a/src/screen-share.c b/src/screen-share.c
 index 5de20be..924672e 100644
 --- a/src/screen-share.c
 +++ b/src/screen-share.c
 @@ -433,12 +433,18 @@ shared_output_get_shm_buffer(struct shared_output *so)
  
   data = mmap(NULL, height * stride, PROT_READ | PROT_WRITE, MAP_SHARED, 
 fd, 0);
   if (data == MAP_FAILED) {
 - weston_log(mmap: %m);
 + weston_log(could not mmap %d memory for data: %m\n, height * 
 stride);
   close(fd);
   return NULL;
   }
  
   sb = zalloc(sizeof *sb);
 + if (sb == NULL) {
 + weston_log(could not zalloc %d memory for sb: %m\n, sizeof 
 *sb);
 + close(fd);
 + free(data);

data was mmapped, I fixed this to use munmap instead.

 + return NULL;
 + }
  
   sb-output = so;
   wl_list_init(sb-free_link);
 diff --git a/src/screenshooter.c b/src/screenshooter.c
 index 02146c8..369e920 100644
 --- a/src/screenshooter.c
 +++ b/src/screenshooter.c
 @@ -450,6 +450,17 @@ weston_recorder_frame_notify(struct wl_listener 
 *listener, void *data)
  }
  
  static void
 +weston_recorder_free(struct weston_recorder *recorder)
 +{
 + if (recorder == NULL)
 + return;
 + free(recorder-rect);
 + free(recorder-tmpbuf);
 + free(recorder-frame);
 + free(recorder);
 +}
 +
 +static void
  weston_recorder_create(struct weston_output *output, const char *filename)
  {
   struct weston_compositor *compositor = output-compositor;
 @@ -461,7 +472,6 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)
   do_yflip = !!(compositor-capabilities  WESTON_CAP_CAPTURE_YFLIP);
  
   recorder = malloc(sizeof *recorder);
 -
   if (recorder == NULL) {
   weston_log(%s: out of memory\n, __func__);
   return;
 @@ -476,6 +486,12 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)
   recorder-destroying = 0;
   recorder-output = output;
  
 + if ((recorder-frame == NULL) || (recorder-rect == NULL)) {
 + weston_log(%s: out of memory\n, __func__);
 + weston_recorder_free(recorder);
 + return;
 + }
 +
   if (do_yflip)
   recorder-tmpbuf = NULL;
   else
 @@ -493,10 +509,7 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)
   break;
   default:
   weston_log(unknown recorder format\n);
 - free(recorder-rect);
 - free(recorder-tmpbuf);
 - free(recorder-frame);
 - free(recorder);
 + weston_recorder_free(recorder);
   return;
   }
  
 @@ -505,10 +518,7 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)
  
   if (recorder-fd  0) {
   weston_log(problem opening output file %s: %m\n, filename);
 - free(recorder-rect);
 - free(recorder-tmpbuf);
 - free(recorder-frame);
 - free(recorder);
 + weston_recorder_free(recorder);
   return;
   }
  
 @@ -527,11 +537,8 @@ weston_recorder_destroy(struct weston_recorder *recorder)
  {
   wl_list_remove(recorder-frame_listener.link);
   close(recorder-fd);
 - free(recorder-tmpbuf);
 - free(recorder-frame);
 - 

Re: [PATCH 2/3] xwayland: Check zalloc return for out of memory situation

2014-04-25 Thread Kristian Høgsberg
On Mon, Apr 21, 2014 at 11:51:03PM +, Bryce W. Harrington wrote:
 
 Signed-off-by: Bryce Harrington b.harring...@samsung.com
 ---

Applied, thanks.

Kristian

  xwayland/launcher.c |2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/xwayland/launcher.c b/xwayland/launcher.c
 index ac692de..70703a4 100644
 --- a/xwayland/launcher.c
 +++ b/xwayland/launcher.c
 @@ -348,6 +348,8 @@ module_init(struct weston_compositor *compositor,
   char lockfile[256], display_name[8];
  
   wxs = zalloc(sizeof *wxs);
 + if (wxs == NULL)
 + return -1;
   wxs-process.cleanup = weston_xserver_cleanup;
   wxs-wl_display = display;
   wxs-compositor = compositor;
 -- 
 1.7.9.5
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/3] Check zalloc return for out of memory situation

2014-04-25 Thread Kristian Høgsberg
On Fri, Apr 25, 2014 at 1:18 PM, Kristian Høgsberg hoegsb...@gmail.com wrote:
 On Mon, Apr 21, 2014 at 11:51:02PM +, Bryce W. Harrington wrote:
 Most zalloc calls in weston are checked, this fixes a handful that were
 being ignored.  As found by `grep -EIsr [^x]zalloc\( . -A1`

 Thanks Bryce, applied with once change as mentioned below.

 Kristian

 Signed-off-by: Bryce Harrington b.harring...@samsung.com
 ---
  src/compositor-wayland.c |6 ++
  src/libinput-seat.c  |2 +-
  src/screen-share.c   |8 +++-
  src/screenshooter.c  |   33 -
  src/udev-seat.c  |2 +-
  5 files changed, 35 insertions(+), 16 deletions(-)

 diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
 index f35db9c..67f15be 100644
 --- a/src/compositor-wayland.c
 +++ b/src/compositor-wayland.c
 @@ -256,6 +256,12 @@ wayland_output_get_shm_buffer(struct wayland_output 
 *output)
   }

   sb = zalloc(sizeof *sb);
 + if (sb == NULL) {
 + weston_log(could not zalloc %ld memory for sb: %m\n, sizeof 
 *sb);
 + close(fd);
 + free(data);
 + return NULL;
 + }

   sb-output = output;
   wl_list_init(sb-free_link);
 diff --git a/src/libinput-seat.c b/src/libinput-seat.c
 index b6adc76..b2090fa 100644
 --- a/src/libinput-seat.c
 +++ b/src/libinput-seat.c
 @@ -313,9 +313,9 @@ udev_seat_create(struct udev_input *input, const char 
 *seat_name)
   struct udev_seat *seat;

   seat = zalloc(sizeof *seat);
 -
   if (!seat)
   return NULL;
 +
   weston_seat_init(seat-base, c, seat_name);
   seat-base.led_update = udev_seat_led_update;

 diff --git a/src/screen-share.c b/src/screen-share.c
 index 5de20be..924672e 100644
 --- a/src/screen-share.c
 +++ b/src/screen-share.c
 @@ -433,12 +433,18 @@ shared_output_get_shm_buffer(struct shared_output *so)

   data = mmap(NULL, height * stride, PROT_READ | PROT_WRITE, MAP_SHARED, 
 fd, 0);
   if (data == MAP_FAILED) {
 - weston_log(mmap: %m);
 + weston_log(could not mmap %d memory for data: %m\n, height * 
 stride);
   close(fd);
   return NULL;
   }

   sb = zalloc(sizeof *sb);
 + if (sb == NULL) {
 + weston_log(could not zalloc %d memory for sb: %m\n, sizeof 
 *sb);
 + close(fd);
 + free(data);

 data was mmapped, I fixed this to use munmap instead.

And this was already fixed by Hardenings patch, so I left the
screen-share.c part out.

Kristian


 + return NULL;
 + }

   sb-output = so;
   wl_list_init(sb-free_link);
 diff --git a/src/screenshooter.c b/src/screenshooter.c
 index 02146c8..369e920 100644
 --- a/src/screenshooter.c
 +++ b/src/screenshooter.c
 @@ -450,6 +450,17 @@ weston_recorder_frame_notify(struct wl_listener 
 *listener, void *data)
  }

  static void
 +weston_recorder_free(struct weston_recorder *recorder)
 +{
 + if (recorder == NULL)
 + return;
 + free(recorder-rect);
 + free(recorder-tmpbuf);
 + free(recorder-frame);
 + free(recorder);
 +}
 +
 +static void
  weston_recorder_create(struct weston_output *output, const char *filename)
  {
   struct weston_compositor *compositor = output-compositor;
 @@ -461,7 +472,6 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)
   do_yflip = !!(compositor-capabilities  WESTON_CAP_CAPTURE_YFLIP);

   recorder = malloc(sizeof *recorder);
 -
   if (recorder == NULL) {
   weston_log(%s: out of memory\n, __func__);
   return;
 @@ -476,6 +486,12 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)
   recorder-destroying = 0;
   recorder-output = output;

 + if ((recorder-frame == NULL) || (recorder-rect == NULL)) {
 + weston_log(%s: out of memory\n, __func__);
 + weston_recorder_free(recorder);
 + return;
 + }
 +
   if (do_yflip)
   recorder-tmpbuf = NULL;
   else
 @@ -493,10 +509,7 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)
   break;
   default:
   weston_log(unknown recorder format\n);
 - free(recorder-rect);
 - free(recorder-tmpbuf);
 - free(recorder-frame);
 - free(recorder);
 + weston_recorder_free(recorder);
   return;
   }

 @@ -505,10 +518,7 @@ weston_recorder_create(struct weston_output *output, 
 const char *filename)

   if (recorder-fd  0) {
   weston_log(problem opening output file %s: %m\n, filename);
 - free(recorder-rect);
 - free(recorder-tmpbuf);
 - free(recorder-frame);
 - free(recorder);
 + weston_recorder_free(recorder);
   return;
   }

 @@ -527,11 +537,8 @@ weston_recorder_destroy(struct weston_recorder

Re: [PATCH] Use the correct width/height when transforming surfaces with viewports.

2014-04-25 Thread Kristian Høgsberg
On Tue, Apr 22, 2014 at 09:51:53AM +0300, Pekka Paalanen wrote:
 On Mon, 21 Apr 2014 20:56:46 -0500
 Jason Ekstrand ja...@jlekstrand.net wrote:
 
  Previously, because of the wrong width/height,
  weston_surface_to_buffer_* would return the wrong values when
  wl_viewport was used in combination with wl_surface.set_buffer_transform.
  
  Signed-off-by: Jason Ekstrand ja...@jlekstrand.net

Committed this one and the pixman-renderer, with Pekkas Reviewed-by added.

Kristian

  ---
   src/compositor.c | 6 --
   1 file changed, 4 insertions(+), 2 deletions(-)
  
  diff --git a/src/compositor.c b/src/compositor.c
  index a298fb8..342e5e4 100644
  --- a/src/compositor.c
  +++ b/src/compositor.c
  @@ -675,7 +675,8 @@ weston_surface_to_buffer_float(struct weston_surface 
  *surface,
  /* first transform coordinates if the scaler is set */
  scaler_surface_to_buffer(surface, sx, sy, bx, by);
   
  -   weston_transformed_coord(surface-width, surface-height,
  +   weston_transformed_coord(surface-width_from_buffer,
  +surface-height_from_buffer,
   vp-buffer.transform, vp-buffer.scale,
   *bx, *by, bx, by);
   }
  @@ -709,7 +710,8 @@ weston_surface_to_buffer_rect(struct weston_surface 
  *surface,
  rect.x2 = floorf(xf);
  rect.y2 = floorf(yf);
   
  -   return weston_transformed_rect(surface-width, surface-height,
  +   return weston_transformed_rect(surface-width_from_buffer,
  +  surface-height_from_buffer,
 vp-buffer.transform, vp-buffer.scale,
 rect);
   }
 
 Hi Jason,
 
 good catch, this looks correct.
 
 
 Thanks,
 pq
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] clients/window: Don't remove the touch listener on a frame event

2014-04-25 Thread Kristian Høgsberg
On Wed, Apr 23, 2014 at 06:02:47PM +0100, Neil Roberts wrote:
 It looks like the handler for frame events from the wl_touch interface for
 widgets may have been erroneously copied from the cancel handler so that it
 removes all handlers as they are processed. I don't think this makes much 
 sense
 for the frame event. This was stopping the panel icons from being pushable 
 with
 touch events when using libinput since commit 1679f232e541489e. All that 
 commit
 does it make it start sending the frame events.

Yeah, that doesn't look right, patch applied.

Kristian

 ---
  clients/window.c | 3 ---
  1 file changed, 3 deletions(-)
 
 diff --git a/clients/window.c b/clients/window.c
 index e770a04..e2f7010 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -3065,9 +3065,6 @@ touch_handle_frame(void *data, struct wl_touch 
 *wl_touch)
   if (tp-widget-touch_frame_handler)
   (*tp-widget-touch_frame_handler)(tp-widget, input, 
  
 tp-widget-user_data);
 -
 - wl_list_remove(tp-link);
 - free(tp);
   }
  }
  
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] Simply the matrix calculation for zooming

2014-04-25 Thread Kristian Høgsberg
On Fri, Apr 25, 2014 at 01:19:37PM +0100, Neil Roberts wrote:
 In order to apply the zoom transformation to the output matrix, Weston was
 doing the following:
 
 • Create a temporary matrix to hold the translation
 • Invert the translation matrix using weston_matrix_invert into
   another temporary matrix
 • Scale that matrix by the scale factor
 • Multiply the current matrix with the temporary matrix
 
 Using weston_matrix_invert to invert a translation matrix is over the top.
 Instead we can just negate the values we pass to weston_matrix_translate.
 Matrix multiplication is associative so creating a temporary matrix to hold 
 the
 scale and translation transform should be equivalent to just applying them
 directly to the output matrix.

Heh, nice clean up, that always looked like it was too complicated for its
own good.  Patch applied.

Kristian

 ---
  src/compositor.c | 13 -
  1 file changed, 4 insertions(+), 9 deletions(-)
 
 diff --git a/src/compositor.c b/src/compositor.c
 index fd2decb..f836cf7 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -3186,8 +3186,6 @@ WL_EXPORT void
  weston_output_update_matrix(struct weston_output *output)
  {
   float magnification;
 - struct weston_matrix camera;
 - struct weston_matrix modelview;
  
   weston_matrix_init(output-matrix);
   weston_matrix_translate(output-matrix,
 @@ -3202,14 +3200,11 @@ weston_output_update_matrix(struct weston_output 
 *output)
  
   if (output-zoom.active) {
   magnification = 1 / (1 - output-zoom.spring_z.current);
 - weston_matrix_init(camera);
 - weston_matrix_init(modelview);
   weston_output_update_zoom(output);
 - weston_matrix_translate(camera, output-zoom.trans_x,
 - -output-zoom.trans_y, 0);
 - weston_matrix_invert(modelview, camera);
 - weston_matrix_scale(modelview, magnification, magnification, 
 1.0);
 - weston_matrix_multiply(output-matrix, modelview);
 + weston_matrix_translate(output-matrix, -output-zoom.trans_x,
 + output-zoom.trans_y, 0);
 + weston_matrix_scale(output-matrix, magnification,
 + magnification, 1.0);
   }
  
   output-dirty = 0;
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] Use non-blocking timerfd to prevent blocking when updating timer event sources

2014-04-25 Thread Kristian Høgsberg
On Fri, Apr 25, 2014 at 03:00:54PM +0100, Andrew Wedgbury wrote:
 This implements a simple fix for the blocking problem that occurs when 
 updating a timer event source after the timer expires, but before its 
 callback is dispatched. This can happen when another event happens during the
 same epoll wakeup as the timer event, and causes the read() call in 
 wl_event_source_timer_dispatch() to block for the updated duration of the 
 timer.
 
 We never want this read() call to block, so I believe it makes sense for the
 timerfd to be non-blocking, and we simply ignore the case where the read fails
 with EAGAIN. We still report all other errors as before, and still ignore the
 actual value read from the socket.
 
 With this change, the event_loop_timer_updates unit test case I submitted
 previously now passes, and weston appears to work as before.

Thanks, Andrew, good test case and analysis and I agree with the fix.
Test case and fix committed.

Kristian

 
 ---
  src/event-loop.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/src/event-loop.c b/src/event-loop.c
 index d323601..1046600 100644
 --- a/src/event-loop.c
 +++ b/src/event-loop.c
 @@ -173,7 +173,7 @@ wl_event_source_timer_dispatch(struct wl_event_source 
 *source,
   int len;
  
   len = read(source-fd, expires, sizeof expires);
 - if (len != sizeof expires)
 + if (!(len == -1  errno == EAGAIN)  len != sizeof expires)
   /* Is there anything we can do here?  Will this ever happen? */
   fprintf(stderr, timerfd read error: %m\n);
  
 @@ -196,7 +196,8 @@ wl_event_loop_add_timer(struct wl_event_loop *loop,
   return NULL;
  
   source-base.interface = timer_source_interface;
 - source-base.fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC);
 + source-base.fd = timerfd_create(CLOCK_MONOTONIC,
 +  
 TFD_CLOEXEC | TFD_NONBLOCK);
   source-func = func;
  
   return add_source(loop, source-base, WL_EVENT_READABLE, data);
 -- 
 1.9.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-drm: Fix crash when setting up seat constrained by an output

2014-04-21 Thread Kristian Høgsberg
On Thu, Apr 17, 2014 at 01:08:45PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 Commit 58e15865 changed the parameters for udev_get_seat_by_name() to
 receive a struct udev_input. However, when this gets called from
 create_output_from_connector() during initialization, the input struct
 is not yet initialized, leading to a crash. Previously, that function
 would take only a pointer to the compositor.
 
 This patch fixes the crash by initializing input before creating any
 outputs.

Thanks, that makes sense.  Patch applied.

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=77503
 ---
  src/compositor-drm.c | 15 ---
  1 file changed, 8 insertions(+), 7 deletions(-)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 3c15ec3..9a4b311 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -2783,9 +2783,15 @@ drm_compositor_create(struct wl_display *display,
   wl_list_init(ec-sprite_list);
   create_sprites(ec);
  
 + if (udev_input_init(ec-input,
 + ec-base, ec-udev, param-seat_id)  0) {
 + weston_log(failed to create input devices\n);
 + goto err_sprite;
 + }
 +
   if (create_outputs(ec, param-connector, drm_device)  0) {
   weston_log(failed to create output for %s\n, path);
 - goto err_sprite;
 + goto err_udev_input;
   }
  
   /* A this point we have some idea of whether or not we have a working
 @@ -2795,12 +2801,6 @@ drm_compositor_create(struct wl_display *display,
  
   path = NULL;
  
 - if (udev_input_init(ec-input,
 - ec-base, ec-udev, param-seat_id)  0) {
 - weston_log(failed to create input devices\n);
 - goto err_sprite;
 - }
 -
   loop = wl_display_get_event_loop(ec-base.wl_display);
   ec-drm_source =
   wl_event_loop_add_fd(loop, ec-drm.fd,
 @@ -2843,6 +2843,7 @@ err_udev_monitor:
   udev_monitor_unref(ec-udev_monitor);
  err_drm_source:
   wl_event_source_remove(ec-drm_source);
 +err_udev_input:
   udev_input_destroy(ec-input);
  err_sprite:
   ec-base.renderer-destroy(ec-base);
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] shell: display the input panel on the active output

2014-04-21 Thread Kristian Høgsberg
On Thu, Apr 17, 2014 at 02:04:32PM +0200, Manuel Bachmann wrote:
 We now dynamically move the input panel (i.e. virtual
 keyboard) surface to the output containing the currently
 focused surface.

That works, but it does seem like we're missing a link from the
input panel surface to the input context it comes from.  That might
be a problem with multi-seat on-screen keyboard situations, but fixing
it requires wl_input_panel protocol changes.  Let stick with this for now.

Kristian

 
 Signed-off-by: Manuel Bachmann manuel.bachm...@open.eurogiciel.org
 ---
  desktop-shell/input-panel.c |   14 ++
  1 file changed, 14 insertions(+)
 
 diff --git a/desktop-shell/input-panel.c b/desktop-shell/input-panel.c
 index 12fe686..d5e7d71 100644
 --- a/desktop-shell/input-panel.c
 +++ b/desktop-shell/input-panel.c
 @@ -54,6 +54,9 @@ show_input_panels(struct wl_listener *listener, void *data)
   container_of(listener, struct desktop_shell,
show_input_panel_listener);
   struct input_panel_surface *ipsurf, *next;
 + struct weston_seat *seat;
 + struct weston_surface *focus;
 + float x, y;
  
   shell-text_input.surface = (struct weston_surface*)data;
  
 @@ -70,6 +73,17 @@ show_input_panels(struct wl_listener *listener, void *data)
 shell-input_panel.surfaces, link) {
   if (ipsurf-surface-width == 0)
   continue;
 +
 + wl_list_for_each(seat, shell-compositor-seat_list, link) {
 + if (!seat-keyboard)
 + continue;
 + focus = 
 weston_surface_get_main_surface(seat-keyboard-focus);
 + ipsurf-output = focus-output;
 + x = ipsurf-output-x + (ipsurf-output-width - 
 ipsurf-surface-width) / 2;
 + y = ipsurf-output-y + ipsurf-output-height - 
 ipsurf-surface-height;
 + weston_view_set_position(ipsurf-view, x, y);
 + }
 +
   wl_list_insert(shell-input_panel_layer.view_list,
  ipsurf-view-layer_link);
   weston_view_geometry_dirty(ipsurf-view);
 -- 
 1.7.10.4
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston v2 0/5] Input bug fixes

2014-04-21 Thread Kristian Høgsberg
On Thu, Apr 17, 2014 at 07:53:21AM -0700, U. Artie Eoff wrote:
 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77578
 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77577
 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77341
 Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=77576

Thanks Artie, all good fixes, all applied.

Kristian

 U. Artie Eoff (5):
   libinput-seat: redirect libinput log to weston log
   libinput-seat: allow setting libinput log priority in weston
   libinput-device: break after LIBINPUT_EVENT_TOUCH_UP
   input: fix input device map to output if it doesn't exist.
   seat: don't break in notify_output_create
 
  src/evdev.c   |  5 +
  src/libinput-device.c |  6 ++
  src/libinput-seat.c   | 21 +++--
  src/udev-seat.c   |  5 +++--
  4 files changed, 33 insertions(+), 4 deletions(-)
 
 -- 
 1.8.5.3
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH wayland] connection: Don't write past the end of the connection buffer

2014-04-21 Thread Kristian Høgsberg
On Thu, Apr 17, 2014 at 06:20:37PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 If a message was too big to fit in the connection buffer, the code
 in wl_buffer_put would just write past the end of it.
 
 I haven't seen any real world use case that would trigger this bug, but
 it was possible to trigger it by sending a long enough string to the
 wl_data_source.offer request.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=69267

Right, that looks fine.  I've been debating whether we should allow
arbitrary size strings, but I think it's reasonable to cap the size.
If you're doing a protocol where a string my exceed the protocol buffer
size you should be using mmap buffers instead.  The protocol was not
designed for bulk data transfer.

Kristian

 ---
  src/connection.c| 25 +
  tests/connection-test.c | 37 +
  2 files changed, 54 insertions(+), 8 deletions(-)
 
 diff --git a/src/connection.c b/src/connection.c
 index 40a2182..63b0592 100644
 --- a/src/connection.c
 +++ b/src/connection.c
 @@ -61,11 +61,18 @@ struct wl_connection {
   int want_flush;
  };
  
 -static void
 +static int
  wl_buffer_put(struct wl_buffer *b, const void *data, size_t count)
  {
   uint32_t head, size;
  
 + if (count  sizeof(b-data)) {
 + wl_log(Data too big for buffer (%d  %d).\n,
 +count, sizeof(b-data));
 + errno = E2BIG;
 + return -1;
 + }
 +
   head = MASK(b-head);
   if (head + count = sizeof b-data) {
   memcpy(b-data + head, data, count);
 @@ -76,6 +83,8 @@ wl_buffer_put(struct wl_buffer *b, const void *data, size_t 
 count)
   }
  
   b-head += count;
 +
 + return 0;
  }
  
  static void
 @@ -243,8 +252,8 @@ decode_cmsg(struct wl_buffer *buffer, struct msghdr *msg)
   size /= sizeof(int32_t);
   for (i = 0; i  size; i++)
   close(((int*)CMSG_DATA(cmsg))[i]);
 - } else {
 - wl_buffer_put(buffer, CMSG_DATA(cmsg), size);
 + } else if (wl_buffer_put(buffer, CMSG_DATA(cmsg), size)  0) {
 + return -1;
   }
   }
  
 @@ -350,7 +359,9 @@ wl_connection_write(struct wl_connection *connection,
   return -1;
   }
  
 - wl_buffer_put(connection-out, data, count);
 + if (wl_buffer_put(connection-out, data, count)  0)
 + return -1;
 +
   connection-want_flush = 1;
  
   return 0;
 @@ -367,7 +378,7 @@ wl_connection_queue(struct wl_connection *connection,
   return -1;
   }
  
 - wl_buffer_put(connection-out, data, count);
 + return wl_buffer_put(connection-out, data, count);
  
   return 0;
  }
 @@ -394,9 +405,7 @@ wl_connection_put_fd(struct wl_connection *connection, 
 int32_t fd)
   return -1;
   }
  
 - wl_buffer_put(connection-fds_out, fd, sizeof fd);
 -
 - return 0;
 + return wl_buffer_put(connection-fds_out, fd, sizeof fd);
  }
  
  const char *
 diff --git a/tests/connection-test.c b/tests/connection-test.c
 index 52d235d..1213875 100644
 --- a/tests/connection-test.c
 +++ b/tests/connection-test.c
 @@ -235,6 +235,27 @@ expected_fail_marshal(int expected_error, const char 
 *format, ...)
   assert(errno == expected_error);
  }
  
 +static void
 +expected_fail_marshal_send(struct marshal_data *data, int expected_error,
 +const char *format, ...)
 +{
 + struct wl_closure *closure;
 + static const uint32_t opcode = ;
 + static struct wl_object sender = { NULL, NULL, 1234 };
 + struct wl_message message = { test, format, NULL };
 + va_list ap;
 +
 + va_start(ap, format);
 + closure = wl_closure_vmarshal(sender, opcode, ap, message);
 + va_end(ap);
 +
 + assert(closure);
 + assert(wl_closure_send(closure, data-write_connection)  0);
 + assert(errno == expected_error);
 +
 + wl_closure_destroy(closure);
 +}
 +
  TEST(connection_marshal_nullables)
  {
   struct marshal_data data;
 @@ -490,6 +511,22 @@ TEST(connection_marshal_alot)
   release_marshal_data(data);
  }
  
 +TEST(connection_marshal_too_big)
 +{
 + struct marshal_data data;
 + char *big_string = malloc(5000);
 +
 + memset(big_string, ' ', 4999);
 + big_string[4999] = '\0';
 +
 + setup_marshal_data(data);
 +
 + expected_fail_marshal_send(data, E2BIG, s, big_string);
 +
 + release_marshal_data(data);
 + free(big_string);
 +}
 +
  static void
  marshal_helper(const char *format, void *handler, ...)
  {
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___

Re: [PATCH] editor: react on Enter, Tab, and Up-Down arrow keys

2014-04-21 Thread Kristian Høgsberg
On Fri, Apr 18, 2014 at 12:52:03PM +0200, Manuel Bachmann wrote:
 This fixes :
 https://bugs.freedesktop.org/show_bug.cgi?id=77496
 

Yup, the patch looks good, thanks Manuel.

Kristian

 Regards,
 Manuel
 
 
 2014-04-18 12:50 GMT+02:00 Manuel Bachmann 
 manuel.bachm...@open.eurogiciel.org:
 
  The editor will now insert new lines and tabulations when
  pressing the corresponding keys on the virtual keyboard.
 
  The Up and Down arrows can be used to navigate through
  lines.
 
  Signed-off-by: Manuel Bachmann manuel.bachm...@open.eurogiciel.org
  ---
   clients/editor.c |   97
  --
   1 file changed, 87 insertions(+), 10 deletions(-)
 
  diff --git a/clients/editor.c b/clients/editor.c
  index 76e2346..4c5c427 100644
  --- a/clients/editor.c
  +++ b/clients/editor.c
  @@ -110,6 +110,47 @@ utf8_next_char(const char *p)
  return NULL;
   }
 
  +static void
  +move_up(const char *p, uint32_t *cursor)
  +{
  +   const char *posr, *posr_i;
  +   char text[16];
  +
  +   xkb_keysym_to_utf8(XKB_KEY_Return, text, sizeof(text));
  +
  +   posr = strstr(p, text);
  +   while (posr) {
  +   if (*cursor  (unsigned)(posr-p)) {
  +   posr_i = strstr(posr+1, text);
  +   if (!posr_i || !(*cursor  (unsigned)(posr_i-p))) {
  +   *cursor = posr-p;
  +   break;
  +   }
  +   posr = posr_i;
  +   } else {
  +   break;
  +   }
  +   }
  +}
  +
  +static void
  +move_down(const char *p, uint32_t *cursor)
  +{
  +   const char *posr;
  +   char text[16];
  +
  +   xkb_keysym_to_utf8(XKB_KEY_Return, text, sizeof(text));
  +
  +   posr = strstr(p, text);
  +   while (posr) {
  +   if (*cursor = (unsigned)(posr-p)) {
  +   *cursor = posr-p + 1;
  +   break;
  +   }
  +   posr = strstr(posr+1, text);
  +   }
  +}
  +
   static void text_entry_redraw_handler(struct widget *widget, void *data);
   static void text_entry_button_handler(struct widget *widget,
struct input *input, uint32_t time,
  @@ -374,6 +415,23 @@ text_input_keysym(void *data,
  return;
  }
 
  +   if (key == XKB_KEY_Up ||
  +   key == XKB_KEY_Down) {
  +   if (state != WL_KEYBOARD_KEY_STATE_RELEASED)
  +   return;
  +
  +   if (key == XKB_KEY_Up)
  +   move_up(entry-text, entry-cursor);
  +   else
  +   move_down(entry-text, entry-cursor);
  +
  +   if (!(modifiers  entry-keysym.shift_mask))
  +   entry-anchor = entry-cursor;
  +   widget_schedule_redraw(entry-widget);
  +
  +   return;
  +   }
  +
  if (key == XKB_KEY_BackSpace) {
  const char *start, *end;
 
  @@ -395,17 +453,20 @@ text_input_keysym(void *data,
  return;
  }
 
  -   switch (key) {
  -   case XKB_KEY_Tab:
  -   key_label = Tab;
  -   break;
  -   case XKB_KEY_KP_Enter:
  -   case XKB_KEY_Return:
  -   key_label = Enter;
  -   break;
  -   }
  +   if (key == XKB_KEY_Tab ||
  +   key == XKB_KEY_KP_Enter ||
  +   key == XKB_KEY_Return) {
  +   char text[16];
  +
  +   if (state != WL_KEYBOARD_KEY_STATE_RELEASED)
  +   return;
  +
  +   xkb_keysym_to_utf8(key, text, sizeof(text));
 
  -   fprintf(stderr, %s key was %s.\n, key_label, state_label);
  +   text_entry_insert_at_cursor(entry, text, 0, 0);
  +
  +   return;
  +   }
   }
 
   static void
  @@ -1208,6 +1269,22 @@ key_handler(struct window *window,
  widget_schedule_redraw(entry-widget);
  }
  break;
  +   case XKB_KEY_Up:
  +   text_entry_commit_and_reset(entry);
  +
  +   move_up(entry-text, entry-cursor);
  +   if (!(input_get_modifiers(input)  MOD_SHIFT_MASK))
  +   entry-anchor = entry-cursor;
  +   widget_schedule_redraw(entry-widget);
  +   break;
  +   case XKB_KEY_Down:
  +   text_entry_commit_and_reset(entry);
  +
  +   move_down(entry-text, entry-cursor);
  +   if (!(input_get_modifiers(input)  MOD_SHIFT_MASK))
  +   entry-anchor = entry-cursor;
  +   widget_schedule_redraw(entry-widget);
  +   break;

Re: [PATCH weston] weston-info: fix log message typo

2014-04-21 Thread Kristian Høgsberg
On Fri, Apr 18, 2014 at 09:30:07AM -0700, U. Artie Eoff wrote:
 Signed-off-by: U. Artie Eoff ullysses.a.e...@intel.com
 ---

Committed, thanks.

Kristian

  clients/weston-info.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/clients/weston-info.c b/clients/weston-info.c
 index 147dc48..df869e3 100644
 --- a/clients/weston-info.c
 +++ b/clients/weston-info.c
 @@ -225,7 +225,7 @@ print_output_info(void *data)
  output-geometry.physical_height);
   printf(\tmake: '%s', model: '%s',\n,
  output-geometry.make, output-geometry.model);
 - printf(\tsubpixel_orientation: %s, output_tranform: %s,\n,
 + printf(\tsubpixel_orientation: %s, output_transform: %s,\n,
  subpixel_orientation, transform);
  
   wl_list_for_each(mode, output-modes, link) {
 -- 
 1.8.5.3
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCHv2 weston] gl-renderer: Remove gl_renderer_interface from gl-renderer.h

2014-04-21 Thread Kristian Høgsberg
On Thu, Apr 10, 2014 at 08:05:17PM +0200, John Kåre Alsaker wrote:
 The rationale here is, that this line would create an instance of
 gl_renderer_interface in every compilation unit that included
 gl-renderer.h. This is not necessary, and it can actually be harmful by
 masking the real exported gl_renderer_interface symbol, if you added
 another compilation unit to gl-renderer.so, causing a runtime failure in
 loading it.
 
 gl-renderer.c already creates the exported symbol.

Committed, thanks.

Kristian 
 ---
  src/gl-renderer.h | 1 -
  1 file changed, 1 deletion(-)
 
 diff --git a/src/gl-renderer.h b/src/gl-renderer.h
 index db42f6c..6cd5f54 100644
 --- a/src/gl-renderer.h
 +++ b/src/gl-renderer.h
 @@ -101,4 +101,3 @@ struct gl_renderer_interface {
   void (*print_egl_error_state)(void);
  };
  
 -struct gl_renderer_interface gl_renderer_interface;
 -- 
 1.9.1
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] Check malloc result

2014-04-21 Thread Kristian Høgsberg
On Fri, Apr 11, 2014 at 09:06:58AM +0200, Hardening wrote:
 This patch checks malloc was successfull and release resources if it
 wasn't.

Commmitted, thanks.

Kristian

 ---
  src/screen-share.c | 17 +++--
  1 file changed, 15 insertions(+), 2 deletions(-)
 
 diff --git a/src/screen-share.c b/src/screen-share.c
 index 5de20be..d3e3f05 100644
 --- a/src/screen-share.c
 +++ b/src/screen-share.c
 @@ -434,11 +434,12 @@ shared_output_get_shm_buffer(struct shared_output *so)
   data = mmap(NULL, height * stride, PROT_READ | PROT_WRITE, MAP_SHARED, 
 fd, 0);
   if (data == MAP_FAILED) {
   weston_log(mmap: %m);
 - close(fd);
 - return NULL;
 + goto out_close;
   }
  
   sb = zalloc(sizeof *sb);
 + if (!sb)
 + goto out_unmap;
  
   sb-output = so;
   wl_list_init(sb-free_link);
 @@ -457,14 +458,26 @@ shared_output_get_shm_buffer(struct shared_output *so)
   wl_buffer_add_listener(sb-buffer, buffer_listener, sb);
   wl_shm_pool_destroy(pool);
   close(fd);
 + fd = -1;
  
   memset(data, 0, sb-size);
  
   sb-pm_image =
   pixman_image_create_bits(PIXMAN_a8r8g8b8, width, height,
(uint32_t *)data, stride);
 + if (!sb-pm_image)
 + goto out_pixman_error;
  
   return sb;
 +
 +out_pixman_error:
 + pixman_region32_fini(sb-damage);
 +out_unmap:
 + munmap(data, height * stride);
 +out_close:
 + if (fd != -1)
 + close(fd);
 + return NULL;
  }
  
  static void
 -- 
 1.8.1.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] compositor-drm: Pass the right stride to the vaapi recorder

2014-04-16 Thread Kristian Høgsberg
On Wed, Apr 16, 2014 at 12:05:12PM +0300, Ander Conselvan de Oliveira wrote:
 It takes the stride in bytes, not pixels. The bug was hidden when using
 va intel-driver 1.2.1 because it would ignore the stride from user and
 set the surface state in a wrong way.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=77495

Thanks, applied.

Kristian

 ---
  src/compositor-drm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/compositor-drm.c b/src/compositor-drm.c
 index 3c15ec3..5765b40 100644
 --- a/src/compositor-drm.c
 +++ b/src/compositor-drm.c
 @@ -2576,7 +2576,7 @@ recorder_frame_notify(struct wl_listener *listener, 
 void *data)
   return;
   }
  
 - vaapi_recorder_frame(output-recorder, fd, output-current-stride / 4);
 + vaapi_recorder_frame(output-recorder, fd, output-current-stride);
  }
  
  static void *
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] desktop-shell: Get rid of get_shell_client

2014-04-16 Thread Kristian Høgsberg
On Wed, Apr 16, 2014 at 09:12:10PM -0500, Jason Ekstrand wrote:
 We now carry the shell_client around with each shell_surface.  This is much
 more reliable than tacitly assuming that there is only one wl_shell or
 xdg_shell instance bound to a particular wl_client.  In particular, weston
 would crash when a client bound to both wl_shell and xdg_shell even if it
 only ever used one of them.

That makes sense.  Is there a bugzilla bug that this fixes or did you just
hit that crasher locally?  Patch applied.

Kristian

 Signed-off-by: Jason Ekstrand ja...@jlekstrand.net
 ---
  desktop-shell/shell.c | 54 
 +--
  1 file changed, 22 insertions(+), 32 deletions(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 59fa99c..0e4329b 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -63,6 +63,8 @@ enum shell_surface_type {
   SHELL_SURFACE_XWAYLAND
  };
  
 +struct shell_client;
 +
  /*
   * Surface stacking and ordering.
   *
 @@ -104,6 +106,7 @@ enum shell_surface_type {
  struct shell_surface {
   struct wl_resource *resource;
   struct wl_signal destroy_signal;
 + struct shell_client *owner;
  
   struct weston_surface *surface;
   struct weston_view *view;
 @@ -233,9 +236,6 @@ set_alpha_if_fullscreen(struct shell_surface *shsurf)
   shsurf-fullscreen.black_view-alpha = 0.25;
  }
  
 -static struct shell_client *
 -get_shell_client(struct wl_client *client);
 -
  static struct desktop_shell *
  shell_surface_get_shell(struct shell_surface *shsurf);
  
 @@ -1859,12 +1859,10 @@ static void
  handle_xdg_ping(struct shell_surface *shsurf, uint32_t serial)
  {
   struct weston_compositor *compositor = shsurf-shell-compositor;
 - struct wl_client *client = wl_resource_get_client(shsurf-resource);
 - struct shell_client *sc;
 + struct shell_client *sc = shsurf-owner;
   struct wl_event_loop *loop;
   static const int ping_timeout = 200;
  
 - sc = get_shell_client(client);
   if (sc-unresponsive) {
   xdg_ping_timeout_handler(sc);
   return;
 @@ -1982,19 +1980,6 @@ create_keyboard_focus_listener(struct weston_seat 
 *seat)
   wl_signal_add(seat-keyboard-focus_signal, listener);
  }
  
 -static struct shell_client *
 -get_shell_client(struct wl_client *client)
 -{
 - struct wl_listener *listener;
 -
 - listener = wl_client_get_destroy_listener(client,
 -   handle_shell_client_destroy);
 - if (listener == NULL)
 - return NULL;
 -
 - return container_of(listener, struct shell_client, destroy_listener);
 -}
 -
  static void
  shell_client_pong(struct shell_client *sc, uint32_t serial)
  {
 @@ -2015,9 +2000,9 @@ static void
  shell_surface_pong(struct wl_client *client,
  struct wl_resource *resource, uint32_t serial)
  {
 - struct shell_client *sc;
 + struct shell_surface *shsurf = wl_resource_get_user_data(resource);
 + struct shell_client *sc = shsurf-owner;
  
 - sc = get_shell_client(client);
   shell_client_pong(sc, serial);
  }
  
 @@ -3105,7 +3090,8 @@ get_shell_surface(struct weston_surface *surface)
  }
  
  static struct shell_surface *
 -create_common_surface(void *shell, struct weston_surface *surface,
 +create_common_surface(struct shell_client *owner, void *shell,
 +   struct weston_surface *surface,
 const struct weston_shell_client *client)
  {
   struct shell_surface *shsurf;
 @@ -3134,6 +3120,7 @@ create_common_surface(void *shell, struct 
 weston_surface *surface,
   shsurf-resource_destroy_listener.notify = handle_resource_destroy;
   wl_resource_add_destroy_listener(surface-resource,
shsurf-resource_destroy_listener);
 + shsurf-owner = owner;
  
   shsurf-shell = (struct desktop_shell *) shell;
   shsurf-unresponsive = 0;
 @@ -3176,7 +3163,7 @@ static struct shell_surface *
  create_shell_surface(void *shell, struct weston_surface *surface,
const struct weston_shell_client *client)
  {
 - return create_common_surface(shell, surface, client);
 + return create_common_surface(NULL, shell, surface, client);
  }
  
  static struct weston_view *
 @@ -3193,7 +3180,8 @@ shell_get_shell_surface(struct wl_client *client,
  {
   struct weston_surface *surface =
   wl_resource_get_user_data(surface_resource);
 - struct desktop_shell *shell = wl_resource_get_user_data(resource);
 + struct shell_client *sc = wl_resource_get_user_data(resource);
 + struct desktop_shell *shell = sc-shell;
   struct shell_surface *shsurf;
  
   if (get_shell_surface(surface)) {
 @@ -3203,7 +3191,7 @@ shell_get_shell_surface(struct wl_client *client,
   return;
   }
  
 - shsurf = create_shell_surface(shell, surface, shell_client);
 + shsurf = 

Re: [PATCH v2] tests: fix bad-buffer-test

2014-04-16 Thread Kristian Høgsberg
On Sat, Apr 12, 2014 at 12:19:28PM +0300, Pekka Paalanen wrote:
 On Fri, 11 Apr 2014 11:48:55 +0200
 Marek Chalupa mchqwe...@gmail.com wrote:
 
  bad-buffer-test is FAIL_TEST and every assert() (or even SIGSEGV signal)
  make it pass. It shouldn't be so for example when assert() is invoked
  when a client couldn't connect to display.
  
  Make sure that only relevant asserts make the test pass
  and the other make it fail (by returning 0)
  ---
   tests/bad-buffer-test.c | 30 ++
   1 file changed, 30 insertions(+)
  
  diff --git a/tests/bad-buffer-test.c b/tests/bad-buffer-test.c
  index 6eae313..86e0299 100644
  --- a/tests/bad-buffer-test.c
  +++ b/tests/bad-buffer-test.c
  @@ -25,6 +25,8 @@
   
   #include unistd.h
   #include sys/types.h
  +#include stdio.h
  +#include signal.h
   
   #include ../shared/os-compatibility.h
   #include weston-test-client-helper.h
  @@ -58,12 +60,34 @@ create_bad_shm_buffer(struct client *client, int width, 
  int height)
  return buffer;
   }
   
  +static void sighandler(int signum)
  +{
  +   /* this means failure */
  +   exit(0);
  +}
  +
   FAIL_TEST(test_truncated_shm_file)
   {
  struct client *client;
  struct wl_buffer *bad_buffer;
  struct wl_surface *surface;
  int frame;
  +   struct sigaction new_action, old_action;
  +
  +   /* until the bad buffer creation, the SIGABRT or SIGSEGV signals
  +* should fail the test. That means returning 0 */
  +   new_action.sa_handler = sighandler;
  +   sigemptyset(new_action.sa_mask);
  +   new_action.sa_flags = 0;
  +
  +   if (sigaction(SIGSEGV, new_action, NULL) != 0) {
  +   fprintf(stderr, Failed setting new sigaction for SIGSEGV);
  +   exit(0);
  +   }
  +   if (sigaction(SIGABRT, new_action, old_action) != 0) {
  +   fprintf(stderr, Failed setting new sigaction for SIGABRT);
  +   exit(0);
  +   }
   
  client = client_create(46, 76, 111, 134);
  assert(client);
  @@ -71,6 +95,12 @@ FAIL_TEST(test_truncated_shm_file)
   
  bad_buffer = create_bad_shm_buffer(client, 200, 200);
   
  +   /* from this point we expect the signal */
  +   if (sigaction(SIGABRT, old_action, NULL) != 0) {
  +   fprintf(stderr, Failed setting old sigaction for SIGABRT);
  +   exit(0);
  +   }
  +
  wl_surface_attach(surface, bad_buffer, 0, 0);
  wl_surface_damage(surface, 0, 0, 200, 200);
  frame_callback_set(surface, frame);
  -- 
  1.8.4.2
 
 Looks fine to me. Let's get this in and fix the test suite properly
 later.

Thanks for reviewing Pekka, patch applied.

Kristian

 
 
 Thanks,
 pq
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] keyboard: add the missing symbols layout, fix arabic layout

2014-04-16 Thread Kristian Høgsberg
On Tue, Apr 15, 2014 at 12:38:31PM +0200, Manuel Bachmann wrote:
 The symbols modifier key of weston-keyboard is no longer
 inactive, but will provide an additionnal layout with
 numerals and special characters.
 
 Fix the Arabic keyboard, which was rendering out of the
 bounds, and now use the Arabic IBM PC keyboard as a
 reference for its standard and new symbols layouts.

That looks good, thanks.  I added the link to bug 71757 which this fixes
to the commit message.

Kristian

 Signed-off-by: Manuel Bachmann manuel.bachm...@open.eurogiciel.org
 ---
  clients/keyboard.c |  280 
 +---
  1 file changed, 159 insertions(+), 121 deletions(-)
 
 diff --git a/clients/keyboard.c b/clients/keyboard.c
 index 11fe21d..cd1ad58 100644
 --- a/clients/keyboard.c
 +++ b/clients/keyboard.c
 @@ -75,7 +75,8 @@ struct key {
   enum key_type key_type;
  
   char *label;
 - char *alt;
 + char *uppercase;
 + char *symbol;
  
   unsigned int width;
  };
 @@ -92,120 +93,119 @@ struct layout {
  };
  
  static const struct key normal_keys[] = {
 - { keytype_default, q, Q, 1},
 - { keytype_default, w, W, 1},
 - { keytype_default, e, E, 1},
 - { keytype_default, r, R, 1},
 - { keytype_default, t, T, 1},
 - { keytype_default, y, Y, 1},
 - { keytype_default, u, U, 1},
 - { keytype_default, i, I, 1},
 - { keytype_default, o, O, 1},
 - { keytype_default, p, P, 1},
 - { keytype_backspace, --, --, 2},
 -
 - { keytype_tab, -|, -|, 1},
 - { keytype_default, a, A, 1},
 - { keytype_default, s, S, 1},
 - { keytype_default, d, D, 1},
 - { keytype_default, f, F, 1},
 - { keytype_default, g, G, 1},
 - { keytype_default, h, H, 1},
 - { keytype_default, j, J, 1},
 - { keytype_default, k, K, 1},
 - { keytype_default, l, L, 1},
 - { keytype_enter, Enter, Enter, 2},
 -
 - { keytype_switch, ABC, abc, 2},
 - { keytype_default, z, Z, 1},
 - { keytype_default, x, X, 1},
 - { keytype_default, c, C, 1},
 - { keytype_default, v, V, 1},
 - { keytype_default, b, B, 1},
 - { keytype_default, n, N, 1},
 - { keytype_default, m, M, 1},
 - { keytype_default, ,, ,, 1},
 - { keytype_default, ., ., 1},
 - { keytype_switch, ABC, abc, 1},
 -
 - { keytype_symbols, ?123, ?123, 1},
 - { keytype_space, , , 5},
 - { keytype_arrow_up, /\\, /\\, 1},
 - { keytype_arrow_left, , , 1},
 - { keytype_arrow_right, , , 1},
 - { keytype_arrow_down, \\/, \\/, 1},
 - { keytype_style, , , 2}
 + { keytype_default, q, Q, 1, 1},
 + { keytype_default, w, W, 2, 1},
 + { keytype_default, e, E, 3, 1},
 + { keytype_default, r, R, 4, 1},
 + { keytype_default, t, T, 5, 1},
 + { keytype_default, y, Y, 6, 1},
 + { keytype_default, u, U, 7, 1},
 + { keytype_default, i, I, 8, 1},
 + { keytype_default, o, O, 9, 1},
 + { keytype_default, p, P, 0, 1},
 + { keytype_backspace, --, --, --, 2},
 +
 + { keytype_tab, -|, -|, -|, 1},
 + { keytype_default, a, A, -, 1},
 + { keytype_default, s, S, @, 1},
 + { keytype_default, d, D, *, 1},
 + { keytype_default, f, F, ^, 1},
 + { keytype_default, g, G, :, 1},
 + { keytype_default, h, H, ;, 1},
 + { keytype_default, j, J, (, 1},
 + { keytype_default, k, K, ), 1},
 + { keytype_default, l, L, ~, 1},
 + { keytype_enter, Enter, Enter, Enter, 2},
 +
 + { keytype_switch, ABC, abc, ABC, 2},
 + { keytype_default, z, Z, /, 1},
 + { keytype_default, x, X, \', 1},
 + { keytype_default, c, C, \, 1},
 + { keytype_default, v, V, +, 1},
 + { keytype_default, b, B, =, 1},
 + { keytype_default, n, N, ?, 1},
 + { keytype_default, m, M, !, 1},
 + { keytype_default, ,, ,, \\, 1},
 + { keytype_default, ., ., |, 1},
 + { keytype_switch, ABC, abc, ABC, 1},
 +
 + { keytype_symbols, ?123, ?123, abc, 1},
 + { keytype_space, , , , 5},
 + { keytype_arrow_up, /\\, /\\, /\\, 1},
 + { keytype_arrow_left, , , , 1},
 + { keytype_arrow_right, , , , 1},
 + { keytype_arrow_down, \\/, \\/, \\/, 1},
 + { keytype_style, , , , 2}
  };
  
  static const struct key numeric_keys[] = {
 - { keytype_default, 1, 1, 1},
 - { keytype_default, 2, 2, 1},
 - { keytype_default, 3, 3, 1},
 - { keytype_default, 4, 4, 1},
 - { keytype_default, 5, 5, 1},
 - { keytype_default, 6, 6, 1},
 - { keytype_default, 7, 7, 1},
 - { keytype_default, 8, 8, 1},
 - { keytype_default, 9, 9, 1},
 - { keytype_default, 0, 0, 1},
 - { keytype_backspace, --, --, 2},
 -
 - { keytype_space, , , 4},
 - { keytype_enter, Enter, Enter, 2},
 - { keytype_arrow_up, /\\, /\\, 1},
 - { keytype_arrow_left, , , 1},
 - { keytype_arrow_right, , , 1},
 - { keytype_arrow_down, \\/, \\/, 1},
 - { keytype_style, , , 2}
 + { keytype_default, 1, 1, 1, 1},
 + { keytype_default, 2, 2, 2, 1},
 + 

Re: [PATCH] gl-renderer: Fix a typo in the output_set_border description

2014-04-11 Thread Kristian Høgsberg
On Fri, Apr 11, 2014 at 03:42:59AM -0500, Jason Ekstrand wrote:
 Signed-off-by: Jason Ekstrand ja...@jlekstrand.net

Thanks, applied.

Kristian

 ---
  src/gl-renderer.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/src/gl-renderer.h b/src/gl-renderer.h
 index db42f6c..bdfe93e 100644
 --- a/src/gl-renderer.h
 +++ b/src/gl-renderer.h
 @@ -75,8 +75,8 @@ struct gl_renderer_interface {
* tightly packed.
*
* The top and bottom textures will extend over the sides to the
 -  * full width of the bordered window while.  The right and left
 -  * edges, however, will extend only to the top and bottom of the
 +  * full width of the bordered window.  The right and left edges,
 +  * however, will extend only to the top and bottom of the
* compositor surface.  This is demonstrated by the picture below:
*
* +---+
 -- 
 1.9.0
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 1/2] Reset focus on unknown seats when restoring focus state

2014-04-10 Thread Kristian Høgsberg
On Wed, Apr 09, 2014 at 04:33:31PM +0100, Neil Roberts wrote:
 The focus_state list on a workspace only contains entries for seats
 which have a keyboard focus on that workspace. For workspaces that
 have no surfaces the list will be empty. That means that when a
 workspace with no surfaces is switched to it would previously leave
 the keyboard focus unaffected and you could still type in the surface
 on the old workspace.
 
 This patch makes it instead reset the keyboard focus to NULL for seats
 without a focus_state. It does this by temporarily stealing the
 compositor's list of seats while it iterates the focus_states. After
 all of the focus states have been processed any seats remaining in
 this temporary list have their focus reset.

Yeah, that works, patch applied.  It feels a little dirty to modify
compositor-seat_list, but it certainly works.

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=73905
 ---
  desktop-shell/shell.c | 23 +++
  1 file changed, 23 insertions(+)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 466ea93..fa081f3 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -694,8 +694,20 @@ restore_focus_state(struct desktop_shell *shell, struct 
 workspace *ws)
  {
   struct focus_state *state, *next;
   struct weston_surface *surface;
 + struct wl_list pending_seat_list;
 + struct weston_seat *seat, *next_seat;
 +
 + /* Temporarily steal the list of seats so that we can keep
 +  * track of the seats we've already processed */
 + wl_list_init(pending_seat_list);
 + wl_list_insert_list(pending_seat_list, shell-compositor-seat_list);
 + wl_list_init(shell-compositor-seat_list);
  
   wl_list_for_each_safe(state, next, ws-focus_list, link) {
 + wl_list_remove(state-seat-link);
 + wl_list_insert(shell-compositor-seat_list,
 +state-seat-link);
 +
   if (state-seat-keyboard == NULL)
   continue;
  
 @@ -703,6 +715,17 @@ restore_focus_state(struct desktop_shell *shell, struct 
 workspace *ws)
  
   weston_keyboard_set_focus(state-seat-keyboard, surface);
   }
 +
 + /* For any remaining seats that we don't have a focus state
 +  * for we'll reset the keyboard focus to NULL */
 + wl_list_for_each_safe(seat, next_seat, pending_seat_list, link) {
 + wl_list_insert(shell-compositor-seat_list, seat-link);
 +
 + if (state-seat-keyboard == NULL)
 + continue;
 +
 + weston_keyboard_set_focus(seat-keyboard, NULL);
 + }
  }
  
  static void
 -- 
 1.8.5.3
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 2/2] Reset the keyboard focus on all seats when the compositor is locked

2014-04-10 Thread Kristian Høgsberg
On Wed, Apr 09, 2014 at 04:33:32PM +0100, Neil Roberts wrote:
 Before commit 2f5faff7f9142 when the compositor is locked it would
 reset the keyboard focus on all of the seats as part of pushing the
 focus_state. This was removed because it now always keeps track of the
 focus_state in the workspace instead of waiting until the state is
 pushed. However this had the side effect that the active surface would
 retain focus when the compositor is locked. This patch just makes it
 explicitly set the keyboard focus to NULL on all of the seats when
 locking. This will be restored based on the workspace's state when
 unlocking.

Right, nice and simple.  Patch applied, thanks.

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=73905
 ---
  desktop-shell/shell.c | 18 ++
  1 file changed, 18 insertions(+)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index fa081f3..b19965f 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -4498,6 +4498,19 @@ touch_to_activate_binding(struct weston_seat *seat, 
 uint32_t time, void *data)
  }
  
  static void
 +unfocus_all_seats(struct desktop_shell *shell)
 +{
 + struct weston_seat *seat, *next;
 +
 + wl_list_for_each_safe(seat, next, shell-compositor-seat_list, link) {
 + if (seat-keyboard == NULL)
 + continue;
 +
 + weston_keyboard_set_focus(seat-keyboard, NULL);
 + }
 +}
 +
 +static void
  lock(struct desktop_shell *shell)
  {
   struct workspace *ws = get_current_workspace(shell);
 @@ -4523,6 +4536,11 @@ lock(struct desktop_shell *shell)
  
   launch_screensaver(shell);
  
 + /* Remove the keyboard focus on all seats. This will be
 +  * restored to the workspace's saved state via
 +  * restore_focus_state when the compositor is unlocked */
 + unfocus_all_seats(shell);
 +
   /* TODO: disable bindings that should not work while locked. */
  
   /* All this must be undone in resume_desktop(). */
 -- 
 1.8.5.3
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] shell: Disarm the screensaver timeout timer on terminate_screensaver()

2014-04-10 Thread Kristian Høgsberg
On Thu, Apr 10, 2014 at 02:49:35PM +0300, Ander Conselvan de Oliveira wrote:
 The timer was left running after the screensaver was terminated. When
 it triggered, a fade out that would in turn cause the screen to be
 locked was started. Since that could happen without the compositor
 emitting the idle signal, there would be no wake signal to make the
 shell show the lock screen, so the system was left unresponsive
 until the idle signal actually triggered.

Thanks, that makes sense.  This only triggers when we actually compile
and run the GL screensaver, right?

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=70923
 ---
  desktop-shell/shell.c | 6 ++
  1 file changed, 6 insertions(+)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 466ea93..09b992c 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -3715,6 +3715,12 @@ terminate_screensaver(struct desktop_shell *shell)
   if (shell-screensaver.process.pid == 0)
   return;
  
 + /* Disarm the screensaver timer, otherwise it may fire when the
 +  * compositor is not in the idle state. In that case, the screen will
 +  * be locked, but the wake_signal won't fire on user input, making the
 +  * system unresponsive. */
 + wl_event_source_timer_update(shell-screensaver.timer, 0);
 +
   kill(shell-screensaver.process.pid, SIGTERM);
  }
  
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] shell: Damage below child surfaces on move to different workspace

2014-04-10 Thread Kristian Høgsberg
On Thu, Apr 10, 2014 at 03:35:58PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 When moving from a surface from visible workspace to an invisible one
 via a popup menu, the area below the menu wouldn't be repainted.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=76973

Cool, that makes sense, fixes the problem here.

Kristian

 ---
  desktop-shell/shell.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 466ea93..b6dc975 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -2139,6 +2139,7 @@ shell_surface_update_child_surface_layers (struct 
 shell_surface *shsurf)
* stacked above shsurf. */
   wl_list_for_each_reverse(child, shsurf-children_list, children_link) {
   if (shsurf-view-layer_link.prev != child-view-layer_link) {
 + weston_view_damage_below(child-view);
   weston_view_geometry_dirty(child-view);
   wl_list_remove(child-view-layer_link);
   wl_list_insert(shsurf-view-layer_link.prev,
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] shell: Keep shsurf-fullscreen_output set after unset_fullscreen()

2014-04-10 Thread Kristian Høgsberg
On Thu, Apr 10, 2014 at 04:36:57PM +0300, Ander Conselvan de Oliveira wrote:
 When a fullscreen surface gets the maximized state, the function
 reset_surface_type() is called and that causes unset_fullscreen() to be
 called. That function would set the value of shsurf-fullscreen_output
 to NULL. However, since the surface still has the fullscreen state, it
 will be configured as a fullscreen surface again, and an attempt to
 access that field would cause the compositor to crash.
 
 Fix the crash by keeping the value of fullscreen_output around after
 unset_fullscreen(). This is safe since the value is only used when a
 surface has the fullscreen state and is replaced on a new request to
 make the surface fullscreen.
 
 https://bugs.freedesktop.org/show_bug.cgi?id=76867
 
 ---
 
 This fixes the crash, but perhaps a better fix would be to not call
 unset_fullscreen() if the surface still has the fullscreen state. I
 did this simpler fix for now, since I don't know all the intricate
 details of the state change logic.

Yup, I like this simpler fix.  We're still planning an change to the
surface state protocol, so let's just fix it the simplest way for now.

 Cheers,
 Ander
 
 ---
  desktop-shell/shell.c | 1 -
  1 file changed, 1 deletion(-)
 
 diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
 index 09b992c..0680dc1 100644
 --- a/desktop-shell/shell.c
 +++ b/desktop-shell/shell.c
 @@ -2313,7 +2313,6 @@ unset_fullscreen(struct shell_surface *shsurf)
   shell_surface_is_top_fullscreen(shsurf)) {
   restore_output_mode(shsurf-fullscreen_output);
   }
 - shsurf-fullscreen_output = NULL;
  
   shsurf-fullscreen.type = WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT;
   shsurf-fullscreen.framerate = 0;
 -- 
 1.8.3.2
 
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] gl-renderer: Remove gl_renderer_interface from gl-renderer.h

2014-04-10 Thread Kristian Høgsberg
On Thu, Apr 10, 2014 at 3:41 AM, Pekka Paalanen ppaala...@gmail.com wrote:
 On Tue,  8 Apr 2014 20:51:45 +0200
 John Kåre Alsaker john.kare.alsa...@gmail.com wrote:

 John, you forgot the commit message.

 ---
  src/gl-renderer.h | 1 -
  1 file changed, 1 deletion(-)

 diff --git a/src/gl-renderer.h b/src/gl-renderer.h
 index db42f6c..6cd5f54 100644
 --- a/src/gl-renderer.h
 +++ b/src/gl-renderer.h
 @@ -101,4 +101,3 @@ struct gl_renderer_interface {
   void (*print_egl_error_state)(void);
  };

 -struct gl_renderer_interface gl_renderer_interface;

 The rationale here is, that this line would create an instance of
 gl_renderer_interface in every compilation unit that included
 gl-renderer.h. This is not necessary, and it can actually be harmful by
 masking the real exported gl_renderer_interface symbol, if you added
 another compilation unit to gl-renderer.so, causing a runtime failure in
 loading it. (Which is how John found this.)

 gl-renderer.c already creates the exported symbol.

I don't think that was ever the intention, I think we just forgot an
extern there.  And now that we look it up using dlsym() we don't need
the forward declaration anymore.

Kristian


 Thanks,
 pq
 ___
 wayland-devel mailing list
 wayland-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


  1   2   3   4   5   6   7   8   9   10   >