[RFC] Add wayland support for MPlayer2

2012-08-24 Thread Alexander Preisinger
This patch series will enable support for wayland via EGL.
Input and output works correctly. But there is no window decoration.

Please have look and tell what should be changed or improved.


This patch series also goes to wayland-devel@lists.freedesktop.org.


Regards,

Alexander Preisinger

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


[PATCH 1/3] Add wayland support

2012-08-24 Thread Alexander Preisinger
Implements shared routines for initialising wayland and keyboard/pointer input.
Indepentend from the video output.
---
 libvo/wl_common.c | 634 ++
 libvo/wl_common.h | 131 +++
 2 files changed, 765 insertions(+)
 create mode 100644 libvo/wl_common.c
 create mode 100644 libvo/wl_common.h

diff --git a/libvo/wl_common.c b/libvo/wl_common.c
new file mode 100644
index 000..e271e5d
--- /dev/null
+++ b/libvo/wl_common.c
@@ -0,0 +1,634 @@
+/*
+ * This file is part of MPlayer.
+ *
+ * MPlayer is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * MPlayer is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with MPlayer; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include stdio.h
+#include stdlib.h
+#include math.h
+#include inttypes.h
+#include limits.h
+#include assert.h
+
+#include unistd.h
+#include sys/mman.h
+#include sys/timerfd.h
+
+#include config.h
+#include bstr.h
+#include options.h
+#include mp_msg.h
+#include mp_fifo.h
+#include libavutil/common.h
+#include talloc.h
+
+#include wl_common.h
+
+#include video_out.h
+#include aspect.h
+#include geometry.h
+#include osdep/timer.h
+
+#include subopt-helper.h
+
+#include input/input.h
+#include input/keycodes.h
+
+#ifdef CONFIG_GL_WAYLAND
+#include wayland-egl.h
+#endif
+
+static void create_display (struct wl_priv *wl);
+static void create_window (struct wl_priv *wl, int width, int height);
+
+/* SHELL SURFACE LISTENER  */
+static void ssurface_handle_ping (void *data,
+struct wl_shell_surface *shell_surface, uint32_t serial)
+{
+wl_shell_surface_pong(shell_surface, serial);
+}
+
+static void ssurface_handle_configure (void *data,
+struct wl_shell_surface *shell_surface,
+uint32_t edges, int32_t width, int32_t height)
+{
+}
+
+static void ssurface_handle_popup_done (void *data,
+struct wl_shell_surface *shell_surface)
+{
+}
+
+const struct wl_shell_surface_listener shell_surface_listener = {
+ssurface_handle_ping,
+ssurface_handle_configure,
+ssurface_handle_popup_done
+};
+
+/* OUTPUT LISTENER */
+static void output_handle_geometry (void *data, struct wl_output *wl_output,
+int32_t x, int32_t y, int32_t physical_width, int32_t physical_height,
+int32_t subpixel, const char *make, const char *model,
+int32_t transform)
+{
+struct vo_wl_display *d = data;
+
+d-pos_x = x;
+d-pos_y = y;
+}
+
+static void output_handle_mode (void *data, struct wl_output *wl_output,
+uint32_t flags, int32_t width, int32_t height, int32_t refresh)
+{
+struct vo_wl_display *d = data;
+
+d-output_height = height;
+d-output_width = width;
+d-mode_received = 1;
+}
+
+const struct wl_output_listener output_listener = {
+output_handle_geometry,
+output_handle_mode
+};
+
+/* KEY LOOKUP */
+static const struct mp_keymap keymap[] = {
+// special keys
+{XKB_KEY_Pause, KEY_PAUSE}, {XKB_KEY_Escape, KEY_ESC},
+{XKB_KEY_BackSpace, KEY_BS}, {XKB_KEY_Tab, KEY_TAB},
+{XKB_KEY_Return, KEY_ENTER}, {XKB_KEY_Menu, KEY_MENU},
+{XKB_KEY_Print, KEY_PRINT},
+
+// cursor keys
+{XKB_KEY_Left, KEY_LEFT}, {XKB_KEY_Right, KEY_RIGHT},
+{XKB_KEY_Up, KEY_UP}, {XKB_KEY_Down, KEY_DOWN},
+
+// navigation block
+{XKB_KEY_Insert, KEY_INSERT}, {XKB_KEY_Delete, KEY_DELETE},
+{XKB_KEY_Home, KEY_HOME}, {XKB_KEY_End, KEY_END},
+{XKB_KEY_Page_Up, KEY_PAGE_UP}, {XKB_KEY_Page_Down, KEY_PAGE_DOWN},
+
+// F-keys
+{XKB_KEY_F1, KEY_F+1}, {XKB_KEY_F2, KEY_F+2}, {XKB_KEY_F3, KEY_F+3},
+{XKB_KEY_F4, KEY_F+4}, {XKB_KEY_F5, KEY_F+5}, {XKB_KEY_F6, KEY_F+6},
+{XKB_KEY_F7, KEY_F+7}, {XKB_KEY_F8, KEY_F+8}, {XKB_KEY_F9, KEY_F+9},
+{XKB_KEY_F10, KEY_F+10}, {XKB_KEY_F11, KEY_F+11}, {XKB_KEY_F12, KEY_F+12},
+
+// numpad independent of numlock
+{XKB_KEY_KP_Subtract, '-'}, {XKB_KEY_KP_Add, '+'},
+{XKB_KEY_KP_Multiply, '*'}, {XKB_KEY_KP_Divide, '/'},
+{XKB_KEY_KP_Enter, KEY_KPENTER},
+
+// numpad with numlock
+{XKB_KEY_KP_0, KEY_KP0}, {XKB_KEY_KP_1, KEY_KP1}, {XKB_KEY_KP_2, KEY_KP2},
+{XKB_KEY_KP_3, KEY_KP3}, {XKB_KEY_KP_4, KEY_KP4}, {XKB_KEY_KP_5, KEY_KP5},
+{XKB_KEY_KP_6, KEY_KP6}, {XKB_KEY_KP_7, KEY_KP7}, {XKB_KEY_KP_8, KEY_KP8},
+{XKB_KEY_KP_9, KEY_KP9}, {XKB_KEY_KP_Decimal, KEY_KPDEC},
+{XKB_KEY_KP_Separator, KEY_KPDEC},
+
+// numpad without numlock
+{XKB_KEY_KP_Insert, KEY_KPINS}, {XKB_KEY_KP_End, KEY_KP1},
+

[PATCH 2/3] Add wayland egl support for vo_gl

2012-08-24 Thread Alexander Preisinger
---
 libvo/gl_common.c | 199 ++
 libvo/gl_common.h |   9 +++
 2 files changed, 208 insertions(+)

diff --git a/libvo/gl_common.c b/libvo/gl_common.c
index 3b72349..d916db7 100644
--- a/libvo/gl_common.c
+++ b/libvo/gl_common.c
@@ -1971,6 +1971,182 @@ static void swapGlBuffers_x11(MPGLContext *ctx)
 }
 #endif
 
