Re: [PATCH weston 5/9] clients/simple-dmabuf-intel: rename to simple-dmabuf-drm

2016-11-21 Thread Daniel Stone
Hi Varad,

On 17 November 2016 at 11:55, Varad Gautam  wrote:
> From: Varad Gautam 
>
> this will allow adding other drm backends later.

It's still not a particularly pretty client, but no worse than what came before.

Reviewed-by: Daniel Stone 

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


Re: [PATCH weston 5/9] clients/simple-dmabuf-intel: rename to simple-dmabuf-drm

2016-11-17 Thread Eric Engestrom
On Thursday, 2016-11-17 17:25:59 +0530, Varad Gautam wrote:
> From: Varad Gautam 
> 
> this will allow adding other drm backends later.
> 
> Signed-off-by: Varad Gautam 
> ---
>  Makefile.am   |  12 +-
>  clients/simple-dmabuf-drm.c   | 668 
> ++
>  clients/simple-dmabuf-intel.c | 668 
> --
>  configure.ac  |  22 +-
>  4 files changed, 685 insertions(+), 685 deletions(-)
>  create mode 100644 clients/simple-dmabuf-drm.c
>  delete mode 100644 clients/simple-dmabuf-intel.c

Hint: next time, you could use `git format-patch -M` to show renames,
instead of delete + create.
Makes reading the diff (and therefore reviewing) much easier :)
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston 5/9] clients/simple-dmabuf-intel: rename to simple-dmabuf-drm

2016-11-17 Thread Varad Gautam
From: Varad Gautam 

this will allow adding other drm backends later.

Signed-off-by: Varad Gautam 
---
 Makefile.am   |  12 +-
 clients/simple-dmabuf-drm.c   | 668 ++
 clients/simple-dmabuf-intel.c | 668 --
 configure.ac  |  22 +-
 4 files changed, 685 insertions(+), 685 deletions(-)
 create mode 100644 clients/simple-dmabuf-drm.c
 delete mode 100644 clients/simple-dmabuf-intel.c

diff --git a/Makefile.am b/Makefile.am
index b08ce71..5a7fadb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -582,18 +582,18 @@ weston_simple_egl_CFLAGS = $(AM_CFLAGS) 
$(SIMPLE_EGL_CLIENT_CFLAGS)
 weston_simple_egl_LDADD = $(SIMPLE_EGL_CLIENT_LIBS) -lm
 endif
 
-if BUILD_SIMPLE_DMABUF_INTEL_CLIENT
-demo_clients += weston-simple-dmabuf-intel
-weston_simple_dmabuf_intel_SOURCES = clients/simple-dmabuf-intel.c
-nodist_weston_simple_dmabuf_intel_SOURCES =\
+if BUILD_SIMPLE_DMABUF_DRM_CLIENT
+demo_clients += weston-simple-dmabuf-drm
+weston_simple_dmabuf_drm_SOURCES = clients/simple-dmabuf-drm.c
+nodist_weston_simple_dmabuf_drm_SOURCES =  \
protocol/xdg-shell-unstable-v6-protocol.c   \
protocol/xdg-shell-unstable-v6-client-protocol.h\
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \
protocol/linux-dmabuf-unstable-v1-client-protocol.h
-weston_simple_dmabuf_intel_CFLAGS = $(AM_CFLAGS) 
$(SIMPLE_DMABUF_INTEL_CLIENT_CFLAGS)
-weston_simple_dmabuf_intel_LDADD = $(SIMPLE_DMABUF_INTEL_CLIENT_LIBS) 
libshared.la
+weston_simple_dmabuf_drm_CFLAGS = $(AM_CFLAGS) 
$(SIMPLE_DMABUF_DRM_CLIENT_CFLAGS)
+weston_simple_dmabuf_drm_LDADD = $(SIMPLE_DMABUF_DRM_CLIENT_LIBS) libshared.la
 BUILT_SOURCES += protocol/linux-dmabuf-unstable-v1-client-protocol.h
 endif
 
diff --git a/clients/simple-dmabuf-drm.c b/clients/simple-dmabuf-drm.c
new file mode 100644
index 000..fad420a
--- /dev/null
+++ b/clients/simple-dmabuf-drm.c
@@ -0,0 +1,668 @@
+/*
+ * Copyright © 2011 Benjamin Franzke
+ * Copyright © 2010 Intel Corporation
+ * Copyright © 2014 Collabora Ltd.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include "config.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "shared/zalloc.h"
+#include "xdg-shell-unstable-v6-client-protocol.h"
+#include "fullscreen-shell-unstable-v1-client-protocol.h"
+#include "linux-dmabuf-unstable-v1-client-protocol.h"
+
+struct display {
+   struct wl_display *display;
+   struct wl_registry *registry;
+   struct wl_compositor *compositor;
+   struct zxdg_shell_v6 *shell;
+   struct zwp_fullscreen_shell_v1 *fshell;
+   struct zwp_linux_dmabuf_v1 *dmabuf;
+   int xrgb_format_found;
+   int req_dmabuf_immediate;
+};
+
+struct buffer {
+   struct wl_buffer *buffer;
+   int busy;
+
+   int drm_fd;
+
+   drm_intel_bufmgr *bufmgr;
+   drm_intel_bo *bo;
+
+   uint32_t gem_handle;
+   int dmabuf_fd;
+   uint8_t *mmap;
+
+   int width;
+   int height;
+   int bpp;
+   unsigned long stride;
+};
+
+#define NUM_BUFFERS 3
+
+struct window {
+   struct display *display;
+   int width, height;
+   struct wl_surface *surface;
+   struct zxdg_surface_v6 *xdg_surface;
+   struct zxdg_toplevel_v6 *xdg_toplevel;
+   struct buffer buffers[NUM_BUFFERS];
+   struct buffer *prev_buffer;
+   struct wl_callback *callback;
+   bool initialized;
+   bool wait_for_configure;
+};
+
+static int running = 1;
+
+static void
+redraw(void *data, struct wl_callback *callback, uint32_t time);