Re: [PATCH RFC] Allow configuration of output positions

2013-06-25 Thread Pekka Paalanen
On Thu, 13 Jun 2013 21:59:55 +0200
Florian Scandella  wrote:

> 
> Hi,
> 
> Can someone pls have a look at this patch?
> 
> I implemented configuration options for relativ output positioning in
> weston.ini. Currently the implementation is private to the drm
> compositor, but i think this can be generalized for all output
> drivers. ATM it can only be configured in weston.ini, a dynamic way
> like xrandr would be nice (now idea how to).
> Next i want to introduce a concept of primary output, to center the
> mouse on the right monitor on start, draw the launcher only there and
> other stuff.
> 
> I'm new to wayland/weston, so i'm not sure if this is even the right
> approach ...
> 
> only tested with 2 monitors, sadly i don't have more :)

Hi,

yeah, the basic approach seems fine to me. You can get an arbitrary
amount of outputs for testing, if you add this functionality to the x11
backend. It would also be useful to test and guard against crazy(?)
configurations, like multiple position keys in one output section, or
impossibilities like A:left-of-B combined with B:left-of-A or longer
loop. It would be cool to add that to the test suite.

I also see you are trying to cope with dynamic output changes, that's
good, even though Weston on other parts (especially shell) does not
handle it.

There are some coding style issues, like operator spacing, and line
lengths.

I didn't review the algorithm, though one thing coming to my mind is,
if you have configured outputs A-B-C in that layout, and only A and C
are present, are they positioned properly?

If you want comments on the code, you should send it inline. We cannot
easily quote an attachment in email.

Don't worry about the xrandr-replacement for now, it is somewhat
orthogonal to this.

Primary output is probably more of a shell concept than a Weston core
concept, but I guess you could propose something. I would think that
the core would use it only for the initial position of a pointer, when
a wl_pointer first appears. The shell would do its own stuff if it
wishes.


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


[PATCH] fbdev: initialization of varinfo reorder and storage

2013-06-25 Thread mchalain [marc.chal...@gmail.com]
From: mchalain 

Currently the frame buffer initalization is uncomplete and the reenable
uses different values as the startup. To set the frame buffer with values
and to be sure of the configuration's result, this patch reorder the
initialization sequence.
The new order is:
 - read the weston.ini to set the resolution
 - open the device
 - get the device info from device
 - try to set the weston.ini resolution
 - get the resulting device info
 - store the device info
 - map the device memory
 - close the device
runing
 - VT_LEAVE
device access disabling
 - VT_ENTER
 - reenable the framebuffer
 - open the device
 - set the device info from storage
 - map the device memory
 - close the device

the fbdev-backend read some configurations from
weston.ini in the [output] section.
name is the name of the device (default "fb0")
mode to read the resolution
transform to change the screen rotation
---
 src/compositor-fbdev.c |  254 ++--
 1 file changed, 138 insertions(+), 116 deletions(-)

diff --git a/src/compositor-fbdev.c b/src/compositor-fbdev.c
index 9c3d17e..349833a 100644
--- a/src/compositor-fbdev.c
+++ b/src/compositor-fbdev.c
@@ -56,11 +56,7 @@ struct fbdev_compositor {
 };
 
 struct fbdev_screeninfo {
-   unsigned int x_resolution; /* pixels, visible area */
-   unsigned int y_resolution; /* pixels, visible area */
-   unsigned int width_mm; /* visible screen width in mm */
-   unsigned int height_mm; /* visible screen height in mm */
-   unsigned int bits_per_pixel;
+   struct fb_var_screeninfo varinfo;
 
size_t buffer_length; /* length of frame buffer memory in bytes */
size_t line_length; /* length of a line in bytes */
@@ -203,6 +199,61 @@ finish_frame_handler(void *data)
return 1;
 }
 
+static uint32_t
+parse_transform(const char *transform, const char *output_name)
+{
+   static const struct { const char *name; uint32_t token; } names[] = {
+   { "normal", WL_OUTPUT_TRANSFORM_NORMAL },
+   { "90", WL_OUTPUT_TRANSFORM_90 },
+   { "180",WL_OUTPUT_TRANSFORM_180 },
+   { "270",WL_OUTPUT_TRANSFORM_270 },
+   { "flipped",WL_OUTPUT_TRANSFORM_FLIPPED },
+   { "flipped-90", WL_OUTPUT_TRANSFORM_FLIPPED_90 },
+   { "flipped-180", WL_OUTPUT_TRANSFORM_FLIPPED_180 },
+   { "flipped-270", WL_OUTPUT_TRANSFORM_FLIPPED_270 },
+   };
+   unsigned int i;
+
+   for (i = 0; i < ARRAY_LENGTH(names); i++)
+   if (strcmp(names[i].name, transform) == 0)
+   return names[i].token;
+
+   weston_log("Invalid transform \"%s\" for output %s\n",
+  transform, output_name);
+
+   return WL_OUTPUT_TRANSFORM_NORMAL;
+}
+
+static int
+fbdev_read_config(struct fbdev_compositor *ec,
+   struct fbdev_output *output)
+{
+   struct weston_config_section *section;
+   char *s;
+
+   weston_log("output name %s\n", output->base.name);
+   memset(&output->fb_info.varinfo, 0, sizeof(output->fb_info.varinfo));
+   output->base.transform = WL_OUTPUT_TRANSFORM_NORMAL;
+   section = weston_config_get_section(ec->base.config, "output", "name",
+   output->base.name);
+   if (section) {
+   weston_config_section_get_string(section, "mode", &s, 
"preferred");
+   if (strcmp(s, "preferred") == 0) {
+   output->fb_info.varinfo.xres = 0;
+   output->fb_info.varinfo.yres = 0;
+   } else if (sscanf(s, "%dx%d", &output->fb_info.varinfo.xres,
+   &output->fb_info.varinfo.yres) != 2) {
+   weston_log("Invalid mode \"%s\" for output %s\n",
+  s, output->base.name);
+   }
+   free(s);
+
+   weston_config_section_get_string(section, "transform", &s, 
"normal");
+   output->base.transform = parse_transform(s, output->base.name);
+   free(s);
+   }
+   return 0;
+}
 static pixman_format_code_t
 calculate_pixman_format(struct fb_var_screeninfo *vinfo,
 struct fb_fix_screeninfo *finfo)
