Index: abi/include/abi/ipc/interfaces.h
===================================================================
--- abi/include/abi/ipc/interfaces.h	(revision 24cf391ab7bf79bde5200b1cd912d7966b81d8b5)
+++ abi/include/abi/ipc/interfaces.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -188,4 +188,6 @@
 	INTERFACE_PCI =
 	    FOURCC_COMPACT('p', 'c', 'i', ' ') | IFACE_EXCHANGE_SERIALIZE,
+	INTERFACE_DDEV =
+	    FOURCC_COMPACT('d', 'd', 'e', 'v') | IFACE_EXCHANGE_SERIALIZE,
 	INTERFACE_DISPLAY =
 	    FOURCC_COMPACT('d', 's', 'p', 'l') | IFACE_EXCHANGE_SERIALIZE,
Index: uspace/lib/ddev/doc/doxygroups.h
===================================================================
--- uspace/lib/ddev/doc/doxygroups.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/doc/doxygroups.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,3 @@
+/** @addtogroup libddev libddev
+ * @ingroup libs
+ */
Index: uspace/lib/ddev/include/ddev.h
===================================================================
--- uspace/lib/ddev/include/ddev.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/include/ddev.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libddev
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _LIBDDEV_DDEV_H_
+#define _LIBDDEV_DDEV_H_
+
+#include <errno.h>
+#include <gfx/context.h>
+#include <stdbool.h>
+#include "types/ddev.h"
+
+extern errno_t ddev_open(const char *, ddev_t **);
+extern void ddev_close(ddev_t *);
+extern errno_t ddev_get_gc(ddev_t *, gfx_context_t **);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/ddev/include/ddev_srv.h
===================================================================
--- uspace/lib/ddev/include/ddev_srv.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/include/ddev_srv.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libdisplay
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _LIBDDEV_DDEV_SRV_H_
+#define _LIBDDEV_DDEV_SRV_H_
+
+#include <async.h>
+#include <errno.h>
+#include <gfx/context.h>
+
+typedef struct ddev_ops ddev_ops_t;
+
+/** Display device server structure (per client session) */
+typedef struct {
+	async_sess_t *client_sess;
+	ddev_ops_t *ops;
+	void *arg;
+} ddev_srv_t;
+
+struct ddev_ops {
+	errno_t (*get_gc)(void *, gfx_context_t **);
+};
+
+extern void ddev_conn(ipc_call_t *, ddev_srv_t *);
+extern void ddev_srv_initialize(ddev_srv_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/ddev/include/ipc/ddev.h
===================================================================
--- uspace/lib/ddev/include/ipc/ddev.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/include/ipc/ddev.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libddev
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _LIBC_IPC_DDEV_H_
+#define _LIBC_IPC_DDEV_H_
+
+#include <ipc/common.h>
+
+typedef enum {
+	DDEV_GET_GC = IPC_FIRST_USER_METHOD
+} ddev_request_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/ddev/include/types/ddev.h
===================================================================
--- uspace/lib/ddev/include/types/ddev.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/include/types/ddev.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libddev
+ * @{
+ */
+/** @file
+ */
+
+#ifndef _LIBDDEV_TYPES_DDEV_H_
+#define _LIBDDEV_TYPES_DDEV_H_
+
+#include <async.h>
+
+/** Display server session */
+typedef struct {
+	/** Session with display device */
+	async_sess_t *sess;
+} ddev_t;
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/ddev/meson.build
===================================================================
--- uspace/lib/ddev/meson.build	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/meson.build	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,38 @@
+#
+# Copyright (c) 2019 Jiri Svoboda
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+deps = [ 'gfx', 'ipcgfx' ]
+src = files(
+	'src/ddev.c',
+	'src/ddev_srv.c',
+)
+
+test_src = files(
+	'test/ddev.c',
+	'test/main.c',
+)
Index: uspace/lib/ddev/src/ddev.c
===================================================================
--- uspace/lib/ddev/src/ddev.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/src/ddev.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <async.h>
+#include <ddev.h>
+#include <errno.h>
+#include <ipc/ddev.h>
+#include <ipc/services.h>
+#include <ipcgfx/client.h>
+#include <loc.h>
+#include <stdlib.h>
+
+/** Open display device.
+ *
+ * @param ddname Display device service name
+ * @param rdisplay Place to store pointer to display session
+ * @return EOK on success or an error code
+ */
+errno_t ddev_open(const char *ddname, ddev_t **rddev)
+{
+	service_id_t ddev_svc;
+	ddev_t *ddev;
+	errno_t rc;
+
+	ddev = calloc(1, sizeof(ddev_t));
+	if (ddev == NULL)
+		return ENOMEM;
+
+	rc = loc_service_get_id(ddname, &ddev_svc, IPC_FLAG_BLOCKING);
+	if (rc != EOK) {
+		free(ddev);
+		return ENOENT;
+	}
+
+	ddev->sess = loc_service_connect(ddev_svc, INTERFACE_DDEV,
+	    IPC_FLAG_BLOCKING);
+	if (ddev->sess == NULL) {
+		free(ddev);
+		return ENOENT;
+	}
+
+	*rddev = ddev;
+	return EOK;
+}
+
+/** Close display device.
+ *
+ * @param ddev Display device session
+ */
+void ddev_close(ddev_t *ddev)
+{
+	async_hangup(ddev->sess);
+	free(ddev);
+}
+
+/** Create graphics context for drawing to display device.
+ *
+ * @param ddev Display device
+ * @param rgc Place to store pointer to new graphics context
+ */
+errno_t ddev_get_gc(ddev_t *ddev, gfx_context_t **rgc)
+{
+	async_sess_t *sess;
+	async_exch_t *exch;
+	ipc_gc_t *gc;
+	errno_t rc;
+
+	exch = async_exchange_begin(ddev->sess);
+	sess = async_connect_me_to(exch, INTERFACE_GC, 0, 42);
+	if (sess == NULL) {
+		async_exchange_end(exch);
+		return EIO;
+	}
+
+	async_exchange_end(exch);
+
+	rc = ipc_gc_create(sess, &gc);
+	if (rc != EOK) {
+		async_hangup(sess);
+		return ENOMEM;
+	}
+
+	*rgc = ipc_gc_get_ctx(gc);
+	return EOK;
+}
+
+/** @}
+ */
Index: uspace/lib/ddev/src/ddev_srv.c
===================================================================
--- uspace/lib/ddev/src/ddev_srv.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/src/ddev_srv.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libddev
+ * @{
+ */
+/**
+ * @file
+ * @brief Display protocol server stub
+ */
+
+#include <ddev_srv.h>
+#include <errno.h>
+#include <io/log.h>
+#include <ipc/ddev.h>
+#include <mem.h>
+#include <stdlib.h>
+#include <stddef.h>
+
+#include <stdio.h>
+
+void ddev_conn(ipc_call_t *icall, ddev_srv_t *srv)
+{
+	/* Accept the connection */
+	async_accept_0(icall);
+	printf("display_conn\n");
+
+	while (true) {
+		ipc_call_t call;
+
+		async_get_call(&call);
+		sysarg_t method = ipc_get_imethod(&call);
+
+		if (!method) {
+			/* The other side has hung up */
+			async_answer_0(&call, EOK);
+			break;
+		}
+
+		printf("display_conn method=%u\n", (unsigned) method);
+		switch (method) {
+		case DDEV_GET_GC:
+		default:
+			async_answer_0(&call, ENOTSUP);
+		}
+	}
+
+	/* Hang up callback session */
+	if (srv->client_sess != NULL) {
+		async_hangup(srv->client_sess);
+		srv->client_sess = NULL;
+	}
+}
+
+/** Initialize display device server structure
+ *
+ * @param srv Display device server structure to initialize
+ */
+void ddev_srv_initialize(ddev_srv_t *srv)
+{
+	memset(srv, 0, sizeof(*srv));
+}
+
+/** @}
+ */
Index: uspace/lib/ddev/test/ddev.c
===================================================================
--- uspace/lib/ddev/test/ddev.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/test/ddev.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <async.h>
+#include <errno.h>
+#include <ddev.h>
+#include <ddev_srv.h>
+#include <fibril_synch.h>
+#include <gfx/color.h>
+#include <gfx/context.h>
+#include <gfx/render.h>
+#include <ipcgfx/server.h>
+#include <loc.h>
+#include <pcut/pcut.h>
+
+PCUT_INIT;
+
+PCUT_TEST_SUITE(ddev);
+
+static const char *test_ddev_server = "test-ddev";
+static const char *test_ddev_svc = "test/ddev";
+
+static void test_ddev_conn(ipc_call_t *, void *);
+
+static errno_t test_get_gc(void *, gfx_context_t **);
+static errno_t test_gc_set_color(void *, gfx_color_t *);
+
+static ddev_ops_t test_ddev_ops = {
+	.get_gc = test_get_gc
+};
+
+static gfx_context_ops_t test_gc_ops = {
+	.set_color = test_gc_set_color
+};
+
+/** Describes to the server how to respond to our request and pass tracking
+ * data back to the client.
+ */
+typedef struct {
+	errno_t rc;
+	bool set_color_called;
+	ddev_srv_t *srv;
+} test_response_t;
+
+/** ddev_open(), ddev_close() work for valid display device service */
+PCUT_TEST(open_close)
+{
+	errno_t rc;
+	service_id_t sid;
+	ddev_t *ddev = NULL;
+	test_response_t resp;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(test_ddev_svc, &sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ddev_open(test_ddev_svc, &ddev);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(ddev);
+
+	ddev_close(ddev);
+	rc = loc_service_unregister(sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+}
+
+/** ddev_get_gc with server returning failure */
+PCUT_TEST(dev_get_gc_failure)
+{
+	errno_t rc;
+	service_id_t sid;
+	ddev_t *ddev = NULL;
+	test_response_t resp;
+	gfx_context_t *gc;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(test_ddev_svc, &sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ddev_open(test_ddev_svc, &ddev);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(ddev);
+
+	gc = NULL;
+	resp.rc = ENOMEM;
+	rc = ddev_get_gc(ddev, &gc);
+	/* async_connect_me_to() does not return specific error */
+	PCUT_ASSERT_ERRNO_VAL(EIO, rc);
+	PCUT_ASSERT_NULL(gc);
+
+	ddev_close(ddev);
+	rc = loc_service_unregister(sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+}
+
+/** ddev_get_gc with server returning success */
+PCUT_TEST(dev_get_gc_success)
+{
+	errno_t rc;
+	service_id_t sid;
+	ddev_t *ddev = NULL;
+	test_response_t resp;
+	gfx_context_t *gc;
+	gfx_color_t *color;
+
+	async_set_fallback_port_handler(test_ddev_conn, &resp);
+
+	// FIXME This causes this test to be non-reentrant!
+	rc = loc_server_register(test_ddev_server);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = loc_service_register(test_ddev_svc, &sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	rc = ddev_open(test_ddev_svc, &ddev);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(ddev);
+
+	resp.rc = EOK;
+	gc = NULL;
+	rc = ddev_get_gc(ddev, &gc);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_NOT_NULL(gc);
+
+	rc = gfx_color_new_rgb_i16(0, 0, 0, &color);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+
+	resp.set_color_called = false;
+	rc = gfx_set_color(gc, color);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+	PCUT_ASSERT_TRUE(resp.set_color_called);
+
+	gfx_color_delete(color);
+
+	ddev_close(ddev);
+	rc = loc_service_unregister(sid);
+	PCUT_ASSERT_ERRNO_VAL(EOK, rc);
+}
+
+/** Test display device connection.
+ *
+ * This is very similar to connection handler in the display server.
+ * XXX This should be folded into display_srv, if possible
+ */
+static void test_ddev_conn(ipc_call_t *icall, void *arg)
+{
+	test_response_t *resp = (test_response_t *) arg;
+	ddev_srv_t srv;
+	sysarg_t svc_id;
+	gfx_context_t *gc;
+	errno_t rc;
+
+	svc_id = ipc_get_arg2(icall);
+
+	if (svc_id != 0) {
+		/* Set up protocol structure */
+		ddev_srv_initialize(&srv);
+		srv.ops = &test_ddev_ops;
+		srv.arg = arg;
+		resp->srv = &srv;
+
+		/* Handle connection */
+		ddev_conn(icall, &srv);
+
+		resp->srv = NULL;
+	} else {
+		if (resp->rc != EOK) {
+			async_answer_0(icall, resp->rc);
+			return;
+		}
+
+		rc = gfx_context_new(&test_gc_ops, arg, &gc);
+		if (rc != EOK) {
+			async_answer_0(icall, ENOMEM);
+			return;
+		}
+
+		/* Window GC connection */
+		gc_conn(icall, gc);
+	}
+}
+
+static errno_t test_get_gc(void *arg, gfx_context_t **rgc)
+{
+	*rgc = NULL;
+	return ENOTSUP;
+}
+
+static errno_t test_gc_set_color(void *arg, gfx_color_t *color)
+{
+	test_response_t *resp = (test_response_t *) arg;
+
+	resp->set_color_called = true;
+	return resp->rc;
+}
+
+PCUT_EXPORT(ddev);
Index: uspace/lib/ddev/test/main.c
===================================================================
--- uspace/lib/ddev/test/main.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
+++ uspace/lib/ddev/test/main.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2019 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <pcut/pcut.h>
+
+PCUT_INIT;
+
+PCUT_IMPORT(ddev);
+
+PCUT_MAIN();
Index: uspace/lib/display/include/disp_srv.h
===================================================================
--- uspace/lib/display/include/disp_srv.h	(revision 24cf391ab7bf79bde5200b1cd912d7966b81d8b5)
+++ uspace/lib/display/include/disp_srv.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -1,4 +1,4 @@
 /*
- * Copyright (c) 2012 Jiri Svoboda
+ * Copyright (c) 2019 Jiri Svoboda
  * All rights reserved.
  *
Index: uspace/lib/display/include/ipc/display.h
===================================================================
--- uspace/lib/display/include/ipc/display.h	(revision 24cf391ab7bf79bde5200b1cd912d7966b81d8b5)
+++ uspace/lib/display/include/ipc/display.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup libcipc
+/** @addtogroup libdisplay
  * @{
  */
Index: uspace/lib/display/include/types/display.h
===================================================================
--- uspace/lib/display/include/types/display.h	(revision 24cf391ab7bf79bde5200b1cd912d7966b81d8b5)
+++ uspace/lib/display/include/types/display.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup libc
+/** @addtogroup libdisplay
  * @{
  */
@@ -39,5 +39,4 @@
 #include <fibril_synch.h>
 #include <io/kbd_event.h>
-#include <ipc/devman.h>
 #include <stdint.h>
 
Index: uspace/lib/display/include/types/display/event.h
===================================================================
--- uspace/lib/display/include/types/display/event.h	(revision 24cf391ab7bf79bde5200b1cd912d7966b81d8b5)
+++ uspace/lib/display/include/types/display/event.h	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup libc
+/** @addtogroup libdisplay
  * @{
  */
Index: uspace/lib/display/src/disp_srv.c
===================================================================
--- uspace/lib/display/src/disp_srv.c	(revision 24cf391ab7bf79bde5200b1cd912d7966b81d8b5)
+++ uspace/lib/display/src/disp_srv.c	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -27,5 +27,5 @@
  */
 
-/** @addtogroup libc
+/** @addtogroup libdisplay
  * @{
  */
Index: uspace/lib/meson.build
===================================================================
--- uspace/lib/meson.build	(revision 24cf391ab7bf79bde5200b1cd912d7966b81d8b5)
+++ uspace/lib/meson.build	(revision 973efd3684d83cf125f752dd057beb73441fa8f2)
@@ -94,5 +94,6 @@
 	'ipcgfx',
 
-	'display'
+	'ddev',
+	'display',
 ]
 