+#ifdef CONFIG_GL_WAYLAND
+#include assert.h
+#include wl_common.h
+
+static struct wl_priv wl = {NULL, NULL, NULL, NULL};
+/* New wl_common requires to preset it
+to zero, but that is a bit too hackish for my taste.
+Maybe there is another way to get around the fact that mplayer calls
+vo_init two times. */
+
+struct vo_wl_private {
+EGLSurface egl_surface;
+
+struct {
+EGLDisplay dpy;
+EGLContext ctx;
+EGLConfig conf;
+} egl;
+};
+
+static void appendstr(char **dst, const char *str)
+{
+int newsize;
+char *newstr;
+if (!str)
+return;
+newsize = strlen(*dst) + 1 + strlen(str) + 1;
+newstr = realloc(*dst, newsize);
+if (!newstr)
+return;
+*dst = newstr;
+strcat(*dst,  );
+strcat(*dst, str);
+}
+
+static int init_wayland(struct vo *vo)
+{
+wl.vo = vo;
+return vo_wl_priv_init(wl);
+}
+
+static int create_window_wayland(struct MPGLContext *ctx, uint32_t d_width,
+ uint32_t d_height, uint32_t flags)
+{
+wl.window-width = d_width;
+wl.window-height = d_height;
+
+if (!wl.window)
+return 0;
+
+if (!wl.window-private) {
+wl.window-private = malloc(sizeof(struct vo_wl_private));
+
+wl.window-private-egl.dpy = eglGetDisplay(wl.display-display);
+assert(wl.window-private-egl.dpy);
+
+wl.window-egl_window = wl_egl_window_create(wl.window-surface,
+wl.window-width, wl.window-height);
+
+wl.window-x = wl.display-pos_x;
+wl.window-y = wl.display-pos_y;
+}
+
+return 1;
+}
+
+static int setGlWindow_wayland(MPGLContext *ctx)
+{
+GL *gl = ctx-gl;
+void *(*getProcAddress)(const GLubyte *);
+const char *(*eglExtStr)(EGLDisplay *, int);
+char *eglstr = strdup();
+
+EGLint config_attribs[] = {
+EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+EGL_RED_SIZE, 1,
+EGL_GREEN_SIZE, 1,
+EGL_BLUE_SIZE, 1,
+EGL_ALPHA_SIZE, 0,
+EGL_DEPTH_SIZE, 1,
+EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
+EGL_NONE
+};
+
+EGLint major, minor, n;
+EGLBoolean ret;
+
+ret = eglInitialize(wl.window-private-egl.dpy, major, minor);
+assert(ret == EGL_TRUE);
+
+ret = eglBindAPI(EGL_OPENGL_API);
+assert(ret == EGL_TRUE);
+
+ret = eglChooseConfig(wl.window-private-egl.dpy, config_attribs,
+  wl.window-private-egl.conf, 1, n);
+assert(ret  n == 1);
+
+wl.window-private-egl.ctx = eglCreateContext(
+wl.window-private-egl.dpy,
+wl.window-private-egl.conf,
+EGL_NO_CONTEXT, NULL);
+assert(wl.window-private-egl.ctx);
+
+wl.window-private-egl_surface = eglCreateWindowSurface(
+wl.window-private-egl.dpy, wl.window-private-egl.conf,
+wl.window-egl_window, NULL);
+
+ret = eglMakeCurrent(wl.window-private-egl.dpy,
+wl.window-private-egl_surface,
+wl.window-private-egl_surface,
+wl.window-private-egl.ctx);
+
+assert(ret == EGL_TRUE);
+
+getProcAddress = getdladdr(eglGetProcAddress);
+if (!getProcAddress)
+mp_msg(MSGT_VO, MSGL_WARN, [egl] No eglGetProcAdress);
+
+eglExtStr = getdladdr(eglQueryString);
+if (eglExtStr)
+appendstr(eglstr,
+eglExtStr(wl.window-private-egl.dpy, EGL_EXTENSIONS));
+
+getFunctions(gl, (void *(*)(const GLubyte*))eglGetProcAddress, eglstr);
+if (!gl-BindProgram)
+getFunctions(gl, NULL, eglstr);
+
+wl_display_roundtrip(wl.display-display);
+
+return SET_WINDOW_OK;
+}
+
+static void update_xinerama_info_wayland(struct vo * vo)
+{
+struct MPOpts *opts = vo-opts;
+
+vo_wl_priv_init(wl);
+
+while (!wl.display-mode_received)
+wl_display_roundtrip(wl.display-display);
+
+opts-vo_screenwidth = wl.display-output_width;
+opts-vo_screenheight = wl.display-output_height;
+
+aspect_save_screenres(vo, opts-vo_screenwidth, opts-vo_screenheight);
+}
+
+static void releaseGlContext_wayland(MPGLContext *ctx)
+{
+GL *gl = ctx-gl;
+gl-Finish();
+eglMakeCurrent(wl.window-private-egl.dpy, NULL, NULL, EGL_NO_CONTEXT);
+eglDestroyContext(wl.window-private-egl.dpy,
+wl.window-private-egl.ctx);
+eglTerminate(wl.window-private-egl.dpy);
+}
+
+static void swapGlBuffers_wayland(MPGLContext *ctx)
+{
+eglSwapBuffers(wl.window-private-egl.dpy,
+wl.window-private-egl_surface);
+wl_display_flush(wl.display-display);
+}
+
+void fullscreen_wayland(struct vo *vo)
+{
+vo_wl_priv_fullscreen(wl);
+}
+