@@ -219,32 +270,10 @@ calculate_pixman_format(struct fb_var_screeninfo *vinfo,
 * the preferred format in the hardware. */
int type;
 
-   weston_log("Calculating pixman format from:\n"
-  STAMP_SPACE " - type: %i (aux: %i)\n"
-  STAMP_SPACE " - visual: %i\n"
-  STAMP_SPACE " - bpp: %i (grayscale: %i)\n"
-  STAMP_SPACE " - red: offset: %i, length: %i, MSB: %i\n"
-  STAMP_SPACE " - green: offset: %i, length: %i, MSB: %i\n"
-  STAMP_SPACE " - blue: offset: %i, length: %i, MSB: %i\n"
-  STAMP_SPACE " - transp: offset: %i, length: %i, MSB: %i\n

[PATCH] build: disabling the mtdev library support

2013-06-25 Thread mchalain [marc.chal...@gmail.com]
From: mchalain 

This patch creates the --enable-mtdev configure's option with
"auto" as default value.
If mtdv library is not available the mtdev functions are replaced
by empty macros.
To simplify the Makefile.am evdev source files are placed inside
a static library. The other reason of this modification is to
see the link between evdev code and mtdev library from the Makefile
---
 configure.ac|   20 +++-
 src/Makefile.am |   27 ++-
 src/evdev.c |   11 ---
 3 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index b625221..4bfce58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,7 +132,7 @@ AC_ARG_ENABLE(drm-compositor, [  --enable-drm-compositor],,
 AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes -a 
x$enable_egl = xyes)
 if test x$enable_drm_compositor = xyes -a x$enable_egl = xyes; then
   AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
-  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm mtdev 
>= 1.1.0])
+  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm])
 fi
 
 
@@ -161,7 +161,7 @@ AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test 
"x$enable_rpi_compositor" = "xyes")
 have_bcm_host="no"
 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_COMPOSITOR, [libudev >= 136])
   PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
 [have_bcm_host="yes"
  AC_DEFINE([HAVE_BCM_HOST], [1], [have Raspberry Pi BCM 
headers])],
@@ -176,7 +176,7 @@ AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR],
[test x$enable_fbdev_compositor = xyes])
 AS_IF([test x$enable_fbdev_compositor = xyes], [
   AC_DEFINE([BUILD_FBDEV_COMPOSITOR], [1], [Build the fbdev compositor])
-  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 mtdev >= 1.1.0])
+  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 ])
 ])
 
 AC_ARG_ENABLE([rdp-compositor], [  --enable-rdp-compositor],,
@@ -203,6 +203,16 @@ PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], 
[have_webp=no])
 AS_IF([test "x$have_webp" = "xyes"],
   [AC_DEFINE([HAVE_WEBP], [1], [Have webp])])
 
+AC_ARG_ENABLE(mtdev,
+  AS_HELP_STRING([--disable-mtdev],
+ [do not support multitouch library libmtdev]),,
+ enable_mtdev=auto)
+if test "x$enable_mtdev" != "xno"; then
+   PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0], [have_mtdev=yes], 
[have_mtdev=no])
+   AS_IF([test "x$have_mtdev" = "xyes"],
+ [AC_DEFINE([HAVE_MTDEV], [1], [Have Multitouch device 
support])])
+fi
+
 AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
 if test x$have_jpeglib = xyes; then
   JPEG_LIBS="-ljpeg"
@@ -259,8 +269,8 @@ 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
+AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch = xyes)
+if test x$enable_weston_launch = xyes; then
   PKG_CHECK_MODULES(WESTON_LAUNCH, [libdrm])
   PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login],
