[Mesa-dev] [PATCH 01/12] egl: add void library, we need to implement driver on platform_haiku.cpp

Alexander von Gluck IV kallisti5 at unixzen.com
Mon Dec 22 06:36:00 PST 2014


From: Adrián Arroyo Calle <adrian.arroyocalle at gmail.com>

---
 include/EGL/eglplatform.h               |   10 ++++++-
 src/SConscript                          |    3 +-
 src/egl/drivers/dri2/SConscript         |   24 +++++++++++++++++
 src/egl/drivers/dri2/platform_haiku.cpp |   42 +++++++++++++++++++++++++++++++
 src/egl/main/SConscript                 |    2 +-
 5 files changed, 78 insertions(+), 3 deletions(-)
 create mode 100644 src/egl/drivers/dri2/SConscript
 create mode 100644 src/egl/drivers/dri2/platform_haiku.cpp

diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
index 21b18fe..2eb6865 100644
--- a/include/EGL/eglplatform.h
+++ b/include/EGL/eglplatform.h
@@ -106,7 +106,7 @@ typedef void                        *EGLNativeDisplayType;
 
 #elif defined(__unix__)
 
-#ifdef MESA_EGL_NO_X11_HEADERS
+#if defined(MESA_EGL_NO_X11_HEADERS)
 
 typedef void            *EGLNativeDisplayType;
 typedef khronos_uintptr_t EGLNativePixmapType;
@@ -124,8 +124,16 @@ typedef Window   EGLNativeWindowType;
 
 #endif /* MESA_EGL_NO_X11_HEADERS */
 
+#elif __HAIKU__
+#include <kernel/image.h>
+typedef void				*EGLNativeDisplayType;
+typedef khronos_uintptr_t	 EGLNativePixmapType;
+typedef khronos_uintptr_t	 EGLNativeWindowType;
+
 #else
+
 #error "Platform not recognized"
+
 #endif
 
 /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
diff --git a/src/SConscript b/src/SConscript
index 2657bba..6cac490 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -24,6 +24,7 @@ SConscript('mapi/glapi/SConscript')
 # Haiku C++ libGL dispatch (renderers depend on libgl)
 if env['platform'] in ['haiku']:
     SConscript('hgl/SConscript')
+    SConscript('egl/drivers/dri2/SConscript')
 
 SConscript('mesa/SConscript')
 
@@ -32,7 +33,7 @@ SConscript('mapi/vgapi/SConscript')
 if not env['embedded']:
     if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 'windows'):
         SConscript('glx/SConscript')
-    if env['platform'] not in ['darwin', 'haiku', 'sunos']:
+    if env['platform'] not in ['darwin', 'sunos']:
         SConscript('egl/main/SConscript')
 
     if env['gles']:
diff --git a/src/egl/drivers/dri2/SConscript b/src/egl/drivers/dri2/SConscript
new file mode 100644
index 0000000..b122182
--- /dev/null
+++ b/src/egl/drivers/dri2/SConscript
@@ -0,0 +1,24 @@
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPDEFINES = [
+	'HAVE_EGL_PLATFORM_HAIKU',
+	'DEFAULT_DRIVER_DIR=\\"\\"'
+])
+
+env.Append(CPPPATH = [
+	'#/src/egl/main',
+])
+
+sources = [
+	'egl_dri2.c',
+	'platform_haiku.cpp',
+]
+
+libEGL_Haiku = env.SharedLibrary(
+	target = 'egl_haiku.so',
+	source = sources,
+)
+
+Export('libEGL_Haiku')
diff --git a/src/egl/drivers/dri2/platform_haiku.cpp b/src/egl/drivers/dri2/platform_haiku.cpp
new file mode 100644
index 0000000..d182663
--- /dev/null
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -0,0 +1,42 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2014 Adrián Arroyo Calle <adrian.arroyocalle at gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+ 
+#include <errno.h>
+#include <dlfcn.h>
+
+/*#include "loader.h"
+#include "egl_dri2.h"
+#include "egl_dri2_fallbacks.h"
+#include "gralloc_drm.h"
+
+static EGLBoolean
+haiku_window_dequeue_buffer(struct dri2_egl_surface* dri2_surf)
+{
+	if (dri2_surf->window->dequeueBuffer(dri2_surf->window, &dri2_surf->buffer))
+      return EGL_FALSE;
+
+   dri2_surf->buffer->common.incRef(&dri2_surf->buffer->common);
+   dri2_surf->window->lockBuffer(dri2_surf->window, dri2_surf->buffer);
+   return EGL_TRUE;
+}*/
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 390f28a..87c5b81 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -7,7 +7,7 @@ Import('*')
 env = env.Clone()
 
 env.Append(CPPDEFINES = [
-    '_EGL_BUILT_IN_DRIVER_GALLIUM',
+    #'_EGL_BUILT_IN_DRIVER_GALLIUM',
     '_EGL_DRIVER_SEARCH_DIR=\\"\\"',
 ])
 
-- 
1.7.1



More information about the mesa-dev mailing list