[PATCH 3/3] Enable build for wayland egl

2012-08-24 Thread Alexander Preisinger
This uses 2 defines
 * CONFIG_WAYLAND
 * CONFIG_GL_WAYLAND

CONFIG_WAYLAND is not used at the moment
---
 Makefile  |  1 +
 configure | 48 +++-
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index d1ce8dd..035606c 100644
--- a/Makefile
+++ b/Makefile
@@ -453,6 +453,7 @@ SRCS_MPLAYER-$(GL)   += libvo/gl_common.c 
libvo/vo_gl.c \
 SRCS_MPLAYER-$(GL_SDL)   += libvo/sdl_common.c
 SRCS_MPLAYER-$(GL_WIN32) += libvo/w32_common.c
 SRCS_MPLAYER-$(GL_X11)   += libvo/x11_common.c
+SRCS_MPLAYER-$(GL_WAYLAND)   += libvo/wl_common.c
 
 SRCS_MPLAYER-$(IVTV) += libao2/ao_ivtv.c libvo/vo_ivtv.c
 SRCS_MPLAYER-$(JACK) += libao2/ao_jack.c
diff --git a/configure b/configure
index 5c1e288..d698031 100755
--- a/configure
+++ b/configure
@@ -416,6 +416,7 @@ Video output:
   --enable-vm  enable XF86VidMode support [autodetect]
   --enable-xineramaenable Xinerama support [autodetect]
   --enable-x11 enable X11 video output [autodetect]