[have_systemd_login=yes], [have_systemd_login=no])
diff --git a/src/Makefile.am b/src/Makefile.am
index d06e773..b16bc80 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,6 +100,7 @@ module_LTLIBRARIES =\
$(tablet_shell) \
$(cms_static)   \
$(cms_colord)   \
+   $(libevdev) \
$(x11_backend)  \
$(drm_backend)  \
$(wayland_backend)  \
@@ -129,11 +130,20 @@ x11_backend_la_CFLAGS =   \
 x11_backend_la_SOURCES = compositor-x11.c
 endif
 
+libevdev = libevdev.la
+libevdev_la_LIBADD = $(MTDEV_LIBS)
+evdev_la_CFLAGS =  \
+   $(MTDEV_CFLAGS)
+libevdev_la_SOURCES =  \
+   evdev.c \
+   evdev.h \
+   evdev-touchpad.c
+   
 if ENABLE_DRM_COMPOSITOR
 drm_backend = drm-backend.la
 drm_backend_la_LDFLAGS = -module -avoid-version
 drm_backend_la_LIBADD = $(COMPOSITOR_LIBS) $(DRM_COMPOSITOR_LIBS) \
-   ../shared/libshared.la -lrt
+   ./libevdev.la ../shared/libshared.la -lrt
 drm_backend_la_CFLAGS =\
$(COMPOSITOR_CFLAGS)\
$(DRM_COMPOSITOR_CFLAGS)

Re: [PATCH] build: disabling the mtdev library support

2013-06-25 Thread sardemff7+wayland

On 25/06/2013 17:28, mchalain [marc.chal...@gmail.com] wrote:

From: mchalain 

This patch creates the --enable-mtdev configure's option with
"auto" as default value.
If mtdv library is not available the mtdev functions are replaced
by empty macros.
To simplify the Makefile.am evdev source files are placed inside
a static library. The other reason of this modification is to
see the link between evdev code and mtdev library from the Makefile
---
  configure.ac|   20 +++-
  src/Makefile.am |   27 ++-
  src/evdev.c |   11 ---
  3 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index b625221..4bfce58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,7 +132,7 @@ AC_ARG_ENABLE(drm-compositor, [  --enable-drm-compositor],,
  AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes -a 
x$enable_egl = xyes)
  if test x$enable_drm_compositor = xyes -a x$enable_egl = xyes; then
AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
-  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm mtdev 
>= 1.1.0])
+  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm])
  fi


@@ -161,7 +161,7 @@ AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test "x$enable_rpi_compositor" 
= "xyes")
  have_bcm_host="no"
  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_COMPOSITOR, [libudev >= 136])
PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
  [have_bcm_host="yes"
   AC_DEFINE([HAVE_BCM_HOST], [1], [have Raspberry Pi BCM 
headers])],
@@ -176,7 +176,7 @@ AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR],
 [test x$enable_fbdev_compositor = xyes])
  AS_IF([test x$enable_fbdev_compositor = xyes], [
AC_DEFINE([BUILD_FBDEV_COMPOSITOR], [1], [Build the fbdev compositor])
-  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 mtdev >= 1.1.0])
+  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 ])
  ])

  AC_ARG_ENABLE([rdp-compositor], [  --enable-rdp-compositor],,
@@ -203,6 +203,16 @@ PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], 
[have_webp=no])
  AS_IF([test "x$have_webp" = "xyes"],
[AC_DEFINE([HAVE_WEBP], [1], [Have webp])])

+AC_ARG_ENABLE(mtdev,
+  AS_HELP_STRING([--disable-mtdev],
+ [do not support multitouch library libmtdev]),,
+ enable_mtdev=auto)
+if test "x$enable_mtdev" != "xno"; then
+   PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0], [have_mtdev=yes], 
[have_mtdev=no])
+   AS_IF([test "x$have_mtdev" = "xyes"],
+ [AC_DEFINE([HAVE_MTDEV], [1], [Have Multitouch device 
support])])
+fi
+


Again, please put an AC_MSG_ERROR if it is explicitly enabled and the 
library is not found.




  AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
  if test x$have_jpeglib = xyes; then
JPEG_LIBS="-ljpeg"
@@ -259,8 +269,8 @@ 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
+AM_CONDITIONAL(BUILD_WESTON_LAUNCH, test x$enable_weston_launch = xyes)
+if test x$enable_weston_launch = xyes; then
PKG_CHECK_MODULES(WESTON_LAUNCH, [libdrm])
PKG_CHECK_MODULES(SYSTEMD_LOGIN, [libsystemd-login],
[have_systemd_login=yes], [have_systemd_login=no])


You should remove that hunk (git checkout -p).



diff --git a/src/Makefile.am b/src/Makefile.am
index d06e773..b16bc80 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,6 +100,7 @@ module_LTLIBRARIES =\
$(tablet_shell) \
$(cms_static)   \
$(cms_colord)   \
+   $(libevdev) \
$(x11_backend)  \
$(drm_backend)  \
$(wayland_backend)  \


No, it is not a module, you must use noinst_LTLIBRARIES here, see below.



@@ -129,11 +130,20 @@ x11_backend_la_CFLAGS =   \
  x11_backend_la_SOURCES = compositor-x11.c
  endif

+libevdev = libevdev.la


noinst_LTLIBRARIES += libevdev.la



