Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces

2013-05-22 Thread Pekka Paalanen
On Mon, 20 May 2013 13:56:27 -0500
Jason Ekstrand ja...@jlekstrand.net wrote:

 On Mon, May 20, 2013 at 4:00 AM, Pekka Paalanen ppaala...@gmail.com wrote:
 
  On Thu, 16 May 2013 16:43:52 -0500
  Jason Ekstrand ja...@jlekstrand.net wrote:
 
   The point of this soi is to allow surfaces to render the same size on
   different density outputs.
 
  Are you serious? Really? Same size measured in meters?
 
 
 No, measured in inches. :-P
 
 Seriously though.  While we can't make it *exactly* the same on all your
 displays, we should be able to make it usably close.

I do not think that should be a goal here, on the core protocol level.
It's a can of worms, like you see from all fractional pixel problems
raised, which the current integer-only proposal does not have.

  I do not think that will ever work:
  http://blogs.gnome.org/danni/2011/12/15/more-on-dpi/
  and doing it via scaling is going to be worse.
 
 
 Yes, scaling looks bad.  I don't know that we can avoid it in all cases
 (see also the 200DPI and 300 DPI case).

Sorry, which email was this in?

  Going for the same size is a very different problem than just trying to
  get all apps readable by default. I'm not sure same size is a better
  goal than same look.
 
  And on a side note:
  http://web.archive.org/web/20120102153021/http://www.fooishbar.org/blog
 
 
 What I would like in the end is a per-output slider bar (or something of
 that ilk) that let's the user select the interface size on that output.
 Sure, they probably won't be able to select *any* resolution (the
 compositor may limit it to multiples of 24 dpi or something).  And they can
 certainly make an ugly set-up for themselves.  However, I want them to be
 able to make something more-or-less reasonable and I see no reason why the
 compositor shouldn't coordinate this and why this scale factor can't be
 used for that.

I think that is an orthogonal issue. That would be a DE thing, just
like choosing font sizes. Buffer_scale OTOH is a Wayland core feature,
and is best kept as simple as possible.

The slider would control window and widget sizes, while buffer_scale
only controls the resolution they are rendered in. Or...

 My primary concern is that integer multiples of 96 DPI isn't going to be
 enough granularity.  I don't know whether we can really accomplish a higher
 granularity in a reasonable way.

For the cases where buffer_scale cannot offer a usable resolution, we
can still fall back to arbitrary scaling in the compositor by
private surface or output transformations. That does not allow
pixel-accurate/high-resolution presentation of windows like
buffer_scale, but I believe is an acceptable compromise. Didn't OS X or
something do similar for the 1.5 factor? I recall someone mentioning
about that, but couldn't find it.

...or the slider could control buffer_scale and output scaling in
tandem, using buffer_scale for integer factors (which the GUI would
recommend), and realize non-integer factors by some combination of the
two.

Naturally the units in slider would be scaling factors, not DPI, since
DPI is meaningless to a user. I can imagine how hilarious it would be
to have Please, try to use integer multiples of 96 DPI for the best
performance and look in the GUI. ;-)


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


Re: [PATCH] Last updates for the RDP compositor

2013-05-22 Thread Pekka Paalanen
On Tue, 21 May 2013 23:53:53 +0200
Hardening rdp.eff...@gmail.com wrote:

 This patch fixes the compilation of the RDP compositor with the head of the
 FreeRDP project. It also brings the following improvements/fixes:
 * the fake seat as been dropped as now a compositor can be safely started
 without any seat
 * fixed a wrong initialisation of the NSC encoder context
 * the first screen update is now sent on postConnect, not on Synchronize 
 packets
 as not all clients send then (this is the case for the last version of 
 FreeRDP).
 In the specs, Synchronize packets are described as old artifacts that SHOULD 
 be
 ignored.
 * send frame markers when using raw surfaces
 * reworked raw surfaces sending so that the subtile and the image flip are 
 done
 in one step (instead of computing the subtile and then flip it)
 * we now send all the sub-rectangles instead of sending the full bounding box
 * the negociated size for the fragmentation buffer is honored when sending raw
 surfaces PDUs
 * always send using the preferred codec without caring about the size

Hi,

by the description, sounds like this patch should actually be split
into 8 separate patches, each doing one logical change. If you cannot
write a commit title, that identifies the exact changes a patch makes,
and instead you have to blurt out like lotsa changes or A, B, C, and
D, that's an indication for a need to split.

Granted, this patch is not huge, and the individual patches would be
tiny, but size is rarely a reason for a certain split or squash.

Just a thing worth keeping in mind.

A few nitpicks below, to show that I at least looked through this
patch. ;-)

 ---
  src/compositor-rdp.c | 184 
 ++-
  1 file changed, 108 insertions(+), 76 deletions(-)
 
 diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
 index 0dae963..7eec273 100644
 --- a/src/compositor-rdp.c
 +++ b/src/compositor-rdp.c
 @@ -59,7 +59,6 @@ struct rdp_output;
  
  struct rdp_compositor {
   struct weston_compositor base;
 - struct weston_seat main_seat;
  
   freerdp_listener *listener;
   struct wl_event_source *listener_events[MAX_FREERDP_FDS];
 @@ -133,8 +132,8 @@ rdp_peer_refresh_rfx(pixman_region32_t *damage, 
 pixman_image_t *image, freerdp_p
   SURFACE_BITS_COMMAND *cmd = update-surface_bits_command;
   RdpPeerContext *context = (RdpPeerContext *)peer-context;
  
 - stream_clear(context-encode_stream);
 - stream_set_pos(context-encode_stream, 0);
 + Stream_Clear(context-encode_stream);
 + Stream_SetPosition(context-encode_stream, 0);
  
   width = (damage-extents.x2 - damage-extents.x1);
   height = (damage-extents.y2 - damage-extents.y1);
 @@ -169,8 +168,8 @@ rdp_peer_refresh_rfx(pixman_region32_t *damage, 
 pixman_image_t *image, freerdp_p
   pixman_image_get_stride(image)
   );
  
 - cmd-bitmapDataLength = stream_get_length(context-encode_stream);
 - cmd-bitmapData = stream_get_head(context-encode_stream);
 + cmd-bitmapDataLength = Stream_GetPosition(context-encode_stream);
 + cmd-bitmapData = Stream_Buffer(context-encode_stream);
  
   update-SurfaceBits(update-context, cmd);
  }
 @@ -185,8 +184,8 @@ rdp_peer_refresh_nsc(pixman_region32_t *damage, 
 pixman_image_t *image, freerdp_p
   SURFACE_BITS_COMMAND *cmd = update-surface_bits_command;
   RdpPeerContext *context = (RdpPeerContext *)peer-context;
  
 - stream_clear(context-encode_stream);
 - stream_set_pos(context-encode_stream, 0);
 + Stream_Clear(context-encode_stream);
 + Stream_SetPosition(context-encode_stream, 0);
  
   width = (damage-extents.x2 - damage-extents.x1);
   height = (damage-extents.y2 - damage-extents.y1);
 @@ -206,42 +205,79 @@ rdp_peer_refresh_nsc(pixman_region32_t *damage, 
 pixman_image_t *image, freerdp_p
   nsc_compose_message(context-nsc_context, context-encode_stream, (BYTE 
 *)ptr,
   cmd-width, cmd-height,
   pixman_image_get_stride(image));
 - cmd-bitmapDataLength = stream_get_length(context-encode_stream);
 - cmd-bitmapData = stream_get_head(context-encode_stream);
 + cmd-bitmapDataLength = Stream_GetPosition(context-encode_stream);
 + cmd-bitmapData = Stream_Buffer(context-encode_stream);
   update-SurfaceBits(update-context, cmd);
  }
  
  static void
 +pixman_image_flipped_subrect(const pixman_box32_t *rect, pixman_image_t 
 *img, BYTE *dest) {
 + int stride = pixman_image_get_stride(img);
 + int h;
 + int toCopy = (rect-x2 - rect-x1) * 4;
 + int height = (rect-y2 - rect-y1);
 + const BYTE *src = (const BYTE *)pixman_image_get_data(img);
 + src += ((rect-y2-1) * stride) + (rect-x1 * 4);
 +
 + for(h = 0; h  height; h++, src -= stride, dest += toCopy)

Missing space.

 + memcpy(dest, src, toCopy);
 +}

I wonder if there was a pixman subrect copy function, that could
achieve the same, using negative 

[PATCH weston] window: avoid a gcc warning in buffer release handler

2013-05-22 Thread ppaalanen
From: Pekka Paalanen pekka.paala...@collabora.co.uk

Apparently some compilers complain about set but not used variables
'available' and 'bufs', but I don't get the warning. Still, separate the
debugging code from shm_surface_buffer_release(), so that we only
compute 'bufs' when it is printed. This should fix the warnings.

The debugging code now prints the shm_surface buffer state before and
after, instead of just after.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 clients/window.c | 48 +++-
 1 file changed, 31 insertions(+), 17 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 40c0ef4..627f1e8 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -420,7 +420,9 @@ enum window_location {
 
 static const cairo_user_data_key_t shm_surface_data_key;
 
-#if 0
+/* #define DEBUG */
+
+#ifdef DEBUG
 
 static void
 debug_print(void *proxy, int line, const char *func, const char *fmt, ...)
@@ -893,20 +895,43 @@ to_shm_surface(struct toysurface *base)
 }
 
 static void
+shm_surface_buffer_state_debug(struct shm_surface *surface, const char *msg)
+{
+#ifdef DEBUG
+   struct shm_surface_leaf *leaf;
+   char bufs[MAX_LEAVES + 1];
+   int i;
+
+   for (i = 0; i  MAX_LEAVES; i++) {
+   leaf = surface-leaf[i];
+
+   if (leaf-busy)
+   bufs[i] = 'b';
+   else if (leaf-cairo_surface)
+   bufs[i] = 'a';
+   else
+   bufs[i] = ' ';
+   }
+
+   bufs[MAX_LEAVES] = '\0';
+   DBG_OBJ(surface-surface, %s, leaves [%s]\n, msg, bufs);
+#endif
+}
+
+static void
 shm_surface_buffer_release(void *data, struct wl_buffer *buffer)
 {
struct shm_surface *surface = data;
struct shm_surface_leaf *leaf;
int i;
int free_found;
-   int available = MAX_LEAVES;
-   char bufs[MAX_LEAVES + 1];
+
+   shm_surface_buffer_state_debug(surface, buffer_release before);
 
for (i = 0; i  MAX_LEAVES; i++) {
leaf = surface-leaf[i];
if (leaf-data  leaf-data-buffer == buffer) {
leaf-busy = 0;
-   available = i;
break;
}
}
@@ -917,27 +942,16 @@ shm_surface_buffer_release(void *data, struct wl_buffer 
*buffer)
for (i = 0; i  MAX_LEAVES; i++) {
leaf = surface-leaf[i];
 
-   if (leaf-busy)
-   bufs[i] = 'b';
-   else if (leaf-cairo_surface)
-   bufs[i] = 'a';
-   else
-   bufs[i] = ' ';
-
if (!leaf-cairo_surface || leaf-busy)
continue;
 
if (!free_found)
free_found = 1;
-   else {
+   else
shm_surface_leaf_release(leaf);
-   bufs[i] = '*';
-   }
}
 
-   bufs[MAX_LEAVES] = '\0';
-   DBG_OBJ(surface-surface, leaf %d released, leaves [%s]\n,
-   available, bufs);
+   shm_surface_buffer_state_debug(surface, buffer_release  after);
 }
 
 static const struct wl_buffer_listener shm_surface_buffer_listener = {
-- 
1.8.1.5

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


Re: [RFC] libinputmapper: Input device configuration for graphic-servers

2013-05-22 Thread Peter Hutterer
On Wed, May 22, 2013 at 12:25:19AM -0400, Rick Yorgason wrote:
 On 2013-05-20 23:56, Peter Hutterer wrote:
 what I am wondering is whether that difference matters to the outside
 observer (i.e. the compositor). a gamepad and a joystick are both gaming
 devices and with the exception of the odd need to control the pointer it
 doesn't matter much which type they are.
 
 as for a game that would access the device - does it matter if the device is
 labelled gamepad or joystick? if it's a gaming device you have to look at
 the pysical properties anyway and decide which you use in what matter.
 
 That would seem to unnecessarily complicate things. Let's say you
 want to do something simple, like display a list of the devices
 plugged into the computer, with a graphic showing the device type.

 If you don't have separate gamepad and joystick types, you would
 need to use some heuristic to decide whether to show the gamepad or
 joystick graphic. Really, the device driver should be able to tell
 us what kind of device it considers itself.

you don't need to differ between gamepad and joystick for that. to take the
wacom example (again), we want those devices to show themselves with the
right graphics for the tablet series* - they're still all tablets as far as
compositors and clients are concerned.

so the driver that handles the device can provide the graphics. 
you could subgroup categories, or have a tag hierarchy to categorise
appropriately.  in any case,this is conflating the concept of a library to
map drivers to devices with a library to tag devices in a client-visible
way.

Cheers,
   Peter

* the OS X driver does that, and libwacom + latest GNOME too

 Granted, we can't do that right now, because the kernel doesn't
 expose device types, which is something that should probably be
 resolved regardless of what happens with libinputmapper.
 
 In the meantime, we can put the heuristic in libinputmapper, and if
 the kernel ever grows the ability to expose device types, we can
 remove the heuristic all together (or maybe demote it to a backup
 strategy).
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 1/2] protocol: Allow output changes to be treated atomically

2013-05-22 Thread Alexander Larsson
On mån, 2013-05-20 at 09:51 +0300, Pekka Paalanen wrote:
 On Thu, 16 May 2013 15:49:35 +0200
 al...@redhat.com wrote:
 
  From: Alexander Larsson al...@redhat.com
  
  This add a wl_output.done event which is send after every group
  of events caused by some property change. This allows clients to treat
  changes touching multiple events in an atomic fashion.
 
 Hi,
 
 why did you end up deciding that this is better than using the geometry
 event as the end signal?

Some other people wanted it. I don't know which is best, they are
essentially identical. Although one advantage of done is that it
allows us to extend e.g. the mode event also.



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


Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces

2013-05-22 Thread Alexander Larsson
On tis, 2013-05-21 at 20:57 +0300, Pekka Paalanen wrote:
 On Tue, 21 May 2013 08:35:53 -0700
 Bill Spitzak spit...@gmail.com wrote:

  This proposal does not actually restrict widget positions or line sizes, 
  since they are drawn by the client at buffer resolution. Although 
 
 No, but I expect the toolkits may.

Gtk very much will do this at least.

  annoying, the outside buffer size is not that limiting. The client can 
  just place a few transparent pixels along the edge to make it look like 
  it is any size.
  
  However it does restrict the positions of widgets that use subsurfaces.
  
  I see this as a serious problem and I'm not sure why you don't think it 
  is. It is an arbitrary artificial limit in the api that has nothing to 
  do with any hardware limits.
 
 It is a design decision with the least negative impact, and it is
 not serious. Sub-surfaces will not be that common, and they
 certainly will not be used for common widgets like buttons.

Yeah, this is a simple solution to an actual real-life problem that is
easy to implement (I've got weston and gtk+ mostly working). If you want
to do something very complicated then just don't use scaling and draw
however you want. We don't want to overcomplicate the normal case with
fractional complexity and extra coordinate spaces.

  The reason you want to position widgets at finer positions is so they 
  can be positioned evenly, and so they can be moved smoothly, and so they 
  can be perfectly aligned with hi-resolution graphics.
 
 But why? You have a real, compelling use case? Otherwise it just
 complicates things.

Exactly.

 A what? No way, buffer_scale is private to a surface, and does not
 affect any other surface, not even sub-surfaces. It is not
 inherited, that would be insane.

Yes, buffer_transform and buffer_scale only define how you map the
client supplied buffer pixels into the surface coordinates. It does not
really change the size of the surface or affect subsurfaces. (Well,
technically it does since we don't separatately specify the surface size
but derive it from the buffer and its transform, but after that the
surface is what it is in an abstract space).

 There is no compositor coordinate space in the protocol. There
 are only surface coordinates, and now to a small extent we are
 getting buffer coordinates.

Very small extent. I think the only place in the protocol where they are
used is when specifying the size of the surface.

   The x,y do not
   describe how the surface moves, they describe how pixel rows and
   columns are added or removed on the edges.
  
   No, it is in the surface coordinate system, like written in the patch.
  
  Then I would not describe it as pixel rows and columns added or removed 
  on the edges. If the scaler is set to 70/50 than a delta of -1,0 is 
  adding 1.4 pixels to the left edge of the buffer. I agree that having it 
  in the parent coordinates works otherwise.
 
 We use the units of pixels in the surface coordinate system, even
 if they do not correspond exactly to any real pixels like
 elements in a buffer or on screen.

Actually this is sort of a problem. Maybe the docs would be clearer if
we just used a different name for these? points?



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


Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces

2013-05-22 Thread Alexander Larsson
On mån, 2013-05-20 at 13:56 -0500, Jason Ekstrand wrote:
 On Mon, May 20, 2013 at 4:00 AM, Pekka Paalanen ppaala...@gmail.com
 wrote:
 On Thu, 16 May 2013 16:43:52 -0500
 Jason Ekstrand ja...@jlekstrand.net wrote:
 
  The point of this soi is to allow surfaces to render the
 same size on
  different density outputs.
 
 
 Are you serious? Really? Same size measured in meters?
 
 
 No, measured in inches. :-P
 
 
 Seriously though.  While we can't make it *exactly* the same on all
 your displays, we should be able to make it usably close.

Having the exact physical size (be it in inches or steradians) of a
window on two different monitors is *not* a goal of my work. Its already
the case that windows are different sizes on different monitor, and that
has been ok for users since the first a CRT was used with a computer.
People have been bikeshedding about solving this problem for ages, and
I'm not interested in that.

No, I have an *actual* problem, which is that its super hard to see or
hit widgets on a high dpi monitor, and a single DPI setting for the
whole desktop is a nonstarter since you may be using mixed monitors.
This is a practical problem I have on my pixel laptop and which will
only get more common as hw moves on. The solution required is not exact
size matches, but rather make it the same ballpark, which my proposal
solves in a very simple fashion.


 What I would like in the end is a per-output slider bar (or something
 of that ilk) that let's the user select the interface size on that
 output.  Sure, they probably won't be able to select *any* resolution
 (the compositor may limit it to multiples of 24 dpi or something).
 And they can certainly make an ugly set-up for themselves.  However, I
 want them to be able to make something more-or-less reasonable and I
 see no reason why the compositor shouldn't coordinate this and why
 this scale factor can't be used for that.

The compositor is free to scale the final result to any fraction it
wants, which will get you this kind of behavior. It will not be
perfect, but the other solution (adding complexity of fractional
surface sizes, multiple coordinate spaces, etc) also will also not look
very nice (i.e. widget clipping on fractional coordinates will look
ugly, non-integer-width lines will *never* look good, etc), and in fact,
internal details makes it unlikely that toolkits like Gtk will ever be
able to support fractional scaling, so it has little practical use.



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


Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces

2013-05-22 Thread Alexander Larsson
On ons, 2013-05-22 at 09:11 +0300, Pekka Paalanen wrote:
  
  What I would like in the end is a per-output slider bar (or something of
  that ilk) that let's the user select the interface size on that output.
  Sure, they probably won't be able to select *any* resolution (the
  compositor may limit it to multiples of 24 dpi or something).  And they can
  certainly make an ugly set-up for themselves.  However, I want them to be
  able to make something more-or-less reasonable and I see no reason why the
  compositor shouldn't coordinate this and why this scale factor can't be
  used for that.
 
 I think that is an orthogonal issue. That would be a DE thing, just
 like choosing font sizes. Buffer_scale OTOH is a Wayland core feature,
 and is best kept as simple as possible.

 The slider would control window and widget sizes, while buffer_scale
 only controls the resolution they are rendered in. Or...

This is doable, but slightly problematic as you would need a way to
coordinate between all clients how to combine these...

  My primary concern is that integer multiples of 96 DPI isn't going to be
  enough granularity.  I don't know whether we can really accomplish a higher
  granularity in a reasonable way.
 
 For the cases where buffer_scale cannot offer a usable resolution, we
 can still fall back to arbitrary scaling in the compositor by
 private surface or output transformations. That does not allow
 pixel-accurate/high-resolution presentation of windows like
 buffer_scale, but I believe is an acceptable compromise. Didn't OS X or
 something do similar for the 1.5 factor? I recall someone mentioning
 about that, but couldn't find it.

So, in practice I think this is the more reasonable way to do it, and it
is indeed how OSX does it. In some theoretical way doing it by drawing
at 2x and downscaling to 1.5x is looks worse, but neither is going to
look really good anyway, and the integer surface scaling makes the
implementation vastly simpler.

 Naturally the units in slider would be scaling factors, not DPI, since
 DPI is meaningless to a user. I can imagine how hilarious it would be
 to have Please, try to use integer multiples of 96 DPI for the best
 performance and look in the GUI. ;-)

I don't think a slider for scaling factor is the right UI at all. What
you want is to just list various resolutions and let the user pick
one. Some resolution are native, some are scaled by an integer and some
are scaled by an fraction. You want to somehow mark out in the UI that
some resolutions are worse than others, but otherwise this is
generally how most end user would think of this anyway.


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


Wayland surface units (Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces)

2013-05-22 Thread Pekka Paalanen
On Wed, 22 May 2013 10:12:00 +0200
Alexander Larsson al...@redhat.com wrote:

 On tis, 2013-05-21 at 20:57 +0300, Pekka Paalanen wrote:
 
  We use the units of pixels in the surface coordinate system, even
  if they do not correspond exactly to any real pixels like
  elements in a buffer or on screen.
 
 Actually this is sort of a problem. Maybe the docs would be clearer if
 we just used a different name for these? points?

That is a good idea, but choosing a name is hard. I think points will
get too easily confused with font sizes or the 1/72 inches unit and all
that mess.

Follow Android with dp?
http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

I'm not sure that is exactly the definition we want to use, with just
160 dpi changed to 96 dpi. I feel uneasy mentioning dpi at all. So
maybe not dp, then.

We need a name for the surface length unit, since the surface local
coordinate system is such a central concept in Wayland.

I just can't seem to come up with anything serious.
- wayland units, wu
- wayland pixels, wp, wpx
- surface units, su
- surface unit pixels, sux
- surface pixels, sp, spx
- wayland surface units, wsu
- wayland atomic units, wau
- pips, pip
ehhh...


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


Re: Wayland surface units (Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces)

2013-05-22 Thread Alexander Larsson
On ons, 2013-05-22 at 12:11 +0300, Pekka Paalanen wrote:
 On Wed, 22 May 2013 10:12:00 +0200
 Alexander Larsson al...@redhat.com wrote:
 
  On tis, 2013-05-21 at 20:57 +0300, Pekka Paalanen wrote:
  
   We use the units of pixels in the surface coordinate system, even
   if they do not correspond exactly to any real pixels like
   elements in a buffer or on screen.
  
  Actually this is sort of a problem. Maybe the docs would be clearer if
  we just used a different name for these? points?
 
 That is a good idea, but choosing a name is hard. I think points will
 get too easily confused with font sizes or the 1/72 inches unit and all
 that mess.
 
 Follow Android with dp?
 http://developer.android.com/guide/topics/resources/more-resources.html#Dimension
 
 I'm not sure that is exactly the definition we want to use, with just
 160 dpi changed to 96 dpi. I feel uneasy mentioning dpi at all. So
 maybe not dp, then.

Yeah, i'd rather have it disconnected from some physical notion of size.

 We need a name for the surface length unit, since the surface local
 coordinate system is such a central concept in Wayland.
 
 I just can't seem to come up with anything serious.
 - wayland units, wu
 - wayland pixels, wp, wpx
 - surface units, su
 - surface unit pixels, sux
 - surface pixels, sp, spx
 - wayland surface units, wsu
 - wayland atomic units, wau
 - pips, pip
 ehhh...

Yeah, names are hard. But sux is awesome!

Other alternatives:
- compositor units, cu
- pels, pel
- dots, dot
- surface element, surfel, sel

none of these are great either...







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


Re: Wayland surface units (Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces)

2013-05-22 Thread Alexander Larsson
On ons, 2013-05-22 at 11:42 +0200, Alexander Larsson wrote:
 On ons, 2013-05-22 at 12:11 +0300, Pekka Paalanen wrote:

  - wayland units, wu
  - wayland pixels, wp, wpx
  - surface units, su
  - surface unit pixels, sux
  - surface pixels, sp, spx
  - wayland surface units, wsu
  - wayland atomic units, wau
  - pips, pip
  ehhh...
 
 Yeah, names are hard. But sux is awesome!
 
 Other alternatives:
 - compositor units, cu
 - pels, pel
 - dots, dot
 - surface element, surfel, sel
 
 none of these are great either...

For the record, Microsoft uses DIP, for Device-independent-pixels, and
Apple uses Points for the non-hardware coordinates (in the app level
APIs).



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


Re: Wayland surface units (Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces)

2013-05-22 Thread Pekka Paalanen
On Wed, 22 May 2013 11:50:31 +0200
Alexander Larsson al...@redhat.com wrote:

 On ons, 2013-05-22 at 11:42 +0200, Alexander Larsson wrote:
  On ons, 2013-05-22 at 12:11 +0300, Pekka Paalanen wrote:
 
   - wayland units, wu
   - wayland pixels, wp, wpx
   - surface units, su
   - surface unit pixels, sux
   - surface pixels, sp, spx
   - wayland surface units, wsu
   - wayland atomic units, wau
   - pips, pip
   ehhh...
  
  Yeah, names are hard. But sux is awesome!
  
  Other alternatives:
  - compositor units, cu
  - pels, pel
  - dots, dot
  - surface element, surfel, sel
  
  none of these are great either...
 
 For the record, Microsoft uses DIP, for Device-independent-pixels, and
 Apple uses Points for the non-hardware coordinates (in the app level
 APIs).

And we have no well-known equivalent in the FOSS or Linux world?

DIP would sound fine otherwise, except Microsoft seems to tie it to the
physical units via dpi again. Meh.

pel sounds nice...


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


Re: Wayland surface units (Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces)

2013-05-22 Thread Alexander Larsson
On ons, 2013-05-22 at 13:01 +0300, Pekka Paalanen wrote:

  For the record, Microsoft uses DIP, for Device-independent-pixels, and
  Apple uses Points for the non-hardware coordinates (in the app level
  APIs).
 
 And we have no well-known equivalent in the FOSS or Linux world?

Not that I know of.

 DIP would sound fine otherwise, except Microsoft seems to tie it to the
 physical units via dpi again. Meh.
 
 pel sounds nice...

pel is from Picture ELement, and was historically used equivalently to
pixel. But pixel won that fight and nobody remembers pel. So, by
now we can probably use them as two not-quite-equivalent units without
risking confusion.



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


[PATCH 00/15] weston scaling support

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

This adds support to weston (X11 and DRM backends) for output
scale and buffer_scale. It also contains some work on the
example clients to make them support buffer scaling.

I think the support is fairly comprehensive, although I'm aware of
a few outstanding issues:

* The drm backend doesn't upscale pointers on the DRM backend
* There is no support in the desktop shell for setting up a higher resolution
  cursor image on scaled outputs
* I did not yet look at the screenshoter/read_pixels APIs

Overall I think the approach is working out well, but an obvious issue is how 
we handle
scaling wrt modes. I'll bring this up in another mail.

The series is also availible in the scale branch here: (eventually)
 http://cgit.freedesktop.org/~alexl/weston/

Alexander Larsson (15):
  window: Support transform in widget_cairo_create()
  transformed: Rely on transformation in widget_cairo_create
  window: Track output scales
  window: allow setting a buffer scale on a window
  window: Apply buffer_scale automatically in widget_cairo_create
  transformed: Use the scale factor from the output
  window: Store server_allocation in surface size
  desktop-shell: Respect output scale and translate
  window: Add window_get_output_scale()
  terminal: Handle output transform
  transformed: Add keyboard shortcuts to change transform
  pixman-renderer: Fix up transform handling
  compositor: Support output/buffer scaling
  compositor-x11: Only repaint the damaged region
  compositor-drm: Support output scaling

 clients/desktop-shell.c   |  75 ++--
 clients/terminal.c|  13 +-
 clients/transformed.c | 124 ++---
 clients/window.c  | 237 ++---
 clients/window.h  |  13 ++
 src/compositor-drm.c  |  88 +++---
 src/compositor-fbdev.c|   3 +-
 src/compositor-headless.c |   2 +-
 src/compositor-rpi.c  |   3 +-
 src/compositor-wayland.c  |   2 +-
 src/compositor-x11.c  | 166 --
 src/compositor.c  | 110 +---
 src/compositor.h  |  18 +-
 src/gl-renderer.c |  21 +--
 src/pixman-renderer.c | 436 ++
 15 files changed, 977 insertions(+), 334 deletions(-)

-- 
1.8.1.4

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


[PATCH 01/15] window: Support transform in widget_cairo_create()

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

If a buffer_transform it specified in the window we automatically
compensate for it in the cairo_t
---
 clients/window.c | 77 
 1 file changed, 77 insertions(+)

diff --git a/clients/window.c b/clients/window.c
index 40c0ef4..48b784d 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1607,6 +1607,81 @@ widget_get_cairo_surface(struct widget *widget)
return surface-cairo_surface;
 }
 