+  --enable-wayland enable Wayland video output [autodetect]
   --enable-xshape  enable XShape support [autodetect]
   --disable-xssdisable screensaver support via xss [autodetect]
   --enable-fbdev   enable FBDev video output [autodetect]
@@ -560,6 +561,7 @@ ffmpeg=auto
 ffmpeg_internals=no
 _mplayer=yes
 _x11=auto
+_wayland=auto
 _xshape=auto
 _xss=auto
 _dga1=auto
@@ -839,6 +841,8 @@ for ac_option do
   --disable-cross-compile)  _cross_compile=no   ;;
   --enable-mplayer) _mplayer=yes;;
   --disable-mplayer)_mplayer=no ;;
+  --enable-wayland) _wayland=yes;;
+  --disable-wayland)_wayland=no ;;
   --enable-x11) _x11=yes;;
   --disable-x11)_x11=no ;;
   --enable-xshape)  _xshape=yes ;;
@@ -3833,6 +3837,34 @@ depends_on_application_services(){
 
 fi #if darwin
 
+echocheck Wayland headers presence
+  _wayland_headers=no
+  res_comment=check if the dev(el) packages are installed
+  for I in $(echo $extra_cflags | sed s/-I//g) /usr/include ; do
+if test -f $I/wayland-client.h ; then
+  _wayland_headers=yes
+  res_comment=
+  break
+fi
+  done
+echores $_wayland_headers
+
+echocheck Wayland
+if test $_wayland = auto  test $_wayland_headers = yes ; then
+  pkg_config_add wayland-client  _wayland=yes
+fi
+if test $_wayland = yes ; then
+  def_wayland='#define CONFIG_WAYLAND'
+  vomodules=wayland $vomodules
+  libs_mplayer=$libs_mplayer -lwayland-client -lxkbcommon
+  #pkg_config_add doesn't work
+else
+  _wayland=no
+  def_wayland=#undef CONFIG_WAYLAND
+  novomodules=wayland $novomodules
+  res_comment=check if the dev(el) packages are installed
+fi
+echores $_wayland
 
 echocheck X11 headers presence
   _x11_headers=no
@@ -4475,7 +4507,7 @@ echores $_sdl
 # conflicts between -lGL and -framework OpenGL
 echocheck OpenGL
 #Note: this test is run even with --enable-gl since we autodetect linker flags
-if (test $_x11 = yes || test $_sdl = yes || test $_cocoa = yes || win32) 
 test $_gl != no ; then
+if (test $_x11 = yes || test $_wayland = yes || test $_sdl = yes || test 
$_cocoa = yes || win32)  test $_gl != no ; then
   cat  $TMPC  EOF
 #ifdef GL_WIN32
 #include windows.h
@@ -4520,6 +4552,11 @@ EOF
   fi
 done
   fi
+  if test $_wayland = yes ; then
+_gl=yes
+_gl_wayland=yes
+libs_mplayer=$libs_mplayer -lGL -lEGL -lwayland-egl
+  fi
   if win32  cc_check -DGL_WIN32 -lopengl32 ; then
 _gl=yes
 _gl_win32=yes
@@ -4560,6 +4597,10 @@ if test $_gl = yes ; then
 def_gl_x11='#define CONFIG_GL_X11 1'
 res_comment=$res_comment x11
   fi
+  if test $_gl_wayland = yes ; then
+def_gl_wayland='#define CONFIG_GL_WAYLAND'
+res_comment=$res_comment wayland
+  fi
   if test $_gl_sdl = yes ; then
 def_gl_sdl='#define CONFIG_GL_SDL 1'
 res_comment=$res_comment sdl
@@ -4570,6 +4611,7 @@ else
   def_gl_cocoa='#undef CONFIG_GL_COCOA'
   def_gl_win32='#undef CONFIG_GL_WIN32'
   def_gl_x11='#undef CONFIG_GL_X11'
+  def_gl_wayland='#undef CONFIG_GL_WAYLAND'
   def_gl_sdl='#undef CONFIG_GL_SDL'
   novomodules=opengl $novomodules
 fi
@@ -6305,6 +6347,7 @@ GL = $_gl
 GL_COCOA = $_gl_cocoa
 GL_WIN32 = $_gl_win32
 GL_X11 = $_gl_x11
+GL_WAYLAND = $_gl_wayland
 GL_SDL = $_gl_sdl
 HAVE_POSIX_SELECT = $_posix_select
 HAVE_SYS_MMAN_H = $_mman
@@ -6380,6 +6423,7 @@ WIN32DLL = $_win32dll
 WIN32WAVEOUT = $_win32waveout
 WIN32_EMULATION = $_win32_emulation
 X11 = $_x11
+WAYLAND = $_wayland
 XANIM_CODECS = $_xanim
 XMGA = $_xmga
 XMMS_PLUGINS = $_xmms
@@ -6699,6 +6743,7 @@ $def_gl
 $def_gl_cocoa
 $def_gl_win32
 $def_gl_x11
+$def_gl_wayland
 $def_gl_sdl
 $def_ivtv
 $def_jpeg
@@ -6720,6 +6765,7 @@ $def_vesa
 $def_vm
 $def_wii
 $def_x11
+$def_wayland
 $def_xdpms
 $def_xf86keysym
 $def_xinerama
-- 
1.7.12

___
wayland-devel mailing list

Re: [PATCH 1/3] Add wayland support

2012-08-24 Thread Pekka Paalanen
On Fri, 24 Aug 2012 08:08:22 +0200
Alexander Preisinger alexander.preisin...@gmail.com wrote:

 Implements shared routines for initialising wayland and keyboard/pointer 
 input.
 Indepentend from the video output.

Hi,

I have some wayland protocol related comments below, inline.

 ---
  libvo/wl_common.c | 634 
 ++
  libvo/wl_common.h | 131 +++
  2 files changed, 765 insertions(+)
  create mode 100644 libvo/wl_common.c
  create mode 100644 libvo/wl_common.h
 
 diff --git a/libvo/wl_common.c b/libvo/wl_common.c
 new file mode 100644
 index 000..e271e5d
 --- /dev/null
 +++ b/libvo/wl_common.c
 @@ -0,0 +1,634 @@
 +/*
 + * This file is part of MPlayer.
 + *
 + * MPlayer is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * MPlayer is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License along
 + * with MPlayer; if not, write to the Free Software Foundation, Inc.,
 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 + */
 +
 +#include stdio.h
 +#include stdlib.h
 +#include math.h
 +#include inttypes.h
 +#include limits.h
 +#include assert.h
 +
 +#include unistd.h
 +#include sys/mman.h
 +#include sys/timerfd.h
 +
 +#include config.h
 +#include bstr.h
 +#include options.h
 +#include mp_msg.h
 +#include mp_fifo.h
 +#include libavutil/common.h
 +#include talloc.h
 +
 +#include wl_common.h
 +
 +#include video_out.h
 +#include aspect.h
 +#include geometry.h
 +#include osdep/timer.h
 +
 +#include subopt-helper.h
 +
 +#include input/input.h
 +#include input/keycodes.h
 +
 +#ifdef CONFIG_GL_WAYLAND
 +#include wayland-egl.h
 +#endif
 +
 +static void create_display (struct wl_priv *wl);
 +static void create_window (struct wl_priv *wl, int width, int height);
 +
 +/* SHELL SURFACE LISTENER  */
 +static void ssurface_handle_ping (void *data,
 +struct wl_shell_surface *shell_surface, uint32_t serial)
 +{
 +wl_shell_surface_pong(shell_surface, serial);
 +}
 +
 +static void ssurface_handle_configure (void *data,
 +struct wl_shell_surface *shell_surface,
 +uint32_t edges, int32_t width, int32_t height)
 +{
 +}
 +
 +static void ssurface_handle_popup_done (void *data,
 +struct wl_shell_surface *shell_surface)
 +{
 +}
 +
 +const struct wl_shell_surface_listener shell_surface_listener = {
 +ssurface_handle_ping,
 +ssurface_handle_configure,
 +ssurface_handle_popup_done
 +};
 +
 +/* OUTPUT LISTENER */
 +static void output_handle_geometry (void *data, struct wl_output *wl_output,
 +int32_t x, int32_t y, int32_t physical_width, int32_t 
 physical_height,
 +int32_t subpixel, const char *make, const char *model,
 +int32_t transform)
 +{
 +struct vo_wl_display *d = data;
 +
 +d-pos_x = x;
 +d-pos_y = y;

What are these x and y used for? They are leftovers from the global
coordinate system removal, and I don't think they should be used at all.

Doesn't mplayer use the physical dimensions for anything?

Later you would also want to take care of the transform, so that for a
rotated output, you can render a rotated image so that Weston is not
forced to rotate it. That would be especially useful for fullscreen
output, where weston might be able to scan out your image without
compositing it first.

 +}
 +
 +static void output_handle_mode (void *data, struct wl_output *wl_output,
 +uint32_t flags, int32_t width, int32_t height, int32_t refresh)
 +{
 +struct vo_wl_display *d = data;
 +
 +d-output_height = height;
 +d-output_width = width;
 +d-mode_received = 1;

You will get a mode event for every possible video mode an output *may*
have. If you want the current mode, you need to pick the one which has
current flag set. Note, that the x11 backend of Weston does not
advertise more than one mode, but the DRM backend does.

I think this event is also sent, when the output mode is changed... or
at least when the default mode is changed, not sure if it is emitted
for fullscreen switches.

 +}
 +
 +const struct wl_output_listener output_listener = {
 +output_handle_geometry,
 +output_handle_mode
 +};

 +/* POINTER LISTENER */
 +static void pointer_handle_enter(void *data, struct wl_pointer *pointer,
 +uint32_t serial, struct wl_surface *surface,
 +wl_fixed_t sx_w, wl_fixed_t sy_w)
 +{

I think you should set a cursor here, or set a NULL cursor if you want
to hide it. Otherwise you probably get whatever cursor another client
set earlier.

 +}
 +
 +static void pointer_handle_leave(void *data, 

[PATCH] Do not set dpms to standby which cause system could be resotred when system is locked at the second time.

2012-08-24 Thread Wang, Quanxian
Reproduce this:
1)  Weston -i1 and after 1 second, the system go into idle and wait a 
little while, go to lock status
2)  Press key and the screen is fine
3)  After 1 second, system go to idle and wait a little while, go to lock 
status again
4)  Whatever you press any key or mouse, you could restore the system.