+libevdev_la_LIBADD = $(MTDEV_LIBS)
+evdev_la_CFLAGS =  \
+   $(MTDEV_CFLAGS)
+libevdev_la_SOURCES =  \
+   evdev.c \
+   evdev.h \
+   evdev-touchpad.c
+   
  if ENABLE_DRM_COMPOSITOR
  drm_backend = drm-backend.l

Re: [PATCH] build: disabling the mtdev library support

2013-06-25 Thread Marc Chalain
2013/6/25 

> On 25/06/2013 17:28, mchalain [marc.chal...@gmail.com] wrote:
>
>> From: mchalain 
>>
>

>AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
>>   if test x$have_jpeglib = xyes; then
>> JPEG_LIBS="-ljpeg"
>> @@ -259,8 +269,8 @@ 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
>> +AM_CONDITIONAL(BUILD_WESTON_**LAUNCH, test x$enable_weston_launch =
>> xyes)
>> +if test x$enable_weston_launch = xyes; then
>> PKG_CHECK_MODULES(WESTON_**LAUNCH, [libdrm])
>> PKG_CHECK_MODULES(SYSTEMD_**LOGIN, [libsystemd-login],
>> [have_systemd_login=yes], [have_systemd_login=no])
>>
>
> You should remove that hunk (git checkout -p).
>
> Yes but it's a bug already exiting

>
>
> --
>
> Quentin “Sardem FF7” Glidic
>
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH] build: disabling the mtdev library support

2013-06-25 Thread sardemff7+wayland

On 25/06/2013 17:59, Marc Chalain wrote:

2013/6/25 


On 25/06/2013 17:28, mchalain [marc.chal...@gmail.com] wrote:


From: mchalain 






AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)

   if test x$have_jpeglib = xyes; then
 JPEG_LIBS="-ljpeg"
@@ -259,8 +269,8 @@ 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
+AM_CONDITIONAL(BUILD_WESTON_**LAUNCH, test x$enable_weston_launch =
xyes)
+if test x$enable_weston_launch = xyes; then
 PKG_CHECK_MODULES(WESTON_**LAUNCH, [libdrm])
 PKG_CHECK_MODULES(SYSTEMD_**LOGIN, [libsystemd-login],
 [have_systemd_login=yes], [have_systemd_login=no])



You should remove that hunk (git checkout -p).


Yes but it's a bug already exiting


Then please submit it in its own patch. :-)


--

Quentin “Sardem FF7” Glidic
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH] build: disabling the mtdev library support

2013-06-25 Thread mchalain [marc.chal...@gmail.com]
From: mchalain 

This patch creates the --enable-mtdev configure's option with
"auto" as default value.
If mtdv library is not available the mtdev functions are replaced
by empty macros.
To simplify the Makefile.am evdev source files are placed inside
a static library. The other reason of this modification is to
see the link between evdev code and mtdev library from the Makefile
---
 configure.ac|   17 ++---
 src/Makefile.am |   29 +++--
 src/evdev.c |   11 ---
 3 files changed, 37 insertions(+), 20 deletions(-)

diff --git a/configure.ac b/configure.ac
index b625221..b967a54 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,7 +132,7 @@ AC_ARG_ENABLE(drm-compositor, [  --enable-drm-compositor],,
 AM_CONDITIONAL(ENABLE_DRM_COMPOSITOR, test x$enable_drm_compositor = xyes -a 
x$enable_egl = xyes)
 if test x$enable_drm_compositor = xyes -a x$enable_egl = xyes; then
   AC_DEFINE([BUILD_DRM_COMPOSITOR], [1], [Build the DRM compositor])
-  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm mtdev 
>= 1.1.0])
+  PKG_CHECK_MODULES(DRM_COMPOSITOR, [libudev >= 136 libdrm >= 2.4.30 gbm])
 fi
 
 
