aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSathishkumar2013-08-28 08:13:59 -0500
committerSaurabh Bipin Chandra2013-08-29 04:08:17 -0500
commit30c8b47648b5ff316519e7054b9caa7131878ab6 (patch)
tree9629eb810252a204a4068a86848b2846cc4b3209
parent90deab3291a4cf18f2bb3df18da0678fd27ac467 (diff)
downloadrepo-libdce-30c8b47648b5ff316519e7054b9caa7131878ab6.tar.gz
repo-libdce-30c8b47648b5ff316519e7054b9caa7131878ab6.tar.xz
repo-libdce-30c8b47648b5ff316519e7054b9caa7131878ab6.zip
[LINUX] X11 and Wayland Support removed
X11 and wayland support is removed from libdce. Defaults to omapdrm device. Change-Id: I0def0c872cc2658edd12a3e69dec6016eab3f1c9 Signed-off-by: Sathishkumar <x0203598@ti.com>
-rw-r--r--Makefile.am7
-rw-r--r--configure.ac18
-rw-r--r--libdce.c33
-rw-r--r--linux/libdce-x11.c131
-rw-r--r--linux/wayland-drm-client-protocol.h209
-rw-r--r--linux/wayland-drm-protocol.c71
6 files changed, 3 insertions, 466 deletions
diff --git a/Makefile.am b/Makefile.am
index 93d14d4..5869713 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,13 +20,6 @@ libdce_la_CFLAGS = $(WARN_CFLAGS) $(CE_CFLAGS) $(DRM_CFLAGS) $(X11_C
20libdce_la_LDFLAGS = -no-undefined -version-info 1:0:0 20libdce_la_LDFLAGS = -no-undefined -version-info 1:0:0
21libdce_la_LIBADD = $(DRM_LIBS) $(X11_LIBS) $(WAYLAND_LIBS) $(MMRPC_LIBS) 21libdce_la_LIBADD = $(DRM_LIBS) $(X11_LIBS) $(WAYLAND_LIBS) $(MMRPC_LIBS)
22 22
23if ENABLE_X11
24libdce_la_SOURCES += linux/libdce-x11.c
25endif
26if ENABLE_WAYLAND
27libdce_la_SOURCES += linux/libdce-wayland.c linux/wayland-drm-protocol.c
28endif
29
30libdce_la_includedir = $(includedir) 23libdce_la_includedir = $(includedir)
31libdce_la_include_HEADERS = libdce.h 24libdce_la_include_HEADERS = libdce.h
32 25
diff --git a/configure.ac b/configure.ac
index 72430cb..fbf34b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,24 +53,6 @@ dnl *** checks for libraries ***
53dnl Check for libmmrpc 53dnl Check for libmmrpc
54PKG_CHECK_MODULES(MMRPC, libmmrpc) 54PKG_CHECK_MODULES(MMRPC, libmmrpc)
55 55
56dnl Check for X11/libdri2
57PKG_CHECK_MODULES(X11, x11 dri2, [HAVE_X11=yes], [HAVE_X11=no])
58if test "x$HAVE_X11" = "xyes"; then
59 AC_DEFINE(HAVE_X11, 1, [Have X11 support])
60else
61 AC_MSG_WARN([Building without X11 support])
62fi
63AM_CONDITIONAL(ENABLE_X11, [test "x$HAVE_X11" = xyes])
64
65dnl Check for wayland
66PKG_CHECK_MODULES(WAYLAND, wayland-client >= 0.95.0, [HAVE_WAYLAND=yes], [HAVE_WAYLAND=no])
67if test "x$HAVE_WAYLAND" = "xyes"; then
68 AC_DEFINE(HAVE_WAYLAND, 1, [Have Wayland support])
69else
70 AC_MSG_WARN([Building without Wayland support])
71fi
72AM_CONDITIONAL(ENABLE_WAYLAND, [test "x$HAVE_WAYLAND" = xyes])
73
74dnl *** checks for header files *** 56dnl *** checks for header files ***
75dnl check if we have ANSI C header files 57dnl check if we have ANSI C header files
76AC_HEADER_STDC 58AC_HEADER_STDC
diff --git a/libdce.c b/libdce.c
index fc507c6..11ee333 100644
--- a/libdce.c
+++ b/libdce.c
@@ -88,14 +88,6 @@
88 88
89 89
90#if defined(BUILDOS_LINUX) 90#if defined(BUILDOS_LINUX)
91#ifdef HAVE_X11
92// Defined from configure.ac
93extern int dce_auth_x11(int *fd);
94#endif /* HAVE_X11 */
95#ifdef HAVE_WAYLAND // Defined from configure.ac
96extern int dce_auth_wayland(int *fd);
97#endif /* HAVE_WAYLAND */
98
99int fd = -1; 91int fd = -1;
100struct omap_device *dev = 0; 92struct omap_device *dev = 0;
101uint32_t dce_debug = 3; 93uint32_t dce_debug = 3;
@@ -181,28 +173,9 @@ static int dce_init(void)
181 173
182#if defined(BUILDOS_LINUX) 174#if defined(BUILDOS_LINUX)
183 /* Open omapdrm device */ 175 /* Open omapdrm device */
184 int authenticated = 0; 176
185 177 if(fd == -1) {
186#ifdef HAVE_X11 178 printf("Open omapdrm device \n");
187 /*If X11 server is running*/
188 if( !authenticated ) {
189 int ret = dce_auth_x11(&fd);
190 if( !ret ) {
191 authenticated = 1;
192 }
193 }
194#endif
195#ifdef HAVE_WAYLAND
196 /*If Wayland windowing is supported*/
197 if( !authenticated ) {
198 int ret = dce_auth_wayland(&fd);
199 if( !ret ) {
200 authenticated = 1;
201 }
202 }
203#endif
204 if((fd == -1) && !authenticated ) {
205 printf("no X11/wayland, fallback to opening DRM device directly\n");
206 fd = drmOpen("omapdrm", "platform:omapdrm:00"); 179 fd = drmOpen("omapdrm", "platform:omapdrm:00");
207 } 180 }
208 if( fd >= 0 ) { 181 if( fd >= 0 ) {
diff --git a/linux/libdce-x11.c b/linux/libdce-x11.c
deleted file mode 100644
index 442a761..0000000
--- a/linux/libdce-x11.c
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Copyright (c) 2012, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <stdlib.h>
34#include <string.h>
35#include <stdio.h>
36#include <unistd.h>
37#include <stdint.h>
38#include <sys/types.h>
39#include <sys/stat.h>
40#include <fcntl.h>
41#include <pthread.h>
42#include <xf86drm.h>
43#include <xf86drm.h>
44#include <omap_drm.h>
45#include <omap_drmif.h>
46
47#include <X11/Xlib.h>
48#include <X11/Xmd.h>
49#include <X11/extensions/dri2proto.h>
50#include <X11/extensions/dri2.h>
51
52#include <dce_priv.h>
53
54int dce_auth_x11(int *pfd)
55{
56 Display *dpy;
57 Window root;
58 drm_magic_t magic;
59 int eventBase, errorBase, major, minor;
60 char *driver, *device;
61 int ret = -1;
62 int fd = *pfd;
63
64 DEBUG("attempting to open X11 connection");
65 dpy = XOpenDisplay(NULL);
66 if (!dpy) {
67 ERROR("Could not open display");
68 goto no_x11;
69 }
70
71 if (!DRI2InitDisplay(dpy, NULL)) {
72 ERROR("DRI2InitDisplay failed");
73 goto no_x11;
74 }
75
76 if (!DRI2QueryExtension(dpy, &eventBase, &errorBase)) {
77 ERROR("DRI2QueryExtension failed");
78 goto no_x11;
79 }
80
81 DEBUG("DRI2QueryExtension: eventBase=%d, errorBase=%d", eventBase, errorBase);
82
83 if (!DRI2QueryVersion(dpy, &major, &minor)) {
84 ERROR("DRI2QueryVersion failed");
85 goto no_x11;
86 }
87
88 DEBUG("DRI2QueryVersion: major=%d, minor=%d", major, minor);
89
90 root = RootWindow(dpy, DefaultScreen(dpy));
91
92 if (!DRI2Connect(dpy, root, DRI2DriverDRI, &driver, &device)) {
93 DEBUG("DRI2Connect failed");
94 goto no_x11;
95 }
96
97 DEBUG("DRI2Connect: driver=%s, device=%s", driver, device);
98
99 /* only open the device if we don't already have an fd.. see
100 * dce_set_fd(). Need to sort out a better way to handle this
101 * but GEM buffer handles are only valid within the context of
102 * a given file-open. Switching to dmabuf or flink handles
103 * would solve this.
104 */
105 if (fd == -1) {
106 fd = open(device, O_RDWR);
107 if (fd < 0) {
108 ERROR("open failed");
109 goto no_x11_free;
110 }
111 }
112
113 if (drmGetMagic(fd, &magic)) {
114 ERROR("drmGetMagic failed");
115 goto no_x11_free;
116 }
117
118 if (!DRI2Authenticate(dpy, root, magic)) {
119 ERROR("DRI2Authenticate failed");
120 goto no_x11_free;
121 }
122
123 ret = 0;
124 *pfd = fd;
125
126no_x11_free:
127 XFree(driver);
128 XFree(device);
129no_x11:
130 return ret;
131}
diff --git a/linux/wayland-drm-client-protocol.h b/linux/wayland-drm-client-protocol.h
deleted file mode 100644
index dfcaa8b..0000000
--- a/linux/wayland-drm-client-protocol.h
+++ /dev/null
@@ -1,209 +0,0 @@
1/*
2 * Copyright © 2008-2011 Kristian Høgsberg
3 * Copyright © 2010-2011 Intel Corporation
4 *
5 * Permission to use, copy, modify, distribute, and sell this
6 * software and its documentation for any purpose is hereby granted
7 * without fee, provided that\n the above copyright notice appear in
8 * all copies and that both that copyright notice and this permission
9 * notice appear in supporting documentation, and that the name of
10 * the copyright holders not be used in advertising or publicity
11 * pertaining to distribution of the software without specific,
12 * written prior permission. The copyright holders make no
13 * representations about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied
15 * warranty.
16 *
17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
22 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
23 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
24 * THIS SOFTWARE.
25 */
26
27#ifndef DRM_CLIENT_PROTOCOL_H
28#define DRM_CLIENT_PROTOCOL_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#include <stdint.h>
35#include <stddef.h>
36#include "wayland-util.h"
37
38struct wl_client;
39struct wl_resource;
40struct wl_drm;
41extern const struct wl_interface wl_drm_interface;
42
43#ifndef WL_DRM_ERROR_ENUM
44#define WL_DRM_ERROR_ENUM
45enum wl_drm_error {
46 WL_DRM_ERROR_AUTHENTICATE_FAIL = 0,
47 WL_DRM_ERROR_INVALID_FORMAT = 1,
48 WL_DRM_ERROR_INVALID_NAME = 2,
49};
50#endif /* WL_DRM_ERROR_ENUM */
51
52#ifndef WL_DRM_FORMAT_ENUM
53#define WL_DRM_FORMAT_ENUM
54enum wl_drm_format {
55 WL_DRM_FORMAT_C8 = 0x20203843,
56 WL_DRM_FORMAT_RGB332 = 0x38424752,
57 WL_DRM_FORMAT_BGR233 = 0x38524742,
58 WL_DRM_FORMAT_XRGB4444 = 0x32315258,
59 WL_DRM_FORMAT_XBGR4444 = 0x32314258,
60 WL_DRM_FORMAT_RGBX4444 = 0x32315852,
61 WL_DRM_FORMAT_BGRX4444 = 0x32315842,
62 WL_DRM_FORMAT_ARGB4444 = 0x32315241,
63 WL_DRM_FORMAT_ABGR4444 = 0x32314241,
64 WL_DRM_FORMAT_RGBA4444 = 0x32314152,
65 WL_DRM_FORMAT_BGRA4444 = 0x32314142,
66 WL_DRM_FORMAT_XRGB1555 = 0x35315258,
67 WL_DRM_FORMAT_XBGR1555 = 0x35314258,
68 WL_DRM_FORMAT_RGBX5551 = 0x35315852,
69 WL_DRM_FORMAT_BGRX5551 = 0x35315842,
70 WL_DRM_FORMAT_ARGB1555 = 0x35315241,
71 WL_DRM_FORMAT_ABGR1555 = 0x35314241,
72 WL_DRM_FORMAT_RGBA5551 = 0x35314152,
73 WL_DRM_FORMAT_BGRA5551 = 0x35314142,
74 WL_DRM_FORMAT_RGB565 = 0x36314752,
75 WL_DRM_FORMAT_BGR565 = 0x36314742,
76 WL_DRM_FORMAT_RGB888 = 0x34324752,
77 WL_DRM_FORMAT_BGR888 = 0x34324742,
78 WL_DRM_FORMAT_XRGB8888 = 0x34325258,
79 WL_DRM_FORMAT_XBGR8888 = 0x34324258,
80 WL_DRM_FORMAT_RGBX8888 = 0x34325852,
81 WL_DRM_FORMAT_BGRX8888 = 0x34325842,
82 WL_DRM_FORMAT_ARGB8888 = 0x34325241,
83 WL_DRM_FORMAT_ABGR8888 = 0x34324241,
84 WL_DRM_FORMAT_RGBA8888 = 0x34324152,
85 WL_DRM_FORMAT_BGRA8888 = 0x34324142,
86 WL_DRM_FORMAT_XRGB2101010 = 0x30335258,
87 WL_DRM_FORMAT_XBGR2101010 = 0x30334258,
88 WL_DRM_FORMAT_RGBX1010102 = 0x30335852,
89 WL_DRM_FORMAT_BGRX1010102 = 0x30335842,
90 WL_DRM_FORMAT_ARGB2101010 = 0x30335241,
91 WL_DRM_FORMAT_ABGR2101010 = 0x30334241,
92 WL_DRM_FORMAT_RGBA1010102 = 0x30334152,
93 WL_DRM_FORMAT_BGRA1010102 = 0x30334142,
94 WL_DRM_FORMAT_YUYV = 0x56595559,
95 WL_DRM_FORMAT_YVYU = 0x55595659,
96 WL_DRM_FORMAT_UYVY = 0x59565955,
97 WL_DRM_FORMAT_VYUY = 0x59555956,
98 WL_DRM_FORMAT_AYUV = 0x56555941,
99 WL_DRM_FORMAT_NV12 = 0x3231564e,
100 WL_DRM_FORMAT_NV21 = 0x3132564e,
101 WL_DRM_FORMAT_NV16 = 0x3631564e,
102 WL_DRM_FORMAT_NV61 = 0x3136564e,
103 WL_DRM_FORMAT_YUV410 = 0x39565559,
104 WL_DRM_FORMAT_YVU410 = 0x39555659,
105 WL_DRM_FORMAT_YUV411 = 0x31315559,
106 WL_DRM_FORMAT_YVU411 = 0x31315659,
107 WL_DRM_FORMAT_YUV420 = 0x32315559,
108 WL_DRM_FORMAT_YVU420 = 0x32315659,
109 WL_DRM_FORMAT_YUV422 = 0x36315559,
110 WL_DRM_FORMAT_YVU422 = 0x36315659,
111 WL_DRM_FORMAT_YUV444 = 0x34325559,
112 WL_DRM_FORMAT_YVU444 = 0x34325659,
113};
114#endif /* WL_DRM_FORMAT_ENUM */
115
116struct wl_drm_listener {
117 /**
118 * device - (none)
119 * @name: (none)
120 */
121 void (*device)(void *data,
122 struct wl_drm *wl_drm,
123 const char *name);
124 /**
125 * format - (none)
126 * @format: (none)
127 */
128 void (*format)(void *data,
129 struct wl_drm *wl_drm,
130 uint32_t format);
131 /**
132 * authenticated - (none)
133 */
134 void (*authenticated)(void *data,
135 struct wl_drm *wl_drm);
136};
137
138static inline int
139wl_drm_add_listener(struct wl_drm *wl_drm,
140 const struct wl_drm_listener *listener, void *data)
141{
142 return wl_proxy_add_listener((struct wl_proxy *) wl_drm,
143 (void (**)(void)) listener, data);
144}
145
146#define WL_DRM_AUTHENTICATE 0
147#define WL_DRM_CREATE_BUFFER 1
148#define WL_DRM_CREATE_PLANAR_BUFFER 2
149
150static inline void
151wl_drm_set_user_data(struct wl_drm *wl_drm, void *user_data)
152{
153 wl_proxy_set_user_data((struct wl_proxy *) wl_drm, user_data);
154}
155
156static inline void *
157wl_drm_get_user_data(struct wl_drm *wl_drm)
158{
159 return wl_proxy_get_user_data((struct wl_proxy *) wl_drm);
160}
161
162static inline void
163wl_drm_destroy(struct wl_drm *wl_drm)
164{
165 wl_proxy_destroy((struct wl_proxy *) wl_drm);
166}
167
168static inline void
169wl_drm_authenticate(struct wl_drm *wl_drm, uint32_t id)
170{
171 wl_proxy_marshal((struct wl_proxy *) wl_drm,
172 WL_DRM_AUTHENTICATE, id);
173}
174
175static inline struct wl_buffer *
176wl_drm_create_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t stride, uint32_t format)
177{
178 struct wl_proxy *id;
179 id = wl_proxy_create((struct wl_proxy *) wl_drm,
180 &wl_buffer_interface);
181 if (!id)
182 return NULL;
183
184 wl_proxy_marshal((struct wl_proxy *) wl_drm,
185 WL_DRM_CREATE_BUFFER, id, name, width, height, stride, format);
186
187 return (struct wl_buffer *) id;
188}
189
190static inline struct wl_buffer *
191wl_drm_create_planar_buffer(struct wl_drm *wl_drm, uint32_t name, int32_t width, int32_t height, uint32_t format, int32_t offset0, int32_t stride0, int32_t offset1, int32_t stride1, int32_t offset2, int32_t stride2)
192{
193 struct wl_proxy *id;
194 id = wl_proxy_create((struct wl_proxy *) wl_drm,
195 &wl_buffer_interface);
196 if (!id)
197 return NULL;
198
199 wl_proxy_marshal((struct wl_proxy *) wl_drm,
200 WL_DRM_CREATE_PLANAR_BUFFER, id, name, width, height, format, offset0, stride0, offset1, stride1, offset2, stride2);
201
202 return (struct wl_buffer *) id;
203}
204
205#ifdef __cplusplus
206}
207#endif
208
209#endif
diff --git a/linux/wayland-drm-protocol.c b/linux/wayland-drm-protocol.c
deleted file mode 100644
index aa6d4e0..0000000
--- a/linux/wayland-drm-protocol.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * Copyright © 2008-2011 Kristian Høgsberg
3 * Copyright © 2010-2011 Intel Corporation
4 *
5 * Permission to use, copy, modify, distribute, and sell this
6 * software and its documentation for any purpose is hereby granted
7 * without fee, provided that\n the above copyright notice appear in
8 * all copies and that both that copyright notice and this permission
9 * notice appear in supporting documentation, and that the name of
10 * the copyright holders not be used in advertising or publicity
11 * pertaining to distribution of the software without specific,
12 * written prior permission. The copyright holders make no
13 * representations about the suitability of this software for any
14 * purpose. It is provided "as is" without express or implied
15 * warranty.
16 *
17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
22 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
23 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
24 * THIS SOFTWARE.
25 */
26
27#include <stdlib.h>
28#include <stdint.h>
29#include "wayland-util.h"
30
31extern const struct wl_interface wl_buffer_interface;
32extern const struct wl_interface wl_buffer_interface;
33
34static const struct wl_interface *types[] = {
35 NULL,
36 &wl_buffer_interface,
37 NULL,
38 NULL,
39 NULL,
40 NULL,
41 NULL,
42 &wl_buffer_interface,
43 NULL,
44 NULL,
45 NULL,
46 NULL,
47 NULL,
48 NULL,
49 NULL,
50 NULL,
51 NULL,
52 NULL,
53};
54
55static const struct wl_message wl_drm_requests[] = {
56 { "authenticate", "u", types + 0 },
57 { "create_buffer", "nuiiuu", types + 1 },
58 { "create_planar_buffer", "nuiiuiiiiii", types + 7 },
59};
60
61static const struct wl_message wl_drm_events[] = {
62 { "device", "s", types + 0 },
63 { "format", "u", types + 0 },
64 { "authenticated", "", types + 0 },
65};
66
67WL_EXPORT const struct wl_interface wl_drm_interface = {
68 "wl_drm", 1,
69 ARRAY_LENGTH(wl_drm_requests), wl_drm_requests,
70 ARRAY_LENGTH(wl_drm_events), wl_drm_events,
71};