From Quanxian Wang quanxian.w...@intel.com

Do not set dpms to standby which cause system could be restored.

diff --git a/src/shell.c b/src/shell.c
index 4d6bc4f..1df571b 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -2470,10 +2470,6 @@ lock(struct wl_listener *listener, void *data)
struct workspace *ws = get_current_workspace(shell);

if (shell-locked) {
-   wl_list_for_each(output, shell-compositor-output_list, link)
-   /* TODO: find a way to jump to other DPMS levels */
-   if (output-set_dpms)
-   output-set_dpms(output, WESTON_DPMS_STANDBY);
return;
}

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


RE: [PATCH] Do not set dpms to standby which cause system could not be resotred when system is locked at the second time.

2012-08-24 Thread Wang, Quanxian
Could not resotred the system. Sorry

   _
   From: Wang, Quanxian
   Sent: Friday, August 24, 2012 6:57 PM
   To: wayland-devel@lists.freedesktop.org
   Cc: Wang, Quanxian
   Subject: [PATCH] Do not set dpms to standby which cause system could be 
resotred when system is locked at the second time.


   Reproduce this:
1)  Weston -i1 and after 1 second, the system go into idle and wait a 
little while, go to lock status
2)  Press key and the screen is fine
3)  After 1 second, system go to idle and wait a little while, go to lock 
status again
4)  Whatever you press any key or mouse, you could not restore the system.

   From Quanxian Wang quanxian.w...@intel.commailto:quanxian.w...@intel.com

   Do not set dpms to standby which cause system could be restored.

   diff --git a/src/shell.c b/src/shell.c
   index 4d6bc4f..1df571b 100644
   --- a/src/shell.c
   +++ b/src/shell.c
   @@ -2470,10 +2470,6 @@ lock(struct wl_listener *listener, void *data)
   struct workspace *ws = get_current_workspace(shell);

   if (shell-locked) {
   -   wl_list_for_each(output, shell-compositor-output_list, 
link)
   -   /* TODO: find a way to jump to other DPMS levels */
   -   if (output-set_dpms)
   -   output-set_dpms(output, 
WESTON_DPMS_STANDBY);
   return;
   }

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