@@ -161,7 +161,7 @@ AM_CONDITIONAL(ENABLE_RPI_COMPOSITOR, test 
"x$enable_rpi_compositor" = "xyes")
 have_bcm_host="no"
 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_COMPOSITOR, [libudev >= 136])
   PKG_CHECK_MODULES(RPI_BCM_HOST, [bcm_host],
 [have_bcm_host="yes"
  AC_DEFINE([HAVE_BCM_HOST], [1], [have Raspberry Pi BCM 
headers])],
@@ -176,7 +176,7 @@ AM_CONDITIONAL([ENABLE_FBDEV_COMPOSITOR],
[test x$enable_fbdev_compositor = xyes])
 AS_IF([test x$enable_fbdev_compositor = xyes], [
   AC_DEFINE([BUILD_FBDEV_COMPOSITOR], [1], [Build the fbdev compositor])
-  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 mtdev >= 1.1.0])
+  PKG_CHECK_MODULES([FBDEV_COMPOSITOR], [libudev >= 136 ])
 ])
 
 AC_ARG_ENABLE([rdp-compositor], [  --enable-rdp-compositor],,
@@ -203,6 +203,17 @@ PKG_CHECK_MODULES(WEBP, [libwebp], [have_webp=yes], 
[have_webp=no])
 AS_IF([test "x$have_webp" = "xyes"],
   [AC_DEFINE([HAVE_WEBP], [1], [Have webp])])
 
+AC_ARG_ENABLE(mtdev,
+  AS_HELP_STRING([--disable-mtdev],
+ [do not support multitouch library libmtdev]),,
+ enable_mtdev=auto)
+if test "x$enable_mtdev" != "xno"; then
+   PKG_CHECK_MODULES(MTDEV, [mtdev >= 1.1.0], [have_mtdev=yes], 
[have_mtdev=no])
+   AS_IF([test "x$have_mtdev" = "xyes"],
+ [AC_DEFINE([HAVE_MTDEV], [1], [Have Multitouch device 
support])],
+ [AC_MSG_ERROR("--enable-mtdev but mtdev library not found")])
+fi
+
 AC_CHECK_LIB([jpeg], [jpeg_CreateDecompress], have_jpeglib=yes)
 if test x$have_jpeglib = xyes; then
   JPEG_LIBS="-ljpeg"
diff --git a/src/Makefile.am b/src/Makefile.am
index d06e773..82c183a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -107,7 +107,8 @@ module_LTLIBRARIES =\
$(fbdev_backend)\
$(rdp_backend)
 
-noinst_LTLIBRARIES =
+noinst_LTLIBRARIES =   \
+   $(libevdev)
 
 if INSTALL_RPI_COMPOSITOR
 module_LTLIBRARIES += $(rpi_backend)
@@ -129,11 +130,20 @@ x11_backend_la_CFLAGS =   \
 x11_backend_la_SOURCES = compositor-x11.c
 endif
 
+libevdev = libevdev.la
+libevdev_la_LIBADD = $(MTDEV_LIBS)
+evdev_la_CFLAGS =  \
+   $(MTDEV_CFLAGS)
+libevdev_la_SOURCES =  \
+   evdev.c \
+   evdev.h \
+   evdev-touchpad.c
+   
 if ENABLE_DRM_COMPOSITOR
 drm_backend = drm-backend.la
 drm_backend_la_LDFLAGS = -module -avoid-version
 drm_backend_la_LIBADD = $(COMPOSITOR_LIBS) $(DRM_COMPOSITOR_LIBS) \
-   ../shared/libshared.la -lrt
+   libevdev.la ../shared/libshared.la -lrt
 drm_backend_la_CFLAGS =\
$(COMPOSITOR_CFLAGS)\
$(DRM_COMPOSITOR_CFLAGS)\
@@ -143,9 +153,6 @@ drm_backend_la_SOURCES =\
tty.c   \
udev-seat.c \
udev-seat.h \
-   evdev.c \
-   evdev.h \
-   evdev-touchpad.c\
launcher-util.c \
launcher-util.h \
libbacklight.c  \
@@ -172,7 +179,7 @@ rpi_backend_la_LDFLAGS = -module -avoid-version
 rpi_backend_la_LIBADD = $(COMPOSITOR_LIBS) \
$(RPI_COMPOSITOR_LIBS)  \
$(RPI_BCM_HOST_LIBS)   

Re: minimized and stick windows

2013-06-25 Thread Rafael Antognolli
On Thu, Jun 13, 2013 at 5:42 PM, Bill Spitzak  wrote:
> sardemff7+wayl...@sardemff7.net wrote:
>
>>> This is a requirement so that non-trivial clients can be written
>>> that are not forced to blink the transient windows to change their
>>> parenting.
>>
>>
>> Do you have a use case for this scenario ? There are probably some I
>> cannot see, but maybe could we solve them another way.
>
>
> A "toolbox" that must remain all of the N document windows, no matter which
> is raised.
>
> I propose that rather than the client having to send a directed acyclic
> graph to describe this situation, it only has to send a tree but it can edit
> it . Before the client raises any document window it reparents the toolbox
> to the new top-most window.
>
>
>> Same question, do you have a use case for a popup surface that you would
>> reparent? For our current use case (menus, do we have another one?) this
>> is unlikely (afaict, I am not a toolkit guy).
>
>
> The exact same situation, because a client needs to be able to turn a
> "popup" into a "transient", for instance if the user can pin the menu.

Just in case people have some filters set, I've sent some patches to
the list, changing maximized and fullscreen to states. I don't real
reviews on that, but at least a quick look to see if the overall
approach is good, so I can continue. I want to know basically two
things:

1) Will we have 2 new APIs for *each* surface states, so we can add
the needed parameters to them, or a generic set/unset API with
something like a void * parameter that will be used for any state?

2) Is fullscreen staying as another state, or as a surface type?

After that I can add the events from server to inform that such states
should be set, and then work on the minimize itself.

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


[PATCH weston v2 1/4] udev-seat: Refactor out seat lookup and possible creation

2013-06-25 Thread Rob Bradford
From: Rob Bradford 

This change spills the code for looking up a seat by name and then
potentially creating it if it doesn't exist into a new function called
udev_seat_get_named.

This change allows us to reuse this code when looking up the seat
when parsing seat constraints per output.
---
 src/udev-seat.c | 29 -
 src/udev-seat.h |  2 ++
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/udev-seat.c b/src/udev-seat.c
index a8790b3..bd25535 100644
--- a/src/udev-seat.c
+++ b/src/udev-seat.c
@@ -66,18 +66,11 @@ device_added(struct udev_device *udev_device, struct 
udev_input *input)
if (!seat_name)
seat_name = default_seat_name;
 