+static void
+widget_cairo_update_transform(struct widget *widget, cairo_t *cr)
+{
+   struct surface *surface = widget-surface;
+   double angle;
+   cairo_matrix_t m;
+   enum wl_output_transform transform;
+   int surface_width, surface_height;
+   int translate_x, translate_y;
+
+   surface_width = surface-allocation.width;
+   surface_height = surface-allocation.height;
+
+   transform = window_get_buffer_transform(widget-window);
+   switch (transform) {
+   case WL_OUTPUT_TRANSFORM_FLIPPED:
+   case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+   case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+   case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+   cairo_matrix_init(m, -1, 0, 0, 1, 0, 0);
+   break;
+   default:
+   cairo_matrix_init_identity(m);
+   break;
+   }
+
+   switch (transform) {
+   case WL_OUTPUT_TRANSFORM_NORMAL:
+   default:
+   angle = 0;
+   translate_x = 0;
+   translate_y = 0;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED:
+   angle = 0;
+   translate_x = surface_width;
+   translate_y = 0;
+   break;
+   case WL_OUTPUT_TRANSFORM_90:
+   angle = M_PI_2;
+   translate_x = surface_height;
+   translate_y = 0;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+   angle = M_PI_2;
+   translate_x = surface_height;
+   translate_y = surface_width;
+   break;
+   case WL_OUTPUT_TRANSFORM_180:
+   angle = M_PI;
+   translate_x = surface_width;
+   translate_y = surface_height;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+   angle = M_PI;
+   translate_x = 0;
+   translate_y = surface_height;
+   break;
+   case WL_OUTPUT_TRANSFORM_270:
+   angle = M_PI + M_PI_2;
+   translate_x = 0;
+   translate_y = surface_width;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+   angle = M_PI + M_PI_2;
+   translate_x = 0;
+   translate_y = 0;
+   break;
+   }
+
+   cairo_translate(cr, translate_x, translate_y);
+   cairo_rotate(cr, angle);
+   cairo_transform(cr, m);
+}
+
 cairo_t *
 widget_cairo_create(struct widget *widget)
 {
@@ -1617,6 +1692,8 @@ widget_cairo_create(struct widget *widget)
cairo_surface = widget_get_cairo_surface(widget);
cr = cairo_create(cairo_surface);
 
+   widget_cairo_update_transform(widget, cr);
+
cairo_translate(cr, -surface-allocation.x, -surface-allocation.y);
 
return cr;
-- 
1.8.1.4

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


[PATCH 02/15] transformed: Rely on transformation in widget_cairo_create

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

Rather than doing our own transformation handling when drawing we
just rely on the generic code in widget_cairo_create
---
 clients/transformed.c | 69 ++-
 1 file changed, 8 insertions(+), 61 deletions(-)

diff --git a/clients/transformed.c b/clients/transformed.c
index 8983bb5..560ddf3 100644
--- a/clients/transformed.c
+++ b/clients/transformed.c
@@ -42,67 +42,14 @@ struct transformed {
 };
 
 static void
-update_transform(cairo_t *cr, enum wl_output_transform transform)
+draw_stuff(cairo_t *cr, int width, int height)
 {
-   double angle;
-
cairo_matrix_t m;
+   cairo_get_matrix (cr, m);
 
-   switch(transform) {
-   case WL_OUTPUT_TRANSFORM_FLIPPED:
-   case WL_OUTPUT_TRANSFORM_FLIPPED_90:
-   case WL_OUTPUT_TRANSFORM_FLIPPED_180:
-   case WL_OUTPUT_TRANSFORM_FLIPPED_270:
-   cairo_matrix_init(m, -1, 0, 0, 1, 0, 0);
-   break;
-   default:
-   cairo_matrix_init_identity(m);
-   break;
-   }
-   switch (transform) {
-   case WL_OUTPUT_TRANSFORM_NORMAL:
-   case WL_OUTPUT_TRANSFORM_FLIPPED:
-   default:
-   angle = 0;
-   break;
-   case WL_OUTPUT_TRANSFORM_90:
-   case WL_OUTPUT_TRANSFORM_FLIPPED_90:
-   angle = M_PI_2;
-   break;
-   case WL_OUTPUT_TRANSFORM_180:
-   case WL_OUTPUT_TRANSFORM_FLIPPED_180:
-   angle = M_PI;
-   break;
-   case WL_OUTPUT_TRANSFORM_270:
-   case WL_OUTPUT_TRANSFORM_FLIPPED_270:
-   angle = M_PI + M_PI_2;
-   break;
-   }
-
-   cairo_rotate(cr, angle);
-   cairo_transform(cr, m);
-}
-
-static void
-draw_stuff(cairo_surface_t *surface, int width, int height, int transform)
-{
-   cairo_t *cr;
-   int tmp;
-
-   if (transform  1) {
-   tmp = width;
-   width = height;
-   height = tmp;
-   }
-
-   cr = cairo_create(surface);
-
-   cairo_identity_matrix(cr);
cairo_translate(cr, width / 2, height / 2);
cairo_scale(cr, width / 2, height / 2);
 
-   update_transform(cr, transform);
-
cairo_set_source_rgba(cr, 0, 0, 0.3, 1.0);
cairo_set_source_rgba(cr, 0, 0, 0, 1.0);
cairo_rectangle(cr, -1, -1, 2, 2);
@@ -113,7 +60,7 @@ draw_stuff(cairo_surface_t *surface, int width, int height, 
int transform)
cairo_line_to(cr, 0, -1);
 
cairo_save(cr);
-   cairo_identity_matrix(cr);
+   cairo_set_matrix(cr, m);
cairo_set_line_width(cr, 2.0);
cairo_stroke(cr);
cairo_restore(cr);
@@ -123,7 +70,7 @@ draw_stuff(cairo_surface_t *surface, int width, int height, 
int transform)
cairo_line_to(cr, 1, 0);
 
cairo_save(cr);
-   cairo_identity_matrix(cr);
+   cairo_set_matrix(cr, m);
cairo_set_line_width(cr, 2.0);
cairo_stroke(cr);
cairo_restore(cr);
@@ -135,7 +82,7 @@ draw_stuff(cairo_surface_t *surface, int width, int height, 
int transform)
cairo_line_to(cr, -1, 0);
 
cairo_save(cr);
-   cairo_identity_matrix(cr);
+   cairo_set_matrix(cr, m);
cairo_set_line_width(cr, 2.0);
cairo_stroke(cr);
cairo_restore(cr);
@@ -168,7 +115,7 @@ redraw_handler(struct widget *widget, void *data)
struct transformed *transformed = data;
struct rectangle allocation;
cairo_surface_t *surface;
-   int transform;
+   cairo_t *cr;
 
surface = window_get_surface(transformed-window);
if (surface == NULL ||
@@ -178,9 +125,9 @@ redraw_handler(struct widget *widget, void *data)
}
 
widget_get_allocation(transformed-widget, allocation);
-   transform = window_get_buffer_transform(transformed-window);
 
-   draw_stuff(surface, allocation.width, allocation.height, transform);
+   cr = widget_cairo_create(widget);
+   draw_stuff(cr, allocation.width, allocation.height);
 
cairo_surface_destroy(surface);
 }
-- 
1.8.1.4

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


[PATCH 03/15] window: Track output scales

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

---
 clients/window.c | 30 --
 clients/window.h |  3 +++
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 48b784d..36fda25 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -322,6 +322,7 @@ struct output {
struct rectangle allocation;
struct wl_list link;
int transform;
+   int scale;
 
display_output_handler_t destroy_handler;
void *user_data;
@@ -4382,6 +4383,22 @@ display_handle_geometry(void *data,
 }
 
 static void
+display_handle_done(void *data,
+struct wl_output *wl_output)
+{
+}
+
+static void
+display_handle_scale(void *data,
+struct wl_output *wl_output,
+uint32_t scale)
+{
+   struct output *output = data;
+
+   output-scale = scale;
+}
+
+static void
 display_handle_mode(void *data,
struct wl_output *wl_output,
uint32_t flags,
@@ -4403,7 +4420,9 @@ display_handle_mode(void *data,
 
 static const struct wl_output_listener output_listener = {
display_handle_geometry,
-   display_handle_mode
+   display_handle_mode,
+   display_handle_done,
+   display_handle_scale
 };
 
 static void
@@ -4417,8 +4436,9 @@ display_add_output(struct display *d, uint32_t id)
 
memset(output, 0, sizeof *output);
output-display = d;
+   output-scale = 1;
output-output =
-   wl_registry_bind(d-registry, id, wl_output_interface, 1);
+   wl_registry_bind(d-registry, id, wl_output_interface, 2);
wl_list_insert(d-output_list.prev, output-link);
 
wl_output_add_listener(output-output, output_listener, output);
@@ -4522,6 +4542,12 @@ output_get_transform(struct output *output)
return output-transform;
 }
 
+uint32_t
+output_get_scale(struct output *output)
+{
+   return output-scale;
+}
+
 static void
 fini_xkb(struct input *input)
 {
diff --git a/clients/window.h b/clients/window.h
index 7db9c63..c0a7cb6 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -504,6 +504,9 @@ output_get_wl_output(struct output *output);
 enum wl_output_transform
 output_get_transform(struct output *output);
 
+uint32_t
+output_get_scale(struct output *output);
+
 void
 keysym_modifiers_add(struct wl_array *modifiers_map,
 const char *name);
-- 
1.8.1.4

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


[PATCH 04/15] window: allow setting a buffer scale on a window

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

---
 clients/window.c | 25 +++--
 clients/window.h |  7 +++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 36fda25..378cc75 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -152,7 +152,7 @@ struct toysurface {
 * Prepare the surface for drawing. Makes sure there is a surface
 * of the right size available for rendering, and returns it.
 * dx,dy are the x,y of wl_surface.attach.
-* width,height are the new surface size.
+* width,height are the new buffer size.
 * If flags has SURFACE_HINT_RESIZE set, the user is
 * doing continuous resizing.
 * Returns the Cairo surface to draw to.
@@ -208,6 +208,7 @@ struct surface {
 
enum window_buffer_type buffer_type;
enum wl_output_transform buffer_transform;
+   uint32_t buffer_scale;
 
cairo_surface_t *cairo_surface;
 
@@ -1325,6 +1326,9 @@ surface_create_surface(struct surface *surface, int dx, 
int dy, uint32_t flags)
break;
}
 
+   allocation.width *= surface-buffer_scale;
+   allocation.height *= surface-buffer_scale;
+
if (!surface-toysurface  display-dpy 
surface-buffer_type == WINDOW_BUFFER_TYPE_EGL_WINDOW) {
surface-toysurface =
@@ -1383,6 +1387,21 @@ window_set_buffer_transform(struct window *window,
transform);
 }
 
+void
+window_set_buffer_scale(struct window *window,
+   uint32_t scale)
+{
+   window-main_surface-buffer_scale = scale;
+   wl_surface_set_buffer_scale(window-main_surface-surface,
+   scale);
+}
+
+uint32_t
+window_get_buffer_scale(struct window *window)
+{
+   return window-main_surface-buffer_scale;
+}
+
 static void frame_destroy(struct frame *frame);
 
 static void
@@ -1621,7 +1640,8 @@ widget_cairo_update_transform(struct widget *widget, 
cairo_t *cr)
surface_width = surface-allocation.width;
surface_height = surface-allocation.height;
 
-   transform = window_get_buffer_transform(widget-window);
+   transform = surface-buffer_transform;
+
switch (transform) {
case WL_OUTPUT_TRANSFORM_FLIPPED:
case WL_OUTPUT_TRANSFORM_FLIPPED_90:
@@ -4057,6 +4077,7 @@ surface_create(struct window *window)
 
surface-window = window;
surface-surface = wl_compositor_create_surface(display-compositor);
+   surface-buffer_scale = 1;
wl_surface_add_listener(surface-surface, surface_listener, window);
 
wl_list_insert(window-subsurface_list, surface-link);
diff --git a/clients/window.h b/clients/window.h
index c0a7cb6..fec601f 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -253,6 +253,13 @@ void
 window_set_buffer_transform(struct window *window,
enum wl_output_transform transform);
 
+uint32_t
+window_get_buffer_scale(struct window *window);
+
+void
+window_set_buffer_scale(struct window *window,
+uint32_t scale);
+
 void
 window_destroy(struct window *window);
 
-- 
1.8.1.4

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


[PATCH 05/15] window: Apply buffer_scale automatically in widget_cairo_create

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

---
 clients/window.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clients/window.c b/clients/window.c
index 378cc75..00ffd27 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1636,11 +1636,13 @@ widget_cairo_update_transform(struct widget *widget, 
cairo_t *cr)
enum wl_output_transform transform;
int surface_width, surface_height;
int translate_x, translate_y;
+   uint32_t scale;
 
surface_width = surface-allocation.width;
surface_height = surface-allocation.height;
 
transform = surface-buffer_transform;
+   scale = surface-buffer_scale;
 
switch (transform) {
case WL_OUTPUT_TRANSFORM_FLIPPED:
@@ -1698,6 +1700,7 @@ widget_cairo_update_transform(struct widget *widget, 
cairo_t *cr)
break;
}
 
+   cairo_scale(cr, scale, scale);
cairo_translate(cr, translate_x, translate_y);
cairo_rotate(cr, angle);
cairo_transform(cr, m);
-- 
1.8.1.4

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


[PATCH 06/15] transformed: Use the scale factor from the output

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

---
 clients/transformed.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clients/transformed.c b/clients/transformed.c
index 560ddf3..d685330 100644
--- a/clients/transformed.c
+++ b/clients/transformed.c
@@ -140,6 +140,7 @@ output_handler(struct window *window, struct output 
*output, int enter,
return;
 
window_set_buffer_transform(window, output_get_transform(output));
+   window_set_buffer_scale(window, output_get_scale(output));
window_schedule_redraw(window);
 }
 
-- 
1.8.1.4

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


[PATCH 07/15] window: Store server_allocation in surface size

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

We used to just store the buffer size here which is not right if the
surface has a buffer_transform or a buffer_scale. To fix this we pass
the transform and scale into the toysurface prepare and swap calls and
move both the surface to buffer and the buffer to surface size
conversion there.

Without this interactive resize on the top or left sides of a transformed
or scaled surface will not work correctly.
---
 clients/window.c | 92 
 1 file changed, 72 insertions(+), 20 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 00ffd27..6dd6533 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -158,7 +158,8 @@ struct toysurface {
 * Returns the Cairo surface to draw to.
 */
cairo_surface_t *(*prepare)(struct toysurface *base, int dx, int dy,
-   int width, int height, uint32_t flags);
+   int32_t width, int32_t height, uint32_t 
flags,
+   enum wl_output_transform buffer_transform, 
uint32_t buffer_scale);
 
/*
 * Post the surface to the server, returning the server allocation
@@ -166,6 +167,7 @@ struct toysurface {
 * after calling this.
 */
void (*swap)(struct toysurface *base,
+enum wl_output_transform buffer_transform, uint32_t 
buffer_scale,
 struct rectangle *server_allocation);
 
/*
@@ -463,6 +465,50 @@ debug_print(void *proxy, int line, const char *func, const 
char *fmt, ...)
 
 #endif
 
+static void
+surface_to_buffer_size (enum wl_output_transform buffer_transform, uint32_t 
buffer_scale, int32_t *width, int32_t *height)
+{
+   int32_t tmp;
+
+   switch (buffer_transform) {
+   case WL_OUTPUT_TRANSFORM_90:
+   case WL_OUTPUT_TRANSFORM_270:
+   case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+   case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+   tmp = *width;
+   *width = *height;
+   *height = tmp;
+   break;
+   default:
+   break;
+   }
+
+   *width *= buffer_scale;
+   *height *= buffer_scale;
+}
+
+static void
+buffer_to_surface_size (enum wl_output_transform buffer_transform, uint32_t 
buffer_scale, int32_t *width, int32_t *height)
+{
+   int32_t tmp;
+
+   switch (buffer_transform) {
+   case WL_OUTPUT_TRANSFORM_90:
+   case WL_OUTPUT_TRANSFORM_270:
+   case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+   case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+   tmp = *width;
+   *width = *height;
+   *height = tmp;
+   break;
+   default:
+   break;
+   }
+
+   *width /= buffer_scale;
+   *height /= buffer_scale;
+}
+
 #ifdef HAVE_CAIRO_EGL
 
 struct egl_window_surface {
@@ -482,10 +528,13 @@ to_egl_window_surface(struct toysurface *base)
 
 static cairo_surface_t *
 egl_window_surface_prepare(struct toysurface *base, int dx, int dy,
-  int width, int height, uint32_t flags)
+  int32_t width, int32_t height, uint32_t flags,
+  enum wl_output_transform buffer_transform, uint32_t 
buffer_scale)
 {
struct egl_window_surface *surface = to_egl_window_surface(base);
 
+   surface_to_buffer_size (buffer_transform, buffer_scale, width, 
height);
+
wl_egl_window_resize(surface-egl_window, width, height, dx, dy);
cairo_gl_surface_set_size(surface-cairo_surface, width, height);
 
@@ -494,6 +543,7 @@ egl_window_surface_prepare(struct toysurface *base, int dx, 
int dy,
 
 static void
 egl_window_surface_swap(struct toysurface *base,
+   enum wl_output_transform buffer_transform, uint32_t 
buffer_scale,
struct rectangle *server_allocation)
 {
struct egl_window_surface *surface = to_egl_window_surface(base);
@@ -502,6 +552,10 @@ egl_window_surface_swap(struct toysurface *base,
wl_egl_window_get_attached_size(surface-egl_window,
server_allocation-width,
server_allocation-height);
+
+   buffer_to_surface_size (buffer_transform, buffer_scale,
+   server_allocation-width,
+   server_allocation-height);
 }
 
 static int
@@ -948,11 +1002,12 @@ static const struct wl_buffer_listener 
shm_surface_buffer_listener = {
 
 static cairo_surface_t *
 shm_surface_prepare(struct toysurface *base, int dx, int dy,
-   int width, int height, uint32_t flags)
+   int32_t width, int32_t height, uint32_t flags,
+   enum wl_output_transform buffer_transform, uint32_t 
buffer_scale)
 {
int resize_hint = !!(flags  SURFACE_HINT_RESIZE);
struct shm_surface *surface = to_shm_surface(base);
-   struct 

[PATCH 08/15] desktop-shell: Respect output scale and translate

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

We pick the window scale/tranform based on what the output uses, which means
we can avoid rotations in the compositor, and get sharper rendering
in scaled outputs.
---
 clients/desktop-shell.c | 75 -
 1 file changed, 62 insertions(+), 13 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 3949975..497e4ff 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -201,12 +201,10 @@ static void
 panel_launcher_redraw_handler(struct widget *widget, void *data)
 {
struct panel_launcher *launcher = data;
-   cairo_surface_t *surface;
struct rectangle allocation;
cairo_t *cr;
 
-   surface = window_get_surface(launcher-panel-window);
-   cr = cairo_create(surface);
+   cr = widget_cairo_create(launcher-panel-widget);
 
widget_get_allocation(widget, allocation);
if (launcher-pressed) {
@@ -255,13 +253,13 @@ panel_redraw_handler(struct widget *widget, void *data)
cairo_t *cr;
struct panel *panel = data;
 
-   surface = window_get_surface(panel-window);
-   cr = cairo_create(surface);
+   cr = widget_cairo_create(panel-widget);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
set_hex_color(cr, key_panel_color);
cairo_paint(cr);
 
cairo_destroy(cr);
+   surface = window_get_surface(panel-window);
cairo_surface_destroy(surface);
 }
 
@@ -317,7 +315,6 @@ clock_func(struct task *task, uint32_t events)
 static void
 panel_clock_redraw_handler(struct widget *widget, void *data)
 {
-   cairo_surface_t *surface;
struct panel_clock *clock = data;
cairo_t *cr;
struct rectangle allocation;
@@ -335,8 +332,7 @@ panel_clock_redraw_handler(struct widget *widget, void 
*data)
if (allocation.width == 0)
return;
 
-   surface = window_get_surface(clock-panel-window);
-   cr = cairo_create(surface);
+   cr = widget_cairo_create(clock-panel-widget);
cairo_select_font_face(cr, sans,
   CAIRO_FONT_SLANT_NORMAL,
   CAIRO_FONT_WEIGHT_NORMAL);
@@ -644,7 +640,7 @@ background_draw(struct widget *widget, void *data)
 
surface = window_get_surface(background-window);
 
-   cr = cairo_create(surface);
+   cr = widget_cairo_create(background-widget);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
cairo_set_source_rgba(cr, 0.0, 0.0, 0.2, 1.0);
cairo_paint(cr);
@@ -713,13 +709,12 @@ unlock_dialog_redraw_handler(struct widget *widget, void 
*data)
 {
struct unlock_dialog *dialog = data;
struct rectangle allocation;
-   cairo_t *cr;
cairo_surface_t *surface;
+   cairo_t *cr;
cairo_pattern_t *pat;
double cx, cy, r, f;
 
-   surface = window_get_surface(dialog-window);
-   cr = cairo_create(surface);
+   cr = widget_cairo_create(widget);
 
widget_get_allocation(dialog-widget, allocation);
cairo_rectangle(cr, allocation.x, allocation.y,
@@ -752,6 +747,7 @@ unlock_dialog_redraw_handler(struct widget *widget, void 
*data)
 
cairo_destroy(cr);
 
+   surface = window_get_surface(dialog-window);
cairo_surface_destroy(surface);
 }
 
@@ -1025,6 +1021,57 @@ desktop_destroy_outputs(struct desktop *desktop)
 }
 
 static void
+output_handle_geometry(void *data,
+   struct wl_output *wl_output,
+   int x, int y,
+   int physical_width,
+   int physical_height,
+   int subpixel,
+   const char *make,
+   const char *model,
+   int transform)
+{
+   struct output *output = data;
+
+   window_set_buffer_transform(output-panel-window, transform);
+   window_set_buffer_transform(output-background-window, transform);
+}
+
+static void
+output_handle_mode(void *data,
+  struct wl_output *wl_output,
+  uint32_t flags,
+  int width,
+  int height,
+  int refresh)
+{
+}
+
+static void
+output_handle_done(void *data,
+   struct wl_output *wl_output)
+{
+}
+
+static void
+output_handle_scale(void *data,
+struct wl_output *wl_output,
+uint32_t scale)
+{
+   struct output *output = data;
+
+   window_set_buffer_scale(output-panel-window, scale);
+   window_set_buffer_scale(output-background-window, scale);
+}
+
+static const struct wl_output_listener output_listener = {
+   output_handle_geometry,
+   output_handle_mode,
+   output_handle_done,
+   output_handle_scale
+};
+
+static void
 create_output(struct desktop *desktop, uint32_t id)
 {
struct output *output;
@@ -1034,7 +1081,9 @@ create_output(struct desktop *desktop, 

[PATCH 09/15] window: Add window_get_output_scale()

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

This lets you find the maximal scale for all the outputs a window
is on, which is useful for picking a buffer_scale.
---
 clients/window.c | 18 ++
 clients/window.h |  3 +++
 2 files changed, 21 insertions(+)

diff --git a/clients/window.c b/clients/window.c
index 6dd6533..09573f6 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1454,6 +1454,22 @@ window_get_buffer_scale(struct window *window)
return window-main_surface-buffer_scale;
 }
 
+uint32_t
+window_get_output_scale(struct window *window)
+{
+   struct window_output *window_output;
+   struct window_output *window_output_tmp;
+   int scale = 1;
+
+   wl_list_for_each_safe(window_output, window_output_tmp,
+ window-window_output_list, link) {
+   if (window_output-output-scale  scale)
+   scale = window_output-output-scale;
+   }
+
+   return scale;
+}
+
 static void frame_destroy(struct frame *frame);
 
 static void
@@ -4370,6 +4386,8 @@ window_show_menu(struct display *display,
 
menu-window = window;
menu-widget = window_add_widget(menu-window, menu);
+   window_set_buffer_scale (menu-window, window_get_buffer_scale 
(parent));
+   window_set_buffer_transform (menu-window, window_get_buffer_transform 
(parent));
menu-entries = entries;
menu-count = count;
menu-release_count = 0;
diff --git a/clients/window.h b/clients/window.h
index fec601f..f7b3f28 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -260,6 +260,9 @@ void
 window_set_buffer_scale(struct window *window,
 uint32_t scale);
 
+uint32_t
+window_get_output_scale(struct window *window);
+
 void
 window_destroy(struct window *window);
 
-- 
1.8.1.4

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


[PATCH 10/15] terminal: Handle output transform

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

We pick the highest scale of any output the terminal is on, and the
transform from the last one it entered.
---
 clients/terminal.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/clients/terminal.c b/clients/terminal.c
index f11a6cc..2985726 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -933,7 +933,7 @@ redraw_handler(struct widget *widget, void *data)
 
surface = window_get_surface(terminal-window);
widget_get_allocation(terminal-widget, allocation);
-   cr = cairo_create(surface);
+   cr = widget_cairo_create(terminal-widget);
cairo_rectangle(cr, allocation.x, allocation.y,
allocation.width, allocation.height);
cairo_clip(cr);
@@ -2517,6 +2517,16 @@ motion_handler(struct widget *widget,
return CURSOR_IBEAM;
 }
 
+static void
+output_handler(struct window *window, struct output *output, int enter,
+  void *data)
+{
+   if (enter)
+   window_set_buffer_transform(window, 
output_get_transform(output));
+   window_set_buffer_scale(window, window_get_output_scale(window));
+   window_schedule_redraw(window);
+}
+
 static struct terminal *
 terminal_create(struct display *display)
 {
@@ -2549,6 +2559,7 @@ terminal_create(struct display *display)
window_set_keyboard_focus_handler(terminal-window,
  keyboard_focus_handler);
window_set_fullscreen_handler(terminal-window, fullscreen_handler);
+   window_set_output_handler(terminal-window, output_handler);
window_set_close_handler(terminal-window, close_handler);
 
widget_set_redraw_handler(terminal-widget, redraw_handler);
-- 
1.8.1.4

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


[PATCH 11/15] transformed: Add keyboard shortcuts to change transform

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

This makes it easy to test buffer_transform and buffer_scale handling.
left-right: rotate
space: toggle inverse
z: toggle scale between 1 and 2
---
 clients/transformed.c | 54 +++
 1 file changed, 54 insertions(+)

diff --git a/clients/transformed.c b/clients/transformed.c
index d685330..e8d817d 100644
--- a/clients/transformed.c
+++ b/clients/transformed.c
@@ -145,6 +145,59 @@ output_handler(struct window *window, struct output 
*output, int enter,
 }
 
 static void
+key_handler(struct window *window, struct input *input, uint32_t time,
+   uint32_t key, uint32_t sym, enum wl_keyboard_key_state state,
+   void *data)
+{
+   int transform, scale;
+
+   if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
+   return;
+
+   transform = window_get_buffer_transform (window);
+   scale = window_get_buffer_scale (window);
+   switch (sym) {
+   case XKB_KEY_Left:
+   if (transform == 0)
+   transform = 3;
+   else if (transform == 4)
+   transform = 7;
+   else
+   transform--;
+   break;
+
+   case XKB_KEY_Right:
+   if (transform == 3)
+   transform = 0;
+   else if (transform == 7)
+   transform = 4;
+   else
+   transform++;
+   break;
+
+   case XKB_KEY_space:
+   if (transform = 4)
+   transform -= 4;
+   else
+   transform += 4;
+   break;
+
+   case XKB_KEY_z:
+   if (scale == 1)
+   scale = 2;
+   else
+   scale = 1;
+   break;
+   }
+
+   printf (setting buffer transform to %d\n, transform);
+   printf (setting buffer scale to %d\n, scale);
+   window_set_buffer_transform(window, transform);
+   window_set_buffer_scale(window, scale);
+   window_schedule_redraw(window);
+}
+
+static void
 button_handler(struct widget *widget,
   struct input *input, uint32_t time,
   uint32_t button, enum wl_pointer_button_state state, void *data)
@@ -234,6 +287,7 @@ int main(int argc, char *argv[])
widget_set_redraw_handler(transformed.widget, redraw_handler);
widget_set_button_handler(transformed.widget, button_handler);
 
+   window_set_key_handler(transformed.window, key_handler);
window_set_fullscreen_handler(transformed.window, fullscreen_handler);
window_set_output_handler(transformed.window, output_handler);
 
-- 
1.8.1.4

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


[PATCH 12/15] pixman-renderer: Fix up transform handling

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

Rather than storing the shadow_image in the untransformed space
and rotating on copy to hw_buffer we store both on the transformed
space. This means a copy between them is a straight copy, and that
apps supplying correctly transformed surface buffers need not
change them.

We also correctly handle all output transform including the previously
unhandled flipped ones, as well as client supplied buffer_transforms (which
were previously ignored).

We also simplify the actual rendering by just converting any damage
region to output coordinates and set it on a clip and composite
the whole buffer, letting pixman do the rectangle handling. This
means we always do all the transforms, including the surface positioning
as a pixman_image transform. This simplifies the code and sets us up
for handling scaling at a later stage.

The transform looks complicated, but in practice it ends up being
an integer translation almost always, so it will hit the pixman
fastpaths.
---
 src/pixman-renderer.c | 408 ++
 1 file changed, 248 insertions(+), 160 deletions(-)

diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 60800bc..92c6bb3 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -105,92 +105,98 @@ pixman_renderer_read_pixels(struct weston_output *output,
 }
 
 static void
-box_translate(pixman_box32_t *dst, const pixman_box32_t *src, int x, int y)
+transform_region (pixman_region32_t *region, int width, int height, enum 
wl_output_transform transform)
 {
-   dst-x1 = src-x1 + x;
-   dst-x2 = src-x2 + x;
-   dst-y1 = src-y1 + y;
-   dst-y2 = src-y2 + y;
-}
-
-#define D2F(v) pixman_double_to_fixed((double)v)
-
-static void
-repaint_region_complex(struct weston_surface *es, struct weston_output *output,
-   pixman_region32_t *region)
-{
-   struct pixman_renderer *pr =
-   (struct pixman_renderer *) output-compositor-renderer;
-   struct pixman_surface_state *ps = get_surface_state(es);
-   struct pixman_output_state *po = get_output_state(output);
+   pixman_box32_t *rects, *transformed_rects;
int nrects, i;
-   pixman_box32_t *rects, rect;
 
-   /* Pixman supports only 2D transform matrix, but Weston uses 3D,
-* so we're omitting Z coordinate here
-*/
-   pixman_transform_t transform = {{
-   { D2F(es-transform.matrix.d[0]),
- D2F(es-transform.matrix.d[4]),
- D2F(es-transform.matrix.d[12]),
-   },
-   { D2F(es-transform.matrix.d[1]),
- D2F(es-transform.matrix.d[5]),
- D2F(es-transform.matrix.d[13]),
-   },
-   { D2F(es-transform.matrix.d[3]),
- D2F(es-transform.matrix.d[7]),
- D2F(es-transform.matrix.d[15]),
-   }
-   }};
-
-   pixman_transform_invert(transform, transform);
-
-   pixman_image_set_transform(ps-image, transform);
-   pixman_image_set_filter(ps-image, PIXMAN_FILTER_BILINEAR, NULL, 0);
+   if (transform == WL_OUTPUT_TRANSFORM_NORMAL)
+   return;
 
rects = pixman_region32_rectangles(region, nrects);
+   transformed_rects = calloc(nrects, sizeof(pixman_box32_t));
+
for (i = 0; i  nrects; i++) {
-   box_translate(rect, rects[i], -output-x, -output-y);
-   pixman_image_composite32(PIXMAN_OP_OVER,
-   ps-image, /* src */
-   NULL /* mask */,
-   po-shadow_image, /* dest */
-   rects[i].x1, rects[i].y1, /* src_x, src_y */
-   0, 0, /* mask_x, mask_y */
-   rect.x1, rect.y1, /* dst_x, dst_y */
-   rect.x2 - rect.x1, /* width */
-   rect.y2 - rect.y1 /* height */
-   );
+   switch (transform) {
+   default:
+   case WL_OUTPUT_TRANSFORM_NORMAL:
+   transformed_rects[i].x1 = rects[i].x1;
+   transformed_rects[i].y1 = rects[i].y1;
+   transformed_rects[i].x2 = rects[i].x2;
+   transformed_rects[i].y2 = rects[i].y2;
+   break;
+   case WL_OUTPUT_TRANSFORM_90:
+   transformed_rects[i].x1 = height - rects[i].y2;
+   transformed_rects[i].y1 = rects[i].x1;
+   transformed_rects[i].x2 = height - rects[i].y1;
+   transformed_rects[i].y2 = rects[i].x2;
+   break;
+   case WL_OUTPUT_TRANSFORM_180:
+   transformed_rects[i].x1 = width - rects[i].x2;
+   transformed_rects[i].y1 = height - rects[i].y2;
+   transformed_rects[i].x2 = width - rects[i].x1;
+   transformed_rects[i].y2 = 

[PATCH 13/15] compositor: Support output/buffer scaling

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

If you specify e.g. scale=2 in weston.ini an output section for the
X11 backend we automatically upscale all normal surfaces by this
amount. Additionally we respect a buffer_scale set on the buffer to
mean that the buffer is already in a scaled form.

This works with both the gl and the pixman renderer. The non-X
backends compile and work, but don't support changing the output
scale (they do downscale as needed due to buffer_scale though).

This also sends the new scale and done events on wl_output,
making clients aware of the scale.
---
 src/compositor-drm.c  |   7 +--
 src/compositor-fbdev.c|   3 +-
 src/compositor-headless.c |   2 +-
 src/compositor-rpi.c  |   3 +-
 src/compositor-wayland.c  |   2 +-
 src/compositor-x11.c  |  60 ++---
 src/compositor.c  | 110 +-
 src/compositor.h  |  18 +++-
 src/gl-renderer.c |  21 +++--
 src/pixman-renderer.c |  48 +---
 10 files changed, 210 insertions(+), 64 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 35019e0..8b33256 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -858,7 +858,8 @@ drm_output_prepare_overlay_surface(struct weston_output 
*output_base,
box = pixman_region32_extents(dest_rect);
tbox = weston_transformed_rect(output_base-width,
   output_base-height,
-  output_base-transform, *box);
+  output_base-transform,
+  1, *box);
s-dest_x = tbox.x1;
s-dest_y = tbox.y1;
s-dest_w = tbox.x2 - tbox.x1;
@@ -895,7 +896,7 @@ drm_output_prepare_overlay_surface(struct weston_output 
*output_base,
 
tbox = weston_transformed_rect(wl_fixed_from_int(es-geometry.width),
   wl_fixed_from_int(es-geometry.height),
-  es-buffer_transform, tbox);
+  es-buffer_transform, 1, tbox);
 
s-src_x = tbox.x1  8;
s-src_y = tbox.y1  8;
@@ -1813,7 +1814,7 @@ create_output_for_connector(struct drm_compositor *ec,
 
weston_output_init(output-base, ec-base, x, y,
   connector-mmWidth, connector-mmHeight,
-  o ? o-transform : WL_OUTPUT_TRANSFORM_NORMAL);
+  o ? o-transform : WL_OUTPUT_TRANSFORM_NORMAL, 1);
 
if (ec-use_pixman) {
if (drm_output_init_pixman(output, ec)  0) {
diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 21028a5..c643c23 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -537,7 +537,8 @@ fbdev_output_create(struct fbdev_compositor *compositor,
weston_output_init(output-base, compositor-base,
   0, 0, output-fb_info.width_mm,
   output-fb_info.height_mm,
-  WL_OUTPUT_TRANSFORM_NORMAL);
+  WL_OUTPUT_TRANSFORM_NORMAL,
+  1);
 
width = output-fb_info.x_resolution;
height = output-fb_info.y_resolution;
diff --git a/src/compositor-headless.c b/src/compositor-headless.c
index 0df0f7d..e4bd1be 100644
--- a/src/compositor-headless.c
+++ b/src/compositor-headless.c
@@ -112,7 +112,7 @@ headless_compositor_create_output(struct 
headless_compositor *c,
 
output-base.current = output-mode;
weston_output_init(output-base, c-base, 0, 0, width, height,
-  WL_OUTPUT_TRANSFORM_NORMAL);
+  WL_OUTPUT_TRANSFORM_NORMAL, 1);
 
output-base.make = weston;
output-base.model = headless;
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 3cb2b56..226c5ce 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -1080,7 +1080,8 @@ rpi_output_create(struct rpi_compositor *compositor)
 
weston_output_init(output-base, compositor-base,
   0, 0, round(mm_width), round(mm_height),
-  WL_OUTPUT_TRANSFORM_NORMAL);
+  WL_OUTPUT_TRANSFORM_NORMAL,
+  1);
 
if (gl_renderer_output_create(output-base,
(EGLNativeWindowType)output-egl_window)  0)
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 4112401..511a12d 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -267,7 +267,7 @@ wayland_compositor_create_output(struct wayland_compositor 
*c,
 
output-base.current = output-mode;
weston_output_init(output-base, c-base, 0, 0, width, height,
-   WL_OUTPUT_TRANSFORM_NORMAL);
+  WL_OUTPUT_TRANSFORM_NORMAL, 1);
 
output-base.make = waywayland;

[PATCH 14/15] compositor-x11: Only repaint the damaged region

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

Set a clip on the GC when painting the damaged region so that
we don't copy the entire shadow buffer each time.
---
 src/compositor-x11.c | 106 +++
 1 file changed, 106 insertions(+)

diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 58ccc16..9d6b6e7 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -355,6 +355,111 @@ x11_output_repaint_gl(struct weston_output *output_base,
 }
 
 static void
+set_clip_for_output(struct weston_output *output_base, pixman_region32_t 
*region)
+{
+   struct x11_output *output = (struct x11_output *)output_base;
+   struct weston_compositor *ec = output-base.compositor;
+   struct x11_compositor *c = (struct x11_compositor *)ec;
+   pixman_box32_t *rects;
+   xcb_rectangle_t *output_rects;
+   pixman_box32_t rect, transformed_rect;
+   xcb_void_cookie_t cookie;
+   int width, height, nrects, i;
+   xcb_generic_error_t *err;
+
+   rects = pixman_region32_rectangles(region, nrects);
+   output_rects = calloc(nrects, sizeof(xcb_rectangle_t));
+
+   if (output_rects == NULL)
+   return;
+
+   width = output_base-width;
+   height = output_base-height;
+
+   for (i = 0; i  nrects; i++) {
+   rect = rects[i];
+   rect.x1 -= output_base-x;
+   rect.y1 -= output_base-y;
+   rect.x2 -= output_base-x;
+   rect.y2 -= output_base-y;
+
+   switch (output_base-transform) {
+   default:
+   case WL_OUTPUT_TRANSFORM_NORMAL:
+   transformed_rect.x1 = rect.x1;
+   transformed_rect.y1 = rect.y1;
+   transformed_rect.x2 = rect.x2;
+   transformed_rect.y2 = rect.y2;
+   break;
+   case WL_OUTPUT_TRANSFORM_90:
+   transformed_rect.x1 = height - rect.y2;
+   transformed_rect.y1 = rect.x1;
+   transformed_rect.x2 = height - rect.y1;
+   transformed_rect.y2 = rect.x2;
+   break;
+   case WL_OUTPUT_TRANSFORM_180:
+   transformed_rect.x1 = width - rect.x2;
+   transformed_rect.y1 = height - rect.y2;
+   transformed_rect.x2 = width - rect.x1;
+   transformed_rect.y2 = height - rect.y1;
+   break;
+   case WL_OUTPUT_TRANSFORM_270:
+   transformed_rect.x1 = rect.y1;
+   transformed_rect.y1 = width - rect.x2;
+   transformed_rect.x2 = rect.y2;
+   transformed_rect.y2 = width - rect.x1;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED:
+   transformed_rect.x1 = width - rect.x2;
+   transformed_rect.y1 = rect.y1;
+   transformed_rect.x2 = width - rect.x1;
+   transformed_rect.y2 = rect.y2;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED_90:
+   transformed_rect.x1 = height - rect.y2;
+   transformed_rect.y1 = width - rect.x2;
+   transformed_rect.x2 = height - rect.y1;
+   transformed_rect.y2 = width - rect.x1;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED_180:
+   transformed_rect.x1 = rect.x1;
+   transformed_rect.y1 = height - rect.y2;
+   transformed_rect.x2 = rect.x2;
+   transformed_rect.y2 = height - rect.y1;
+   break;
+   case WL_OUTPUT_TRANSFORM_FLIPPED_270:
+   transformed_rect.x1 = rect.y1;
+   transformed_rect.y1 = rect.x1;
+   transformed_rect.x2 = rect.y2;
+   transformed_rect.y2 = rect.x2;
+   break;
+   }
+
+   transformed_rect.x1 *= output_base-scale;
+   transformed_rect.y1 *= output_base-scale;
+   transformed_rect.x2 *= output_base-scale;
+   transformed_rect.y2 *= output_base-scale;
+
+   output_rects[i].x = transformed_rect.x1;
+   output_rects[i].y = transformed_rect.y1;
+   output_rects[i].width = transformed_rect.x2 - 
transformed_rect.x1;
+   output_rects[i].height = transformed_rect.y2 - 
transformed_rect.y1;
+   }
+
+   cookie = xcb_set_clip_rectangles_checked(c-conn, 
XCB_CLIP_ORDERING_UNSORTED,
+   output-gc,
+   0, 0, nrects,
+   output_rects);
+   err = xcb_request_check(c-conn, cookie);
+   if (err 

[PATCH 15/15] compositor-drm: Support output scaling

2013-05-22 Thread alexl
From: Alexander Larsson al...@redhat.com

If you specify e.g. scale=2 in an output section in weston.ini
we scale all modes by that factor.

We also correctly scale cursor positioning, but ATM there is no
scaling of the cursor sprite itself.
---
 src/compositor-drm.c | 87 +++-
 1 file changed, 59 insertions(+), 28 deletions(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 8b33256..1485c6c 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -61,6 +61,7 @@ static int option_current_mode = 0;
 static char *output_name;
 static char *output_mode;
 static char *output_transform;
+static char *output_scale;
 static struct wl_list configured_output_list;
 
 enum output_config {
@@ -76,6 +77,7 @@ struct drm_configured_output {
char *name;
char *mode;
uint32_t transform;
+   int32_t scale;
int32_t width, height;
drmModeModeInfo crtc_mode;
enum output_config config;
@@ -463,6 +465,7 @@ drm_output_prepare_scanout_surface(struct weston_output 
*_output,
buffer-width != output-base.current-width ||
buffer-height != output-base.current-height ||
output-base.transform != es-buffer_transform ||
+   output-base.scale != es-buffer_scale ||
es-transform.enabled)
return NULL;
 
@@ -791,6 +794,9 @@ drm_output_prepare_overlay_surface(struct weston_output 
*output_base,
if (es-buffer_transform != output_base-transform)
return NULL;
 
+   if (es-buffer_scale != output_base-scale)
+   return NULL;
+
if (c-sprites_are_broken)
return NULL;
 
@@ -859,7 +865,8 @@ drm_output_prepare_overlay_surface(struct weston_output 
*output_base,
tbox = weston_transformed_rect(output_base-width,
   output_base-height,
   output_base-transform,
-  1, *box);
+  output_base-scale,
+  *box);
s-dest_x = tbox.x1;
s-dest_y = tbox.y1;
s-dest_w = tbox.x2 - tbox.x1;
@@ -896,7 +903,7 @@ drm_output_prepare_overlay_surface(struct weston_output 
*output_base,
 
tbox = weston_transformed_rect(wl_fixed_from_int(es-geometry.width),
   wl_fixed_from_int(es-geometry.height),
-  es-buffer_transform, 1, tbox);
+  es-buffer_transform, es-buffer_scale, 
tbox);
 
s-src_x = tbox.x1  8;
s-src_y = tbox.y1  8;
@@ -977,8 +984,8 @@ drm_output_set_cursor(struct drm_output *output)
}
}
 
-   x = es-geometry.x - output-base.x;
-   y = es-geometry.y - output-base.y;
+   x = (es-geometry.x - output-base.x) * output-base.scale;
+   y = (es-geometry.y - output-base.y) * output-base.scale;
if (output-cursor_plane.x != x || output-cursor_plane.y != y) {
if (drmModeMoveCursor(c-drm.fd, output-crtc_id, x, y)) {
weston_log(failed to move cursor: %m\n);
@@ -1258,18 +1265,29 @@ init_pixman(struct drm_compositor *ec)
 }
 
 static struct drm_mode *
-drm_output_add_mode(struct drm_output *output, drmModeModeInfo *info)
+drm_output_add_mode(struct drm_output *output, drmModeModeInfo *info, struct 
drm_configured_output *config)
 {
struct drm_mode *mode;
uint64_t refresh;
+int scale;
 
mode = malloc(sizeof *mode);
if (mode == NULL)
return NULL;
 
+scale = 1;
+if (config)
+  scale = config-scale;
+
+   if (info-hdisplay % scale != 0 ||
+   info-vdisplay % scale) {
+   weston_log(Mode %dx%d not multiple of scale %d\n, 
info-hdisplay, info-vdisplay, scale);
+   return NULL;
+   }
+
mode-base.flags = 0;
-   mode-base.width = info-hdisplay;
-   mode-base.height = info-vdisplay;
+   mode-base.width = info-hdisplay / scale;
+   mode-base.height = info-vdisplay / scale;
 
/* Calculate higher precision (mHz) refresh rate */
refresh = (info-clock * 100LL / info-htotal +
@@ -1285,6 +1303,9 @@ drm_output_add_mode(struct drm_output *output, 
drmModeModeInfo *info)
mode-base.refresh = refresh;
mode-mode_info = *info;
 
+   if (scale != 1)
+   mode-base.flags |= WL_OUTPUT_MODE_SCALED;
+
if (info-type  DRM_MODE_TYPE_PREFERRED)
mode-base.flags |= WL_OUTPUT_MODE_PREFERRED;
 
@@ -1446,8 +1467,8 @@ drm_output_init_egl(struct drm_output *output, struct 
drm_compositor *ec)
int i, flags;
 
output-surface = gbm_surface_create(ec-gbm,
-output-base.current-width,
-output-base.current-height,
+  

Announce: Wayland Functional Integration Test Suite

2013-05-22 Thread Eoff, Ullysses A
I wanted to announce that a new open source project called
wayland-fits is now available on 01.org https://01.org/wayland.

The Wayland Functional Integration Test Suite (wayland-fits) is a fully
automated test suite.  Its purpose is to validate the functionality and
integration between Wayland client software and Wayland server
software.  It provides a test framework and test suites for multiple
Wayland-enabled toolkits and the Wayland core.  The test framework
allows tests to emit input events from the bottom of the software stack.
That is, [input system]-server-client-toolkit-test-app.  This
enables full input pipeline validation.  It also includes its own Wayland
test protocol that enables tests to cross-validate client and server
states.

Currently there are tests for Wayland Core and Wayland EFL.  And just
recently, I have started adding tests for Wayland Gtk+ (I'm already
finding several trivial bugs).  There are plans to start adding tests for
Wayland Clutter and Wayland Qt, too.  Also, a server-side
implementation of the wayland-fits protocol is essential for every test
to execute.  Right now, there is only an implementation for Weston
included that supports drm, x11, and headless backends (caution: the
headless backend will only run the software/shm based tests).  It's
absolutely plausible, however, that there will be implementations for
other Wayland compositors that have a plugin architecture, too.

I am currently the maintainer of this project with contributions
coming in from one or two other people on occasion.  I would be
oh-so-grateful to have more contributors from the enthusiastic Wayland
community.  So start sending your patches!  I only develop and
test on Intel hardware and Fedora... so if there are issues on other
hardware/OS flavors, feel free to submit fixes; tested, of course ;-).
There is still a lot of Wayland functionality that is not tested by this suite
and design decisions that could be made...and I could use as much help
as I can get.  If nothing else, I hope it's a useful test suite for those
that use it.  It has already detected many regressions and bugs.

The source repository is on github at:

https://github.com/01org/wayland-fits

There is more information in the README about contributing, building,
running, etc...  Also, we can start using the wiki in the github project to
share more info (and such) as needed.

If you have any questions, feel free to drop me a line.  I generally hang out
in the #wayland and #wayland-efl IRC channels on freenode as some of
you already know (nick: uartie).  I am travelling this week so expect a
delayed response. 

Oh, and P.S. the project is written in C++ ;-)


U. Artie Eoff
Intel Open Source Technology Center

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


[PATCH weston 00/18] Raspberry Pi: a new renderer and demos

2013-05-22 Thread ppaalanen
From: Pekka Paalanen pekka.paala...@collabora.co.uk

Hi all,

this patch series consists of several independent features, which all come
together in demonstrating the capabilities of Raspberry Pi for running a
desktop.

We add a new rpi-renderer, that replaces the gl-renderer + weston_planes
on RPi. Since it is not as flexible as the gl-renderer, we add some
capability bits to disable incompatible features in Weston.

Weston-desktop-shell gets new features. The major new feature is
exposay, a window overview mode with animated transitions. Another new
feature is optional keyboard-focus animation, which dims unfocused
surfaces. Smaller enhancements include a new wallpaper scaling mode, and
ensuring weston-desktop-shell has finished starting up before the
compositor fades in.

Then there are various smaller fixes and enhancements.

This work is joint effort of the Raspberry Pi foundation and Collabora. I
will later (tomorrow) reply with an email with links to all the related
announcements and blog posts. More details behind those links, and the
individual commits.

Beware of the rough edges, there are some bugs we didn't have time to fix
yet. Most of them need a little effort to discover, though, that's why we
didn't see them earlier. ;-)

This series is also available as a branch:

git://git.collabora.co.uk/git/user/pq/weston.git raspberrypi-dispmanx
http://cgit.collabora.com/git/user/pq/weston.git/log/?h=raspberrypi-dispmanx

There is also a patch for the RPi building guide on the Wayland website.


Daniel Stone (4):
  Add modifier-only binding
  Add move/scale animation
  Shell: Add Exposay
  configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS

Louis-Francis Ratté-Boulianne (3):
  animation: Make zoom animation renders better and smoother
  compositor, shell: Add animation to measure desktop fps
  xwayland: Fix the race condition when mapping a surface

Louis-Francis Ratté-Boulianne (3):
  toytoolkit: Make the window resizing optimization optional
  animation, shell: add kbd focus change animation
  shell: Fix calculation of center point in surface rotation

Pekka Paalanen (8):
  compositor: add capability flag for arbitrary surface rotation
  compositor: add capability CAPTURE_YFLIP
  rpi: add a Dispmanx renderer
  rpi: switch to rpi-renderer
  rpi: remove weston_plane support
  shell: wait for desktop-shell init before fade in
  desktop-shell: new wallpaper mode scale-crop
  screenshooter: print info to log

 clients/desktop-shell.c   |   73 ++-
 clients/window.c  |6 +-
 configure.ac  |   13 +-
 man/weston.ini.man|9 +-
 protocol/desktop-shell.xml|   13 +-
 shared/cairo-util.c   |2 +-
 shared/config-parser.c|3 +-
 shared/image-loader.c |2 +-
 shared/matrix.c   |2 +
 shared/option-parser.c|2 +
 shared/os-compatibility.c |2 +-
 src/Makefile.am   |2 +
 src/animation.c   |  128 +++-
 src/bindings.c|   60 ++
 src/clipboard.c   |2 +-
 src/cms-helper.c  |4 +-
 src/cms-static.c  |5 +-
 src/compositor-drm.c  |6 +-
 src/compositor-fbdev.c|2 +-
 src/compositor-headless.c |4 +-
 src/compositor-rdp.c  |4 +-
 src/compositor-rpi.c  |  898 +++
 src/compositor-wayland.c  |5 +-
 src/compositor-x11.c  |4 +-
 src/compositor.c  |   71 ++-
 src/compositor.h  |   48 ++
 src/evdev-touchpad.c  |2 +
 src/evdev.c   |2 +
 src/filter.c  |2 +
 src/gl-renderer.c |4 +-
 src/gl-renderer.h |7 +-
 src/input.c   |   38 ++
 src/launcher-util.c   |2 +
 src/libbacklight.c|2 +-
 src/log.c |2 +
 src/noop-renderer.c   |2 +-
 src/pixman-renderer.c |4 +-
 src/rpi-bcm-stubs.h   |   39 ++
 src/rpi-renderer.c| 1370 +
 src/rpi-renderer.h|   48 ++
 src/screenshooter.c   |  103 +++-
 src/shell.c   | 1078 ++--
 src/tablet-shell.c|2 +
 src/text-backend.c|2 +
 src/tty.c |2 +
 src/udev-seat.c   |2 +
 src/weston-launch.c   |2 -
 src/xwayland/launcher.c   |2 +-
 src/xwayland/selection.c  |2 +-
 src/xwayland/window-manager.c |   20 +-
 src/zoom.c|2 +
 51 files changed, 3166 insertions(+), 945 deletions(-)
 create mode 100644 src/rpi-renderer.c
 create mode 100644 src/rpi-renderer.h

-- 
1.8.1.5


Thanks,
pq

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


[PATCH weston 01/18] compositor: add capability flag for arbitrary surface rotation

2013-05-22 Thread ppaalanen
From: Pekka Paalanen ppaala...@gmail.com

The upcoming rpi-renderer cannot handle arbitrary rotations. Introduce
Weston capability bits, and add a bit for arbitrary rotation. GL and
Pixman renderers support it.

Shell or any other module must not produce surface transformations with
rotation, if the capability bit is not set. Do not register the surface
rotation binding in desktop shell, if arbitary rotation is not
supported.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 src/compositor.c  | 24 
 src/compositor.h  |  6 ++
 src/gl-renderer.c |  1 +
 src/pixman-renderer.c |  1 +
 src/shell.c   |  7 +--
 5 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index f67028e..657e134 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2820,6 +2820,28 @@ weston_version(int *major, int *minor, int *micro)
*micro = WESTON_VERSION_MICRO;
 }
 
+static const struct {
+   uint32_t bit;
+   const char *desc;
+} capability_strings[] = {
+   { WESTON_CAP_ROTATION_ANY, arbitrary surface rotation: },
+};
+
+static void
+weston_compositor_log_capabilities(struct weston_compositor *compositor)
+{
+   unsigned i;
+   int yes;
+
+   weston_log(Compositor capabilities:\n);
+   for (i = 0; i  ARRAY_LENGTH(capability_strings); i++) {
+   yes = compositor-capabilities  capability_strings[i].bit;
+   weston_log_continue(STAMP_SPACE %s %s\n,
+   capability_strings[i].desc,
+   yes ? yes : no);
+   }
+}
+
 static int on_term_signal(int signal_number, void *data)
 {
struct wl_display *display = data;
@@ -3214,6 +3236,8 @@ int main(int argc, char *argv[])
goto out;
}
 
+   weston_compositor_log_capabilities(ec);
+
if (wl_display_add_socket(display, socket_name)) {
weston_log(fatal: failed to add socket: %m\n);
ret = EXIT_FAILURE;
diff --git a/src/compositor.h b/src/compositor.h
index 318fc0d..e7d19b0 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -484,6 +484,11 @@ struct weston_renderer {
void (*destroy)(struct weston_compositor *ec);
 };
 
+enum weston_capability {
+   /* backend/renderer supports arbitrary rotation */
+   WESTON_CAP_ROTATION_ANY = 0x0001,
+};
+
 struct weston_compositor {
struct wl_signal destroy_signal;
 
@@ -525,6 +530,7 @@ struct weston_compositor {
 
/* Repaint state. */
struct weston_plane primary_plane;
+   uint32_t capabilities; /* combination of enum weston_capability */
 
uint32_t focus;
 
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index be74eba..87b3be0 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -1837,6 +1837,7 @@ gl_renderer_create(struct weston_compositor *ec, 
EGLNativeDisplayType display,
}
 
ec-renderer = gr-base;
+   ec-capabilities |= WESTON_CAP_ROTATION_ANY;
 
return 0;
 
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index 60800bc..ad79c95 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -496,6 +496,7 @@ pixman_renderer_init(struct weston_compositor *ec)
renderer-base.destroy_surface = pixman_renderer_destroy_surface;
renderer-base.destroy = pixman_renderer_destroy;
ec-renderer = renderer-base;
+   ec-capabilities |= WESTON_CAP_ROTATION_ANY;
 
weston_compositor_add_debug_binding(ec, KEY_R,
debug_binding, ec);
diff --git a/src/shell.c b/src/shell.c
index 7261570..e23c09b 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -4247,8 +4247,11 @@ shell_add_bindings(struct weston_compositor *ec, struct 
desktop_shell *shell)
 shell);
weston_compositor_add_button_binding(ec, BTN_MIDDLE, mod,
 resize_binding, shell);
-   weston_compositor_add_button_binding(ec, BTN_RIGHT, mod,
-rotate_binding, NULL);
+
+   if (ec-capabilities  WESTON_CAP_ROTATION_ANY)
+   weston_compositor_add_button_binding(ec, BTN_RIGHT, mod,
+rotate_binding, NULL);
+
weston_compositor_add_key_binding(ec, KEY_TAB, mod, switcher_binding,
  shell);
weston_compositor_add_key_binding(ec, KEY_F9, mod, backlight_binding,
-- 
1.8.1.5

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


[PATCH weston 02/18] compositor: add capability CAPTURE_YFLIP

2013-05-22 Thread ppaalanen
From: Pekka Paalanen ppaala...@gmail.com

Both GL and pixman renderer (pixman probably only because GL did?)
return the screen capture image as y-flipped, therefore Weston y-flips
it again. However, the future rpi-renderer can produce only right-way-up
(non-flipped) screen captures, and does not need an y-flip.

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

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

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 src/compositor.c  |  3 +-
 src/compositor.h  |  3 ++
 src/gl-renderer.c |  1 +
 src/pixman-renderer.c |  1 +
 src/screenshooter.c   | 96 ---
 5 files changed, 83 insertions(+), 21 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 657e134..33010dd 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2821,10 +2821,11 @@ weston_version(int *major, int *minor, int *micro)
 }
 
 static const struct {
-   uint32_t bit;
+   uint32_t bit; /* enum weston_capability */
const char *desc;
 } capability_strings[] = {
{ WESTON_CAP_ROTATION_ANY, arbitrary surface rotation: },
+   { WESTON_CAP_CAPTURE_YFLIP, screen capture uses y-flip: },
 };
 
 static void
diff --git a/src/compositor.h b/src/compositor.h
index e7d19b0..efc4102 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -487,6 +487,9 @@ struct weston_renderer {
 enum weston_capability {
/* backend/renderer supports arbitrary rotation */
WESTON_CAP_ROTATION_ANY = 0x0001,
+
+   /* screencaptures need to be y-flipped */
+   WESTON_CAP_CAPTURE_YFLIP= 0x0002,
 };
 
 struct weston_compositor {
diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index 87b3be0..4915b90 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -1838,6 +1838,7 @@ gl_renderer_create(struct weston_compositor *ec, 
EGLNativeDisplayType display,
 
ec-renderer = gr-base;
ec-capabilities |= WESTON_CAP_ROTATION_ANY;
+   ec-capabilities |= WESTON_CAP_CAPTURE_YFLIP;
 
return 0;
 
diff --git a/src/pixman-renderer.c b/src/pixman-renderer.c
index ad79c95..36563c6 100644
--- a/src/pixman-renderer.c
+++ b/src/pixman-renderer.c
@@ -497,6 +497,7 @@ pixman_renderer_init(struct weston_compositor *ec)
renderer-base.destroy = pixman_renderer_destroy;
ec-renderer = renderer-base;
ec-capabilities |= WESTON_CAP_ROTATION_ANY;
+   ec-capabilities |= WESTON_CAP_CAPTURE_YFLIP;
 
weston_compositor_add_debug_binding(ec, KEY_R,
debug_binding, ec);
diff --git a/src/screenshooter.c b/src/screenshooter.c
index ae97b4e..6f53fad 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -62,6 +62,13 @@ copy_bgra_yflip(uint8_t *dst, uint8_t *src, int height, int 
stride)
 }
 
 static void
+copy_bgra(uint8_t *dst, uint8_t *src, int height, int stride)
+{
+   /* TODO: optimize this out */
+   memcpy(dst, src, height * stride);
+}
+
+static void
 copy_row_swap_RB(void *vdst, void *vsrc, int bytes)
 {
uint32_t *dst = vdst;
@@ -92,18 +99,32 @@ copy_rgba_yflip(uint8_t *dst, uint8_t *src, int height, int 
stride)
 }
 
 static void
+copy_rgba(uint8_t *dst, uint8_t *src, int height, int stride)
+{
+   uint8_t *end;
+
+   end = dst + height * stride;
+   while (dst  end) {
+   copy_row_swap_RB(dst, src, stride);
+   dst += stride;
+   src += stride;
+   }
+}
+
+static void
 screenshooter_frame_notify(struct wl_listener *listener, void *data)
 {
struct screenshooter_frame_listener *l =
container_of(listener,
 struct screenshooter_frame_listener, listener);
struct weston_output *output = data;
+   struct weston_compositor *compositor = output-compositor;
int32_t stride;
uint8_t *pixels, *d, *s;
 
output-disable_planes--;
wl_list_remove(listener-link);
-   stride = l-buffer-width * 
(PIXMAN_FORMAT_BPP(output-compositor-read_format) / 8);
+   stride = l-buffer-width * (PIXMAN_FORMAT_BPP(compositor-read_format) 
/ 8);
pixels = malloc(stride * l-buffer-height);
 
if (pixels == NULL) {
@@ -112,8 +133,8 @@ screenshooter_frame_notify(struct wl_listener *listener, 
void *data)
return;
}
 
-   output-compositor-renderer-read_pixels(output,
-output-compositor-read_format, pixels,
+   compositor-renderer-read_pixels(output,
+compositor-read_format, pixels,
 0, 0, output-current-width,
 

[PATCH weston 04/18] rpi: switch to rpi-renderer

2013-05-22 Thread ppaalanen
From: Pekka Paalanen ppaala...@gmail.com

Replace the GL renderer with the new rpi-renderer on the Raspberry Pi
backend. This makes Weston on rpi not use EGL or GL anymore, at all.

The weston_plane feature is disabled, since the rpi-renderer does the
same, but better.

Add a command line option to select the output transform. It is not a
weston.ini option for now, since the rpi backend does not read the
configuration file yet. Hopefully that will be done later with some
shared code.

Add the rpi options to 'weston --help' output.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 configure.ac |   4 +-
 src/compositor-rpi.c | 171 +--
 src/compositor.c |  10 +++
 3 files changed, 97 insertions(+), 88 deletions(-)

diff --git a/configure.ac b/configure.ac
index 93a6720..2aec1bb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,9 +146,9 @@ AC_ARG_ENABLE(rpi-compositor,
  AS_HELP_STRING([--disable-rpi-compositor],
 [do not build the Raspberry Pi backend]),,
  enable_rpi_compositor=yes)
-AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test x$enable_rpi_compositor = xyes 
-a x$enable_egl = xyes)
+AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test x$enable_rpi_compositor = xyes)
 have_bcm_host=no
-if test x$enable_rpi_compositor = xyes -a x$enable_egl = xyes; then
+if test x$enable_rpi_compositor = xyes; then
   AC_DEFINE([BUILD_RPI_COMPOSITOR], [1], [Build the compositor for Raspberry 
Pi])
   PKG_CHECK_MODULES(RPI_COMPOSITOR, [libudev = 136 mtdev = 1.1.0])
   PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index 3cb2b56..f83e55c 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -1,7 +1,7 @@
 /*
  * Copyright © 2008-2011 Kristian Høgsberg
  * Copyright © 2011 Intel Corporation
- * Copyright © 2012 Raspberry Pi Foundation
+ * Copyright © 2012-2013 Raspberry Pi Foundation
  *
  * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation for any purpose is hereby granted without fee, provided
@@ -44,7 +44,7 @@
 #endif
 
 #include compositor.h
-#include gl-renderer.h
+#include rpi-renderer.h
 #include evdev.h
 
 /*
@@ -148,8 +148,6 @@ struct rpi_output {
struct rpi_flippipe flippipe;
 
DISPMANX_DISPLAY_HANDLE_T display;
-   EGL_DISPMANX_WINDOW_T egl_window;
-   DISPMANX_ELEMENT_HANDLE_T egl_element;
 
struct wl_list element_list; /* struct rpi_element */
struct wl_list old_element_list; /* struct rpi_element */
@@ -910,9 +908,12 @@ rpi_output_repaint(struct weston_output *base, 
pixman_region32_t *damage)
DISPMANX_UPDATE_HANDLE_T update;
int layer = 1;
 
-   DBG(%s\n, __func__);
+   DBG(frame update start\n);
 
-   update = vc_dispmanx_update_start(0);
+   /* Update priority higher than in rpi-renderer's
+* output destroy function, see rpi_output_destroy().
+*/
+   update = vc_dispmanx_update_start(1);
 
/* update all live elements */
wl_list_for_each(element, output-element_list, link) {
@@ -923,20 +924,16 @@ rpi_output_repaint(struct weston_output *base, 
pixman_region32_t *damage)
/* remove all unused elements */
rpi_remove_elements(output-old_element_list, update);
 
-   /* schedule callback to rpi_output_update_complete() */
-   rpi_dispmanx_update_submit(update, output);
-
-   /* XXX: if there is anything to composite in GL,
-* framerate seems to suffer */
-   /* XXX: optimise the renderer for the case of nothing to render */
-   /* XXX: if nothing to render, remove the element...
-* but how, is destroying the EGLSurface a bad performance hit?
-*/
+   rpi_renderer_set_update_handle(output-base, update);
compositor-base.renderer-repaint_output(output-base, damage);
 
pixman_region32_subtract(primary_plane-damage,
 primary_plane-damage, damage);
 
+   /* schedule callback to rpi_output_update_complete() */
+   rpi_dispmanx_update_submit(update, output);
+   DBG(frame update submitted\n);
+
/* Move the list of elements into the old_element_list. */
wl_list_insert_list(output-old_element_list, output-element_list);
wl_list_init(output-element_list);
@@ -945,7 +942,9 @@ rpi_output_repaint(struct weston_output *base, 
pixman_region32_t *damage)
 static void
 rpi_output_update_complete(struct rpi_output *output, uint64_t time)
 {
+   DBG(frame update complete(% PRIu64 )\n, time);
rpi_output_destroy_old_elements(output);
+   rpi_renderer_finish_frame(output-base);
weston_output_finish_frame(output-base, time);
 }
 
@@ -958,15 +957,12 @@ rpi_output_destroy(struct weston_output *base)
 
DBG(%s\n, __func__);
 
-   rpi_flippipe_release(output-flippipe);
-
update = vc_dispmanx_update_start(0);

[PATCH weston 05/18] rpi: remove weston_plane support

2013-05-22 Thread ppaalanen
From: Pekka Paalanen ppaala...@gmail.com

There is no need to support weston_plane anymore.
The max-planes option is removed as unused.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 src/compositor-rpi.c | 727 ---
 1 file changed, 727 deletions(-)

diff --git a/src/compositor-rpi.c b/src/compositor-rpi.c
index f83e55c..64ef0ff 100644
--- a/src/compositor-rpi.c
+++ b/src/compositor-rpi.c
@@ -47,51 +47,6 @@
 #include rpi-renderer.h
 #include evdev.h
 
-/*
- * Dispmanx API offers alpha-blended overlays for hardware compositing.
- * The final composite consists of dispmanx elements, and their contents:
- * the dispmanx resource assigned to the element. The elements may be
- * scanned out directly, or composited to a temporary surface, depending on
- * how the firmware decides to handle the scene. Updates to multiple elements
- * may be queued in a single dispmanx update object, resulting in atomic and
- * vblank synchronized display updates.
- *
- * To avoid tearing and display artifacts, the current dispmanx resource in a
- * dispmanx element must not be touched. Therefore each element must be
- * double-buffered, using two resources, the front and the back. The update
- * sequence is:
- * 0. the front resource is already in-use, the back resource is unused
- * 1. write data into the back resource
- * 2. submit an element update, back becomes in-use
- * 3. swap back and front pointers (both are in-use now)
- * 4. wait for update_submit completion, the new back resource becomes unused
- *
- * A resource may be destroyed only, when the update removing the element has
- * completed. Otherwise you risk showing an incomplete composition.
- *
- * The dispmanx element used as the native window for EGL does not need
- * manually allocated resources, EGL does double-buffering internally.
- * Unfortunately it also means, that we cannot alternate between two
- * buffers like the DRM backend does, since we have no control over what
- * resources EGL uses. We are forced to use EGL_BUFFER_PRESERVED as the
- * EGL_SWAP_BEHAVIOR to avoid repainting the whole output every frame.
- *
- * We also cannot bundle eglSwapBuffers into our own display update, which
- * means that Weston's primary plane updates and the overlay updates may
- * happen unsynchronized.
- */
-
-#ifndef ELEMENT_CHANGE_LAYER
-/* copied from interface/vmcs_host/vc_vchi_dispmanx.h of userland.git */
-#define ELEMENT_CHANGE_LAYER  (10)
-#define ELEMENT_CHANGE_OPACITY(11)
-#define ELEMENT_CHANGE_DEST_RECT  (12)
-#define ELEMENT_CHANGE_SRC_RECT   (13)
-#define ELEMENT_CHANGE_MASK_RESOURCE  (14)
-#define ELEMENT_CHANGE_TRANSFORM  (15)
-#endif
-
-/* Enabling this debugging incurs a significant performance hit */
 #if 0
 #define DBG(...) \
weston_log(__VA_ARGS__)
@@ -99,40 +54,9 @@
 #define DBG(...) do {} while (0)
 #endif
 
-/* If we had a fully featured vc_dispmanx_resource_write_data()... */
-/*#define HAVE_RESOURCE_WRITE_DATA_RECT 1*/
-
 struct rpi_compositor;
 struct rpi_output;
 
-struct rpi_resource {
-   DISPMANX_RESOURCE_HANDLE_T handle;
-   int width;
-   int height; /* height of the image (valid pixel data) */
-   int stride; /* bytes */
-   int buffer_height; /* height of the buffer */
-   VC_IMAGE_TYPE_T ifmt;
-};
-
-struct rpi_element {
-   struct wl_list link;
-   struct weston_plane plane;
-   struct rpi_output *output;
-
-   DISPMANX_ELEMENT_HANDLE_T handle;
-   int layer;
-   int need_swap;
-   int single_buffer;
-
-   struct rpi_resource resources[2];
-   struct rpi_resource *front;
-   struct rpi_resource *back;
-   pixman_region32_t prev_damage;
-
-   struct weston_surface *surface;
-   struct wl_listener surface_destroy_listener;
-};
-
 struct rpi_flippipe {
int readfd;
int writefd;
@@ -148,9 +72,6 @@ struct rpi_output {
struct rpi_flippipe flippipe;
 
DISPMANX_DISPLAY_HANDLE_T display;
-
-   struct wl_list element_list; /* struct rpi_element */
-   struct wl_list old_element_list; /* struct rpi_element */
 };
 
 struct rpi_seat {
@@ -169,7 +90,6 @@ struct rpi_compositor {
struct udev *udev;
struct tty *tty;
 
-   int max_planes; /* per output, really */
int single_buffer;
 };
 
@@ -191,425 +111,6 @@ to_rpi_compositor(struct weston_compositor *base)
return container_of(base, struct rpi_compositor, base);
 }
 
-static inline int
-int_max(int a, int b)
-{
-   return a  b ? a : b;
-}
-
-static void
-rpi_resource_init(struct rpi_resource *resource)
-{
-   resource-handle = DISPMANX_NO_HANDLE;
-}
-
-static void
-rpi_resource_release(struct rpi_resource *resource)
-{
-   if (resource-handle == DISPMANX_NO_HANDLE)
-   return;
-
-   vc_dispmanx_resource_delete(resource-handle);
-   DBG(resource %p release\n, resource);
-   resource-handle = DISPMANX_NO_HANDLE;
-}
-

[PATCH weston 06/18] shell: wait for desktop-shell init before fade in

2013-05-22 Thread ppaalanen
From: Pekka Paalanen ppaala...@gmail.com

On Raspberry Pi, weston-desktop-shell is so slow to start, that the
compositor has time to run the fade-in before the wallpaper is up. The
user launching Weston sees the screen flipping to black, the fbcon
fading in, and then the desktop popping up.

To fix this, wait for the weston-desktop-shell to draw
everything before starting the initial fade-in. A new request is
added to the private desktop-shell protocol to signal it. If a
desktop-shell client does not support the new request, the fade-in
happens already at bind time.

If weston-desktop-shell crashes, or does not send the 'desktop_ready'
request in 15 seconds, the compositor will fade in anyway. This should
avoid a blocked screen in case weston-desktop-shell malfunction.

shell_fade_startup() does not directly start the fade-in but schedules
an idle callback, so that the compositor can process all pending events
before starting the fade clock. Otherwise (on RPi) we risk skipping part
of the animation. Yes, it is a hack, that should have been done in
window.c and weston-desktop-shell instead.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 clients/desktop-shell.c|  46 +-
 protocol/desktop-shell.xml |  13 -
 src/shell.c| 119 +++--
 3 files changed, 162 insertions(+), 16 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 3949975..4a39653 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -49,6 +49,7 @@ extern char **environ; /* defined by libc */
 struct desktop {
struct display *display;
struct desktop_shell *shell;
+   uint32_t interface_version;
struct unlock_dialog *unlock_dialog;
struct task unlock_task;
struct wl_list outputs;
@@ -57,6 +58,8 @@ struct desktop {
struct widget *grab_widget;
 
enum cursor_type grab_cursor;
+
+   int painted;
 };
 
 struct surface {
@@ -72,12 +75,14 @@ struct panel {
struct widget *widget;
struct wl_list launcher_list;
struct panel_clock *clock;
+   int painted;
 };
 
 struct background {
struct surface base;
struct window *window;
struct widget *widget;
+   int painted;
 };
 
 struct output {
@@ -175,6 +180,38 @@ show_menu(struct panel *panel, struct input *input, 
uint32_t time)
 x - 10, y - 10, menu_func, entries, 4);
 }
 
+static int
+is_desktop_painted(struct desktop *desktop)
+{
+   struct output *output;
+
+   wl_list_for_each(output, desktop-outputs, link) {
+   if (output-panel  !output-panel-painted)
+   return 0;
+   if (output-background  !output-background-painted)
+   return 0;
+   }
+
+   return 1;
+}
+
+static void
+check_desktop_ready(struct window *window)
+{
+   struct display *display;
+   struct desktop *desktop;
+
+   display = window_get_display(window);
+   desktop = display_get_user_data(display);
+
+   if (!desktop-painted  is_desktop_painted(desktop)) {
+   desktop-painted = 1;
+
+   if (desktop-interface_version = 2)
+   desktop_shell_desktop_ready(desktop-shell);
+   }
+}
+
 static void
 panel_launcher_activate(struct panel_launcher *widget)
 {
@@ -263,6 +300,8 @@ panel_redraw_handler(struct widget *widget, void *data)
 
cairo_destroy(cr);
cairo_surface_destroy(surface);
+   panel-painted = 1;
+   check_desktop_ready(panel-window);
 }
 
 static int
@@ -694,6 +733,9 @@ background_draw(struct widget *widget, void *data)
  allocation.width, allocation.height);
wl_surface_set_opaque_region(window_get_wl_surface(background-window), 
opaque);
wl_region_destroy(opaque);
+
+   background-painted = 1;
+   check_desktop_ready(background-window);
 }
 
 static void
@@ -1046,8 +1088,10 @@ global_handler(struct display *display, uint32_t id,
struct desktop *desktop = data;
 
if (!strcmp(interface, desktop_shell)) {
+   desktop-interface_version = (version  2) ? version : 2;
desktop-shell = display_bind(desktop-display,
- id, desktop_shell_interface, 1);
+ id, desktop_shell_interface,
+ desktop-interface_version);
desktop_shell_add_listener(desktop-shell, listener, desktop);
} else if (!strcmp(interface, wl_output)) {
create_output(desktop, id);
diff --git a/protocol/desktop-shell.xml b/protocol/desktop-shell.xml
index d48c3dd..65e44a7 100644
--- a/protocol/desktop-shell.xml
+++ b/protocol/desktop-shell.xml
@@ -1,6 +1,6 @@
 protocol name=desktop
 
-  interface name=desktop_shell version=1
+  interface name=desktop_shell version=2
 description 

[PATCH weston 07/18] desktop-shell: new wallpaper mode scale-crop

2013-05-22 Thread ppaalanen
From: Pekka Paalanen ppaala...@gmail.com

Scale-crop mode scales the wallpaper to tightly fill the whole output,
but preserving wallpaper aspect ratio. If aspect ratio differs from the
output's, the wallpaper is centered cutting it from top/bottom or
left/right.

Add this to the weston.ini man page, and explain all three modes.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 clients/desktop-shell.c | 27 ++-
 man/weston.ini.man  |  9 +++--
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 4a39653..1fc8753 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -664,6 +664,7 @@ panel_add_launcher(struct panel *panel, const char *icon, 
const char *path)
 
 enum {
BACKGROUND_SCALE,
+   BACKGROUND_SCALE_CROP,
BACKGROUND_TILE
 };
 
@@ -675,7 +676,9 @@ background_draw(struct widget *widget, void *data)
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
cairo_t *cr;
-   double sx, sy;
+   double im_w, im_h;
+   double sx, sy, s;
+   double tx, ty;
struct rectangle allocation;
int type = -1;
struct display *display;
@@ -695,6 +698,8 @@ background_draw(struct widget *widget, void *data)
 
if (strcmp(key_background_type, scale) == 0)
type = BACKGROUND_SCALE;
+   else if (strcmp(key_background_type, scale-crop) == 0)
+   type = BACKGROUND_SCALE_CROP;
else if (strcmp(key_background_type, tile) == 0)
type = BACKGROUND_TILE;
else
@@ -702,20 +707,32 @@ background_draw(struct widget *widget, void *data)
key_background_type);
 
if (image  type != -1) {
+   im_w = cairo_image_surface_get_width(image);
+   im_h = cairo_image_surface_get_height(image);
+   sx = im_w / allocation.width;
+   sy = im_h / allocation.height;
+
pattern = cairo_pattern_create_for_surface(image);
+
switch (type) {
case BACKGROUND_SCALE:
-   sx = (double) cairo_image_surface_get_width(image) /
-   allocation.width;
-   sy = (double) cairo_image_surface_get_height(image) /
-   allocation.height;
cairo_matrix_init_scale(matrix, sx, sy);
cairo_pattern_set_matrix(pattern, matrix);
break;
+   case BACKGROUND_SCALE_CROP:
+   s = (sx  sy) ? sx : sy;
+   /* align center */
+   tx = (im_w - s * allocation.width) * 0.5;
+   ty = (im_h - s * allocation.height) * 0.5;
+   cairo_matrix_init_translate(matrix, tx, ty);
+   cairo_matrix_scale(matrix, s, s);
+   cairo_pattern_set_matrix(pattern, matrix);
+   break;
case BACKGROUND_TILE:
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
break;
}
+
cairo_set_source(cr, pattern);
cairo_pattern_destroy (pattern);
cairo_surface_destroy(image);
diff --git a/man/weston.ini.man b/man/weston.ini.man
index d37654a..c3e5747 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -118,8 +118,13 @@ The entries that can appear in this section are:
 sets the path for the background image file (string).
 .TP 7
 .BI background-type= tile
-determines how the background image is drawn (string). Can be scale or
-tile (default).
+determines how the background image is drawn (string). Can be
+.BR scale ,  scale-crop  or  tile  (default).
+Scale means scaled to fit the output precisely, not preserving aspect ratio.
+Scale-crop preserves aspect ratio, scales the background image just big
+enough to cover the output, and centers it. The image ends up cropped from
+left and right, or top and bottom, if the aspect ratio does not match the
+output. Tile repeats the background image to fill the output.
 .TP 7
 .BI background-color= 0xAARRGGBB
 sets the color of the background (unsigned integer). The hexadecimal
-- 
1.8.1.5

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


[PATCH weston 08/18] toytoolkit: Make the window resizing optimization optional

2013-05-22 Thread ppaalanen
From: Louis-Francis Ratté-Boulianne l...@collabora.com

Whether or not a shm pool is used for resizing is now configurable at
build time (--disable-resize-optimization).

[pq: removed an unnecessary hunk from the patch]
---
 clients/window.c | 2 ++
 configure.ac | 7 +++
 2 files changed, 9 insertions(+)

diff --git a/clients/window.c b/clients/window.c
index 627f1e8..3f54111 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1004,6 +1004,7 @@ shm_surface_prepare(struct toysurface *base, int dx, int 
dy,
if (leaf-cairo_surface)
cairo_surface_destroy(leaf-cairo_surface);
 
+#ifdef USE_RESIZE_POOL
if (resize_hint  !leaf-resize_pool) {
/* Create a big pool to allocate from, while continuously
 * resizing. Mmapping a new pool in the server
@@ -1014,6 +1015,7 @@ shm_surface_prepare(struct toysurface *base, int dx, int 
dy,
leaf-resize_pool = shm_pool_create(surface-display,
6 * 1024 * 1024);
}
+#endif
 
leaf-cairo_surface =
display_create_shm_surface(surface-display, rect,
diff --git a/configure.ac b/configure.ac
index 2aec1bb..323bd87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -239,6 +239,13 @@ if test x$enable_clients = xyes; then
   PKG_CHECK_MODULES(PANGO, [pangocairo], [have_pango=yes], [have_pango=no])
 fi
 
+AC_ARG_ENABLE(resize-optimization,
+  AS_HELP_STRING([--disable-resize-optimization],
+ [disable resize optimization allocating a big 
buffer in toytoolkit]),,
+  enable_resize_optimization=yes)
+AS_IF([test x$enable_resize_optimization = xyes],
+  [AC_DEFINE([USE_RESIZE_POOL], [1], [Use resize memory pool as a 
performance optimization])])
+
 AC_ARG_ENABLE(weston-launch, [  --enable-weston-launch],, 
enable_weston_launch=yes)
 AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch == xyes)
 if test x$enable_weston_launch == xyes; then
-- 
1.8.1.5

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


[PATCH weston 09/18] screenshooter: print info to log

2013-05-22 Thread ppaalanen
From: Pekka Paalanen pekka.paala...@collabora.co.uk

Print the recording info to Weston log, not stderr.

Also fix the frame counter.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 src/screenshooter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/screenshooter.c b/src/screenshooter.c
index 6f53fad..dde052f 100644
--- a/src/screenshooter.c
+++ b/src/screenshooter.c
@@ -432,6 +432,7 @@ weston_recorder_frame_notify(struct wl_listener *listener, 
void *data)
}
 
pixman_region32_fini(damage);
+   recorder-count++;
 }
 
 static void
@@ -525,13 +526,13 @@ recorder_binding(struct weston_seat *seat, uint32_t time, 
uint32_t key, void *da
recorder = container_of(listener, struct weston_recorder,
frame_listener);
 
-   fprintf(stderr,
+   weston_log(
stopping recorder, total file size %dM, %d frames\n,
recorder-total / (1024 * 1024), recorder-count);
 
weston_recorder_destroy(recorder);
} else {
-   fprintf(stderr, starting recorder, file %s\n, filename);
+   weston_log(starting recorder, file %s\n, filename);
weston_recorder_create(output, filename);
}
 }
-- 
1.8.1.5

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


[PATCH weston 10/18] animation, shell: add kbd focus change animation

2013-05-22 Thread ppaalanen
From: Louis-Francis Ratté-Boulianne l...@collabora.com

When enabled, this will make all but the keyboard-focused window dim.
Also the background gets dimmed, if there are any windows open. The
panel is not dimmed.

When the keyboard focus changes, the change in dimming is animated.

The dimming is implemented with transparent solid-color surfaces, two at
most. The net effect of two overlapping dim surfaces is kept constant
during animations (stable fade animation).

There is a new weston.ini option focus-animation, that defaults to
none, and can be set to dim-layer to enable the focus change
animation.

[pq: Sliced, squashed, and rebased the patch series. Fixed surface alpha
interaction with the switcher. Wrote the commit message.]
---
 src/animation.c  |  52 ++--
 src/compositor.h |   8 ++
 src/shell.c  | 251 +--
 3 files changed, 282 insertions(+), 29 deletions(-)

diff --git a/src/animation.c b/src/animation.c
index e947d72..6f20179 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -108,9 +108,10 @@ struct weston_surface_animation {
weston_surface_animation_frame_func_t frame;
weston_surface_animation_done_func_t done;
void *data;
+   void *private;
 };
 
-static void
+WL_EXPORT void
 weston_surface_animation_destroy(struct weston_surface_animation *animation)
 {
wl_list_remove(animation-animation.link);
@@ -162,7 +163,8 @@ weston_surface_animation_run(struct weston_surface *surface,
 float start, float stop,
 weston_surface_animation_frame_func_t frame,
 weston_surface_animation_done_func_t done,
-void *data)
+void *data,
+void *private)
 {
struct weston_surface_animation *animation;
 
@@ -176,6 +178,7 @@ weston_surface_animation_run(struct weston_surface *surface,
animation-data = data;
animation-start = start;
animation-stop = stop;
+   animation-private = private;
weston_matrix_init(animation-transform.matrix);
wl_list_insert(surface-geometry.transformation_list,
   animation-transform.link);
@@ -222,7 +225,7 @@ weston_zoom_run(struct weston_surface *surface, float 
start, float stop,
weston_surface_animation_done_func_t done, void *data)
 {
return weston_surface_animation_run(surface, start, stop,
-   zoom_frame, done, data);
+   zoom_frame, done, data, NULL);
 }
 
 static void
@@ -244,7 +247,7 @@ weston_fade_run(struct weston_surface *surface,
struct weston_surface_animation *fade;
 
fade = weston_surface_animation_run(surface, 0, 0,
-   fade_frame, done, data);
+   fade_frame, done, data, NULL);
 
weston_spring_init(fade-spring, k, start, end);
surface-alpha = start;
@@ -260,6 +263,45 @@ weston_fade_update(struct weston_surface_animation *fade,
 }
 
 static void
+stable_fade_frame(struct weston_surface_animation *animation)
+{
+   struct weston_surface *back_surface;
+
+   if (animation-spring.current  0.999)
+   animation-surface-alpha = 1;
+   else if (animation-spring.current  0.001 )
+   animation-surface-alpha = 0;
+   else
+   animation-surface-alpha = animation-spring.current;
+
+   back_surface = (struct weston_surface *) animation-private;
+   back_surface-alpha =
+   (animation-spring.target - animation-surface-alpha) /
+   (1.0 - animation-surface-alpha);
+   weston_surface_geometry_dirty(back_surface);
+}
+
+WL_EXPORT struct weston_surface_animation *
+weston_stable_fade_run(struct weston_surface *front_surface, float start,
+   struct weston_surface *back_surface, float end,
+   weston_surface_animation_done_func_t done, void *data)
+{
+   struct weston_surface_animation *fade;
+
+   fade = weston_surface_animation_run(front_surface, 0, 0,
+   stable_fade_frame, done, data, 
back_surface);
+
+
+   weston_spring_init(fade-spring, 400, start, end);
+   fade-spring.friction = 1150;
+
+   front_surface-alpha = start;
+   back_surface-alpha = end;
+
+   return fade;
+}
+
+static void
 slide_frame(struct weston_surface_animation *animation)
 {
float scale;
@@ -278,7 +320,7 @@ weston_slide_run(struct weston_surface *surface, float 
start, float stop,
struct weston_surface_animation *animation;
 
animation = weston_surface_animation_run(surface, start, stop,
-slide_frame, done, data);
+slide_frame, done, data, NULL);
if (!animation)
  

[PATCH weston 11/18] animation: Make zoom animation renders better and smoother

2013-05-22 Thread ppaalanen
From: Louis-Francis Ratté-Boulianne l...@collabora.com

Don't scale to a size smaller than 1/8 the surface size
Adjust spring parameters so we don't go over the target value
---
 src/animation.c | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/animation.c b/src/animation.c
index 6f20179..835ed13 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -206,6 +206,9 @@ zoom_frame(struct weston_surface_animation *animation)
scale = animation-start +
(animation-stop - animation-start) *
animation-spring.current;
+   if (scale  0.125)
+   scale = 0.125;
+
weston_matrix_init(animation-transform.matrix);
weston_matrix_translate(animation-transform.matrix,
-0.5f * es-geometry.width,
@@ -224,8 +227,15 @@ WL_EXPORT struct weston_surface_animation *
 weston_zoom_run(struct weston_surface *surface, float start, float stop,
weston_surface_animation_done_func_t done, void *data)
 {
-   return weston_surface_animation_run(surface, start, stop,
+   struct weston_surface_animation *zoom;
+
+   zoom = weston_surface_animation_run(surface, start, stop,
zoom_frame, done, data, NULL);
+
+   zoom-spring.k = 400;
+   zoom-spring.friction = 1150;
+
+   return zoom;
 }
 
 static void
-- 
1.8.1.5

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


[PATCH weston 12/18] compositor, shell: Add animation to measure desktop fps

2013-05-22 Thread ppaalanen
From: Louis-Francis Ratté-Boulianne l...@collabora.com

On the first output, count the number of frames rendered for each
second, and report the fps in the Weston log.

To ensure a busy rendering loop, the debug key binding starting the
measurement also creates a bouncing box animation on screen. The box is
simply a solid color surface that moves around randomly.

This crude benchmark mode is useful for seeing whether the compositor
can consistently hit the screen refresh rate.

[pq: wrote the commit message, ported over the great input rework]
---
 src/compositor.c |  33 +++
 src/compositor.h |  10 +
 src/shell.c  | 121 +++
 3 files changed, 164 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 65da583..238c809 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1293,6 +1293,22 @@ weston_output_finish_frame(struct weston_output *output, 
uint32_t msecs)
wl_display_get_event_loop(compositor-wl_display);
int fd;
 
+   if (output-benchmark.enabled) {
+   if (output-benchmark.update_time == 0) {
+   output-benchmark.update_time = msecs;
+   } else {
+   uint32_t d = msecs - output-benchmark.update_time;
+   float fps;
+   output-benchmark.frame_counter++;
+   if (d = 1000) {
+   fps = output-benchmark.frame_counter * 1000.0f 
/ d;
+   weston_log(FPS = %f\n, fps);
+   output-benchmark.update_time = msecs;
+   output-benchmark.frame_counter = 0;
+   }
+   }
+   }
+
output-frame_time = msecs;
if (output-repaint_needed) {
weston_output_repaint(output, msecs);
@@ -2634,6 +2650,9 @@ weston_output_init(struct weston_output *output, struct 
weston_compositor *c,
output-mm_width = width;
output-mm_height = height;
output-dirty = 1;
+   output-benchmark.enabled = 0;
+   output-benchmark.update_time = 0;
+   output-benchmark.frame_counter = 0;
 
weston_output_transform_init(output, transform);
weston_output_init_zoom(output);
@@ -2655,6 +2674,20 @@ weston_output_init(struct weston_output *output, struct 
weston_compositor *c,
wl_signal_emit(c-output_created_signal, output);
 }
 
+WL_EXPORT void
+weston_output_enable_benchmark(struct weston_output *output)
+{
+   output-benchmark.enabled = 1;
+   output-benchmark.update_time = 0;
+   output-benchmark.frame_counter = 0;
+}
+
+WL_EXPORT void
+weston_output_disable_benchmark(struct weston_output *output)
+{
+   output-benchmark.enabled = 0;
+}
+
 static void
 compositor_bind(struct wl_client *client,
void *data, uint32_t version, uint32_t id)
diff --git a/src/compositor.h b/src/compositor.h
index 61aeb9f..96cabeb 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -188,6 +188,12 @@ struct weston_output {
struct weston_mode *origin;
struct wl_list mode_list;
 
+   struct {
+   int enabled;
+   uint32_t update_time;
+   int frame_counter;
+   } benchmark;
+
void (*start_repaint_loop)(struct weston_output *output);
void (*repaint)(struct weston_output *output,
pixman_region32_t *damage);
@@ -864,6 +870,10 @@ weston_output_schedule_repaint(struct weston_output 
*output);
 void
 weston_output_damage(struct weston_output *output);
 void
+weston_output_enable_benchmark(struct weston_output *output);
+void
+weston_output_disable_benchmark(struct weston_output *output);
+void
 weston_compositor_schedule_repaint(struct weston_compositor *compositor);
 void
 weston_compositor_fade(struct weston_compositor *compositor, float tint);
diff --git a/src/shell.c b/src/shell.c
index b7c372e..812296a 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -158,6 +158,18 @@ struct desktop_shell {
} screensaver;
 
struct {
+   struct weston_layer layer;
+   struct weston_surface *surface;
+   struct weston_animation animation;
+   struct weston_transform transform;
+   uint32_t anim_timestamp;
+   double anim_current;
+   double anim_duration;
+   int32_t anim_dx;
+   int32_t anim_dy;
+   } benchmark;
+
+   struct {
struct wl_resource *binding;
struct wl_list surfaces;
} input_panel;
@@ -4265,6 +4277,111 @@ backlight_binding(struct weston_seat *seat, uint32_t 
time, uint32_t key,
output-set_backlight(output, output-backlight_current);
 }
 
+static void
+benchmark_animation_frame(struct weston_animation *animation,
+ struct weston_output *output, uint32_t msecs)
+{
+   struct 

[PATCH weston 13/18] Add modifier-only binding

2013-05-22 Thread ppaalanen
From: Daniel Stone dan...@fooishbar.org

Add the ability to bind to modifiers; the binding is armed when a key
which sets the requested modifier is pressed, and triggered if the key
is released with no other keys having been pressed in the meantime, as
well as mouse buttons or scroll axes.

This only works for direct modifiers (e.g. Shift and Alt), not modifiers
which latch or lock.

Signed-off-by: Daniel Stone dan...@fooishbar.org
---
 src/bindings.c   | 58 
 src/compositor.c |  1 +
 src/compositor.h | 16 
 src/input.c  | 38 +
 4 files changed, 113 insertions(+)

diff --git a/src/bindings.c b/src/bindings.c
index e548ff1..e560b61 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -74,6 +74,24 @@ weston_compositor_add_key_binding(struct weston_compositor 
*compositor,
 }
 
 WL_EXPORT struct weston_binding *
+weston_compositor_add_modifier_binding(struct weston_compositor *compositor,
+  uint32_t modifier,
+  weston_modifier_binding_handler_t 
handler,
+  void *data)
+{
+   struct weston_binding *binding;
+
+   binding = weston_compositor_add_binding(compositor, 0, 0, 0,
+   modifier, handler, data);
+   if (binding == NULL)
+   return NULL;
+
+   wl_list_insert(compositor-modifier_binding_list.prev, binding-link);
+
+   return binding;
+}
+
+WL_EXPORT struct weston_binding *
 weston_compositor_add_button_binding(struct weston_compositor *compositor,
 uint32_t button, uint32_t modifier,
 weston_button_binding_handler_t handler,
@@ -215,6 +233,10 @@ weston_compositor_run_key_binding(struct weston_compositor 
*compositor,
if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
return;
 
+   /* Invalidate all active modifier bindings. */
+   wl_list_for_each(b, compositor-modifier_binding_list, link)
+   b-key = key;
+
wl_list_for_each(b, compositor-key_binding_list, link) {
if (b-key == key  b-modifier == seat-modifier_state) {
weston_key_binding_handler_t handler = b-handler;
@@ -231,6 +253,34 @@ weston_compositor_run_key_binding(struct weston_compositor 
*compositor,
 }
 
 WL_EXPORT void
+weston_compositor_run_modifier_binding(struct weston_compositor *compositor,
+  struct weston_seat *seat,
+  enum weston_keyboard_modifier modifier,
+  enum wl_keyboard_key_state state)
+{
+   struct weston_binding *b;
+
+   wl_list_for_each(b, compositor-modifier_binding_list, link) {
+   weston_modifier_binding_handler_t handler = b-handler;
+
+   if (b-modifier != modifier)
+   continue;
+
+   /* Prime the modifier binding. */
+   if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
+   b-key = 0;
+   continue;
+   }
+   /* Ignore the binding if a key was pressed in between. */
+   else if (b-key != 0) {
+   return;
+   }
+
+   handler(seat, modifier, b-data);
+   }
+}
+
+WL_EXPORT void
 weston_compositor_run_button_binding(struct weston_compositor *compositor,
 struct weston_seat *seat,
 uint32_t time, uint32_t button,
@@ -241,6 +291,10 @@ weston_compositor_run_button_binding(struct 
weston_compositor *compositor,
if (state == WL_POINTER_BUTTON_STATE_RELEASED)
return;
 
+   /* Invalidate all active modifier bindings. */
+   wl_list_for_each(b, compositor-modifier_binding_list, link)
+   b-key = button;
+
wl_list_for_each(b, compositor-button_binding_list, link) {
if (b-button == button  b-modifier == seat-modifier_state) 
{
weston_button_binding_handler_t handler = b-handler;
@@ -257,6 +311,10 @@ weston_compositor_run_axis_binding(struct 
weston_compositor *compositor,
 {
struct weston_binding *b;
 
+   /* Invalidate all active modifier bindings. */
+   wl_list_for_each(b, compositor-modifier_binding_list, link)
+   b-key = axis;
+
wl_list_for_each(b, compositor-axis_binding_list, link) {
if (b-axis == axis  b-modifier == seat-modifier_state) {
weston_axis_binding_handler_t handler = b-handler;
diff --git a/src/compositor.c b/src/compositor.c
index 238c809..aa5baaf 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -2786,6 +2786,7 @@ weston_compositor_init(struct weston_compositor *ec,
wl_list_init(ec-seat_list);

[PATCH weston 14/18] Add move/scale animation

2013-05-22 Thread ppaalanen
From: Daniel Stone dan...@fooishbar.org

Add an animation which moves a surface to a new location, at the same
time as also rescaling it to a different size from the origin, rather
than the existing scale animation which resizes from the centre.

Signed-off-by: Daniel Stone dan...@fooishbar.org
---
 src/animation.c  | 62 
 src/compositor.h |  5 +
 2 files changed, 67 insertions(+)

diff --git a/src/animation.c b/src/animation.c
index 835ed13..7dd3683 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -339,3 +339,65 @@ weston_slide_run(struct weston_surface *surface, float 
start, float stop,
 
return animation;
 }
+
+struct weston_move_animation {
+   int dx;
+   int dy;
+   int reverse;
+   weston_surface_animation_done_func_t done;
+};
+
+static void
+move_frame(struct weston_surface_animation *animation)
+{
+   struct weston_move_animation *move = animation-private;
+   float scale;
+   float progress = animation-spring.current;
+
+   if (move-reverse)
+   progress = 1.0 - progress;
+
+   scale = animation-start +
+(animation-stop - animation-start) *
+progress;
+   weston_matrix_init(animation-transform.matrix);
+   weston_matrix_scale(animation-transform.matrix, scale, scale, 1.0f);
+   weston_matrix_translate(animation-transform.matrix,
+move-dx * progress, move-dy * progress,
+   0);
+}
+
+static void
+move_done(struct weston_surface_animation *animation, void *data)
+{
+   struct weston_move_animation *move = animation-private;
+
+   if (move-done)
+   move-done(animation, data);
+
+   free(move);
+}
+
+WL_EXPORT struct weston_surface_animation *
+weston_move_scale_run(struct weston_surface *surface, int dx, int dy,
+  float start, float end, int reverse,
+ weston_surface_animation_done_func_t done, void *data)
+{
+   struct weston_move_animation *move;
+   struct weston_surface_animation *animation;
+
+   move = malloc(sizeof(*move));
+   if (!move)
+   return NULL;
+   move-dx = dx;
+   move-dy = dy;
+   move-reverse = reverse;
+   move-done = done;
+
+   animation = weston_surface_animation_run(surface, start, end, 
move_frame,
+move_done, data, move);
+   animation-spring.k = 400;
+   animation-spring.friction = 1150;
+
+   return animation;
+}
diff --git a/src/compositor.h b/src/compositor.h
index 4d70ba2..2de6eb4 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -1142,6 +1142,11 @@ struct weston_surface_animation *
 weston_fade_run(struct weston_surface *surface,
float start, float end, float k,
weston_surface_animation_done_func_t done, void *data);
+
+struct weston_surface_animation *
+weston_move_scale_run(struct weston_surface *surface, int dx, int dy,
+  float start, float end, int reverse,
+ weston_surface_animation_done_func_t done, void *data);
 void
 weston_fade_update(struct weston_surface_animation *fade,
   float start, float end, float k);
-- 
1.8.1.5

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


[PATCH weston 15/18] Shell: Add Exposay

2013-05-22 Thread ppaalanen
From: Daniel Stone dan...@fooishbar.org

Exposay provides window overview functions which, when a key which
produces the binding modifier is pressed on its own, scales all
currently-open windows down to be shown overlaid on the desktop,
providing keyboard and mouse navigation to be able to switch window
focus.

Signed-off-by: Daniel Stone dan...@fooishbar.org
---
 src/shell.c | 574 
 1 file changed, 574 insertions(+)

diff --git a/src/shell.c b/src/shell.c
index 812296a..e0d579a 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1,6 +1,7 @@
 /*
  * Copyright © 2010-2012 Intel Corporation
  * Copyright © 2011-2012 Collabora, Ltd.
+ * Copyright © 2013 Raspberry Pi Foundation
  *
  * Permission to use, copy, modify, distribute, and sell this software and
  * its documentation for any purpose is hereby granted without fee, provided
@@ -55,6 +56,19 @@ enum fade_type {
FADE_OUT
 };
 
+enum exposay_target_state {
+   EXPOSAY_TARGET_OVERVIEW, /* show all windows */
+   EXPOSAY_TARGET_CANCEL, /* return to normal, same focus */
+   EXPOSAY_TARGET_SWITCH, /* return to normal, switch focus */
+};
+
+enum exposay_layout_state {
+   EXPOSAY_LAYOUT_INACTIVE = 0, /* normal desktop */
+   EXPOSAY_LAYOUT_ANIMATE_TO_INACTIVE, /* in transition to normal */
+   EXPOSAY_LAYOUT_OVERVIEW, /* show all windows */
+   EXPOSAY_LAYOUT_ANIMATE_TO_OVERVIEW, /* in transition to all windows */
+};
+
 struct focus_state {
struct weston_seat *seat;
struct workspace *ws;
@@ -181,6 +195,34 @@ struct desktop_shell {
struct wl_event_source *startup_timer;
} fade;
 
+   struct exposay {
+   /* XXX: Make these exposay_surfaces. */
+   struct weston_surface *focus_prev;
+   struct weston_surface *focus_current;
+   struct weston_surface *clicked;
+   struct workspace *workspace;
+   struct weston_seat *seat;
+   struct wl_list surface_list;
+
+   struct weston_keyboard_grab grab_kbd;
+   struct weston_pointer_grab grab_ptr;
+
+enum exposay_target_state state_target;
+enum exposay_layout_state state_cur;
+   int in_flight; /* number of animations still running */
+
+   int num_surfaces;
+   int grid_size;
+   int surface_size;
+
+   int hpadding_outer;
+   int vpadding_outer;
+   int padding_inner;
+
+   int row_current;
+   int column_current;
+   } exposay;
+
uint32_t binding_modifier;
enum animation_type win_animation_type;
enum animation_type focus_animation_type;
@@ -4244,6 +4286,533 @@ switcher_binding(struct weston_seat *seat, uint32_t 
time, uint32_t key,
switcher_next(switcher);
 }
 
+struct exposay_surface {
+   struct desktop_shell *shell;
+   struct weston_surface *surface;
+   struct wl_list link;
+
+   int x;
+   int y;
+   int width;
+   int height;
+   double scale;
+
+   int row;
+   int column;
+
+   /* The animations only apply a transformation for their own lifetime,
+* and don't have an option to indefinitely maintain the
+* transformation in a steady state - so, we apply our own once the
+* animation has finished. */
+   struct weston_transform transform;
+};
+
+static void exposay_set_state(struct desktop_shell *shell,
+  enum exposay_target_state state,
+ struct weston_seat *seat);
+static void exposay_check_state(struct desktop_shell *shell);
+
+static void
+exposay_in_flight_inc(struct desktop_shell *shell)
+{
+   shell-exposay.in_flight++;
+}
+
+static void
+exposay_in_flight_dec(struct desktop_shell *shell)
+{
+   if (--shell-exposay.in_flight  0)
+   return;
+
+   exposay_check_state(shell);
+}
+
+static void
+exposay_animate_in_done(struct weston_surface_animation *animation, void *data)
+{
+   struct exposay_surface *esurface = data;
+
+   wl_list_insert(esurface-surface-geometry.transformation_list,
+  esurface-transform.link);
+   weston_matrix_init(esurface-transform.matrix);
+   weston_matrix_scale(esurface-transform.matrix,
+   esurface-scale, esurface-scale, 1.0f);
+   weston_matrix_translate(esurface-transform.matrix,
+   esurface-x - esurface-surface-geometry.x,
+   esurface-y - esurface-surface-geometry.y,
+   0);
+
+   weston_surface_geometry_dirty(esurface-surface);
+   weston_compositor_schedule_repaint(esurface-surface-compositor);
+
+   exposay_in_flight_dec(esurface-shell);
+}
+
+static void
+exposay_animate_in(struct exposay_surface *esurface)
+{
+   

[PATCH weston 16/18] configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS

2013-05-22 Thread ppaalanen
From: Daniel Stone dan...@fooishbar.org

AC_USE_SYSTEM_EXTENSIONS enables _XOPEN_SOURCE, _GNU_SOURCE and similar
macros to expose the largest extent of functionality supported by the
underlying system.  This is required since these macros are often
limiting rather than merely additive, e.g. _XOPEN_SOURCE will actually
on some systems hide declarations which are not part of the X/Open spec.

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

Signed-off-by: Daniel Stone dan...@fooishbar.org

[pq: rebased and converted more files]
---
 clients/window.c  | 4 +---
 configure.ac  | 2 ++
 shared/cairo-util.c   | 2 +-
 shared/config-parser.c| 3 ++-
 shared/image-loader.c | 2 +-
 shared/matrix.c   | 2 ++
 shared/option-parser.c| 2 ++
 shared/os-compatibility.c | 2 +-
 src/animation.c   | 2 ++
 src/bindings.c| 2 ++
 src/clipboard.c   | 2 +-
 src/cms-helper.c  | 4 +---
 src/cms-static.c  | 5 +
 src/compositor-drm.c  | 6 +-
 src/compositor-fbdev.c| 2 +-
 src/compositor-headless.c | 4 +---
 src/compositor-rdp.c  | 4 +---
 src/compositor-rpi.c  | 4 +---
 src/compositor-wayland.c  | 5 +
 src/compositor-x11.c  | 4 +---
 src/compositor.c  | 2 --
 src/evdev-touchpad.c  | 2 ++
 src/evdev.c   | 2 ++
 src/filter.c  | 2 ++
 src/gl-renderer.c | 2 +-
 src/gl-renderer.h | 7 +++
 src/launcher-util.c   | 2 ++
 src/libbacklight.c| 2 +-
 src/log.c | 2 ++
 src/noop-renderer.c   | 2 +-
 src/pixman-renderer.c | 2 +-
 src/rpi-renderer.c| 4 ++--
 src/screenshooter.c   | 2 ++
 src/shell.c   | 2 ++
 src/tablet-shell.c| 2 ++
 src/text-backend.c| 2 ++
 src/tty.c | 2 ++
 src/udev-seat.c   | 2 ++
 src/weston-launch.c   | 2 --
 src/xwayland/launcher.c   | 2 +-
 src/xwayland/selection.c  | 2 +-
 src/xwayland/window-manager.c | 2 +-
 src/zoom.c| 2 ++
 43 files changed, 62 insertions(+), 54 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 3f54111..28df2ca 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -21,9 +21,7 @@
  * OF THIS SOFTWARE.
  */
 
-#define _GNU_SOURCE
-
-#include ../config.h
+#include config.h
 
 #include stdint.h
 #include stdio.h
diff --git a/configure.ac b/configure.ac
index 323bd87..68a54e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,8 @@ AC_SUBST([WESTON_VERSION], [weston_version])
 
 AC_CONFIG_HEADERS([config.h])
 
+AC_USE_SYSTEM_EXTENSIONS
+
 AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz 
color-tests])
 
 AM_SILENT_RULES([yes])
diff --git a/shared/cairo-util.c b/shared/cairo-util.c
index 8b41f41..c3a966a 100644
--- a/shared/cairo-util.c
+++ b/shared/cairo-util.c
@@ -21,7 +21,7 @@
  * OF THIS SOFTWARE.
  */
 
-#include ../config.h
+#include config.h
 
 #include stdint.h
 #include stdlib.h
diff --git a/shared/config-parser.c b/shared/config-parser.c
index 652da1f..a49e29e 100644
--- a/shared/config-parser.c
+++ b/shared/config-parser.c
@@ -20,7 +20,8 @@
  * OF THIS SOFTWARE.
  */
 
-#define _GNU_SOURCE   /* for stchrnul() */
+#include config.h
+
 #include string.h
 #include stdio.h
 #include stdlib.h
diff --git a/shared/image-loader.c b/shared/image-loader.c
index 9f65dea..35dadd3 100644
--- a/shared/image-loader.c
+++ b/shared/image-loader.c
@@ -21,7 +21,7 @@
  * OF THIS SOFTWARE.
  */
 
-#include ../config.h
+#include config.h
 
 #include stdlib.h
 #include stdio.h
diff --git a/shared/matrix.c b/shared/matrix.c
index 3ff4089..4f0b6b7 100644
--- a/shared/matrix.c
+++ b/shared/matrix.c
@@ -21,6 +21,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include config.h
+
 #include float.h
 #include string.h
 #include stdlib.h
diff --git a/shared/option-parser.c b/shared/option-parser.c
index a7e497f..c00349a 100644
--- a/shared/option-parser.c
+++ b/shared/option-parser.c
@@ -20,6 +20,8 @@
  * OF THIS SOFTWARE.
  */
 
+#include config.h
+
 #include stdlib.h
 #include stdint.h
 #include stdio.h
diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c
index 21d4d02..4f96dd4 100644
--- a/shared/os-compatibility.c
+++ b/shared/os-compatibility.c
@@ -20,7 +20,7 @@
  * OF THIS SOFTWARE.
  */
 
-#define _GNU_SOURCE
+#include config.h
 
 #include sys/types.h
 #include sys/socket.h
diff --git a/src/animation.c b/src/animation.c
index 7dd3683..80b200e 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -20,6 +20,8 @@
  * CONNECTION WITH THE USE OR 

[PATCH weston 17/18] xwayland: Fix the race condition when mapping a surface

2013-05-22 Thread ppaalanen
From: Louis-Francis Ratté-Boulianne l...@collabora.com

Make sure XCB_MAP_NOTIFY has been received and the window id has been
set before mapping the shell surface. It fixes race condition making the
surface appears at wrong coordinates or with wrong size.
---
 src/xwayland/window-manager.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 366f2e0..c2e680b 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -113,6 +113,7 @@ struct weston_wm_window {
int decorate;
int override_redirect;
int fullscreen;
+   int mapped;
 };
 
 static struct weston_wm_window *
@@ -121,6 +122,9 @@ get_wm_window(struct weston_surface *surface);
 static void
 weston_wm_window_schedule_repaint(struct weston_wm_window *window);
 
+static void
+xserver_map_shell_surface(struct weston_wm *wm, struct weston_wm_window 
*window);
+
 const char *
 get_atom_name(xcb_connection_t *c, xcb_atom_t atom)
 {
@@ -723,6 +727,14 @@ static void
 weston_wm_handle_map_notify(struct weston_wm *wm, xcb_generic_event_t *event)
 {
xcb_map_notify_event_t *map_notify = (xcb_map_notify_event_t *) event;
+   struct weston_wm_window *window;
+
+   window = hash_table_lookup(wm-window_hash, map_notify-window);
+
+   if (window-surface != NULL)
+   xserver_map_shell_surface(wm, window);
+   else
+   window-mapped = 1;
 
if (our_resource(wm, map_notify-window)) {
weston_log(XCB_MAP_NOTIFY (window %d, ours)\n,
@@ -915,6 +927,8 @@ weston_wm_window_create(struct weston_wm *wm,
window-override_redirect = override;
window-width = width;
window-height = height;
+   window-surface = NULL;
+   window-mapped = 0;
 
hash_table_insert(wm-window_hash, id, window);
 }
@@ -1874,7 +1888,9 @@ xserver_set_window_id(struct wl_client *client, struct 
wl_resource *resource,
  window-surface_destroy_listener);
 
weston_wm_window_schedule_repaint(window);
-   xserver_map_shell_surface(wm, window);
+
+   if (window-mapped)
+   xserver_map_shell_surface(wm, window);
 }
 
 const struct xserver_interface xserver_implementation = {
-- 
1.8.1.5

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


[PATCH weston 18/18] shell: Fix calculation of center point in surface rotation

2013-05-22 Thread ppaalanen
From: Louis-Francis Ratté-Boulianne l...@collabora.com

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

diff --git a/src/shell.c b/src/shell.c
index e46c30f..757d98d 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -3092,8 +3092,8 @@ surface_rotate(struct shell_surface *surface, struct 
weston_seat *seat)
return;
 
weston_surface_to_global_float(surface-surface,
-  surface-surface-geometry.width / 2,
-  surface-surface-geometry.height / 2,
+  surface-surface-geometry.width * 0.5f,
+  surface-surface-geometry.height * 0.5f,
   rotate-center.x, rotate-center.y);
 
dx = wl_fixed_to_double(seat-pointer-x) - rotate-center.x;
-- 
1.8.1.5

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


[PATCH wayland-web] raspberrypi: update for the new rpi-backend

2013-05-22 Thread ppaalanen
From: Pekka Paalanen pekka.paala...@collabora.co.uk

This depends on the rpi-renderer patch series for Weston.

Update the build instructions for the current state of Weston, remove
options that do not exist anymore, add some more troubleshooting issues.

Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
---
 raspberrypi.html | 42 ++
 1 file changed, 26 insertions(+), 16 deletions(-)

diff --git a/raspberrypi.html b/raspberrypi.html
index 67b7829..d77a9e1 100644
--- a/raspberrypi.html
+++ b/raspberrypi.html
@@ -47,14 +47,6 @@ old firmware may cause rpi-backend to malfunction on 
Raspberry Pi./p
happen off-line into the buffer./dd
 /dl
 
-pBy default, the rpi-backend is configured for the 
ttdispmanx_offline=1/tt
-case. Without this setting, it would be better to run Weston with
-tt--max-planes=10/tt command line option./p
-
-pIf you want to use Weston with purely GLESv2 compositing, you can pass
-tt--max-planes=0/tt to Weston. In that case it would be preferrable
-to not set ttdispmanx_offline=1/tt to conserve VideoCore memory./p
-
 h2Setting up the environment/h2
 
 pHere we will install to the home directory of the pi user./p
@@ -67,9 +59,11 @@ export 
PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
 export ACLOCAL=aclocal -I $WLD/share/aclocal
 export XDG_RUNTIME_DIR=/run/shm/wayland
 export XDG_CONFIG_HOME=$WLD/etc
+export XORGCONFIG=$WLD/etc/xorg.conf
 
 mkdir -p $WLD/share/aclocal
 mkdir -p $XDG_RUNTIME_DIR
+chmod 0700 $XDG_RUNTIME_DIR
 /pre
 /blockquote
 
@@ -97,11 +91,11 @@ contains similar files for Android, and will not work./p
 
 pre$ git clone git://anongit.freedesktop.org/wayland/wayland
 $ cd wayland
-$ ./autogen.sh --prefix=$WLD
+$ ./autogen.sh --prefix=$WLD --disable-documentation
 $ make
 $ make install
 /pre
-
+pThe tt--disable-documentation/tt makes it not require Doxygen./p
 
 h2libxkbcommon/h2
 
@@ -124,9 +118,10 @@ contains similar files for Android, and will not work./p
 $ ./autogen.sh --prefix=$WLD \
 --disable-setuid-install --with-cairo-glesv2 \
 --disable-x11-compositor --disable-drm-compositor \
---disable-android-compositor --disable-wayland-compositor \
+--disable-fbdev-compositor --disable-wayland-compositor \
 --disable-weston-launch --disable-simple-egl-clients \
---disable-fbdev-compositor \
+--disable-egl --disable-libunwind --disable-colord \
+--disable-resize-optimization --disable-xwayland-test \
 WESTON_NATIVE_BACKEND=rpi-backend.so
 
 $ make
@@ -168,10 +163,25 @@ configure: WARNING: clients will use cairo image, 
cairo-egl not used/pre
 
 h3Some or all surfaces (graphics) are corrupted/h3
 
-pToo old firmware might cause corrupted graphics. If you don't want to
-update the firmware, a workaround is to add tt--max-planes=0/tt to the
-Weston command line. This forces everything to be composited with
-GLESv2./p
+pToo old firmware might cause corrupted graphics.
+Try upgrading the firmware, and try the tt/boot/config.txt/tt
+options mentioned above./p
+
+h3Monitor or TV goes blank, loses signal, etc./h3
+
+pYou probably do not have ttdispmanx_offline=1/tt for the firmware.
+When there are too many things on screen for the on-line compositor to
+handle, the output dies or becomes corrupt without the off-line fallback./p
+
+h3Some windows or the whole image flickers/h3
+
+pThere may be so many things on screen, that even the off-line compositor
+in the firmware cannot keep up. Try to close some windows./p
+
+h3Programs are dying on SIGBUS/h3
+
+pMost likely you are running out of space in tt$XDG_RUNTIME_DIR/tt.
+This is where Wayland programs allocate their pixel buffers./p
 
 /body
 /html
-- 
1.8.1.5

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


Re: [PATCH weston] window: avoid a gcc warning in buffer release handler

2013-05-22 Thread Kristian Høgsberg
On Wed, May 22, 2013 at 10:20:05AM +0300, ppaala...@gmail.com wrote:
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 Apparently some compilers complain about set but not used variables
 'available' and 'bufs', but I don't get the warning. Still, separate the
 debugging code from shm_surface_buffer_release(), so that we only
 compute 'bufs' when it is printed. This should fix the warnings.
 
 The debugging code now prints the shm_surface buffer state before and
 after, instead of just after.

Thanks Pekka.

Kristian

 Signed-off-by: Pekka Paalanen pekka.paala...@collabora.co.uk
 ---
  clients/window.c | 48 +++-
  1 file changed, 31 insertions(+), 17 deletions(-)
 
 diff --git a/clients/window.c b/clients/window.c
 index 40c0ef4..627f1e8 100644
 --- a/clients/window.c
 +++ b/clients/window.c
 @@ -420,7 +420,9 @@ enum window_location {
  
  static const cairo_user_data_key_t shm_surface_data_key;
  
 -#if 0
 +/* #define DEBUG */
 +
 +#ifdef DEBUG
  
  static void
  debug_print(void *proxy, int line, const char *func, const char *fmt, ...)
 @@ -893,20 +895,43 @@ to_shm_surface(struct toysurface *base)
  }
  
  static void
 +shm_surface_buffer_state_debug(struct shm_surface *surface, const char *msg)
 +{
 +#ifdef DEBUG
 + struct shm_surface_leaf *leaf;
 + char bufs[MAX_LEAVES + 1];
 + int i;
 +
 + for (i = 0; i  MAX_LEAVES; i++) {
 + leaf = surface-leaf[i];
 +
 + if (leaf-busy)
 + bufs[i] = 'b';
 + else if (leaf-cairo_surface)
 + bufs[i] = 'a';
 + else
 + bufs[i] = ' ';
 + }
 +
 + bufs[MAX_LEAVES] = '\0';
 + DBG_OBJ(surface-surface, %s, leaves [%s]\n, msg, bufs);
 +#endif
 +}
 +
 +static void
  shm_surface_buffer_release(void *data, struct wl_buffer *buffer)
  {
   struct shm_surface *surface = data;
   struct shm_surface_leaf *leaf;
   int i;
   int free_found;
 - int available = MAX_LEAVES;
 - char bufs[MAX_LEAVES + 1];
 +
 + shm_surface_buffer_state_debug(surface, buffer_release before);
  
   for (i = 0; i  MAX_LEAVES; i++) {
   leaf = surface-leaf[i];
   if (leaf-data  leaf-data-buffer == buffer) {
   leaf-busy = 0;
 - available = i;
   break;
   }
   }
 @@ -917,27 +942,16 @@ shm_surface_buffer_release(void *data, struct wl_buffer 
 *buffer)
   for (i = 0; i  MAX_LEAVES; i++) {
   leaf = surface-leaf[i];
  
 - if (leaf-busy)
 - bufs[i] = 'b';
 - else if (leaf-cairo_surface)
 - bufs[i] = 'a';
 - else
 - bufs[i] = ' ';
 -
   if (!leaf-cairo_surface || leaf-busy)
   continue;
  
   if (!free_found)
   free_found = 1;
 - else {
 + else
   shm_surface_leaf_release(leaf);
 - bufs[i] = '*';
 - }
   }
  
 - bufs[MAX_LEAVES] = '\0';
 - DBG_OBJ(surface-surface, leaf %d released, leaves [%s]\n,
 - available, bufs);
 + shm_surface_buffer_state_debug(surface, buffer_release  after);
  }
  
  static const struct wl_buffer_listener shm_surface_buffer_listener = {
 -- 
 1.8.1.5
 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston] window: avoid a gcc warning in buffer release handler

2013-05-22 Thread Thiago Macieira
On quarta-feira, 22 de maio de 2013 10.20.05, ppaala...@gmail.com wrote:
 Apparently some compilers complain about set but not used variables
 'available' and 'bufs', but I don't get the warning. Still, separate the
 debugging code from shm_surface_buffer_release(), so that we only
 compute 'bufs' when it is printed. This should fix the warnings

Set-but-unused is a new warning in GCC 4.7 and, as most warnings of its type, 
sometimes it triggers only in release (optimised) mode. If you're building 
with -O0 or an older GCC, you might not have seen it.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center


signature.asc
Description: This is a digitally signed message part.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] weston-launch: Fix failure to exec weston due to initalized argv values

2013-05-22 Thread Ander Conselvan de Oliveira
From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com

The array of arguments supplied to execv must be NULL terminated. If
unitialized values are used as pointers the exec call may fail with a
EFAULT error (Bad address).

https://bugs.freedesktop.org/show_bug.cgi?id=64874
---
 src/weston-launch.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/weston-launch.c b/src/weston-launch.c
index 42b2506..ad77476 100644
--- a/src/weston-launch.c
+++ b/src/weston-launch.c
@@ -570,7 +570,7 @@ main(int argc, char *argv[])
}
}
 
-   if ((argc - optind)  (MAX_ARGV_SIZE - 5))
+   if ((argc - optind)  (MAX_ARGV_SIZE - 6))
error(1, E2BIG, Too many arguments to pass to weston);
 
if (new_user)
@@ -586,7 +586,8 @@ main(int argc, char *argv[])
child_argv[3] = BINDIR /weston \$@\;
child_argv[4] = weston;
for (i = 0; i  (argc - optind); ++i)
-   child_argv[5+i] = argv[optind+i];
+   child_argv[5 + i] = argv[optind + i];
+   child_argv[5 + i] = NULL;
 
term = getenv(TERM);
clearenv();
-- 
1.7.9.5

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


Re: [PATCH] fixes trivial typo

2013-05-22 Thread Kristian Høgsberg
On Tue, May 21, 2013 at 02:45:30PM +0800, Peng Wu wrote:
 ---
  doc/publican/sources/Protocol.xml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, patch applied.

Kristian

 diff --git a/doc/publican/sources/Protocol.xml 
 b/doc/publican/sources/Protocol.xml
 index f576542..1a7a7da 100644
 --- a/doc/publican/sources/Protocol.xml
 +++ b/doc/publican/sources/Protocol.xml
 @@ -453,7 +453,7 @@
   para
 When the drag ends, the receiving client receives a
 functionwl_data_device.drop/function event at which it is expect
 -   to trasnfer the data using the
 +   to transfer the data using the
 functionwl_data_offer.receive/function request.
   /para
/section
 -- 
 1.8.1.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: [RFC weston] compositor: Use ordered layers

2013-05-22 Thread Kristian Høgsberg
On Tue, May 21, 2013 at 06:26:53PM +0200, Quentin Glidic wrote:
 From: Quentin Glidic sardemff7+...@sardemff7.net
 
 It allows a more generic layer management that several modules can use
 at the same time without breaking each others’ layers.
 
 Signed-off-by: Quentin Glidic sardemff7+...@sardemff7.net
 ---
 
 This change is incomplete but the desktop shell works fine with it.
 
 The idea is to allow other modules to use layers without breaking the shell.
 Using relative layers like the old patch did is not flexible enough, since 
 modules could want to put layers *between* the shell’s ones.
 
 Comments?

I think it's better to change shell.c to not pull out and add back all
layers when the screensaver triggers.  I thought it was a cool idea at
the time since if the other surfaces aren't even in the scenegraph,
there's no way they can steal focus from the screen lock dialog.

At this point, I think it's cleaner to just add a lock-screen layer
that we can put the unlock dialog into and perhaps a lock screen
background surface.

Kristian

  src/compositor.c| 39 +++---
  src/compositor.h| 18 --
  src/shell.c | 54 
 ++---
  src/tablet-shell.c  | 13 +
  tests/weston-test.c |  3 ++-
  5 files changed, 85 insertions(+), 42 deletions(-)
 
 diff --git a/src/compositor.c b/src/compositor.c
 index 9fefb77..46bd370 100644
 --- a/src/compositor.c
 +++ b/src/compositor.c
 @@ -1318,11 +1318,33 @@ idle_repaint(void *data)
  }
  
  WL_EXPORT void
 -weston_layer_init(struct weston_layer *layer, struct wl_list *below)
 +weston_layer_init(struct weston_layer *layer, int32_t order)
  {
   wl_list_init(layer-surface_list);
 - if (below != NULL)
 - wl_list_insert(below, layer-link);
 + layer-order = order;
 +}
 +
 +WL_EXPORT void
 +weston_layer_order(struct weston_layer *layer, struct weston_compositor 
 *compositor, bool use_layer)
 +{
 + if (!use_layer) {
 + wl_list_remove(layer-link);
 + return;
 + }
 +
 + if (wl_list_empty(compositor-layer_list)) {
 + wl_list_insert(compositor-layer_list, layer-link);
 + return;
 + }
 +
 + struct weston_layer *l;
 + wl_list_for_each_reverse(l, compositor-layer_list, link) {
 + if (layer-order = l-order) {
 + wl_list_insert(l-link, layer-link);
 + return;
 + }
 + }
 + wl_list_insert(compositor-layer_list, layer-link);
  }
  
  WL_EXPORT void
 @@ -2779,8 +2801,11 @@ weston_compositor_init(struct weston_compositor *ec,
  
   ec-input_loop = wl_event_loop_create();
  
 - weston_layer_init(ec-fade_layer, ec-layer_list);
 - weston_layer_init(ec-cursor_layer, ec-fade_layer.link);
 + weston_layer_init(ec-fade_layer, WESTON_LAYER_ORDER_BASE);
 + weston_layer_init(ec-cursor_layer, WESTON_LAYER_ORDER_BASE);
 +
 + weston_layer_order(ec-fade_layer, ec, true);
 + weston_layer_order(ec-cursor_layer, ec, true);
  
   weston_compositor_schedule_repaint(ec);
  
 @@ -2878,7 +2903,7 @@ print_backtrace(void)
   filename = dlinfo.dli_fname;
   else
   filename = ?;
 - 
 +
   weston_log(%u: %s (%s%s+0x%x) [%p]\n, i++, filename, procname,
  ret == -UNW_ENOMEM ? ... : , (int)off, (void 
 *)(pip.start_ip + off));
  
 @@ -3151,7 +3176,7 @@ int main(int argc, char *argv[])
   }
  
   weston_log_file_open(log);
 - 
 +
   weston_log(%s\n
  STAMP_SPACE %s\n
  STAMP_SPACE Bug reports to: %s\n
 diff --git a/src/compositor.h b/src/compositor.h
 index 318fc0d..afdd9d8 100644
 --- a/src/compositor.h
 +++ b/src/compositor.h
 @@ -28,6 +28,7 @@
  extern C {
  #endif
  
 +#include stdbool.h
  #include pixman.h
  #include xkbcommon/xkbcommon.h
  #include wayland-server.h
 @@ -183,7 +184,7 @@ struct weston_output {
   char *make, *model, *serial_number;
   uint32_t subpixel;
   uint32_t transform;
 - 
 +
   struct weston_mode *current;
   struct weston_mode *origin;
   struct wl_list mode_list;
 @@ -456,8 +457,10 @@ enum {
  };
  
  struct weston_layer {
 + struct weston_compositor *compositor;
   struct wl_list surface_list;
   struct wl_list link;
 + int32_t order;
  };
  
  struct weston_plane {
 @@ -835,8 +838,19 @@ void
  notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
wl_fixed_t x, wl_fixed_t y, int touch_type);
  
 +enum weston_layer_order {
 + WESTON_LAYER_ORDER_BASE = 0,
 + WESTON_LAYER_ORDER_LOCK = INT8_MAX  4,
 + WESTON_LAYER_ORDER_FULLSCREEN = INT8_MAX,
 + WESTON_LAYER_ORDER_UI = INT16_MAX,
 + WESTON_LAYER_ORDER_NORMAL = INT32_MAX  8, /* INT24 */
 + WESTON_LAYER_ORDER_BACKGROUND = INT32_MAX
 +};
 +
 +void
 +weston_layer_init(struct weston_layer *layer, 

Re: [PATCH] weston-launch: Fix failure to exec weston due to initalized argv values

2013-05-22 Thread Kristian Høgsberg
On Wed, May 22, 2013 at 10:55:33PM +0300, Ander Conselvan de Oliveira wrote:
 From: Ander Conselvan de Oliveira ander.conselvan.de.olive...@intel.com
 
 The array of arguments supplied to execv must be NULL terminated. If
 unitialized values are used as pointers the exec call may fail with a
 EFAULT error (Bad address).

Thanks Ander, I missed that when I reviewed the patch.

Kristian

 https://bugs.freedesktop.org/show_bug.cgi?id=64874
 ---
  src/weston-launch.c |5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/src/weston-launch.c b/src/weston-launch.c
 index 42b2506..ad77476 100644
 --- a/src/weston-launch.c
 +++ b/src/weston-launch.c
 @@ -570,7 +570,7 @@ main(int argc, char *argv[])
   }
   }
  
 - if ((argc - optind)  (MAX_ARGV_SIZE - 5))
 + if ((argc - optind)  (MAX_ARGV_SIZE - 6))
   error(1, E2BIG, Too many arguments to pass to weston);
  
   if (new_user)
 @@ -586,7 +586,8 @@ main(int argc, char *argv[])
   child_argv[3] = BINDIR /weston \$@\;
   child_argv[4] = weston;
   for (i = 0; i  (argc - optind); ++i)
 - child_argv[5+i] = argv[optind+i];
 + child_argv[5 + i] = argv[optind + i];
 + child_argv[5 + i] = NULL;
  
   term = getenv(TERM);
   clearenv();
 -- 
 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


[PATCH 0/5] Misc RDP compositor fixes

2013-05-22 Thread Hardening
As suggested by Pekka Paalanen, i've splitted the patch in multiple parts.
This patch set fixes compilation and does misc improvements in the RDP 
compositor.

Hardening (5):
  Fix compilation against FreeRDP and weston
  Drop unneeded main_seat
  Fix codec initialisations
  Don't rely on Synchronize packet for first screen refresh
  Improve raw surfaces

 src/compositor-rdp.c | 161 ---
 1 file changed, 101 insertions(+), 60 deletions(-)

-- 
1.8.1.2

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


[PATCH 1/5] Fix compilation against FreeRDP and weston

2013-05-22 Thread Hardening
The stream utils of FreeRDP have changed recently, this patch fixes
the compositor compilation against FreeRdp master.
The backend_init() prototype has changed too, this fixes it.
---
 src/compositor-rdp.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 0dae963..0771002 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -133,8 +133,8 @@ rdp_peer_refresh_rfx(pixman_region32_t *damage, 
pixman_image_t *image, freerdp_p
SURFACE_BITS_COMMAND *cmd = update-surface_bits_command;
RdpPeerContext *context = (RdpPeerContext *)peer-context;
 
-   stream_clear(context-encode_stream);
-   stream_set_pos(context-encode_stream, 0);
+   Stream_Clear(context-encode_stream);
+   Stream_SetPosition(context-encode_stream, 0);
 
width = (damage-extents.x2 - damage-extents.x1);
height = (damage-extents.y2 - damage-extents.y1);
@@ -169,8 +169,8 @@ rdp_peer_refresh_rfx(pixman_region32_t *damage, 
pixman_image_t *image, freerdp_p
pixman_image_get_stride(image)
);
 
-   cmd-bitmapDataLength = stream_get_length(context-encode_stream);
-   cmd-bitmapData = stream_get_head(context-encode_stream);
+   cmd-bitmapDataLength = Stream_GetPosition(context-encode_stream);
+   cmd-bitmapData = Stream_Buffer(context-encode_stream);
 
update-SurfaceBits(update-context, cmd);
 }
@@ -185,8 +185,8 @@ rdp_peer_refresh_nsc(pixman_region32_t *damage, 
pixman_image_t *image, freerdp_p
SURFACE_BITS_COMMAND *cmd = update-surface_bits_command;
RdpPeerContext *context = (RdpPeerContext *)peer-context;
 
-   stream_clear(context-encode_stream);
-   stream_set_pos(context-encode_stream, 0);
+   Stream_Clear(context-encode_stream);
+   Stream_SetPosition(context-encode_stream, 0);
 
width = (damage-extents.x2 - damage-extents.x1);
height = (damage-extents.y2 - damage-extents.y1);
@@ -206,8 +206,8 @@ rdp_peer_refresh_nsc(pixman_region32_t *damage, 
pixman_image_t *image, freerdp_p
nsc_compose_message(context-nsc_context, context-encode_stream, (BYTE 
*)ptr,
cmd-width, cmd-height,
pixman_image_get_stride(image));
-   cmd-bitmapDataLength = stream_get_length(context-encode_stream);
-   cmd-bitmapData = stream_get_head(context-encode_stream);
+   cmd-bitmapDataLength = Stream_GetPosition(context-encode_stream);
+   cmd-bitmapData = Stream_Buffer(context-encode_stream);
update-SurfaceBits(update-context, cmd);
 }
 
@@ -562,7 +562,7 @@ rdp_peer_context_new(freerdp_peer* client, RdpPeerContext* 
context)
context-nsc_context = nsc_context_new();
rfx_context_set_pixel_format(context-rfx_context, 
RDP_PIXEL_FORMAT_B8G8R8A8);
 
-   context-encode_stream = stream_new(65536);
+   context-encode_stream = Stream_New(NULL, 65536);
 }
 
 static void
@@ -580,7 +580,7 @@ rdp_peer_context_free(freerdp_peer* client, RdpPeerContext* 
context)
 
if(context-item.flags  RDP_PEER_ACTIVATED)
weston_seat_release(context-item.seat);
-   stream_free(context-encode_stream);
+   Stream_Free(context-encode_stream, TRUE);
nsc_context_free(context-nsc_context);
rfx_context_free(context-rfx_context);
free(context-rfx_rects);
@@ -1012,7 +1012,7 @@ err_free:
 
 WL_EXPORT struct weston_compositor *
 backend_init(struct wl_display *display, int *argc, char *argv[],
-const char *config_file)
+int config_fd)
 {
struct rdp_compositor_config config;
rdp_compositor_config_init(config);
@@ -1035,5 +1035,5 @@ backend_init(struct wl_display *display, int *argc, char 
*argv[],
};
 
parse_options(rdp_options, ARRAY_LENGTH(rdp_options), argc, argv);
-   return rdp_compositor_create(display, config, argc, argv, config_file);
+   return rdp_compositor_create(display, config, argc, argv, config_fd);
 }
-- 
1.8.1.2

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


[PATCH 2/5] Drop unneeded main_seat

2013-05-22 Thread Hardening
With recent changes in shell.c the fake seat is not required to
start a compositor, this patch removes it.
---
 src/compositor-rdp.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 0771002..ec758df 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -59,7 +59,6 @@ struct rdp_output;
 
 struct rdp_compositor {
struct weston_compositor base;
-   struct weston_seat main_seat;
 
freerdp_listener *listener;
struct wl_event_source *listener_events[MAX_FREERDP_FDS];
@@ -498,10 +497,6 @@ rdp_restore(struct weston_compositor *ec)
 static void
 rdp_destroy(struct weston_compositor *ec)
 {
-   struct rdp_compositor *c = (struct rdp_compositor *) ec;
-
-   weston_seat_release(c-main_seat);
-
ec-renderer-destroy(ec);
weston_compositor_shutdown(ec);
 
@@ -944,7 +939,6 @@ rdp_compositor_create(struct wl_display *display,
   config_fd)  0)
goto err_free;
 
-   weston_seat_init(c-main_seat, c-base);
c-base.destroy = rdp_destroy;
c-base.restore = rdp_restore;
c-rdp_key = config-rdp_key ? strdup(config-rdp_key) : NULL;
@@ -1004,7 +998,6 @@ err_free_strings:
free(c-server_cert);
if(c-server_key)
free(c-server_key);
-   weston_seat_release(c-main_seat);
 err_free:
free(c);
return NULL;
-- 
1.8.1.2

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


[PATCH 3/5] Fixed codec initialisations

2013-05-22 Thread Hardening
This patch fixes NSC codec initialisation that was not done (an
erronous copy'n paste).
The remoteFx context must be resetted when we go through an activation
sequence
---
 src/compositor-rdp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index ec758df..eb43f59 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -555,7 +555,7 @@ rdp_peer_context_new(freerdp_peer* client, RdpPeerContext* 
context)
rfx_context_set_pixel_format(context-rfx_context, 
RDP_PIXEL_FORMAT_B8G8R8A8);
 
context-nsc_context = nsc_context_new();
-   rfx_context_set_pixel_format(context-rfx_context, 
RDP_PIXEL_FORMAT_B8G8R8A8);
+   nsc_context_set_pixel_format(context-nsc_context, 
RDP_PIXEL_FORMAT_B8G8R8A8);
 
context-encode_stream = Stream_New(NULL, 65536);
 }
@@ -703,6 +703,8 @@ xf_peer_post_connect(freerdp_peer* client)
 static BOOL
 xf_peer_activate(freerdp_peer *client)
 {
+   RdpPeerContext *context = (RdpPeerContext *)client-context;
+   rfx_context_reset(context-rfx_context);
return TRUE;
 }
 
-- 
1.8.1.2

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


[PATCH 4/5] Don't rely on Synchronize packet for first screen refresh

2013-05-22 Thread Hardening
Last FreeRDP don't send Synchronize packets anymore, so send the
first screen refresh when we're connected. The client cursor is
also disabled during this step.
---
 src/compositor-rdp.c | 26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index eb43f59..d19b448 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -640,10 +640,14 @@ xf_peer_post_connect(freerdp_peer* client)
struct rdp_compositor *c;
struct rdp_output *output;
rdpSettings *settings;
+   rdpPointerUpdate *pointer;
struct xkb_context *xkbContext;
struct xkb_rule_names xkbRuleNames;
struct xkb_keymap *keymap;
int i;
+   pixman_box32_t box;
+   pixman_region32_t damage;
+
 
peerCtx = (RdpPeerContext *)client-context;
c = peerCtx-rdpCompositor;
@@ -697,6 +701,23 @@ xf_peer_post_connect(freerdp_peer* client)
weston_seat_init_pointer(peerCtx-item.seat);
 
peerCtx-item.flags |= RDP_PEER_ACTIVATED;
+
+   /* disable pointer on the client side */
+   pointer = client-update-pointer;
+   pointer-pointer_system.type = SYSPTR_NULL;
+   pointer-PointerSystem(client-context, pointer-pointer_system);
+
+   /* sends a full refresh */
+   box.x1 = 0;
+   box.y1 = 0;
+   box.x2 = output-base.width;
+   box.y2 = output-base.height;
+   pixman_region32_init_with_extents(damage, box);
+
+   rdp_peer_refresh_region(damage, client);
+
+   pixman_region32_fini(damage);
+
return TRUE;
 }
 
@@ -759,16 +780,11 @@ static void
 xf_input_synchronize_event(rdpInput *input, UINT32 flags)
 {
freerdp_peer *client = input-context-peer;
-   rdpPointerUpdate *pointer = client-update-pointer;
RdpPeerContext *peerCtx = (RdpPeerContext *)input-context;
struct rdp_output *output = peerCtx-rdpCompositor-output;
pixman_box32_t box;
pixman_region32_t damage;
 
-   /* disable pointer on the client side */
-   pointer-pointer_system.type = SYSPTR_NULL;
-   pointer-PointerSystem(client-context, pointer-pointer_system);
-
/* sends a full refresh */
box.x1 = 0;
box.y1 = 0;
-- 
1.8.1.2

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


[PATCH 5/5] Improve raw surfaces

2013-05-22 Thread Hardening
This patch does miscellanous improvements with raw surfaces:
* some frames markers are sent to identify a single frame made of
multiple surface updates
* we send the dirty sub-rectangles instead of the full bouncing box
* the size of the fragmentation buffer is now honored, so that our big
surface updates don't look like a DoS
* the subtile and image flipping are done in one step (not requiring a
temporary tile)
* we don't care about the size of the dirty region and always use the
preferred codec for surface update
---
 src/compositor-rdp.c | 100 +--
 1 file changed, 65 insertions(+), 35 deletions(-)

diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index d19b448..15e340c 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -211,36 +211,73 @@ rdp_peer_refresh_nsc(pixman_region32_t *damage, 
pixman_image_t *image, freerdp_p
 }
 
 static void
+pixman_image_flipped_subrect(const pixman_box32_t *rect, pixman_image_t *img, 
BYTE *dest) {
+   int stride = pixman_image_get_stride(img);
+   int h;
+   int toCopy = (rect-x2 - rect-x1) * 4;
+   int height = (rect-y2 - rect-y1);
+   const BYTE *src = (const BYTE *)pixman_image_get_data(img);
+   src += ((rect-y2-1) * stride) + (rect-x1 * 4);
+
+   for (h = 0; h  height; h++, src -= stride, dest += toCopy)
+  memcpy(dest, src, toCopy);
+}
+
+static void
 rdp_peer_refresh_raw(pixman_region32_t *region, pixman_image_t *image, 
freerdp_peer *peer)
 {
-   pixman_image_t *tile;
rdpUpdate *update = peer-update;
SURFACE_BITS_COMMAND *cmd = update-surface_bits_command;
-   pixman_box32_t *extends = pixman_region32_extents(region);
+   SURFACE_FRAME_MARKER *marker = update-surface_frame_marker;
+   pixman_box32_t *rect, subrect;
+   int nrects, i;
+   int heightIncrement, remainingHeight, top;
+
+   rect = pixman_region32_rectangles(region, nrects);
+   if (!nrects)
+   return;
+
+   marker-frameId++;
+   marker-frameAction = SURFACECMD_FRAMEACTION_BEGIN;
+   update-SurfaceFrameMarker(peer-context, marker);
 
cmd-bpp = 32;
cmd-codecID = 0;
-   cmd-width = (extends-x2 - extends-x1);
-   cmd-height = (extends-y2 - extends-y1);;
-   cmd-bitmapDataLength = cmd-width * cmd-height * 4;
-   tile = pixman_image_create_bits(PIXMAN_x8r8g8b8, cmd-width, 
cmd-height, 0, cmd-width * 4);
-   pixman_image_composite32(PIXMAN_OP_SRC, image, NULL, /* op, src, mask */
-   tile, extends-x1, extends-y1, /* dest, src_x, src_y */
-   0, 0, /* mask_x, mask_y */
-   0, 0, /* dest_x, dest_y */
-   cmd-width, cmd-height /* width, height */
-   );
-   freerdp_image_flip((BYTE *)pixman_image_get_data(tile),
-   (BYTE *)pixman_image_get_data(tile),
-   cmd-width, cmd-height, cmd-bpp
-   );
-   cmd-bitmapData = (BYTE *)pixman_image_get_data(tile);
-   cmd-destLeft = extends-x1;
-   cmd-destTop = extends-y1;
-   cmd-destRight = extends-x2;
-   cmd-destBottom = extends-y2;
-   update-SurfaceBits(peer-context, cmd);
-   pixman_image_unref(tile);
+
+   for (i = 0; i  nrects; i++, rect++) {
+   /*weston_log(rect(%d,%d, %d,%d)\n, rect-x1, rect-y1, 
rect-x2, rect-y2);*/
+   cmd-destLeft = rect-x1;
+   cmd-destRight = rect-x2;
+   cmd-width = rect-x2 - rect-x1;
+
+   heightIncrement = peer-settings-MultifragMaxRequestSize / (16 
+ cmd-width * 4);
+   remainingHeight = rect-y2 - rect-y1;
+   top = rect-y1;
+
+   subrect.x1 = rect-x1;
+   subrect.x2 = rect-x2;
+
+   while (remainingHeight) {
+  cmd-height = (remainingHeight  heightIncrement) ? 
heightIncrement : remainingHeight;
+  cmd-destTop = top;
+  cmd-destBottom = top + cmd-height;
+  cmd-bitmapDataLength = cmd-width * cmd-height * 4;
+  cmd-bitmapData = (BYTE *)realloc(cmd-bitmapData, 
cmd-bitmapDataLength);
+
+  subrect.y1 = top;
+  subrect.y2 = top + cmd-height;
+  pixman_image_flipped_subrect(subrect, image, 
cmd-bitmapData);
+
+  /*weston_log(*  sending (%d,%d, %d,%d)\n, 
subrect.x1, subrect.y1, subrect.x2, subrect.y2); */
+  update-SurfaceBits(peer-context, cmd);
+
+  remainingHeight -= cmd-height;
+  top += cmd-height;
+   }
+   }
+
+   marker-frameAction = SURFACECMD_FRAMEACTION_END;
+   update-SurfaceFrameMarker(peer-context, marker);
 }
 
 static void
@@ -249,20 +286,13 @@ rdp_peer_refresh_region(pixman_region32_t *region, 
freerdp_peer *peer)
RdpPeerContext *context = 

Re: [PATCH 00/15] weston scaling support

2013-05-22 Thread Hardening

Le 22/05/2013 14:41, al...@redhat.com a écrit :

From: Alexander Larsson al...@redhat.com

This adds support to weston (X11 and DRM backends) for output
scale and buffer_scale. It also contains some work on the
example clients to make them support buffer scaling.

I think the support is fairly comprehensive, although I'm aware of
a few outstanding issues:

* The drm backend doesn't upscale pointers on the DRM backend
* There is no support in the desktop shell for setting up a higher resolution
   cursor image on scaled outputs
* I did not yet look at the screenshoter/read_pixels APIs

Overall I think the approach is working out well, but an obvious issue is how 
we handle
scaling wrt modes. I'll bring this up in another mail.

[...]

This trivial patch is missing to have it work with the RDP compositor:
diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
index 15e340c..48ac77d 100644
--- a/src/compositor-rdp.c
+++ b/src/compositor-rdp.c
@@ -473,7 +473,7 @@ rdp_compositor_create_output(struct rdp_compositor 
*c, int width, int height,


output-base.current = currentMode;
weston_output_init(output-base, c-base, 0, 0, width, height,
-   WL_OUTPUT_TRANSFORM_NORMAL);
+   WL_OUTPUT_TRANSFORM_NORMAL, 1);

output-base.make = weston;
output-base.model = rdp;

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


Re: [PATCH 00/15] weston scaling support

2013-05-22 Thread Kristian Høgsberg
On Wed, May 22, 2013 at 02:41:24PM +0200, al...@redhat.com wrote:
 From: Alexander Larsson al...@redhat.com
 
 This adds support to weston (X11 and DRM backends) for output
 scale and buffer_scale. It also contains some work on the
 example clients to make them support buffer scaling.
 
 I think the support is fairly comprehensive, although I'm aware of
 a few outstanding issues:
 
 * The drm backend doesn't upscale pointers on the DRM backend
 * There is no support in the desktop shell for setting up a higher resolution
   cursor image on scaled outputs
 * I did not yet look at the screenshoter/read_pixels APIs

Two more: 

 * window.c pre-renders decorations at a fixed 1-to-1 pixel size which
   then get scaled up.  The rounded corners look blocky when you use a
   scale  1.

 * Don't send out new wl_output events to clients that bind with
   version 1.  For this I think we want to extend wl_resource with an
   int version; field.

 Overall I think the approach is working out well, but an obvious
 issue is how we handle scaling wrt modes. I'll bring this up in
 another mail.

I read through the latest wayland protocol patches and the discussion
around them and didn't seen anything I didn't like.  I think the
approach here is good and agree with the consensus.  This patch series
looks great too and I like the improvements to the pixman renderer and
the compositor-x11.c optimization.

I've applied both wayland and weston patches.  The protocol is not set
in stone, but the 1.2 release is coming up end of June, and which
point we lock it down.  So we can tweak it further, but at least the
bulk of the work is now landed.

thanks,
Kristian

 The series is also availible in the scale branch here: (eventually)
  http://cgit.freedesktop.org/~alexl/weston/
 
 Alexander Larsson (15):
   window: Support transform in widget_cairo_create()
   transformed: Rely on transformation in widget_cairo_create
   window: Track output scales
   window: allow setting a buffer scale on a window
   window: Apply buffer_scale automatically in widget_cairo_create
   transformed: Use the scale factor from the output
   window: Store server_allocation in surface size
   desktop-shell: Respect output scale and translate
   window: Add window_get_output_scale()
   terminal: Handle output transform
   transformed: Add keyboard shortcuts to change transform
   pixman-renderer: Fix up transform handling
   compositor: Support output/buffer scaling
   compositor-x11: Only repaint the damaged region
   compositor-drm: Support output scaling
 
  clients/desktop-shell.c   |  75 ++--
  clients/terminal.c|  13 +-
  clients/transformed.c | 124 ++---
  clients/window.c  | 237 ++---
  clients/window.h  |  13 ++
  src/compositor-drm.c  |  88 +++---
  src/compositor-fbdev.c|   3 +-
  src/compositor-headless.c |   2 +-
  src/compositor-rpi.c  |   3 +-
  src/compositor-wayland.c  |   2 +-
  src/compositor-x11.c  | 166 --
  src/compositor.c  | 110 +---
  src/compositor.h  |  18 +-
  src/gl-renderer.c |  21 +--
  src/pixman-renderer.c | 436 
 ++
  15 files changed, 977 insertions(+), 334 deletions(-)
 
 -- 
 1.8.1.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 00/15] weston scaling support

2013-05-22 Thread Jason Ekstrand
On Wed, May 22, 2013 at 7:57 PM, Kristian Høgsberg hoegsb...@gmail.comwrote:

 On Wed, May 22, 2013 at 02:41:24PM +0200, al...@redhat.com wrote:
  From: Alexander Larsson al...@redhat.com
 
  This adds support to weston (X11 and DRM backends) for output
  scale and buffer_scale. It also contains some work on the
  example clients to make them support buffer scaling.
 
  I think the support is fairly comprehensive, although I'm aware of
  a few outstanding issues:
 
  * The drm backend doesn't upscale pointers on the DRM backend
  * There is no support in the desktop shell for setting up a higher
 resolution
cursor image on scaled outputs
  * I did not yet look at the screenshoter/read_pixels APIs

 Two more:

  * window.c pre-renders decorations at a fixed 1-to-1 pixel size which
then get scaled up.  The rounded corners look blocky when you use a
scale  1.

  * Don't send out new wl_output events to clients that bind with
version 1.  For this I think we want to extend wl_resource with an
int version; field.


I hate to rain on the parade, but it's not going to be that simple.  I
already tried adding a field to wl_resource and, as it currently stands, it
causes major issues.  As a reminder, this is because wl_buffer has a
wl_resource field which means that altering wl_resource breaks binary
compatibility for EGL implementations.

I've been trying to figure out how to do this with my java stuff and I
really think adding a version flag to wl_resource is the way to do it.
Unfortunately,  but it's not going to be easy.


  Overall I think the approach is working out well, but an obvious
  issue is how we handle scaling wrt modes. I'll bring this up in
  another mail.

 I read through the latest wayland protocol patches and the discussion
 around them and didn't seen anything I didn't like.  I think the
 approach here is good and agree with the consensus.  This patch series
 looks great too and I like the improvements to the pixman renderer and
 the compositor-x11.c optimization.

 I've applied both wayland and weston patches.  The protocol is not set
 in stone, but the 1.2 release is coming up end of June, and which
 point we lock it down.  So we can tweak it further, but at least the
 bulk of the work is now landed.

 thanks,
 Kristian

  The series is also availible in the scale branch here: (eventually)
   http://cgit.freedesktop.org/~alexl/weston/
 
  Alexander Larsson (15):
window: Support transform in widget_cairo_create()
transformed: Rely on transformation in widget_cairo_create
window: Track output scales
window: allow setting a buffer scale on a window
window: Apply buffer_scale automatically in widget_cairo_create
transformed: Use the scale factor from the output
window: Store server_allocation in surface size
desktop-shell: Respect output scale and translate
window: Add window_get_output_scale()
terminal: Handle output transform
transformed: Add keyboard shortcuts to change transform
pixman-renderer: Fix up transform handling
compositor: Support output/buffer scaling
compositor-x11: Only repaint the damaged region
compositor-drm: Support output scaling
 
   clients/desktop-shell.c   |  75 ++--
   clients/terminal.c|  13 +-
   clients/transformed.c | 124 ++---
   clients/window.c  | 237 ++---
   clients/window.h  |  13 ++
   src/compositor-drm.c  |  88 +++---
   src/compositor-fbdev.c|   3 +-
   src/compositor-headless.c |   2 +-
   src/compositor-rpi.c  |   3 +-
   src/compositor-wayland.c  |   2 +-
   src/compositor-x11.c  | 166 --
   src/compositor.c  | 110 +---
   src/compositor.h  |  18 +-
   src/gl-renderer.c |  21 +--
   src/pixman-renderer.c | 436
 ++
   15 files changed, 977 insertions(+), 334 deletions(-)
 
  --
  1.8.1.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

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


Re: [PATCH 2/2] protocol: Support scaled outputs and surfaces

2013-05-22 Thread Kristian Høgsberg
On Mon, May 20, 2013 at 10:49:27AM +0300, Pekka Paalanen wrote:
 Hi Alexander,
 
 nice to see this going forward, and sorry for replying so rarely and
 late.
 
 On Thu, 16 May 2013 15:49:36 +0200
 al...@redhat.com wrote:
 
  From: Alexander Larsson al...@redhat.com
  
  This adds the wl_surface.set_buffer_scale request, and a wl_output.scale
  event. These together lets us support automatic upscaling of old
  clients on very high resolution monitors, while allowing new clients
  to take advantage of this to render at the higher resolution when the
  surface is displayed on the scaled output.
  
  It is similar to set_buffer_transform in that the buffer is stored in
  a transformed pixels (in this case scaled). This means that if an output
  is scaled we can directly use the pre-scaled buffer with additional data,
  rather than having to scale it.
  
  Additionally this adds a scaled flag to the wl_output.mode flags
  so that clients know which resolutions are native and which are scaled.
  
  Also, in places where the documentation was previously not clear as to
  what coordinate system was used this was fleshed out.
  
  It also adds a scaling_factor event to wl_output that specifies the
  scaling of an output.
  
  This is meant to be used for outputs with a very high DPI to tell the
  client that this particular output has subpixel precision. Coordinates
  in other parts of the protocol, like input events, relative window
  positioning and output positioning are still in the compositor space
 
 We don't have a single compositor space.
 
 This needs some way of explaining that surface coordinates are always
 the same, regardless of the attached buffer's scale. That is, surface
 coordinates always correspond to the size of a buffer with scale 1.
 
  rather than the scaled space. However, input has subpixel precision
  so you can still get input at full resolution.
  
  This setup means global properties like mouse acceleration/speed,
  pointer size, monitor geometry, etc can be specified in a mostly
  similar resolution even on a multimonitor setup where some monitors
  are low dpi and some are e.g. retina-class outputs.
  ---
   protocol/wayland.xml | 107 
  ---
   1 file changed, 93 insertions(+), 14 deletions(-)
  
  diff --git a/protocol/wayland.xml b/protocol/wayland.xml
  index d3ae149..acfb140 100644
  --- a/protocol/wayland.xml
  +++ b/protocol/wayland.xml
  @@ -173,7 +173,7 @@
   /event
 /interface
   
  -  interface name=wl_compositor version=2
  +  interface name=wl_compositor version=3
 
 Ok.
 
   description summary=the compositor singleton
 A compositor.  This object is a singleton global.  The
 compositor is in charge of combining the contents of multiple
  @@ -709,7 +709,7 @@
   
  The x and y arguments specify the locations of the upper left
  corner of the surface relative to the upper left corner of the
  -   parent surface.
  +   parent surface, in surface local coordinates.
   
  The flags argument controls details of the transient behaviour.
 /description
  @@ -777,6 +777,10 @@
  in any of the clients surfaces is reported as normal, however,
  clicks in other clients surfaces will be discarded and trigger
  the callback.
  +
  +   The x and y arguments specify the locations of the upper left
  +   corner of the surface relative to the upper left corner of the
  +   parent surface, in surface local coordinates.
 
 Surface local coordinates are defined to have their origin in the
 surface top-left corner. If that is defined once and for all, you don't
 have to repeat relative to upper left... everywhere.
 
 Surface local coordinates relative to anything else do not exist.
 
 When these were originally written in the spec, the term surface
 coordinates had not settled yet.
 
 /description
   
 arg name=seat type=object interface=wl_seat summary=the 
  wl_seat whose pointer is used/
  @@ -860,6 +864,9 @@
   
  The client is free to dismiss all but the last configure
  event it received.
  +
  +   The width and height arguments specify the size of the window
  +   in surface local coordinates.
 
 Yes, window is definitely the correct term here. Saying surface
 would be incorrect, due to sub-surfaces, if I recall my discussion with
 Giulio Camuffo right.

I think we need to introduce the window geometry concept before this
gets out of hand.  I'm already a little uncomfortable with the idea of
including sub-surfaces in the surface bounding box - it seems like
something the client should control.  So the suggestion is to add a
new wl_shell_surface request:

request name=set_geometry
  description summary=set logical surface geometry
This request sets the the logical geometry of the surface.

The logical geometry is the rectangle that compositor uses for
window management placement decisions.  For example, a buffer
often 

Re: [PATCH 0/5] Misc RDP compositor fixes

2013-05-22 Thread Kristian Høgsberg
On Wed, May 22, 2013 at 11:40:15PM +0200, Hardening wrote:
 As suggested by Pekka Paalanen, i've splitted the patch in multiple parts.
 This patch set fixes compilation and does misc improvements in the RDP 
 compositor.

Thanks, pushed these.  Didn't compile or test them, I don't have the
FreeRDP source on this laptop yet, sorry.

Kristian

 Hardening (5):
   Fix compilation against FreeRDP and weston
   Drop unneeded main_seat
   Fix codec initialisations
   Don't rely on Synchronize packet for first screen refresh
   Improve raw surfaces
 
  src/compositor-rdp.c | 161 
 ---
  1 file changed, 101 insertions(+), 60 deletions(-)
 
 -- 
 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 00/15] weston scaling support

2013-05-22 Thread Kristian Høgsberg
On Thu, May 23, 2013 at 01:05:43AM +0200, Hardening wrote:
 Le 22/05/2013 14:41, al...@redhat.com a écrit :
 From: Alexander Larsson al...@redhat.com
 
 This adds support to weston (X11 and DRM backends) for output
 scale and buffer_scale. It also contains some work on the
 example clients to make them support buffer scaling.
 
 I think the support is fairly comprehensive, although I'm aware of
 a few outstanding issues:
 
 * The drm backend doesn't upscale pointers on the DRM backend
 * There is no support in the desktop shell for setting up a higher resolution
cursor image on scaled outputs
 * I did not yet look at the screenshoter/read_pixels APIs
 
 Overall I think the approach is working out well, but an obvious issue is 
 how we handle
 scaling wrt modes. I'll bring this up in another mail.
 [...]
 
 This trivial patch is missing to have it work with the RDP compositor:
 diff --git a/src/compositor-rdp.c b/src/compositor-rdp.c
 index 15e340c..48ac77d 100644
 --- a/src/compositor-rdp.c
 +++ b/src/compositor-rdp.c
 @@ -473,7 +473,7 @@ rdp_compositor_create_output(struct
 rdp_compositor *c, int width, int height,
 
 output-base.current = currentMode;
 weston_output_init(output-base, c-base, 0, 0, width, height,
 -   WL_OUTPUT_TRANSFORM_NORMAL);
 +   WL_OUTPUT_TRANSFORM_NORMAL, 1);
 
 output-base.make = weston;
 output-base.model = rdp;

Thanks, fixed.

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


Re: [PATCH weston 00/18] Raspberry Pi: a new renderer and demos

2013-05-22 Thread Kristian Høgsberg
On Wed, May 22, 2013 at 06:03:03PM +0300, ppaala...@gmail.com wrote:
 From: Pekka Paalanen pekka.paala...@collabora.co.uk
 
 Hi all,
 
 this patch series consists of several independent features, which all come
 together in demonstrating the capabilities of Raspberry Pi for running a
 desktop.

Hi Pekka,

Thanks, happy to see this go out.  The new renderer is a cool
demonstration of a fast, non-gl renderer.  Patches 1-9 all looked good
and I've applied and pushed them (minor conflicts with Alexs scale
patches).  From 10 and onwards I have some comments, but I'll try to
send those out tomorrow.

Kristian

 We add a new rpi-renderer, that replaces the gl-renderer + weston_planes
 on RPi. Since it is not as flexible as the gl-renderer, we add some
 capability bits to disable incompatible features in Weston.
 
 Weston-desktop-shell gets new features. The major new feature is
 exposay, a window overview mode with animated transitions. Another new
 feature is optional keyboard-focus animation, which dims unfocused
 surfaces. Smaller enhancements include a new wallpaper scaling mode, and
 ensuring weston-desktop-shell has finished starting up before the
 compositor fades in.
 
 Then there are various smaller fixes and enhancements.
 
 This work is joint effort of the Raspberry Pi foundation and Collabora. I
 will later (tomorrow) reply with an email with links to all the related
 announcements and blog posts. More details behind those links, and the
 individual commits.
 
 Beware of the rough edges, there are some bugs we didn't have time to fix
 yet. Most of them need a little effort to discover, though, that's why we
 didn't see them earlier. ;-)
 
 This series is also available as a branch:
 
 git://git.collabora.co.uk/git/user/pq/weston.git raspberrypi-dispmanx
 http://cgit.collabora.com/git/user/pq/weston.git/log/?h=raspberrypi-dispmanx
 
 There is also a patch for the RPi building guide on the Wayland website.
 
 
 Daniel Stone (4):
   Add modifier-only binding
   Add move/scale animation
   Shell: Add Exposay
   configure.ac: Enable AC_USE_SYSTEM_EXTENSIONS
 
 Louis-Francis Ratté-Boulianne (3):
   animation: Make zoom animation renders better and smoother
   compositor, shell: Add animation to measure desktop fps
   xwayland: Fix the race condition when mapping a surface
 
 Louis-Francis Ratté-Boulianne (3):
   toytoolkit: Make the window resizing optimization optional
   animation, shell: add kbd focus change animation
   shell: Fix calculation of center point in surface rotation
 
 Pekka Paalanen (8):
   compositor: add capability flag for arbitrary surface rotation
   compositor: add capability CAPTURE_YFLIP
   rpi: add a Dispmanx renderer
   rpi: switch to rpi-renderer
   rpi: remove weston_plane support
   shell: wait for desktop-shell init before fade in
   desktop-shell: new wallpaper mode scale-crop
   screenshooter: print info to log
 
  clients/desktop-shell.c   |   73 ++-
  clients/window.c  |6 +-
  configure.ac  |   13 +-
  man/weston.ini.man|9 +-
  protocol/desktop-shell.xml|   13 +-
  shared/cairo-util.c   |2 +-
  shared/config-parser.c|3 +-
  shared/image-loader.c |2 +-
  shared/matrix.c   |2 +
  shared/option-parser.c|2 +
  shared/os-compatibility.c |2 +-
  src/Makefile.am   |2 +
  src/animation.c   |  128 +++-
  src/bindings.c|   60 ++
  src/clipboard.c   |2 +-
  src/cms-helper.c  |4 +-
  src/cms-static.c  |5 +-
  src/compositor-drm.c  |6 +-
  src/compositor-fbdev.c|2 +-
  src/compositor-headless.c |4 +-
  src/compositor-rdp.c  |4 +-
  src/compositor-rpi.c  |  898 +++
  src/compositor-wayland.c  |5 +-
  src/compositor-x11.c  |4 +-
  src/compositor.c  |   71 ++-
  src/compositor.h  |   48 ++
  src/evdev-touchpad.c  |2 +
  src/evdev.c   |2 +
  src/filter.c  |2 +
  src/gl-renderer.c |4 +-
  src/gl-renderer.h |7 +-
  src/input.c   |   38 ++
  src/launcher-util.c   |2 +
  src/libbacklight.c|2 +-
  src/log.c |2 +
  src/noop-renderer.c   |2 +-
  src/pixman-renderer.c |4 +-
  src/rpi-bcm-stubs.h   |   39 ++
  src/rpi-renderer.c| 1370 
 +
  src/rpi-renderer.h|   48 ++
  src/screenshooter.c   |  103 +++-
  src/shell.c   | 1078 ++--
  src/tablet-shell.c|2 +
  src/text-backend.c|2 +
  src/tty.c |2 +
  src/udev-seat.c   |2 +
  src/weston-launch.c   |2 -
  src/xwayland/launcher.c   |

Re: [RFC] libinputmapper: Input device configuration for graphic-servers

2013-05-22 Thread Peter Hutterer
On Tue, May 21, 2013 at 04:30:03PM +0200, David Herrmann wrote:
 Hi Peter
 
 On Tue, May 21, 2013 at 6:37 AM, Peter Hutterer
 peter.hutte...@who-t.net wrote:
  On Thu, May 16, 2013 at 03:16:11PM +0200, David Herrmann wrote:
  Hi Peter
 
  On Thu, May 16, 2013 at 7:37 AM, Peter Hutterer
  peter.hutte...@who-t.net wrote:
   On Sun, May 12, 2013 at 04:20:59PM +0200, David Herrmann wrote:
  [..]
   So what is the proposed solution?
   My recommendation is, that compositors still search for devices via
   udev and use device drivers like libxkbcommon. So linux evdev handling
   is still controlled by the compositor. However, I'd like to see
   something like my libinputmapper proposal being used for device
   detection and classification.
  
   libinputmapper provides an inmap_evdev object which reads device
   information from an evdev-fd or sysfs /sys/class/input/inputnum
   path, performs some heuristics to classify it and searches it's global
   database for known fixups for broken devices.
   It then provides capabilities to the caller, which allow them to see
   what drivers to load on the device. And it provides a very simple
   mapping table that allows to apply fixup mappings for broken devices.
   These mappings are simple 1-to-1 mappings that are supposed to be
   applied before drivers handle the input. This is to avoid
   device-specific fixup in the drivers and move all this to the
   inputmapper. An example would be a remapping for gamepads that report
   BTN_A instead of BTN_NORTH, but we cannot fix them in the kernel for
   backwards-compatibility reasons. The gamepad-driver can then assume
   that if it receives BTN_NORTH, it is guaranteed to be BTN_NORTH and
   doesn't need to special case xbox360/etc. controllers, because they're
   broken.
  
   I think evdev is exactly that interface and apparently it doesn't work.
  
   if you want a mapping table, you need a per-client table because sooner 
   or
   later you have a client that needs BTN_FOO when the kernel gives you 
   BTN_BAR
   and you can't change the client to fix it.
  
   i.e. the same issue evdev has now, having a global remapping table just
   moves the problem down by 2 years.
  
   a mapping table is good, but you probably want two stages of mapping: one
   that's used in the compositor for truly broken devices that for some 
   reason
   can't be fixed in the kernel, and one that's used on a per-client basis. 
   and
   you'll likely want to be able to overide the client-specific from outside
   the client too.
 
  IMHO, the problem with evdev is, that it doesn't provide device
  classes. The only class we have is this is an input device. All
  other event-flags can be combined in whatever way we want.
 
  So like 10 years ago when the first gamepad driver was introduced, we
  added some mapping that was unique to this device (the device was
  probably unique, too). Some time later, we added some other
  gamepad-like driver with a different mapping (as it was probably a
  very different device-type, back then, and we didn't see it coming
  that this will become a wide-spread device-type).
  However, today we notice that a GamePad is an established type of
  device (like a touchpad), but we have tons of different mappings in
  the kernel for backwards-compatibility reasons. I can see that this
  kind of development can happen again (and very likely it _will_ happen
  again) and it will happen for all kinds of devices.
 
  But that's why I designed the proposal from a compositor's view
  instead of from a kernel's view.
 
  A touchpad driver of the compositor needs to know exactly what kind of
  events it gets from the kernel. If it gets wrong events, it will
  misbehave. As we cannot guarantee that all kernel drivers behave the
  same way, the compositor's touchpad driver needs to work around all
  these little details on a per-device basis.
  To avoid this, I tried to abstract the touchpad-protocol and moved
  per-device handling into a separate library. It detects all devices
  that can serve as a touchpad and fixes trivial (1-to-1 mapping)
  incompatibilities. This removes all per-device handling from the
  touchpad driver and it can expect all input it gets to be conform with
  a touchpad protocol.
  And in fact, it removes this from all the compositor's input drivers.
  So I think of it more like a lib-detect-and-make-compat.
 
  All devices that do not fall into one of the categories (I called it
  capability), will be handled as custom devices. So if we want an input
  driver for a new fancy device, then we need a custom driver, anyway
  (or adjust a generic driver to handle both). If at some point it turns
  out, that this kind of device becomes more established, we can add a
  new capability for it. Or we try extending an existing capability in a
  backwards-compatible way. We can then remove the custom-device
  handling from the input-driver and instead extend/write a generic
  driver for the new capability.
 
 
  

Re: [PATCH weston] window: avoid a gcc warning in buffer release handler

2013-05-22 Thread Pekka Paalanen
On Wed, 22 May 2013 12:36:27 -0700
Thiago Macieira thiago.macie...@intel.com wrote:

 On quarta-feira, 22 de maio de 2013 10.20.05, ppaala...@gmail.com wrote:
  Apparently some compilers complain about set but not used variables
  'available' and 'bufs', but I don't get the warning. Still, separate the
  debugging code from shm_surface_buffer_release(), so that we only
  compute 'bufs' when it is printed. This should fix the warnings
 
 Set-but-unused is a new warning in GCC 4.7 and, as most warnings of its type, 
 sometimes it triggers only in release (optimised) mode. If you're building 
 with -O0 or an older GCC, you might not have seen it.

Indeed, I do both. Gcc 4.5 and almost always -O0, since I tend to need
to keep debugging stuff. ;-)

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


Re: [PATCH 0/5] Misc RDP compositor fixes

2013-05-22 Thread Pekka Paalanen
On Wed, 22 May 2013 23:40:15 +0200
Hardening rdp.eff...@gmail.com wrote:

 As suggested by Pekka Paalanen, i've splitted the patch in multiple parts.
 This patch set fixes compilation and does misc improvements in the RDP 
 compositor.
 
 Hardening (5):
   Fix compilation against FreeRDP and weston
   Drop unneeded main_seat
   Fix codec initialisations
   Don't rely on Synchronize packet for first screen refresh
   Improve raw surfaces
 
  src/compositor-rdp.c | 161 
 ---
  1 file changed, 101 insertions(+), 60 deletions(-)
 

Yeah, that looks much better by the split and commit messages.

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