xwayland crash

2012-08-24 Thread jegde jedge
Just brought up wayland, weston, qt5, and xwayland on intel 945.

I can reproduce an Xorg crash everytime.

bring up # weston-launch -- --xserver
run any number of X clients
mouse over an X client and start scrolling the mouse wheel.
This will most likely crash Xorg and all the X clients.
Sometimes it brings down weston

All other mouse and keyboard events that I tried could NOT bring it
down, just the mouse wheel.

If you 'wheel slowly' all is well.

Let me know if anyone would like me to help troubleshoot.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Running xserver

2012-08-24 Thread Bill Spitzak

On 08/23/2012 01:41 PM, Scott Moreau wrote:


It sounds like you should read the xwayland build guide
http://wayland.freedesktop.org/xserver.html
There's no trick to it, you just install everything and start weston
with --xserver and DISPLAY should automatically be set in the
environment so you can start running X apps. Read the build guide and
use the default configure options, you don't need to do all this extra
stuff you do to break it before it has a chance to work.


Okay, it is so close now I feel I may succeed!

What I did was:

1. Compile xf86-video-wlshm, with an edit that was in the wayland-build 
script I have:


   git clone git://people.freedesktop.org/~iksaif/xf86-video-wlshm
   sed -i -e s/hosted.h/xwayland.h/ xf86-video-wlshm/src/wlshm.h
   ./autogen.sh --prefix=$WLD
   make
   make install