-   wl_list_for_each(seat, &c->seat_list, base.link) {
-   if (strcmp(seat->base.seat_name, seat_name) == 0)
-   goto seat_found;
-   }
+   seat = udev_seat_get_named(c, seat_name);
 
-   seat = udev_seat_create(c, seat_name);
-
-   if (!seat)
+   if (seat == NULL)
return -1;
 
-seat_found:
-
/* Use non-blocking mode so that we can loop on read on
 * evdev_device_data() until all events on the fd are
 * read.  mtdev_get() also expects this. */
@@ -350,3 +343,21 @@ udev_seat_destroy(struct udev_seat *seat)
weston_seat_release(&seat->base);
free(seat);
 }
+
+struct udev_seat *
+udev_seat_get_named(struct weston_compositor *c, const char *seat_name)
+{
+   struct udev_seat *seat;
+
+   wl_list_for_each(seat, &c->seat_list, base.link) {
+   if (strcmp(seat->base.seat_name, seat_name) == 0)
+   return seat;
+   }
+
+   seat = udev_seat_create(c, seat_name);
+
+   if (!seat)
+   return NULL;
+
+   return seat;
+}
diff --git a/src/udev-seat.h b/src/udev-seat.h
index 7dd5987..3543e7c 100644
--- a/src/udev-seat.h
+++ b/src/udev-seat.h
@@ -48,4 +48,6 @@ int udev_input_init(struct udev_input *input,
const char *seat_id);
 void udev_input_destroy(struct udev_input *input);
 
+struct udev_seat *udev_seat_get_named(struct weston_compositor *c,
+ const char *seat_name);
 #endif
-- 
1.8.3.1

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


[PATCH weston v2 2/4] input: Add weston_pointer_clamp function to ensure pointer visible

2013-06-25 Thread Rob Bradford
From: Rob Bradford 

This refactors the code out from clip_pointer_motion into a function of
its own which can then be used elsewhere to clamp the pointer
coordinates to the range of the outputs.

This change also makes the caller of clip_pointer_motion use this new
function.
---
 src/compositor.h |  3 +++
 src/input.c  | 12 ++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/compositor.h b/src/compositor.h
index 3206e45..45a14d6 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -345,6 +345,9 @@ weston_pointer_start_grab(struct weston_pointer *pointer,
  struct weston_pointer_grab *grab);
 void
 weston_pointer_end_grab(struct weston_pointer *pointer);
+void
+weston_pointer_clamp(struct weston_pointer *pointer,
+   wl_fixed_t *fx, wl_fixed_t *fy);
 
 struct weston_keyboard *
 weston_keyboard_create(void);
diff --git a/src/input.c b/src/input.c
index ad4512d..6d17bc4 100644
--- a/src/input.c
+++ b/src/input.c
@@ -562,17 +562,17 @@ weston_touch_end_grab(struct weston_touch *touch)
touch->grab = &touch->default_grab;
 }
 