2. After much futzing, came up with an xorg.conf that does not produce 
an error and uses wlshm (I think, an example of the correct file would 
be very helpful, or a patch to wayland xserver to not need it):


Section ServerLayout
Identifier Default Layout
Screen  0  Default Screen 0 0
EndSection

Section Device
Identifier Device0
Driver wlshm
EndSection

Section Screen
Identifier Default Screen
Device Device0
EndSection

3. There appears to be no way to get weston to tell the xserver to use 
an alternative config file. So instead I rand weston without --xserver 
and replicated it's launch line inside the weston-terminal:


Xorg -config ./xorg.conf -wayland -rootless :2 

(adding some rules to weston to locate an alternative xorg.conf might be 
a good idea, or a way to pass arbitrary switches to Xorg).


4. I can run X clients, and they seem to talk to the server:

export DISPLAY=:2

5. However nothing appears on the screen. If I kill the client debug 
information prints to stdout from Xorg (not from the client, showing 
that there was successful communication):


(abbreviated because weston-terminal does not do copy  paste to X):
1 XSELINUXs still allocated at reset
SCREEN: 0 objects of 112 bytes = 0 total bytes 0 private allocs
... other 0 objects
PIXMAP: 1 objects of 12 bytes = 12 total bytes 0 private allocs

TOTAL: 1 objects, 12 bytes, 0 allocs
1 PIXMAPs still allocated at reset

xwl_input_delayed_init

6. Running xev produces some output on the stdout of xev showing some 
events have been passed:


Outer window is 0x21, inner window is 0x22

PropertyNotify event, serial 8, synthetic NO, window 0x21,
atom 0x27 (WM_NAME), time 260665416, state PropertyNewValue

PropertyNotify event, serial 9, synthetic NO, window 0x21,
atom 0x22 (WM_COMMAND), time 260665416, state PropertyNewValue

PropertyNotify event, serial 10, synthetic NO, window 0x21,
atom 0x28 (WM_NORMAL_HINTS), time 260665416, state PropertyNewValue

CreateNotify event, serial 11, synthetic NO, window 0x21,
parent 0x21, window 0x22, (10,10), width 50, height 50
border_width 4, override NO

PropertyNotify event, serial 14, synthetic NO, window 0x21,
atom 0xf1 (WM_PROTOCOLS), time 260665416, state PropertyNewValue

MapNotify event, serial 15, synthetic NO, window 0x21,
event 0x21, window 0x22, override NO

MapNotify event, serial 16, synthetic NO, window 0x21,
event 0x21, window 0x21, override NO

VisibilityNotify event, serial 16, synthetic NO, window 0x21,
state VisibilityUnobscured

Expose event, serial 16, synthetic NO, window 0x21,
(0,0), width 178, height 10, count 3

Expose event, serial 16, synthetic NO, window 0x21,
(0,10), width 10, height 58, count 2

Expose event, serial 16, synthetic NO, window 0x21,
(68,10), width 110, height 58, count 1

Expose event, serial 16, synthetic NO, window 0x21,
(0,68), width 178, height 110, count 0
(at this point all output stops, even if I try to click and hit keys in 
weston, and the program waits until I kill it)


Any ideas?

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