-static void
-clip_pointer_motion(struct weston_seat *seat, wl_fixed_t *fx, wl_fixed_t *fy)
+WL_EXPORT void
+weston_pointer_clamp(struct weston_pointer *pointer, wl_fixed_t *fx, 
wl_fixed_t *fy)
 {
-   struct weston_compositor *ec = seat->compositor;
+   struct weston_compositor *ec = pointer->seat->compositor;
struct weston_output *output, *prev = NULL;
int x, y, old_x, old_y, valid = 0;
 
x = wl_fixed_to_int(*fx);
y = wl_fixed_to_int(*fy);
-   old_x = wl_fixed_to_int(seat->pointer->x);
-   old_y = wl_fixed_to_int(seat->pointer->y);
+   old_x = wl_fixed_to_int(pointer->x);
+   old_y = wl_fixed_to_int(pointer->y);
 
wl_list_for_each(output, &ec->output_list, link) {
if (pixman_region32_contains_point(&output->region,
@@ -606,7 +606,7 @@ move_pointer(struct weston_seat *seat, wl_fixed_t x, 
wl_fixed_t y)
struct weston_output *output;
int32_t ix, iy;
 
-   clip_pointer_motion(seat, &x, &y);
+   weston_pointer_clamp (pointer, &x, &y);
 
pointer->x = x;
pointer->y = y;
-- 
1.8.3.1

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


[PATCH weston v2 3/4] compositor-drm: Enable seat constraining when configured in weston.ini

2013-06-25 Thread Rob Bradford
From: Rob Bradford 

This change tweaks weston_pointer_clamp to take into consideration if a
seat is constrained to a particular output by only considering the
pointer position valid if it is within the output we a constrained to.
This function is also used for the initial warping of the pointer when a
constraint is first established.

The other two changes are the application of the constraint when either
a new device added or a new output created and therefore outputs and
input devices can be brought up in either order.

v2: the code in create_output_for_connector has been spun off into a
new function setup_output_seat_constraint (Ander). The inappropriate
warping behaviour has been resolved by using weston_pointer_clamp
(Pekka).
---
 src/compositor-drm.c | 23 +++
 src/compositor.h |  2 ++
 src/input.c  |  7 ++-
 src/udev-seat.c  |  5 +
 4 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index e704c9f..45e7e9b 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1728,6 +1728,25 @@ parse_transform(const char *transform, const char 
*output_name)
return WL_OUTPUT_TRANSFORM_NORMAL;
 }
 
+static void
+setup_output_seat_constraint(struct drm_compositor *ec,
+struct weston_output *output,
+const char *s)
+{
+   if (strcmp(s, "") != 0) {
+   struct udev_seat *seat;
+
+   seat = udev_seat_get_named(&ec->base, s);
+   if (seat)
+   seat->base.output = output;
+
+   if (seat && seat->base.pointer)
+   weston_pointer_clamp(seat->base.pointer,
+&seat->base.pointer->x,
+&seat->base.pointer->y);
+   }
+}
+
 static int
 create_output_for_connector(struct drm_compositor *ec,
drmModeRes *resources,
@@ -1796,6 +1815,10 @@ create_output_for_connector(struct drm_compositor *ec,
transform = parse_transform(s, output->base.name);
free(s);
 
+   weston_config_section_get_string(section, "seat", &s, "");
+   setup_output_seat_constraint(ec, &output->base, s);
+   free(s);
+
output->crtc_id = resources->crtcs[i];
output->pipe = i;
ec->crtc_allocator |= (1 << output->crtc_id);
diff --git a/src/compositor.h b/src/compositor.h
index 45a14d6..4191950 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -437,6 +437,8 @@ struct weston_seat {
struct weston_keyboard *keyboard;
struct weston_touch *touch;
 
+   struct weston_output *output; /* constraint */
+
struct wl_signal destroy_signal;
 
struct weston_compositor *compositor;
diff --git a/src/input.c b/src/input.c
index 6d17bc4..d83fd9c 100644
--- a/src/input.c
+++ b/src/input.c
@@ -575,6 +575,8 @@ weston_pointer_clamp(struct weston_pointer *pointer, 
wl_fixed_t *fx, wl_fixed_t
old_y = wl_fixed_to_int(pointer->y);
 
wl_list_for_each(output, &ec->output_list, link) {
+   if (pointer->seat->output && pointer->seat->output != output)
+   continue;
if (pixman_region32_contains_point(&output->region,
   x, y, NULL))
valid = 1;
@@ -583,7 +585,10 @@ weston_pointer_clamp(struct weston_pointer *pointer, 
wl_fixed_t *fx, wl_fixed_t
prev = output;
}
 
-   if (!valid) {
+   if (!prev)
+   prev = pointer->seat->output;
+
+   if (prev && !valid) {
if (x < prev->x)
*fx = wl_fixed_from_int(prev->x);
else if (x >= prev->x + prev->width)
diff --git a/src/udev-seat.c b/src/udev-seat.c
index bd25535..ec6dc4b 100644
--- a/src/udev-seat.c
+++ b/src/udev-seat.c
@@ -115,6 +115,11 @@ device_added(struct udev_device *udev_device, struct 
udev_input *input)
 
wl_list_insert(seat->devices_list.prev, &device->link);
 
+   if (seat->base.output && seat->base.pointer)
+   weston_pointer_clamp(seat->base.pointer,
+&seat->base.pointer->x,
+&seat->base.pointer->y);
+
return 0;
 }
 
-- 
1.8.3.1

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


[PATCH weston v2 4/4] man: Add documentation for output seat confining

2013-06-25 Thread Rob Bradford
From: Rob Bradford 

v2: Add some explanation about the default seat
---
 man/weston.ini.man | 9 +
 1 file changed, 9 insertions(+)

diff --git a/man/weston.ini.man b/man/weston.ini.man
index c3e5747..9c22b3f 100644
--- a/man/weston.ini.man
+++ b/man/weston.ini.man
@@ -288,6 +288,15 @@ be one of the following 8 strings:
 .BR  "flipped-270   " "Flipped and 90 degrees counter clockwise"
 .fi
 .RE
+.TP 7
+.BI "seat=" name
+The logical seat name that that this output should be associated with. If this
+is set then the seat's input will be confined to the output that has the seat
+set on it. The expectation is that this functionality will be used in a
+multiheaded environment with a single compositor for multiple output and input
+configurations. The default seat is called "default" and will always be
+present. This seat can be constrained like any other.
+.RE
 .SH "INPUT-METHOD SECTION"
 .TP 7
 .BI "path=" "/usr/libexec/weston-keyboard"
-- 
1.8.3.1

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


Re: [PATCH]: src/.gitignore: add spring-tool to .gitignore

2013-06-25 Thread Kristian Høgsberg
On Mon, Jun 24, 2013 at 05:09:21PM +0200, m...@laposte.net wrote:
> From 48b5302d7415e35c7f38b89132d3624817450335 Mon Sep 17 00:00:00 2001
> From: Nathan Reboud 
> Date: Mon, 24 Jun 2013 16:12:55 +0200
> Subject: src/.gitignore: add spring-tool to .gitignore

Thanks, applied.

Kristian

> ---
> src/.gitignore | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/src/.gitignore b/src/.gitignore
> index ee62b84..539150d 100755
> --- a/src/.gitignore
> +++ b/src/.gitignore
> @@ -4,6 +4,7 @@ weston
> weston-launch
> screenshooter-protocol.c
> screenshooter-server-protocol.h
> +spring-tool
> text-cursor-position-protocol.c
> text-cursor-position-server-protocol.h
> tablet-shell-protocol.c
> -- 
> 
> Une messagerie gratuite, garantie à vie et des services en plus, ça vous 
> tente ?
> Je crée ma boîte mail www.laposte.net
> ___
> 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: Two XML files in weston are not distributed in tarballs

2013-06-25 Thread Kristian Høgsberg
On Mon, Jun 24, 2013 at 07:26:51PM +0200, Sven Joachim wrote:
> Hello,
> 
> I have noted that the files subsurface.xml and text-cursor-position.xml
> are not included in EXTRA_DIST in protocol/Makefile.am, and it seems to
> me that they should be included in weston tarballs.

That's reasonable, fixed.  You're also welcome to send a patch ;-)

Kristian

> Cheers,
>Sven



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

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


Re: [PATCH weston 2/3] gl-renderer: Fix initial upload of SHM buffer as texture

2013-06-25 Thread Kristian Høgsberg
On Fri, Jun 07, 2013 at 04:52:45PM +0300, Ander Conselvan de Oliveira wrote:
> The fix to not call glTexImage2D() on every attach does not properly
> set the texture damage region appropriately when the surface has a
> buffer transform with 90 or 270 degrees rotation, since it would simply
> multiply the buffer dimensions by the buffer scale, but in this case
> width and height are inverted.
> 
> A possible fix for this would be to add the properly transformed region
> to the texture damage region. However, there is a conversion back to
> buffer coordinates when doing the actual upload and the entire buffer
> needs to be uploaded anyway. So we just set a flag signalling that and
> handle that special case in gl_renderer_flush_damage().

Thanks, all three applied.  Just one comment below

> ---
>  src/gl-renderer.c |   19 ++-
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gl-renderer.c b/src/gl-renderer.c
> index b869856..c5d683c 100644
> --- a/src/gl-renderer.c
> +++ b/src/gl-renderer.c
> @@ -66,6 +66,7 @@ struct gl_surface_state {
>  
>   GLuint textures[3];
>   int num_textures;
> + int needs_full_upload;
>   pixman_region32_t texture_damage;
>  
>   EGLImageKHR images[3];
> @@ -1147,6 +1148,16 @@ gl_renderer_flush_damage(struct weston_surface 
> *surface)
>   /* Mesa does not define GL_EXT_unpack_subimage */
>   glPixelStorei(GL_UNPACK_ROW_LENGTH, gs->pitch);
>   data = wl_shm_buffer_get_data(buffer);
> +
> + if (gs->needs_full_upload) {
> + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0);
> + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0);
> + glTexSubImage2D(GL_TEXTURE_2D, 0,
> + 0, 0, gs->pitch, buffer->height,
> + GL_BGRA_EXT, GL_UNSIGNED_BYTE, data);
> + goto done;
> + }
> +
>   rectangles = pixman_region32_rectangles(&gs->texture_damage, &n);
>   for (i = 0; i < n; i++) {
>   pixman_box32_t r;
> @@ -1164,6 +1175,7 @@ gl_renderer_flush_damage(struct weston_surface *surface)
>  done:
>   pixman_region32_fini(&gs->texture_damage);
>   pixman_region32_init(&gs->texture_damage);
> + gs->needs_full_upload = 0;
>  
>   weston_buffer_reference(&gs->buffer_ref, NULL);
>  }
> @@ -1227,11 +1239,8 @@ gl_renderer_attach(struct weston_surface *es, struct 
> wl_buffer *buffer)
>   glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT,
>gs->pitch, buffer->height, 0,
>GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
> - pixman_region32_union_rect(&gs->texture_damage,
> -&gs->texture_damage,
> -0, 0,
> -gs->pitch / es->buffer_scale,
> -gs->height / 
> es->buffer_scale);
> +
> + gs->needs_full_upload = 1;

This is close to what I originally suggested, except that we should be
able to avoid the glTexImage2D and use glTexImage2D (not
glTexSubImage2d) in flush_damage above instead.  It shouldn't make a
difference - glTexImage2D with NULL here just reallocates the texture
and the glTexSubImage2D in flush_damage uploads the data.  It's just
nicer to be able to combine the two into one glTexImage2D call,
however, that doesn't work right in mesa (I tried).  I think we're
hitting a bug in mesa where glTexImage2D doesn't detach the texture
from the EGLImage and we end up overwriting the previously attached
EGLImage.

This works and fixes the issues, so lets stick with this for 1.2.

Kristian

>   }
>  
>   if (wl_shm_buffer_get_format(buffer) == WL_SHM_FORMAT_XRGB)
> -- 
> 1.7.10.4
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel