Re: Moving code around, post classic

2021-12-07 Thread Alexander von Gluck IV
December 6, 2021 5:51 PM, "Dylan Baker"  wrote:

> 4. What to do about the src/loader, src/glx, src/egl, src/mapi,
> src/glapi
> 
> These are all part of OpenGL, but not really part of gallium, but if
> we don't move src/gallium/* to src/ does it make sense to leave them
> in the root?
> 

You can lump src/hgl and include/HaikuGL in with these as well. Same
general idea as glx on Linux, but under Haiku with C++

These are all technically "OpenGL Dispatch Code" using old-timey
Mesa terminology. "dispatch" + "gl" are good verbs for them :-)

 -- Alex


Re: [Mesa-dev] Rust drivers in Mesa

2020-10-15 Thread Alexander von Gluck IV
October 1, 2020 8:36 PM, "Alyssa Rosenzweig"  
wrote:
> Hi all,
> 
> Recently I've been thinking about the potential for the Rust programming
> language in Mesa. Rust bills itself a safe system programming language
> with comparable performance to C [0], which is a naturally fit for
> graphics driver development.
> 
> Mesa today is written primarily in C, a notoriously low-level language,
> with some components in C++. To handle the impedance mismatch, we've
> built up a number of abstractions in-tree, including multiple ad hoc
> code generators (GenXML, NIR algebraic passes, Bifrost disassembler). A
> higher level language can help avoid the web of metaprogramming and
> effect code that is simpler and easier to reason about. Similarly, a
> better type system can aid static analysis.

Drive by comment; When I was working on porting Mesa/Gallium Softpipe
over to Haiku (several years ago now), there was some *really* hairy
C downcasting/upcasting in some critical places which made it *extremely*
difficult to decode what was going on without pulling out pen and paper.

Excited to potentially see some Rust in Mesa.
Even Haiku has a Rust port ;-)

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] util/u_thread: Fix build under Haiku

2020-01-08 Thread Alexander von Gluck IV
From: X512 

---
 src/util/u_thread.h | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/util/u_thread.h b/src/util/u_thread.h
index 6fc89099fec..5bb06608fc9 100644
--- a/src/util/u_thread.h
+++ b/src/util/u_thread.h
@@ -40,6 +40,10 @@
 #endif
 #endif
 
+#ifdef __HAIKU__
+#include 
+#endif
+
 #ifdef __FreeBSD__
 #define cpu_set_t cpuset_t
 #endif
@@ -77,6 +81,8 @@ static inline void u_thread_setname( const char *name )
pthread_setname_np(pthread_self(), "%s", (void *)name);
 #elif DETECT_OS_APPLE
pthread_setname_np(name);
+#elif DETECT_OS_HAIKU
+   rename_thread(find_thread(NULL), name);
 #else
 #error Not sure how to call pthread_setname_np
 #endif
@@ -149,7 +155,7 @@ util_get_L3_for_pinned_thread(thrd_t thread, unsigned 
cores_per_L3)
 static inline int64_t
 u_thread_get_time_nano(thrd_t thread)
 {
-#if defined(HAVE_PTHREAD) && !defined(__APPLE__)
+#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__)
struct timespec ts;
clockid_t cid;
 
-- 
2.24.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] haiku/hgl: Fix build via header reordering

2020-01-08 Thread Alexander von Gluck IV
---
 src/gallium/state_trackers/hgl/hgl_context.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/hgl/hgl_context.h 
b/src/gallium/state_trackers/hgl/hgl_context.h
index c5995f1cd2b..e2ebfbad4bc 100644
--- a/src/gallium/state_trackers/hgl/hgl_context.h
+++ b/src/gallium/state_trackers/hgl/hgl_context.h
@@ -9,11 +9,13 @@
 #define HGL_CONTEXT_H
 
 
-#include "state_tracker/st_api.h"
-#include "state_tracker/st_manager.h"
+#include "pipe/p_format.h"
 #include "pipe/p_compiler.h"
 #include "pipe/p_screen.h"
 #include "postprocess/filters.h"
+
+#include "state_tracker/st_api.h"
+#include "state_tracker/st_manager.h"
 #include "os/os_thread.h"
 
 #include "bitmap_wrapper.h"
-- 
2.24.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/2] haiku/hgl: Fix build via header reordering

2020-01-08 Thread Alexander von Gluck IV
Oh.. lol. I just realized mesa is doing PR's now in gitlab and i'm being 
old-fashion.


January 8, 2020 7:04 PM, "Alexander von Gluck IV"  wrote:
> ---
> src/gallium/state_trackers/hgl/hgl_context.h | 6 --
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/state_trackers/hgl/hgl_context.h
> b/src/gallium/state_trackers/hgl/hgl_context.h
> index c5995f1cd2b..e2ebfbad4bc 100644
> --- a/src/gallium/state_trackers/hgl/hgl_context.h
> +++ b/src/gallium/state_trackers/hgl/hgl_context.h
> @@ -9,11 +9,13 @@
> #define HGL_CONTEXT_H
> 
> -#include "state_tracker/st_api.h"
> -#include "state_tracker/st_manager.h"
> +#include "pipe/p_format.h"
> #include "pipe/p_compiler.h"
> #include "pipe/p_screen.h"
> #include "postprocess/filters.h"
> +
> +#include "state_tracker/st_api.h"
> +#include "state_tracker/st_manager.h"
> #include "os/os_thread.h"
> 
> #include "bitmap_wrapper.h"
> -- 
> 2.24.1
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] haiku: Fix hgl dispatch build. Tested under meson/scons.

2019-03-30 Thread Alexander von Gluck IV
---
 src/hgl/GLDispatcher.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hgl/GLDispatcher.h b/src/hgl/GLDispatcher.h
index 8aaf58a6237..7a4bcd33299 100644
--- a/src/hgl/GLDispatcher.h
+++ b/src/hgl/GLDispatcher.h
@@ -15,7 +15,7 @@
 #include 
 #include 
 
-#include "glheader.h"
+#include "main/glheader.h"
 
 #include "glapi/glapi.h"
 
-- 
2.20.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

[Mesa-dev] [PATCH 2/2] egl/drivers/haiku: Fix reference to disp vs dpy

2018-12-27 Thread Alexander von Gluck IV
---
 src/egl/drivers/haiku/egl_haiku.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/haiku/egl_haiku.cpp 
b/src/egl/drivers/haiku/egl_haiku.cpp
index a9c5cf8d29..d4b046c79b 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -29,6 +29,7 @@
 
 #include "eglconfig.h"
 #include "eglcontext.h"
+#include "egldevice.h"
 #include "egldisplay.h"
 #include "egldriver.h"
 #include "eglcurrent.h"
@@ -215,7 +216,7 @@ init_haiku(_EGLDriver *drv, _EGLDisplay *dpy)
_eglError(EGL_NOT_INITIALIZED, "DRI2: failed to find 
EGLDevice");
return EGL_FALSE;
}
-   disp->Device = dev;
+   dpy->Device = dev;
 
TRACE("Add configs\n");
if (!haiku_add_configs_for_visuals(dpy))
-- 
2.14.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] egl/egldevice: Fix broken reference to dev->device without LIBDRM

2018-12-27 Thread Alexander von Gluck IV
---
 src/egl/main/egldevice.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c
index 4878039be0..96042f4c5c 100644
--- a/src/egl/main/egldevice.c
+++ b/src/egl/main/egldevice.c
@@ -211,7 +211,11 @@ _eglDeviceSupports(_EGLDevice *dev, _EGLDeviceExtension 
ext)
 const char *
 _eglGetDRMDeviceRenderNode(_EGLDevice *dev)
 {
-   return dev->device->nodes[DRM_NODE_RENDER];
+   const char* result = NULL;
+#ifdef HAVE_LIBDRM
+   result = dev->device->nodes[DRM_NODE_RENDER];
+#endif
+   return result;
 }
 
 EGLBoolean
-- 
2.14.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium/auxiliary: Extern "c" fixes.

2018-07-27 Thread Alexander von Gluck IV
Used by C++ code such as Haiku's renderer.
---
 src/gallium/auxiliary/driver_ddebug/dd_public.h  | 8 
 src/gallium/auxiliary/driver_noop/noop_public.h  | 8 
 .../auxiliary/target-helpers/inline_debug_helper.h   | 9 -
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_public.h 
b/src/gallium/auxiliary/driver_ddebug/dd_public.h
index e660765575..31c139d6a1 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_public.h
+++ b/src/gallium/auxiliary/driver_ddebug/dd_public.h
@@ -30,7 +30,15 @@
 
 struct pipe_screen;
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct pipe_screen *
 ddebug_screen_create(struct pipe_screen *screen);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* DD_PUBLIC_H_ */
diff --git a/src/gallium/auxiliary/driver_noop/noop_public.h 
b/src/gallium/auxiliary/driver_noop/noop_public.h
index 180ea597fa..46a7f4084f 100644
--- a/src/gallium/auxiliary/driver_noop/noop_public.h
+++ b/src/gallium/auxiliary/driver_noop/noop_public.h
@@ -23,7 +23,15 @@
 #ifndef NOOP_PUBLIC_H
 #define NOOP_PUBLIC_H
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 struct pipe_screen;
 struct pipe_screen *noop_screen_create(struct pipe_screen *screen);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/gallium/auxiliary/target-helpers/inline_debug_helper.h 
b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h
index 66d46de888..15659896b6 100644
--- a/src/gallium/auxiliary/target-helpers/inline_debug_helper.h
+++ b/src/gallium/auxiliary/target-helpers/inline_debug_helper.h
@@ -6,7 +6,6 @@
 #include "util/u_debug.h"
 #include "util/u_tests.h"
 
-
 /* Helper function to wrap a screen with
  * one or more debug drivers.
  */
@@ -16,6 +15,10 @@
 #include "driver_rbug/rbug_public.h"
 #include "driver_noop/noop_public.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * TODO: Audit the following *screen_create() - all of
  * them should return the original screen on failuire.
@@ -35,3 +38,7 @@ debug_screen_wrap(struct pipe_screen *screen)
 }
 
 #endif
+
+#ifdef __cplusplus
+}
+#endif
-- 
2.17.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] meson: Only GLX_USE_TLS when glx is in use

2018-02-19 Thread Alexander von Gluck IV
February 19, 2018 3:00 PM, "Emil Velikov" <emil.l.veli...@gmail.com> wrote:

> On 19 February 2018 at 18:40, Alexander von Gluck IV
>> Thanks to Dylan for figuring this one out.
>> 
>> This was discussed previously on the ML
>> "
>> This can be applied to all GLX implementations, and in autotools this is
>> guarded only by the --enable-glx-tls flag. Since this is on by default
>> in autotools, and is strictly better than being off, the meson build
>> doesn't even have a toggle for it.
>> "
>> 
>> Since the GLX_USE_TLS reaches beyond GLX, i'm guarding it with_glx after
>> the glx auto-detection tri-state (which can disable it)
> 
> Note: the GLX in the name is for historical purposes - toggle applies
> to glapi and the way one (GLX, EGL and DRI modules in particular)
> makes use of it.
> 
> That said - we had serious issues with people tinkering with the
> toggle, so Dylan's decision of omit it is spot on.
> For Haiku, I would suggest the following:
> - open a bug/other issue about the missing static TLS support
> - set the macro for non-haiku platforms, with a clear reference to
> the above report.

Ah. Yup, just found an enhancement for it:
https://dev.haiku-os.org/ticket/13294

I'll adjust to be a Haiku check and notate that ticket.

-- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/3] meson: Only GLX_USE_TLS when glx is in use

2018-02-19 Thread Alexander von Gluck IV
February 19, 2018 12:25 PM, "Alexander von Gluck IV" <kallis...@unixzen.com> 
wrote:

> ---
> meson.build | 5 -
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 6fc7ec7fc9..54572a5bb8 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -331,7 +331,6 @@ if with_egl and not (with_platform_drm or 
> with_platform_surfaceless)
> endif
> endif
> 
> -pre_args += '-DGLX_USE_TLS'
> if with_glx != 'disabled'
> if not (with_platform_x11 and with_any_opengl)
> if with_glx == 'auto'
> @@ -365,6 +364,10 @@ if with_glvnd
> endif
> endif
> 
> +if with_glx != 'disabled'
> + pre_args += '-DGLX_USE_TLS'
> +endif
> +
> # TODO: toggle for this
> with_glx_direct = true

Some comments on this one. I was seeing problems loading static TLS binaries
on Haiku, turns out GLX_USE_TLS impacts more than just GLX. I'm guessing our
(non-glx) libGL.so is getting it via libglapi linkages.

https://kallisti5.keybase.pub/Screenshots/meson_build_tls.png

Thanks to Dylan for figuring this one out.

This was discussed previously on the ML
"
This can be applied to all GLX implementations, and in autotools this is
guarded only by the --enable-glx-tls flag. Since this is on by default
in autotools, and is strictly better than being off, the meson build
doesn't even have a toggle for it.
"

Since the GLX_USE_TLS reaches beyond GLX, i'm guarding it with_glx after
the glx auto-detection tri-state (which can disable it)


I noticed under Fedora the Meson-built libGL differs from the system's
in terms of TLS.. not sure if relevant (or an issue)

meson-compiled HEAD:
$ readelf -a ./src/glx/libGL.so | grep TLS
L (link order), O (extra OS processing required), G (group), T (TLS),
TLS0x00068d68 0x00268d68 0x00268d68
   0x001e (FLAGS)  SYMBOLIC STATIC_TLS
 214:  0 TLS GLOBAL DEFAULT  UND _glapi_tls_Dispatch
 934:  8 TLS LOCAL  DEFAULT   17 __glX_tls_Context
2900:  0 TLS GLOBAL DEFAULT  UND _glapi_tls_Dispatch


mesa-libGL-17.2.4-3.fc27.x86_64:
  $ readelf -a /usr/lib/libGL.so.1.0.0 | grep TLS
L (link order), O (extra OS processing required), G (group), T (TLS),
   0x001e (FLAGS)  BIND_NOW STATIC_TLS
  0005fff4  110e R_386_TLS_TPOFF      _glapi_tls_Current
  17:  0 TLS GLOBAL DEFAULT  UND _glapi_tls_Current


-- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] hgl: Correct glheader.h context inline with glx

2018-02-19 Thread Alexander von Gluck IV
---
 src/hgl/GLDispatcher.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hgl/GLDispatcher.h b/src/hgl/GLDispatcher.h
index 8aaf58a623..7a4bcd3329 100644
--- a/src/hgl/GLDispatcher.h
+++ b/src/hgl/GLDispatcher.h
@@ -15,7 +15,7 @@
 #include 
 #include 
 
-#include "glheader.h"
+#include "main/glheader.h"
 
 #include "glapi/glapi.h"
 
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] haiku-softpipe: Build fix, drop un-needed flip

2018-02-19 Thread Alexander von Gluck IV
---
 .../targets/haiku-softpipe/GalliumContext.cpp  | 25 --
 1 file changed, 25 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index 0356f65417..3922fa61b2 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -338,31 +338,6 @@ GalliumContext::SwapBuffers(context_id contextID)
 
context->st->flush(context->st, ST_FLUSH_FRONT, NULL);
 
-   struct st_context *stContext = (struct st_context*)context->st;
-
-   unsigned nColorBuffers = stContext->state.framebuffer.nr_cbufs;
-   for (unsigned i = 0; i < nColorBuffers; i++) {
-   pipe_surface* surface = stContext->state.framebuffer.cbufs[i];
-   if (!surface) {
-   ERROR("%s: Color buffer %d invalid!\n", __func__, i);
-   continue;
-   }
-
-   TRACE("%s: Flushing color buffer #%d\n", __func__, i);
-
-   // We pass our destination bitmap to flush_fronbuffer which 
passes it
-   // to the private winsys display call.
-   fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
-   context->bitmap, NULL);
-   }
-
-   #if 0
-   // TODO... should we flush the z stencil buffer?
-   pipe_surface* zSurface = stContext->state.framebuffer.zsbuf;
-   fScreen->flush_frontbuffer(fScreen, zSurface->texture, 0, 0,
-   context->bitmap, NULL);
-   #endif
-
return B_OK;
 }
 
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] meson: Only GLX_USE_TLS when glx is in use

2018-02-19 Thread Alexander von Gluck IV
---
 meson.build | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 6fc7ec7fc9..54572a5bb8 100644
--- a/meson.build
+++ b/meson.build
@@ -331,7 +331,6 @@ if with_egl and not (with_platform_drm or 
with_platform_surfaceless)
   endif
 endif
 
-pre_args += '-DGLX_USE_TLS'
 if with_glx != 'disabled'
   if not (with_platform_x11 and with_any_opengl)
 if with_glx == 'auto'
@@ -365,6 +364,10 @@ if with_glvnd
   endif
 endif
 
+if with_glx != 'disabled'
+  pre_args += '-DGLX_USE_TLS'
+endif
+
 # TODO: toggle for this
 with_glx_direct = true
 
-- 
2.14.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] meson: Add Haiku platform support v4

2018-02-16 Thread Alexander von Gluck IV
---
 include/meson.build|  8 +
 meson.build| 16 +++---
 src/egl/meson.build| 36 +++---
 src/gallium/meson.build|  9 ++
 src/gallium/state_trackers/hgl/meson.build | 41 ++
 src/gallium/targets/haiku-softpipe/meson.build | 40 +
 src/gallium/winsys/sw/hgl/meson.build  | 29 ++
 src/hgl/meson.build| 36 ++
 src/mapi/es1api/meson.build|  2 +-
 src/mapi/es2api/meson.build|  2 +-
 src/meson.build|  7 -
 11 files changed, 209 insertions(+), 17 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/meson.build
 create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
 create mode 100644 src/gallium/winsys/sw/hgl/meson.build
 create mode 100644 src/hgl/meson.build

diff --git a/include/meson.build b/include/meson.build
index 1cbc68182c..28ffb33215 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
 inc_vulkan = include_directories('vulkan')
 inc_d3d9 = include_directories('D3D9')
 inc_gl_internal = include_directories('GL/internal')
+inc_haikugl = include_directories('HaikuGL')
 
 if with_gles1
   install_headers(
@@ -80,6 +81,13 @@ if with_gallium_st_nine
   )
 endif
 
+if with_platform_haiku
+  install_headers(
+'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
+subdir : 'opengl',
+  )
+endif
+
 # Only install the headers if we are building a stand alone implementation and
 # not an ICD enabled implementation
 if with_gallium_opencl and not with_opencl_icd
diff --git a/meson.build b/meson.build
index d6ffa30d9e..120042fb24 100644
--- a/meson.build
+++ b/meson.build
@@ -99,7 +99,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = ''
   else
@@ -144,7 +144,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = 'swrast'
   else
 error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
@@ -181,7 +181,7 @@ if _vulkan_drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = ''
   else
@@ -242,6 +242,8 @@ if _platforms == 'auto'
 _platforms = 'x11,wayland,drm,surfaceless'
   elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 _platforms = 'x11,surfaceless'
+  elif ['haiku'].contains(host_machine.system())
+_platforms = 'haiku'
   else
 error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
   endif
@@ -252,6 +254,7 @@ if _platforms != ''
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
   with_platform_drm = _split.contains('drm')
+  with_platform_haiku = _split.contains('haiku')
   with_platform_surfaceless = _split.contains('surfaceless')
   egl_native_platform = _split[0]
 endif
@@ -260,6 +263,8 @@ with_glx = get_option('glx')
 if with_glx == 'auto'
   if with_dri
 with_glx = 'dri'
+  elif with_platform_haiku
+with_glx = 'disabled'
   elif with_gallium
 # Even when building just gallium drivers the user probably wants dri
 with_glx = 'dri'
@@ -375,7 +380,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' and not with_egl
+  if with_glx == 'disabled' and not with_egl and not with_platform_haiku
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
@@ -642,6 +647,9 @@ if with_platform_android
   ]
   pre_args += '-DHAVE_ANDROID_PLATFORM'
 endif
+if with_platform_haiku
+  pre_args += '-DHAVE_HAIKU_PLATFORM'
+endif
 
 prog_python2 = find_program('python2')
 has_mako = run_command(prog_python2, '-c', 

Re: [Mesa-dev] [PATCH] meson: Add Haiku platform support v3

2018-02-16 Thread Alexander von Gluck IV
February 16, 2018 11:49 AM, "Emil Velikov" <emil.l.veli...@gmail.com> wrote:
> Hi Alexander,
> 
> Did you drop the ball on the autotools patches? I could re-spin them
> but have no way to test.

I've been focused on meson since it's the future.
Feel free to re-spin them if you have the bandwidth.

> There's a couple of comments inline, but nothing major.
> 
> On 16 February 2018 at 00:32, Alexander von Gluck IV
> <kallis...@unixzen.com> wrote:
> 
>> --- a/meson.build
>> +++ b/meson.build
>> 
>> gl_priv_libs = []
>> -if dep_thread.found()
>> +if dep_thread.found() and host_machine.system() != 'haiku'
>> gl_priv_libs += ['-lpthread', '-pthread']
>> endif
> 
> There's a bug report/fix in Meson for this one right?
> Please mention the ticket number of Meson version where the fix
> landed. Thus way one can drop this when we bump the Meson requirement.

I did a bump of Meson on my Haiku build system and still saw the same
incorrect searching for -lpthread issues.  I think there are places where
-lpthread -pthread were specified without looking at dep_thread.found()
though which could be at play.  (see below)

>> if dep_m.found()
>> diff --git a/src/egl/meson.build b/src/egl/meson.build
>> index 6cd04567b0..09c28e9f83 100644
>> --- a/src/egl/meson.build
>> +++ b/src/egl/meson.build
> 
> There are three unrelated things happening here:
> 
>> @@ -21,9 +21,8 @@
>> c_args_for_egl = []
>> link_for_egl = []
>> deps_for_egl = []
>> -incs_for_egl = [
>> - inc_include, inc_src, inc_loader, inc_gbm, include_directories('main'),
>> -]
>> +incs_for_egl = [inc_include, inc_src, include_directories('main')]
>> +
> 
> a) inc_gbm should be moved in the with_platform_drm hunk

Can-do.  I wasn't 100% sure on when it was included so didn't want to disrupt
any non-Haiku build conditions.

>> files_egl = files(
>> 'main/eglapi.c',
>> 'main/eglapi.h',
>> @@ -53,9 +52,6 @@ files_egl = files(
>> 'main/eglsync.h',
>> 'main/eglentrypoint.h',
>> 'main/egltypedefs.h',
>> - 'drivers/dri2/egl_dri2.c',
>> - 'drivers/dri2/egl_dri2.h',
>> - 'drivers/dri2/egl_dri2_fallbacks.h',
>> )
>> 
>> linux_dmabuf_unstable_v1_protocol_c = custom_target(
>> @@ -100,6 +96,21 @@ g_egldispatchstubs_h = custom_target(
>> capture : true,
>> )
>> 
>> +if with_dri2
>> + files_egl += files(
>> + 'drivers/dri2/egl_dri2.c',
>> + 'drivers/dri2/egl_dri2.h',
>> + 'drivers/dri2/egl_dri2_fallbacks.h',
>> + )
>> + incs_for_egl += [inc_loader, inc_gbm]
>> + c_args_for_egl += [
>> + '-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
>> + '-D_EGL_BUILT_IN_DRIVER_DRI2',
>> + ]
>> + link_for_egl += [libloader, libxmlconfig]
>> + deps_for_egl += dep_libdrm
>> +endif
>> +
> 
> b) This should be within the with_platform_x11 hunk

So with_platform_x11 always means with_dri2 regardless
of what with_dri2 is set to?

>> if with_platform_x11
>> files_egl += files('drivers/dri2/platform_x11.c')
>> if with_dri3
>> @@ -133,6 +144,15 @@ if with_platform_android
>> deps_for_egl += dep_android
>> files_egl += files('drivers/dri2/platform_android.c')
>> endif
>> +if with_platform_haiku
>> + incs_for_egl += inc_haikugl
>> + c_args_for_egl += [
>> + '-D_EGL_BUILT_IN_DRIVER_HAIKU',
>> + ]
>> + files_egl += files('drivers/haiku/egl_haiku.cpp')
>> + link_for_egl += libgl
>> + deps_for_egl += cpp.find_library('be')
>> +endif
> 
> c) this is the patch introducing haiku support

These are all changes needed to properly build.
 
>> --- /dev/null
>> +++ b/src/gallium/targets/haiku-softpipe/meson.build
>> 
>> +libswpipe = shared_library(
>> 
>> + dependencies : [
>> + driver_swrast, cpp.find_library('be'), cpp.find_library('translation'),
>> + cpp.find_library('network'), dep_unwind
> 
> Some of these find_library calls are duplicated throughout. It would
> be more efficient and robust to have it done once.
> Say in the top level meson.build?

That can be done.  Focused on functionality before optimizing in this first
commit.

>> index 8aaf58a623..7a4bcd3329 100644
>> --- a/src/hgl/GLDispatcher.h
>> +++ b/src/hgl/GLDispatcher.h
>> @@ -15,7 +15,7 @@
>> #include 
>> #include 
>> 
>> -#include "glheader.h"
>> +#include "main/glheader.h"
> 
> Please keep source changes separate from build system bits.

Can-do. This was a requirement and matches the other dispatchers like glx.

>> diff --git a/src/mapi/es1api/meson.build b/src/mapi/es1api/meson.build
&

Re: [Mesa-dev] [PATCH] meson: Add Haiku platform support

2018-02-15 Thread Alexander von Gluck IV
February 15, 2018 6:36 PM, "Dylan Baker" <dy...@pnwbakers.com> wrote:

> Quoting Alexander von Gluck IV (2018-02-15 16:04:37)
> 
>> I'm actually not 100% sure here. I have missing symbols at link without both
>> included. More investigation needed on my part.
> 
> That may be my fault, on Linux and the BSDs have have to have shared_glapi
> because you need it to do GLES, but if you're not doing GLES you should set
> shared-glapi to false and then it should work. If you don't get it figured out
> I'm looking at Windows (non-cygwin) right now, and that requires non-shared
> glapi, so if I run into problems there I'll be sure to ping you :)

Thanks!

Are things in a good enough state for a "Reviewed-by"?

There's more work to be done, but this gets the initial (and furthest reaching)
work done.

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] meson: Add Haiku platform support v3

2018-02-15 Thread Alexander von Gluck IV
---
 include/meson.build|  8 +
 meson.build| 18 +++
 src/egl/meson.build| 34 -
 src/gallium/meson.build|  9 ++
 src/gallium/state_trackers/hgl/meson.build | 41 ++
 src/gallium/targets/haiku-softpipe/meson.build | 40 +
 src/gallium/winsys/sw/hgl/meson.build  | 29 ++
 src/hgl/GLDispatcher.h |  2 +-
 src/hgl/meson.build| 36 ++
 src/mapi/es1api/meson.build|  2 +-
 src/mapi/es2api/meson.build|  2 +-
 src/meson.build|  7 -
 12 files changed, 211 insertions(+), 17 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/meson.build
 create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
 create mode 100644 src/gallium/winsys/sw/hgl/meson.build
 create mode 100644 src/hgl/meson.build

diff --git a/include/meson.build b/include/meson.build
index 1cbc68182c..28ffb33215 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
 inc_vulkan = include_directories('vulkan')
 inc_d3d9 = include_directories('D3D9')
 inc_gl_internal = include_directories('GL/internal')
+inc_haikugl = include_directories('HaikuGL')
 
 if with_gles1
   install_headers(
@@ -80,6 +81,13 @@ if with_gallium_st_nine
   )
 endif
 
+if with_platform_haiku
+  install_headers(
+'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
+subdir : 'opengl',
+  )
+endif
+
 # Only install the headers if we are building a stand alone implementation and
 # not an ICD enabled implementation
 if with_gallium_opencl and not with_opencl_icd
diff --git a/meson.build b/meson.build
index d6ffa30d9e..30e8a9e9ff 100644
--- a/meson.build
+++ b/meson.build
@@ -99,7 +99,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = ''
   else
@@ -144,7 +144,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = 'swrast'
   else
 error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
@@ -181,7 +181,7 @@ if _vulkan_drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = ''
   else
@@ -242,6 +242,8 @@ if _platforms == 'auto'
 _platforms = 'x11,wayland,drm,surfaceless'
   elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 _platforms = 'x11,surfaceless'
+  elif ['haiku'].contains(host_machine.system())
+_platforms = 'haiku'
   else
 error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
   endif
@@ -252,6 +254,7 @@ if _platforms != ''
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
   with_platform_drm = _split.contains('drm')
+  with_platform_haiku = _split.contains('haiku')
   with_platform_surfaceless = _split.contains('surfaceless')
   egl_native_platform = _split[0]
 endif
@@ -260,6 +263,8 @@ with_glx = get_option('glx')
 if with_glx == 'auto'
   if with_dri
 with_glx = 'dri'
+  elif with_platform_haiku
+with_glx = 'disabled'
   elif with_gallium
 # Even when building just gallium drivers the user probably wants dri
 with_glx = 'dri'
@@ -375,7 +380,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' and not with_egl
+  if with_glx == 'disabled' and not with_egl and not with_platform_haiku
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
@@ -642,6 +647,9 @@ if with_platform_android
   ]
   pre_args += '-DHAVE_ANDROID_PLATFORM'
 endif
+if with_platform_haiku
+  pre_args += '-DHAVE_HAIKU_PLATFORM'
+endif
 
 prog_python2 = 

Re: [Mesa-dev] [PATCH] meson: Add Haiku platform support

2018-02-15 Thread Alexander von Gluck IV
February 15, 2018 5:37 PM, "Dylan Baker" <dy...@pnwbakers.com> wrote:

> Quoting Alexander von Gluck IV (2018-02-15 13:12:40)
> 
>> ---
>> include/meson.build | 8 +
>> meson.build | 18 +++---
>> src/egl/meson.build | 33 +
>> src/gallium/meson.build | 9 +
>> src/gallium/state_trackers/hgl/meson.build | 41 +
>> src/gallium/targets/haiku-softpipe/meson.build | 50 
>> ++
>> src/gallium/winsys/sw/hgl/meson.build | 29 +++
>> src/hgl/GLDispatcher.h | 2 +-
>> src/hgl/meson.build | 38 
>> src/mapi/es1api/meson.build | 2 +-
>> src/mapi/es2api/meson.build | 2 +-
>> src/meson.build | 7 +++-
>> 12 files changed, 224 insertions(+), 15 deletions(-)
>> create mode 100644 src/gallium/state_trackers/hgl/meson.build
>> create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
>> create mode 100644 src/gallium/winsys/sw/hgl/meson.build
>> create mode 100644 src/hgl/meson.build
> 
> This doesn't feel quite right now, this code is DRI2 specific, I think this
> should go in the `if with_dri2` block, or put that in this block.

Ooops.. I agree. That else fits better in the existing with_dri2.
Fixed locally... will resubmit v3

>> diff --git a/src/gallium/targets/haiku-softpipe/meson.build
>> b/src/gallium/targets/haiku-softpipe/meson.build
>> new file mode 100644
>> index 00..f805b2e69b
>> --- /dev/null
>> +++ b/src/gallium/targets/haiku-softpipe/meson.build
>> @@ -0,0 +1,50 @@
>> +# Copyright © 2017 Dylan Baker
>> +
>> +# 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.
>> +
>> +hsp_cpp_args = ['-DGALLIUM_SOFTPIPE', '-DGALLIUM_RBUG', '-DGALLIUM_TRACE']
>> +hsp_deps = []
>> +hsp_links = [libsoftpipe]
>> +
>> +if with_llvm
>> + hsp_deps += dep_llvm
>> + hsp_cpp_args += '-DGALLIUM_LLVMPIPE'
>> + hsp_links += libllvmpipe
>> +endif
> 
> This is the old way we did things, now we have these handy `driver_*`
> dependencies that provide this stuff, you can replace the hsp_links, hsp_deps,
> and drop the -DGALLIUM_{SOFT,LLVM}PIPE with driver_swrast, which handles 
> adding
> the -DGALLIUM args and has softpipe or llvmpipe if it's enabled.
> 
> You can look at src/gallium/targets/dri/meson.build if you want to see how 
> that
> works.

Will fix.

>> +libswhgl = static_library(
>> + 'swhgl',
>> + files('hgl_sw_winsys.c', 'hgl_sw_winsys.h'),
> 
> It doesn't matter, but you don't need to add the .h file, meson will figure 
> that
> out.

I was following some patterns I was seeing. Fixed locally :-)

>> +libgl = shared_library(
>> + 'GL',
>> + files(
>> + 'GLView.cpp', 'GLRenderer.cpp', 'GLRendererRoster.cpp', 'GLDispatcher.cpp',
>> + ),
>> + link_args : [ld_args_bsymbolic, ld_args_gc_sections],
>> + include_directories : [
>> + inc_src, inc_mapi, inc_mesa, inc_include, inc_glapi, inc_haikugl,
>> + inc_gl_internal, include_directories('/system/develop/headers/private')
>> + ],
>> + link_with : [libglapi_static, libglapi],
> 
> this seems odd, why do you need both shared and static glapi? In SCons only
> static glapi is used here.

I'm actually not 100% sure here. I have missing symbols at link without both
included. More investigation needed on my part.

>> + dependencies : cpp.find_library('be'),
>> + install : true,
>> +)
>> +
>> +#if with_tests
>> +# subdir('tests')
>> +#endif
> 
> I'd prefer not to have the commented code, let's either implement the tests or
> delete this and ad a TODO

Fixed locally in v3.

Thanks!

-- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] meson: Add Haiku platform support v2

2018-02-15 Thread Alexander von Gluck IV
February 15, 2018 3:22 PM, "Alexander von Gluck IV" <kallis...@unixzen.com> 
wrote:
> ---
> include/meson.build | 8 +
> meson.build | 18 +++---
> src/egl/meson.build | 35 +-
> src/gallium/meson.build | 9 +
> src/gallium/state_trackers/hgl/meson.build | 41 +
> src/gallium/targets/haiku-softpipe/meson.build | 50 ++
> src/gallium/winsys/sw/hgl/meson.build | 29 +++
> src/hgl/GLDispatcher.h | 2 +-
> src/hgl/meson.build | 38 
> src/mapi/es1api/meson.build | 2 +-
> src/mapi/es2api/meson.build | 2 +-
> src/meson.build | 7 +++-
> 12 files changed, 224 insertions(+), 17 deletions(-)
> create mode 100644 src/gallium/state_trackers/hgl/meson.build
> create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
> create mode 100644 src/gallium/winsys/sw/hgl/meson.build
> create mode 100644 src/hgl/meson.build

Sorry for the v2.. I did a test build on Linux and noticed I broke egl.

A diff of what changed in v2:


$ git diff
diff --git a/src/egl/meson.build b/src/egl/meson.build
index 1fd2b241bb..8880d4631b 100644
--- a/src/egl/meson.build
+++ b/src/egl/meson.build
@@ -148,7 +148,7 @@ if with_platform_haiku
 else
   incs_for_egl += [inc_loader, inc_gbm]
   c_args_for_egl += [
-'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_driver_dir),
+'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
 '-D_EGL_BUILT_IN_DRIVER_DRI2',
   ]
   link_for_egl += [libloader, libxmlconfig]
@@ -181,8 +181,6 @@ libegl = shared_library(
   c_args : [
 c_vis_args,
 c_args_for_egl,
-'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
-'-D_EGL_BUILT_IN_DRIVER_DRI2',
 
'-D_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_@0@'.format(egl_native_platform.to_upper()),
   ],
   include_directories : incs_for_egl,





There are a lot of changes here...

If it isn't perfect I ask to get it in to make adjustments to avoid the need
of rebasing over and over.

As for Haiku support, meson successfully generates all the needed binaries... 
there
are a few minor issues around TLS i need to sort still however.

Thanks!

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] meson: Add Haiku platform support v2

2018-02-15 Thread Alexander von Gluck IV
---
 include/meson.build|  8 +
 meson.build| 18 +++---
 src/egl/meson.build| 35 +-
 src/gallium/meson.build|  9 +
 src/gallium/state_trackers/hgl/meson.build | 41 +
 src/gallium/targets/haiku-softpipe/meson.build | 50 ++
 src/gallium/winsys/sw/hgl/meson.build  | 29 +++
 src/hgl/GLDispatcher.h |  2 +-
 src/hgl/meson.build| 38 
 src/mapi/es1api/meson.build|  2 +-
 src/mapi/es2api/meson.build|  2 +-
 src/meson.build|  7 +++-
 12 files changed, 224 insertions(+), 17 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/meson.build
 create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
 create mode 100644 src/gallium/winsys/sw/hgl/meson.build
 create mode 100644 src/hgl/meson.build

diff --git a/include/meson.build b/include/meson.build
index 1cbc68182c..28ffb33215 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
 inc_vulkan = include_directories('vulkan')
 inc_d3d9 = include_directories('D3D9')
 inc_gl_internal = include_directories('GL/internal')
+inc_haikugl = include_directories('HaikuGL')
 
 if with_gles1
   install_headers(
@@ -80,6 +81,13 @@ if with_gallium_st_nine
   )
 endif
 
+if with_platform_haiku
+  install_headers(
+'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
+subdir : 'opengl',
+  )
+endif
+
 # Only install the headers if we are building a stand alone implementation and
 # not an ICD enabled implementation
 if with_gallium_opencl and not with_opencl_icd
diff --git a/meson.build b/meson.build
index 3925ec483e..d476f70bbe 100644
--- a/meson.build
+++ b/meson.build
@@ -103,7 +103,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = ''
   else
@@ -148,7 +148,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = 'swrast'
   else
 error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
@@ -185,7 +185,7 @@ if _vulkan_drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = ''
   else
@@ -246,6 +246,8 @@ if _platforms == 'auto'
 _platforms = 'x11,wayland,drm,surfaceless'
   elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 _platforms = 'x11,surfaceless'
+  elif ['haiku'].contains(host_machine.system())
+_platforms = 'haiku'
   else
 error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
   endif
@@ -256,6 +258,7 @@ if _platforms != ''
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
   with_platform_drm = _split.contains('drm')
+  with_platform_haiku = _split.contains('haiku')
   with_platform_surfaceless = _split.contains('surfaceless')
   egl_native_platform = _split[0]
 endif
@@ -264,6 +267,8 @@ with_glx = get_option('glx')
 if with_glx == 'auto'
   if with_dri
 with_glx = 'dri'
+  elif with_platform_haiku
+with_glx = 'disabled'
   elif with_gallium
 # Even when building just gallium drivers the user probably wants dri
 with_glx = 'dri'
@@ -379,7 +384,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' and not with_egl
+  if with_glx == 'disabled' and not with_egl and not with_platform_haiku
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
@@ -640,6 +645,9 @@ if with_platform_android
   ]
   pre_args += '-DHAVE_ANDROID_PLATFORM'
 endif
+if with_platform_haiku
+  pre_args += '-DHAVE_HAIKU_PLATFORM'
+endif
 
 prog_python2 = find_program('python2')
 

[Mesa-dev] [PATCH] meson: Add Haiku platform support

2018-02-15 Thread Alexander von Gluck IV
---
 include/meson.build|  8 +
 meson.build| 18 +++---
 src/egl/meson.build| 33 +
 src/gallium/meson.build|  9 +
 src/gallium/state_trackers/hgl/meson.build | 41 +
 src/gallium/targets/haiku-softpipe/meson.build | 50 ++
 src/gallium/winsys/sw/hgl/meson.build  | 29 +++
 src/hgl/GLDispatcher.h |  2 +-
 src/hgl/meson.build| 38 
 src/mapi/es1api/meson.build|  2 +-
 src/mapi/es2api/meson.build|  2 +-
 src/meson.build|  7 +++-
 12 files changed, 224 insertions(+), 15 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/meson.build
 create mode 100644 src/gallium/targets/haiku-softpipe/meson.build
 create mode 100644 src/gallium/winsys/sw/hgl/meson.build
 create mode 100644 src/hgl/meson.build

diff --git a/include/meson.build b/include/meson.build
index 1cbc68182c..28ffb33215 100644
--- a/include/meson.build
+++ b/include/meson.build
@@ -22,6 +22,7 @@ inc_drm_uapi = include_directories('drm-uapi')
 inc_vulkan = include_directories('vulkan')
 inc_d3d9 = include_directories('D3D9')
 inc_gl_internal = include_directories('GL/internal')
+inc_haikugl = include_directories('HaikuGL')
 
 if with_gles1
   install_headers(
@@ -80,6 +81,13 @@ if with_gallium_st_nine
   )
 endif
 
+if with_platform_haiku
+  install_headers(
+'HaikuGL/GLRenderer.h', 'HaikuGL/GLView.h', 'HaikuGL/OpenGLKit.h',
+subdir : 'opengl',
+  )
+endif
+
 # Only install the headers if we are building a stand alone implementation and
 # not an ICD enabled implementation
 if with_gallium_opencl and not with_opencl_icd
diff --git a/meson.build b/meson.build
index 3925ec483e..d476f70bbe 100644
--- a/meson.build
+++ b/meson.build
@@ -103,7 +103,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Ddri-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # only swrast would make sense here, but gallium swrast is a much better 
default
 _drivers = ''
   else
@@ -148,7 +148,7 @@ if _drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dgallium-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 _drivers = 'swrast'
   else
 error('Unknown OS. Please pass -Dgallium-drivers to set driver options. 
Patches gladly accepted to fix this.')
@@ -185,7 +185,7 @@ if _vulkan_drivers == 'auto'
 else
   error('Unknown architecture. Please pass -Dvulkan-drivers to set driver 
options. Patches gladly accepted to fix this.')
 endif
-  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+  elif ['darwin', 'windows', 'cygwin', 'haiku'].contains(host_machine.system())
 # No vulkan driver supports windows or macOS currently
 _vulkan_drivers = ''
   else
@@ -246,6 +246,8 @@ if _platforms == 'auto'
 _platforms = 'x11,wayland,drm,surfaceless'
   elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
 _platforms = 'x11,surfaceless'
+  elif ['haiku'].contains(host_machine.system())
+_platforms = 'haiku'
   else
 error('Unknown OS. Please pass -Dplatforms to set platforms. Patches 
gladly accepted to fix this.')
   endif
@@ -256,6 +258,7 @@ if _platforms != ''
   with_platform_x11 = _split.contains('x11')
   with_platform_wayland = _split.contains('wayland')
   with_platform_drm = _split.contains('drm')
+  with_platform_haiku = _split.contains('haiku')
   with_platform_surfaceless = _split.contains('surfaceless')
   egl_native_platform = _split[0]
 endif
@@ -264,6 +267,8 @@ with_glx = get_option('glx')
 if with_glx == 'auto'
   if with_dri
 with_glx = 'dri'
+  elif with_platform_haiku
+with_glx = 'disabled'
   elif with_gallium
 # Even when building just gallium drivers the user probably wants dri
 with_glx = 'dri'
@@ -379,7 +384,7 @@ if with_any_vk and (with_platform_x11 and not with_dri3)
   error('Vulkan drivers require dri3 for X11 support')
 endif
 if with_dri or with_gallium
-  if with_glx == 'disabled' and not with_egl
+  if with_glx == 'disabled' and not with_egl and not with_platform_haiku
 error('building dri or gallium drivers require at least one window system')
   endif
 endif
@@ -640,6 +645,9 @@ if with_platform_android
   ]
   pre_args += '-DHAVE_ANDROID_PLATFORM'
 endif
+if with_platform_haiku
+  pre_args += '-DHAVE_HAIKU_PLATFORM'
+endif
 
 prog_python2 = find_program('python2')
 

[Mesa-dev] [PATCH 2/2] c11/haiku: Define missing timespec_get on Haiku

2017-11-12 Thread Alexander von Gluck IV
---
 include/c11/threads_posix.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 7bf6a0f6ef..2d7ac1326d 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -382,7 +382,7 @@ tss_set(tss_t key, void *val)
 
 /* 7.25.7 Time functions */
 // 7.25.6.1
-#if 0
+#ifdef __HAIKU__
 static inline int
 timespec_get(struct timespec *ts, int base)
 {
-- 
2.13.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] egl/haiku: Correct invalid void* conversion in calloc

2017-11-12 Thread Alexander von Gluck IV
---
 src/egl/drivers/haiku/egl_haiku.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/egl/drivers/haiku/egl_haiku.cpp 
b/src/egl/drivers/haiku/egl_haiku.cpp
index 237cebf056..287760661e 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -313,7 +313,8 @@ _eglBuiltInDriver(void)
 {
CALLED();
 
-   _EGLDriver* driver = calloc(1, sizeof(*driver));
+   _EGLDriver* driver;
+   driver = (_EGLDriver*) calloc(1, sizeof(*driver));
if (!driver) {
_eglError(EGL_BAD_ALLOC, "_eglBuiltInDriverHaiku");
return NULL;
-- 
2.13.6

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] haiku: build fixes around debug defines

2017-02-22 Thread Alexander von Gluck IV
From: Jerome Duval 

---
 src/gallium/auxiliary/util/u_debug.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_debug.h 
b/src/gallium/auxiliary/util/u_debug.h
index 7da7f53..63940b7 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -39,13 +39,13 @@
 #define U_DEBUG_H_
 
 
+#include "os/os_misc.h"
+
 #if defined(PIPE_OS_HAIKU)
 /* Haiku provides debug_printf in libroot with OS.h */
 #include 
 #endif
 
-#include "os/os_misc.h"
-
 #include "pipe/p_format.h"
 #include "pipe/p_defines.h"
 
-- 
1.8.3.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] haiku/winsys: fix dt prototype args

2017-02-22 Thread Alexander von Gluck IV
From: Jerome Duval 

---
 src/gallium/winsys/sw/hgl/hgl_sw_winsys.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c 
b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
index 89dd547..f7bc907 100644
--- a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
+++ b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
@@ -106,7 +106,8 @@ hgl_winsys_convert_cs(enum pipe_format format)
 static struct sw_displaytarget*
 hgl_winsys_displaytarget_create(struct sw_winsys* winsys,
unsigned textureUsage, enum pipe_format format, unsigned width,
-   unsigned height, unsigned alignment, unsigned* stride)
+   unsigned height, unsigned alignment, const void *front_private,
+   unsigned* stride)
 {
struct haiku_displaytarget* haikuDisplayTarget
= CALLOC_STRUCT(haiku_displaytarget);
-- 
1.8.3.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] glapi/hgl: remove the final user of _glapi_check_table()

2016-09-02 Thread Alexander von Gluck IV
August 30 2016 8:53 AM, "Emil Velikov"  wrote:

> On 25 August 2016 at 16:58, Emil Velikov  wrote:
> 
>> From: Emil Velikov 
>> 
>> The symbol is a no-op since, the EXTRA_DEBUG macro is not set in the
>> build. Unused by !Haiku people/platforms since 2010 (commit
>> a73c6540d9a7f6e26d8568ba2fc522cb865f0a6c) while the Haiku C++ wrapper
>> has no obvious users.
> 
> Alexander does my assumption above holds true ? Can we have your
> ack/nack on the topic.

Sorry for the delay, real life has been busy :-)

My gut reaction is it should be ok to drop.  We have a binary
compatibility obligation to BeOS software, but that only extends
to our ~ Mesa 7.9 fork which was the *LAST* possible version
of Mesa I could get built under gcc2 :-)

https://github.com/haiku/mesa_legacy

Anything goes on master as we guarantee no ABI conformity until
R1 comes out.

Our complete OpenGL kit is within Mesa now, if you don't see any
obvious consumers left then we're likely ok.

In the unlikely event I stumble upon some crazy *big* requirement
i'll post back to the ML, explain, and request to revert.

Thanks for asking about this stuff and keeping me in the loop.

I'm working on some package management stuff right now under Haiku,
but will circle back to Mesa and try to give it some love soon.

A month or two ago I tested master. It compiles, but llvmpipe is
currently crashing (likely argument changes in functions that we
access through pointers or something)

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium/util: Fix debug_printf under Haiku

2016-07-18 Thread Alexander von Gluck IV
July 18 2016 1:10 PM, "Emil Velikov" <emil.l.veli...@gmail.com> wrote:
> On 18 July 2016 at 16:28, Alexander von Gluck IV <kallis...@unixzen.com> 
> wrote:
> 
>> July 18 2016 9:20 AM, "Emil Velikov" <emil.l.veli...@gmail.com> wrote:
>>> On 18 July 2016 at 14:39, Alexander von Gluck IV <kallis...@unixzen.com> 
>>> wrote:
>>> 
>>>> July 18 2016 3:29 AM, "Nicolai Hähnle" <nhaeh...@gmail.com> wrote:
>>>>> A comment further up in the same file says
>>>>> 
>>>>> /* Haiku provides debug_printf in libroot with OS.h */
>>>>> 
>>>>> Is that no longer true?
>>>>> 
>>>>> Nicolai
>>>>> 
>>>>> On 16.07.2016 16:27, Alexander von Gluck IV wrote:
>>>>> 
>>>>>> ---
>>>>>> src/gallium/auxiliary/util/u_debug.h | 5 -
>>>>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>>>> 
>>>>>> diff --git a/src/gallium/auxiliary/util/u_debug.h 
>>>>>> b/src/gallium/auxiliary/util/u_debug.h
>>>>>> index 7da7f53..7dc4ce8 100644
>>>>>> --- a/src/gallium/auxiliary/util/u_debug.h
>>>>>> +++ b/src/gallium/auxiliary/util/u_debug.h
>>>>>> @@ -83,7 +83,10 @@ _debug_printf(const char *format, ...)
>>>>>> * - avoid outputing large strings (512 bytes is the current maximum 
>>>>>> length
>>>>>> * that is guaranteed to be printed in all platforms)
>>>>>> */
>>>>>> -#if !defined(PIPE_OS_HAIKU)
>>>>>> +#if defined(PIPE_OS_HAIKU)
>>>>>> +void
>>>>>> +debug_printf(const char *format, ...) _util_printf_format(1,2);
>>>>>> +#else
>>>>>> static inline void
>>>>>> debug_printf(const char *format, ...) _util_printf_format(1,2);
>>> 
>>> Hmm I moved the include further up with commit
>>> 373f118c6c750d717fd0727fc3fc191828714c6f although that should not have
>>> made any difference, barring fragile include file order. Can you check
>>> if reverting the u_debug.h gets you up and running ? If so can you
>>> please:
>>> - Please add the stable tag Cc: <mesa-sta...@lists.freedesktop.org>
>>> - Attempt to straighten the includes (it might be mesa, llvm and/or
>>> Haiku that is getting confused)
>>> 
>>>> It's still true, however without the _util_printf_format I get odd llvm
>>>> symbol errors.
>>> 
>>> I would suspect that the above is in play, but without details
>>> (build/error log) little to no one will be able to tell you if this is
>>> the correct fix, I'm afraid.
>> 
>> gcc 5.4.0 / llvm 3.8.0
>> Sorry, I wasn't near the machine, here is the error without any changes:
>> 
>> src/gallium/auxiliary/gallivm/lp_bld_assert.c: In function 'lp_assert':
>> src/gallium/auxiliary/gallivm/lp_bld_assert.c:43:7: warning: implicit 
>> declaration of function
>> 'debug_printf' [-Wimplicit-function-declaration]
>> debug_printf("LLVM assertion '%s' failed!\n", msg);
>> ^
> 
> Ok, this happens as PIPE_OS_HAIKU isn't defined that early in
> u_debug.h, thus the header is not included
> 
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_const.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_conv.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_debug.cpp ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_flow.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format_aos.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format_cached.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format_float.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format_soa.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_gather.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_init.c ...
>> Compiling src/gallium/auxiliary/gallivm/lp_bld_intr.c ...
>> src/gallium/auxiliary/gallivm/lp_bld_intr.c: In function 
>> 'lp_build_intrinsic_binary_anylength':
>> src/gallium/auxiliary/gallivm/lp_bld_intr.c:252:10: warning: implicit 
>> declaration of function
>> 'debug_printf' [-Wimplicit-function-decl

Re: [Mesa-dev] [PATCH] gallium/util: Fix debug_printf under Haiku

2016-07-18 Thread Alexander von Gluck IV
July 18 2016 9:20 AM, "Emil Velikov" <emil.l.veli...@gmail.com> wrote:
> On 18 July 2016 at 14:39, Alexander von Gluck IV <kallis...@unixzen.com> 
> wrote:
> 
>> July 18 2016 3:29 AM, "Nicolai Hähnle" <nhaeh...@gmail.com> wrote:
>>> A comment further up in the same file says
>>> 
>>> /* Haiku provides debug_printf in libroot with OS.h */
>>> 
>>> Is that no longer true?
>>> 
>>> Nicolai
>>> 
>>> On 16.07.2016 16:27, Alexander von Gluck IV wrote:
>>> 
>>>> ---
>>>> src/gallium/auxiliary/util/u_debug.h | 5 -
>>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>> 
>>>> diff --git a/src/gallium/auxiliary/util/u_debug.h 
>>>> b/src/gallium/auxiliary/util/u_debug.h
>>>> index 7da7f53..7dc4ce8 100644
>>>> --- a/src/gallium/auxiliary/util/u_debug.h
>>>> +++ b/src/gallium/auxiliary/util/u_debug.h
>>>> @@ -83,7 +83,10 @@ _debug_printf(const char *format, ...)
>>>> * - avoid outputing large strings (512 bytes is the current maximum length
>>>> * that is guaranteed to be printed in all platforms)
>>>> */
>>>> -#if !defined(PIPE_OS_HAIKU)
>>>> +#if defined(PIPE_OS_HAIKU)
>>>> +void
>>>> +debug_printf(const char *format, ...) _util_printf_format(1,2);
>>>> +#else
>>>> static inline void
>>>> debug_printf(const char *format, ...) _util_printf_format(1,2);
> 
> Hmm I moved the include further up with commit
> 373f118c6c750d717fd0727fc3fc191828714c6f although that should not have
> made any difference, barring fragile include file order. Can you check
> if reverting the u_debug.h gets you up and running ? If so can you
> please:
> - Please add the stable tag Cc: <mesa-sta...@lists.freedesktop.org>
> - Attempt to straighten the includes (it might be mesa, llvm and/or
> Haiku that is getting confused)
>
>> It's still true, however without the _util_printf_format I get odd llvm
>> symbol errors.
> 
> I would suspect that the above is in play, but without details
> (build/error log) little to no one will be able to tell you if this is
> the correct fix, I'm afraid.

gcc 5.4.0 / llvm 3.8.0
Sorry, I wasn't near the machine, here is the error without any changes:

src/gallium/auxiliary/gallivm/lp_bld_assert.c: In function 'lp_assert':
src/gallium/auxiliary/gallivm/lp_bld_assert.c:43:7: warning: implicit 
declaration of function 'debug_printf' [-Wimplicit-function-declaration]
   debug_printf("LLVM assertion '%s' failed!\n", msg);
   ^
  Compiling src/gallium/auxiliary/gallivm/lp_bld_const.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_conv.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_debug.cpp ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_flow.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format_aos_array.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format_aos.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format_cached.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format_float.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format_soa.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format_srgb.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_gather.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_init.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_intr.c ...
src/gallium/auxiliary/gallivm/lp_bld_intr.c: In function 
'lp_build_intrinsic_binary_anylength':
src/gallium/auxiliary/gallivm/lp_bld_intr.c:252:10: warning: implicit 
declaration of function 'debug_printf' [-Wimplicit-function-declaration]
  debug_printf("%s: should handle arbitrary vector size\n",
  ^
  Compiling src/gallium/auxiliary/gallivm/lp_bld_logic.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_misc.cpp ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_pack.c ...
  Compiling src/gallium/auxiliary/gallivm/lp_bld_printf.c ...
src/gallium/auxiliary/gallivm/lp_bld_printf.c: In function 
'lp_build_print_args':
src/gallium/auxiliary/gallivm/lp_bld_printf.c:68:84: error: 'debug_printf' 
undeclared (first use in this function)
func_printf = lp_build_const_int_pointer(gallivm, 
func_to_pointer((func_pointer)debug_printf));

^
src/gallium/auxiliary/gallivm/lp_bld_printf.c:68:84: note: each undeclared 
identifier is reported only once for each function it appears in
scons: *** 
[build/haiku-x86_64-debug/gallium/auxiliary/gallivm/lp_bld_printf.os] Error 1

debug_printf i

Re: [Mesa-dev] [PATCH] gallium/util: Fix debug_printf under Haiku

2016-07-18 Thread Alexander von Gluck IV
July 18 2016 3:29 AM, "Nicolai Hähnle" <nhaeh...@gmail.com> wrote:
> A comment further up in the same file says
> 
> /* Haiku provides debug_printf in libroot with OS.h */
> 
> Is that no longer true?
> 
> Nicolai
> 
> On 16.07.2016 16:27, Alexander von Gluck IV wrote:
> 
>> ---
>> src/gallium/auxiliary/util/u_debug.h | 5 -
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/src/gallium/auxiliary/util/u_debug.h 
>> b/src/gallium/auxiliary/util/u_debug.h
>> index 7da7f53..7dc4ce8 100644
>> --- a/src/gallium/auxiliary/util/u_debug.h
>> +++ b/src/gallium/auxiliary/util/u_debug.h
>> @@ -83,7 +83,10 @@ _debug_printf(const char *format, ...)
>> * - avoid outputing large strings (512 bytes is the current maximum length
>> * that is guaranteed to be printed in all platforms)
>> */
>> -#if !defined(PIPE_OS_HAIKU)
>> +#if defined(PIPE_OS_HAIKU)
>> +void
>> +debug_printf(const char *format, ...) _util_printf_format(1,2);
>> +#else
>> static inline void
>> debug_printf(const char *format, ...) _util_printf_format(1,2);

It's still true, however without the _util_printf_format I get odd llvm
symbol errors.

The linux code just below defines debug_printf twice as well:

https://cgit.freedesktop.org/mesa/mesa/tree/src/gallium/auxiliary/util/u_debug.h#n87

I'm honestly not 100% sure what's going on here as the arguments are the same,
but defining twice on Haiku (once in OS.h, and again here) seems to resolve the 
issue.

I have to define it differently under Haiku (and can't use the same one for all 
platforms)
because Haiku's debug_printf is not static inline.

 -- Alex
 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium/util: Fix debug_printf under Haiku

2016-07-16 Thread Alexander von Gluck IV
---
 src/gallium/auxiliary/util/u_debug.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/util/u_debug.h 
b/src/gallium/auxiliary/util/u_debug.h
index 7da7f53..7dc4ce8 100644
--- a/src/gallium/auxiliary/util/u_debug.h
+++ b/src/gallium/auxiliary/util/u_debug.h
@@ -83,7 +83,10 @@ _debug_printf(const char *format, ...)
  * - avoid outputing large strings (512 bytes is the current maximum length
  * that is guaranteed to be printed in all platforms)
  */
-#if !defined(PIPE_OS_HAIKU)
+#if defined(PIPE_OS_HAIKU)
+void
+debug_printf(const char *format, ...) _util_printf_format(1,2);
+#else
 static inline void
 debug_printf(const char *format, ...) _util_printf_format(1,2);
 
-- 
2.7.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] state_trackers/hgl: Fix missing include path

2015-09-26 Thread Alexander von Gluck IV
---
 src/gallium/state_trackers/hgl/SConscript |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/state_trackers/hgl/SConscript 
b/src/gallium/state_trackers/hgl/SConscript
index 82a0ce0..d2389c8 100644
--- a/src/gallium/state_trackers/hgl/SConscript
+++ b/src/gallium/state_trackers/hgl/SConscript
@@ -9,6 +9,7 @@ env.Append(CPPPATH = [
 '#/src',
 '#/src/mapi',
 '#/src/mesa',
+'#/include/HaikuGL',
 ])
 
 sources = [
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] egl: Fix missing Haiku include path

2015-09-26 Thread Alexander von Gluck IV
---
 src/egl/SConscript |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/egl/SConscript b/src/egl/SConscript
index f8102db..8f8b11a 100644
--- a/src/egl/SConscript
+++ b/src/egl/SConscript
@@ -8,6 +8,7 @@ env = env.Clone()
 
 env.Append(CPPPATH = [
 '#/include',
+'#/include/HaikuGL',
 '#/src/egl/main',
 '#/src',
 ])
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Mesa 11.0.0 release candidate 2

2015-08-31 Thread Alexander von Gluck IV

Good afternoon,

One more cherry pick for 11.0:

5abbd1caccf4653ac1a8760de68d8ed101c814d8
egl: scons: fix the haiku build, do not build the dri2 backend


Fixes the scons build after support for scons building egl + dri2
was dropped.

 -- Alex

On 2015-08-31 10:05, Emil Velikov wrote:

The second release candidate for Mesa 11.0.0 is now available.


Chris Wilson (1):
  i965: Always re-emit the pipeline select during invariant state 
emission


Daniel Scharrer (1):
  mesa: add missing queries for ARB_direct_state_access

Dave Airlie (5):
  mesa/arb_gpu_shader_fp64: add support for glGetUniformdv
  mesa: enable texture stencil8 for multisample
  mesa/texgetimage: fix missing stencil check
  gallium/util: fix debug_get_flags_option on 32-bit
  r600: port si_conv_prim_to_gs_out from radeonsi

Emil Velikov (1):
  Update version to 11.0.0-rc2

Glenn Kennard (4):
  r600g: Fix assert in tgsi_cmp
  r600g/sb: Handle undef in read port tracker
  r600g/sb: Don't read junk after EOP
  r600g/sb: Don't crash on empty if jump target

Ilia Mirkin (5):
  nv50,nvc0: disable depth bounds test on blit
  nv50: account for the int RT0 rule for alpha-to-one/cov
  nv50: fix 2d engine blits for 64- and 128-bit formats
  mesa: only copy the requested teximage faces
  freedreno/a3xx: add basic clip plane support

Jason Ekstrand (1):
  i965/fs: Split VGRFs after lowering pull constants

Marek Olšák (3):
  Revert "radeon/winsys: increase the IB size for VM"
  mesa: create multisample fallback textures like normal textures
  gallium/radeon: fix the ADDRESS_HI mask for EVENT_WRITE CIK 
packets


Neil Roberts (2):
  i965: Swap the order of the vertex ID and edge flag attributes
  i965/bdw: Fix 3DSTATE_VF_INSTANCING when the edge flag is used


git tag: mesa-11.0.0-rc2

ftp://ftp.freedesktop.org/pub/mesa/10.6.0/mesa-11.0.0-rc2.tar.gz
MD5: 49e4d80f87930ca7b60838f6363fc3d6  mesa-11.0.0-rc2.tar.gz
SHA1: fafd18a79288c4f6e696b4fbc758b83768c0a9cb  mesa-11.0.0-rc2.tar.gz
SHA256:
65b72bc9a92a59f40ae569b0120cbfda60cfab8a8215f6adfe13d163a27993ba
mesa-11.0.0-rc2.tar.gz
PGP: 
ftp://ftp.freedesktop.org/pub/mesa/10.6.0/mesa-11.0.0-rc2.tar.gz.sig


ftp://ftp.freedesktop.org/pub/mesa/10.6.0/mesa-11.0.0-rc2.tar.xz
MD5: 9e65faf8df4f122aca61b0c5ce8acb35  mesa-11.0.0-rc2.tar.xz
SHA1: e8f8ebfa769fa5c8cc73f2efdc0e0e5cc18213bc  mesa-11.0.0-rc2.tar.xz
SHA256:
e45008b21cc9919c5d4f7c83d69dd15a2f247f8a299be45a0370ed0d26304341
mesa-11.0.0-rc2.tar.xz
PGP: 
ftp://ftp.freedesktop.org/pub/mesa/10.6.0/mesa-11.0.0-rc2.tar.xz.sig


--
-Emil


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] egl/SCons: Fix Haiku build. Haiku is the only OS EGL builds on with SCons

2015-08-18 Thread Alexander von Gluck IV
---
 src/egl/SConscript |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/egl/SConscript b/src/egl/SConscript
index 1b2a427..b05da84 100644
--- a/src/egl/SConscript
+++ b/src/egl/SConscript
@@ -1,6 +1,7 @@
 ###
 # SConscript for EGL
 
+# As of e7e29189e27b EGL is only built on Haiku with SCons
 
 Import('*')
 
@@ -15,7 +16,6 @@ env.Append(CPPPATH = [
 
 # parse Makefile.sources
 egl_sources = env.ParseSourceList('Makefile.sources', 'LIBEGL_C_FILES')
-egl_sources.append(env.ParseSourceList('Makefile.sources', 
'dri2_backend_core_FILES'))
 
 env.Append(CPPDEFINES = [
 '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_HAIKU',
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] egl/dri2: Fix include path of u_atomic.h introduced e7e29189

2015-08-07 Thread Alexander von Gluck IV
This was causing a failure to build on SCons due to a missing
-Isrc/egl. Instead of adding in that path, lets just -Isrc/
and include utils/u_atomic.h.
---
 src/egl/Makefile.am | 1 +
 src/egl/SConscript  | 1 +
 src/egl/drivers/dri2/egl_dri2.c | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/egl/Makefile.am b/src/egl/Makefile.am
index be7bfe9..5c2ba30 100644
--- a/src/egl/Makefile.am
+++ b/src/egl/Makefile.am
@@ -25,6 +25,7 @@ AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/egl/main \
-I$(top_srcdir)/src/gbm/main \
+   -I$(top_srcdir)/src \
$(DEFINES) \
$(VISIBILITY_CFLAGS) \
$(LIBDRM_CFLAGS) \
diff --git a/src/egl/SConscript b/src/egl/SConscript
index a7f6282..1b2a427 100644
--- a/src/egl/SConscript
+++ b/src/egl/SConscript
@@ -9,6 +9,7 @@ env = env.Clone()
 env.Append(CPPPATH = [
 '#/include',
 '#/src/egl/main',
+'#/src',
 ])
 
 
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 0290c07..461735f 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -52,7 +52,7 @@
 #endif
 
 #include egl_dri2.h
-#include ../util/u_atomic.h
+#include util/u_atomic.h
 
 /* The kernel header drm_fourcc.h defines the DRM formats below.  We duplicate
  * some of the definitions here so that building Mesa won't bleeding-edge
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] egl/scons: Fix every platform getting dri and haiku added e7e29189

2015-08-07 Thread Alexander von Gluck IV
---
 src/egl/SConscript | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/egl/SConscript b/src/egl/SConscript
index 1b2a427..00761e8 100644
--- a/src/egl/SConscript
+++ b/src/egl/SConscript
@@ -15,14 +15,17 @@ env.Append(CPPPATH = [
 
 # parse Makefile.sources
 egl_sources = env.ParseSourceList('Makefile.sources', 'LIBEGL_C_FILES')
-egl_sources.append(env.ParseSourceList('Makefile.sources', 
'dri2_backend_core_FILES'))
 
-env.Append(CPPDEFINES = [
-'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_HAIKU',
-'_EGL_BUILT_IN_DRIVER_HAIKU',
-'HAVE_HAIKU_PLATFORM',
-])
-egl_sources.append('drivers/haiku/egl_haiku.cpp')
+if env['dri']:
+egl_sources.append(env.ParseSourceList('Makefile.sources', 
'dri2_backend_core_FILES'))
+
+if env['platform'] == 'haiku':
+env.Append(CPPDEFINES = [
+'_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_HAIKU',
+'_EGL_BUILT_IN_DRIVER_HAIKU',
+'HAVE_HAIKU_PLATFORM',
+])
+egl_sources.append('drivers/haiku/egl_haiku.cpp')
 
 egl = env.SharedLibrary(
 target = 'EGL',
-- 
2.4.3

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] egl/scons: Fix every platform getting dri and haiku added e7e29189

2015-08-07 Thread Alexander von Gluck IV

On 2015-08-07 14:49, Emil Velikov wrote:

Ouch seems like a git rebase slip, as I was nuking the final dri scons
target around the same time.

On 07/08/15 19:19, Alexander von Gluck IV wrote: ---

 src/egl/SConscript | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/egl/SConscript b/src/egl/SConscript
index 1b2a427..00761e8 100644
--- a/src/egl/SConscript
+++ b/src/egl/SConscript
@@ -15,14 +15,17 @@ env.Append(CPPPATH = [

 # parse Makefile.sources
 egl_sources = env.ParseSourceList('Makefile.sources', 
'LIBEGL_C_FILES')
-egl_sources.append(env.ParseSourceList('Makefile.sources', 
'dri2_backend_core_FILES'))



As this Sconscript is included only for haiku (see src/SConscript) we
can remove only the above line, and keep everything else intact. The
commit message could use an update though.

To keep make things easier would be better to use this as 1/2 of the 
series.


Sorry for breaking things. I tried really hard to avoid that but I 
seems

to have missed a line.

With the above suggestions
Reviewed-by: Emil Velikov emil.l.veli...@gmail.com


ah.. I pushed 1/2 up as-is after Matt's ack before your review.

Are we sure we want to completely drop support for scons building EGL
on all platforms except Haiku?

I do plan on fixing Mesa's autotools build under Haiku... but every
time I start in I get a pretty bad headache on how messy autotools is.
(scons has spoiled me :-) )

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa/driver/haiku: Drop Mesa swrast renderer

2015-05-18 Thread Alexander von Gluck IV

On , Emil Velikov wrote:

Hi Alexander,

On 17 May 2015 at 13:49, Alexander von Gluck IV kallis...@unixzen.com 
wrote:

This just created extra upkeep and the push to move extern
C's into mesa code would mean a large number of extern's
in core Mesa driver interfaces. The Haiku Gallium renderers
are mostly insulated via the C-based Haiku state tracker.

As any future hardware support in Haiku will be gallium
based, lets just drop swrast.

Haiku has a Mesa 7.12 fork for gcc2 that uses swrast.

This commit fixes the last of the Haiku build issues.
Is it worth adding mentioning in the release notes 
(docs/relnotes/10.6.0.html) ?


Fwiw with the following hunk squashed
Reviewed-by: Emil Velikov emil.l.veli...@gmail.com

--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -60,7 +60,6 @@ main/git_sha1.h: main/git_sha1.h.tmp
 include Makefile.sources

 EXTRA_DIST = \
-   drivers/haiku \
drivers/SConscript \
main/format_info.py \
main/format_pack.py \

On a related note - is there any reading why Haiku opted for C++
interfaces (and no C wrappers)? Is it mostly due to some
historical/compat reasons or more like shortage of manpower ?


Historical is some of the reason.
All of the API is C++. (as well as most of the kernel)

All of the Haiku API's (kits) are standardized and well defined.
(you should always have libGl from the OpenGL Kit). We have an 
Interface
kit, Open GL kit, Application kit, etc. All of our kits are internal to 
Haiku

except for Mesa as it made a lot of sense to break it out.

Here is the document on the OpenGL Kit:
https://www.haiku-os.org/legacy-docs/bebook/TheOpenGLKit_Overview.html

Here is the package recipe that generates our mesa package:
https://bitbucket.org/haikuports/haikuports/src/3ff0d11160a179c654fc7a174b977978f780ee5c/sys-libs/mesa/mesa-10.5.2.recipe?at=master

The BRenderer API is standard internally and lets us have pluggable 
rendering backends.
(I can take the compiled swrast renderer from Mesa 8.x and plug it into 
a machine running

Mesa 10.5 libGL without any trouble)

We were able to fit Mesa into this box by doing the following:

Haiku:

libGL.so, glapi dispatch of a BRenderer
  
(http://cgit.freedesktop.org/mesa/mesa/tree/include/HaikuGL/GLRenderer.h)


Renderers are dispatched from prefix/add-ons/opengl/* on a first come 
basis.
  (user over-ride prefixes, then system installed renderers. On Haiku 
all of the

   system paths are read-only)
  No renderers found results in a handy No Renderer on-screen error in 
GL applications.


Projects like libsdl didn't have much trouble with it:
http://hg.libsdl.org/SDL/file/7746ab058d12/src/video/haiku/SDL_bopengl.cc

So yeah, the sum of all of that is pretty much our glx is C++ :-)
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa/driver/haiku: Drop Mesa swrast renderer

2015-05-17 Thread Alexander von Gluck IV
This just created extra upkeep and the push to move extern
C's into mesa code would mean a large number of extern's
in core Mesa driver interfaces. The Haiku Gallium renderers
are mostly insulated via the C-based Haiku state tracker.

As any future hardware support in Haiku will be gallium
based, lets just drop swrast.

Haiku has a Mesa 7.12 fork for gcc2 that uses swrast.

This commit fixes the last of the Haiku build issues.
---
 src/mesa/drivers/SConscript |3 -
 src/mesa/drivers/haiku/swrast/SConscript|   33 --
 src/mesa/drivers/haiku/swrast/SoftwareRast.cpp  |  697 ---
 src/mesa/drivers/haiku/swrast/SoftwareRast.h|   95 ---
 src/mesa/drivers/haiku/swrast/SoftwareRast.rdef |   39 --
 5 files changed, 0 insertions(+), 867 deletions(-)
 delete mode 100644 src/mesa/drivers/haiku/swrast/SConscript
 delete mode 100644 src/mesa/drivers/haiku/swrast/SoftwareRast.cpp
 delete mode 100644 src/mesa/drivers/haiku/swrast/SoftwareRast.h
 delete mode 100644 src/mesa/drivers/haiku/swrast/SoftwareRast.rdef

diff --git a/src/mesa/drivers/SConscript b/src/mesa/drivers/SConscript
index db65678..5d654f5 100644
--- a/src/mesa/drivers/SConscript
+++ b/src/mesa/drivers/SConscript
@@ -8,6 +8,3 @@ if env['dri']:
 'dri/common/xmlpool/SConscript',
 'dri/common/SConscript',
 ])
-
-if env['platform'] == 'haiku':
-SConscript('haiku/swrast/SConscript')
diff --git a/src/mesa/drivers/haiku/swrast/SConscript 
b/src/mesa/drivers/haiku/swrast/SConscript
deleted file mode 100644
index 907325e..000
--- a/src/mesa/drivers/haiku/swrast/SConscript
+++ /dev/null
@@ -1,33 +0,0 @@
-Import('*')
-
-env = env.Clone()
-
-env.Append(CPPPATH = [
-'#/src',
-'#/src/mapi',
-'#/src/mesa',
-'#/src/mesa/main',
-'#/include/HaikuGL',
-'/boot/system/develop/headers/private',
-Dir('../../../mapi'), # src/mapi build path for python-generated GL API 
files/headers
-])
-
-env.Prepend(LIBS = [
-mesautil,
-glsl,
-mesa,
-])
-
-env.Prepend(LIBS = [libgl])
-
-sources = [
-   'SoftwareRast.cpp'
-]
-
-# Disallow undefined symbols
-#env.Append(SHLINKFLAGS = ['-Wl,-z,defs'])
-
-libswrast = env.SharedLibrary(
-target = 'swrast',
-source = sources
-)
diff --git a/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp 
b/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp
deleted file mode 100644
index 813ad1f..000
--- a/src/mesa/drivers/haiku/swrast/SoftwareRast.cpp
+++ /dev/null
@@ -1,697 +0,0 @@
-/*
- * Copyright 2006-2012, Haiku, Inc. All rights reserved.
- * Distributed under the terms of the MIT License.
- *
- * Authors:
- * Jérôme Duval, ko...@users.berlios.de
- * Philippe Houdoin, philippe.houd...@free.fr
- * Artur Wyszynski, harak...@gmail.com
- * Alexander von Gluck, kallis...@unixzen.com
- */
-
-
-#include kernel/image.h
-#include SoftwareRast.h
-
-#include Autolock.h
-#include interface/DirectWindowPrivate.h
-#include GraphicsDefs.h
-#include Screen.h
-#include stdio.h
-#include string.h
-
-extern C {
-#include extensions.h
-#include drivers/common/driverfuncs.h
-#include drivers/common/meta.h
-#include main/api_exec.h
-#include main/colormac.h
-#include main/cpuinfo.h
-#include main/buffers.h
-#include main/formats.h
-#include main/framebuffer.h
-#include main/renderbuffer.h
-#include main/version.h
-#include main/vtxfmt.h
-#include swrast/swrast.h
-#include swrast/s_renderbuffer.h
-#include swrast_setup/swrast_setup.h
-#include tnl/tnl.h
-#include tnl/t_context.h
-#include tnl/t_pipeline.h
-#include vbo/vbo.h
-
-
-#ifdef DEBUG
-#  define TRACE(x...) printf(MesaSoftwareRast:  x)
-#  define CALLED() printf(MesaSoftwareRast: %s\n, __PRETTY_FUNCTION__)
-#else
-#  define TRACE(x...)
-#  define CALLED()
-#endif
-
-#define ERROR(x...) printf(MesaSoftwareRast:  x)
-}
-
-
-extern const char* color_space_name(color_space space);
-
-
-extern C _EXPORT BGLRenderer*
-instantiate_gl_renderer(BGLView* view, ulong options,
-   BGLDispatcher* dispatcher)
-{
-   return new MesaSoftwareRast(view, options, dispatcher);
-}
-
-
-MesaSoftwareRast::MesaSoftwareRast(BGLView* view, ulong options,
-   BGLDispatcher* dispatcher)
-   : BGLRenderer(view, options, dispatcher),
-   fBitmap(NULL),
-   fDirectModeEnabled(false),
-   fInfo(NULL),
-   fInfoLocker(info locker),
-   fVisual(NULL),
-   fFrameBuffer(NULL),
-   fFrontRenderBuffer(NULL),
-   fBackRenderBuffer(NULL),
-   fColorSpace(B_NO_COLOR_SPACE)
-{
-   CALLED();
-
-   fColorSpace = BScreen(GLView()-Window()).ColorSpace();
-
-   // We force single buffering for the time being
-   options = ~BGL_DOUBLE;
-
-   const GLboolean rgbFlag = ((options  BGL_INDEX) == 0);
-   const GLboolean alphaFlag = ((options  BGL_ALPHA) == BGL_ALPHA);
-   const GLboolean dblFlag = ((options  BGL_DOUBLE) == BGL_DOUBLE);
-   const GLboolean stereoFlag = false;
-   const GLint depth 

[Mesa-dev] Drop Haiku swrast code?

2015-05-16 Thread Alexander von Gluck IV

Good morning,

I'm pondering dropping the Haiku software rasterization code.

(src/mesa/drivers/haiku/swrast/)

The Haiku extern C gallium changes are complete and llvmpipe
is once again compiling + working.

The Mesa based swrast code however doesn't have a C state_tracker
to hide C++ code behind. This means I'll need to cover the Mesa driver
interfaces in extern C's to get it up to snuff.

#   modified:   src/mesa/main/extensions.h
#   modified:   src/mesa/swrast/s_context.h
#   etc.

llvmpipe is working well enough, and any future Haiku hardware driver
work will be on the gallium side of the house. I don't see the point of
keeping two software renderers around adding to the upkeep when at the
moment i'm the primary (and only) Haiku developer working on Mesa.

A little history: we use swrast on our Mesa 7.12 fork for gcc2. I ported
the Mesa 7.12 code over to Mesa 9.x a few years ago before the Haiku
llvmpipe work was complete.

Thoughts?

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/5] gallium/targets: Move api init into st code

2015-05-15 Thread Alexander von Gluck IV
can-do.  I actually think I spotted one more extern C reduction I can 
do.


Thanks!

 -- Alex

On , Brian Paul wrote:

Let's play it safe.  Update your patch series and re-post it to the
list for a final review, please.

-Brian

On 05/14/2015 06:01 PM, Alexander von Gluck IV wrote:


Good evening Brian,

Thanks, these were fixed.

I just realized that I can drop os_thread.h from our C++ code as we no
longer depend on it and not do the extern C there. (tested working)

You ok with this changeset with the change above?
(I'd hate to commit it, then undo it)

Thanks!

  -- Alex



On , Brian Paul wrote:

In the past, you used the prefix target/haiku-softpipe: on changes
to this code.  I'd suggest using that again here.

With these changes,
Reviewed-by: Brian Paul bri...@vmware.com

On 05/14/2015 04:39 PM, Alexander von Gluck IV wrote:

We also reduce the amount of need-to-know information about st_api
to require one less extern C in st_manager.h
---
  .../targets/haiku-softpipe/GalliumContext.cpp  |   23
+++
  .../targets/haiku-softpipe/GalliumContext.h|5 +---
  2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index b24aef7..1e3874b 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -15,14 +15,13 @@
  #include GLView.h

  #include bitmap_wrapper.h
-extern C {
+
  #include glapi/glapi.h
  #include pipe/p_format.h
-#include state_tracker/st_cb_fbo.h
-#include state_tracker/st_cb_flush.h
+//#include state_tracker/st_cb_fbo.h
+//#include state_tracker/st_cb_flush.h
  #include state_tracker/st_context.h
  #include state_tracker/st_gl_api.h
-#include state_tracker/st_manager.h
  #include state_tracker/sw_winsys.h
  #include sw/hgl/hgl_sw_winsys.h
  #include util/u_atomic.h
@@ -30,7 +29,6 @@ extern C {

  #include target-helpers/inline_sw_helper.h
  #include target-helpers/inline_debug_helper.h
-}


  #ifdef DEBUG
@@ -127,7 +125,8 @@ GalliumContext::CreateContext(Bitmap *bitmap)
  context-read = NULL;
  context-st = NULL;

-context-api = st_gl_api_create();
+// Create st_gl_api
+context-api = hgl_create_st_api();
  if (!context-api) {
  ERROR(%s: Couldn't obtain Mesa state tracker API!\n,
__func__);
  return -1;
@@ -159,12 +158,10 @@ GalliumContext::CreateContext(Bitmap *bitmap)
  attribs.minor = 0;
  //attribs.flags |= ST_CONTEXT_FLAG_DEBUG;

-struct st_api* api = context-api;
-
  // Create context using state tracker api call
  enum st_context_error result;
-context-st = api-create_context(api, context-manager, 
attribs,

-result, context-st);
+context-st = context-api-create_context(context-api,
context-manager,
+attribs, result, context-st);

  if (!context-st) {
  ERROR(%s: Couldn't create mesa state tracker context!\n,
@@ -289,10 +286,8 @@ GalliumContext::SetCurrentContext(Bitmap
*bitmap, context_id contextID)
  return B_ERROR;
  }

-struct st_api* api = context-api;
-
  if (!bitmap) {
-api-make_current(context-api, NULL, NULL, NULL);
+context-api-make_current(context-api, NULL, NULL, NULL);
  return B_OK;
  }

@@ -305,7 +300,7 @@ GalliumContext::SetCurrentContext(Bitmap 
*bitmap,

context_id contextID)
  }

  // We need to lock and unlock framebuffers before accessing 
them
-api-make_current(context-api, context-st, 
context-draw-stfbi,

+context-api-make_current(context-api, context-st,
context-draw-stfbi,
  context-read-stfbi);

  //if (context-textures[ST_ATTACHMENT_BACK_LEFT]
diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.h
b/src/gallium/targets/haiku-softpipe/GalliumContext.h
index b50d528..a13c4ce 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.h
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.h
@@ -12,14 +12,11 @@
  #include stddef.h
  #include kernel/image.h

-extern C {
-//#include state_tracker/st_api.h
  #include pipe/p_compiler.h
  #include pipe/p_screen.h
  #include postprocess/filters.h
  #include os/os_thread.h
  #include hgl_context.h
-}

  #include bitmap_wrapper.h

@@ -56,6 +53,6 @@ private:
  context_idfCurrentContext;
  pipe_mutexfMutex;
  };
-
+

  #endif /* GALLIUMCONTEXT_H */





___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/5] st/hgl: Move st_api creation to st and extern C it

2015-05-15 Thread Alexander von Gluck IV
---
 src/gallium/state_trackers/hgl/hgl.c |   16 
 src/gallium/state_trackers/hgl/hgl_context.h |   14 ++
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/hgl/hgl.c 
b/src/gallium/state_trackers/hgl/hgl.c
index 77f7c22..1e804c0 100644
--- a/src/gallium/state_trackers/hgl/hgl.c
+++ b/src/gallium/state_trackers/hgl/hgl.c
@@ -7,8 +7,7 @@
  *  Alexander von Gluck IV, kallis...@unixzen.com
  */
 
-
-#include GLView.h
+#include hgl_context.h
 
 #include stdio.h
 
@@ -17,8 +16,9 @@
 #include util/u_format.h
 #include util/u_memory.h
 #include util/u_inlines.h
+#include state_tracker/st_gl_api.h /* for st_gl_api_create */
 
-#include hgl_context.h
+#include GLView.h
 
 
 #ifdef DEBUG
@@ -93,7 +93,7 @@ hgl_st_framebuffer_validate_textures(struct 
st_framebuffer_iface *stfbi,
for (i = 0; i  ST_ATTACHMENT_COUNT; i++)
pipe_resource_reference(buffer-textures[i], NULL);
}
-   
+
memset(templat, 0, sizeof(templat));
templat.target = buffer-target;
templat.width0 = width;
@@ -258,6 +258,14 @@ hgl_create_st_framebuffer(struct hgl_context* context)
 }
 
 
+struct st_api*
+hgl_create_st_api()
+{
+   CALLED();
+   return st_gl_api_create();
+}
+
+
 struct st_manager *
 hgl_create_st_manager(struct hgl_context* context)
 {
diff --git a/src/gallium/state_trackers/hgl/hgl_context.h 
b/src/gallium/state_trackers/hgl/hgl_context.h
index 4840d9e..d2ec7fb 100644
--- a/src/gallium/state_trackers/hgl/hgl_context.h
+++ b/src/gallium/state_trackers/hgl/hgl_context.h
@@ -9,9 +9,6 @@
 #define HGL_CONTEXT_H
 
 
-#ifdef __cplusplus
-extern C {
-#endif
 #include state_tracker/st_api.h
 #include state_tracker/st_manager.h
 #include pipe/p_compiler.h
@@ -20,8 +17,10 @@ extern C {
 #include os/os_thread.h
 
 #include bitmap_wrapper.h
+
+
 #ifdef __cplusplus
-}
+extern C {
 #endif
 
 
@@ -82,6 +81,9 @@ struct hgl_context
 };
 
 
+// hgl state_tracker api
+struct st_api* hgl_create_st_api(void);
+
 // hgl state_tracker framebuffer
 struct hgl_buffer* hgl_create_st_framebuffer(struct hgl_context* context);
 
@@ -94,4 +96,8 @@ struct st_visual* hgl_create_st_visual(ulong options);
 void hgl_destroy_st_visual(struct st_visual* visual);
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* HGL_CONTEXT_H */
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/5] winsys/hgl: Add needed extern C to hgl winsys

2015-05-15 Thread Alexander von Gluck IV
---
 src/gallium/winsys/sw/hgl/hgl_sw_winsys.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h 
b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h
index bdcddfb..a81f890 100644
--- a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h
+++ b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h
@@ -27,9 +27,16 @@
 #ifndef _HGL_SOFTWAREWINSYS_H
 #define _HGL_SOFTWAREWINSYS_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct sw_winsys;
 
 struct sw_winsys* hgl_create_sw_winsys(void);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/5] gallium/drivers: Add extern C wrappers to public entry

2015-05-15 Thread Alexander von Gluck IV
---
 src/gallium/drivers/llvmpipe/lp_public.h |8 
 src/gallium/drivers/rbug/rbug_public.h   |8 
 src/gallium/drivers/softpipe/sp_public.h |8 
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_public.h 
b/src/gallium/drivers/llvmpipe/lp_public.h
index ec6b660..27ab1ba 100644
--- a/src/gallium/drivers/llvmpipe/lp_public.h
+++ b/src/gallium/drivers/llvmpipe/lp_public.h
@@ -1,10 +1,18 @@
 #ifndef LP_PUBLIC_H
 #define LP_PUBLIC_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 struct sw_winsys;
 
 struct pipe_screen *
 llvmpipe_create_screen(struct sw_winsys *winsys);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/gallium/drivers/rbug/rbug_public.h 
b/src/gallium/drivers/rbug/rbug_public.h
index b66740b..83f9c94 100644
--- a/src/gallium/drivers/rbug/rbug_public.h
+++ b/src/gallium/drivers/rbug/rbug_public.h
@@ -28,6 +28,10 @@
 #ifndef RBUG_PUBLIC_H
 #define RBUG_PUBLIC_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 struct pipe_context;
 
@@ -37,4 +41,8 @@ rbug_screen_create(struct pipe_screen *screen);
 boolean
 rbug_enabled(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* RBUG_PUBLIC_H */
diff --git a/src/gallium/drivers/softpipe/sp_public.h 
b/src/gallium/drivers/softpipe/sp_public.h
index 62d0903..88a9b5e 100644
--- a/src/gallium/drivers/softpipe/sp_public.h
+++ b/src/gallium/drivers/softpipe/sp_public.h
@@ -1,10 +1,18 @@
 #ifndef SP_PUBLIC_H
 #define SP_PUBLIC_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 struct sw_winsys;
 
 struct pipe_screen *
 softpipe_create_screen(struct sw_winsys *winsys);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 5/5] target/haiku-softpipe: Move api init into st code

2015-05-15 Thread Alexander von Gluck IV
We also reduce the amount of need-to-know information about st_api
to require one less extern C in st_manager.h
---
 .../targets/haiku-softpipe/GalliumContext.cpp  |   23 +++
 .../targets/haiku-softpipe/GalliumContext.h|6 +
 2 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index b24aef7..1e3874b 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -15,14 +15,13 @@
 #include GLView.h
 
 #include bitmap_wrapper.h
-extern C {
+
 #include glapi/glapi.h
 #include pipe/p_format.h
-#include state_tracker/st_cb_fbo.h
-#include state_tracker/st_cb_flush.h
+//#include state_tracker/st_cb_fbo.h
+//#include state_tracker/st_cb_flush.h
 #include state_tracker/st_context.h
 #include state_tracker/st_gl_api.h
-#include state_tracker/st_manager.h
 #include state_tracker/sw_winsys.h
 #include sw/hgl/hgl_sw_winsys.h
 #include util/u_atomic.h
@@ -30,7 +29,6 @@ extern C {
 
 #include target-helpers/inline_sw_helper.h
 #include target-helpers/inline_debug_helper.h
-}
 
 
 #ifdef DEBUG
@@ -127,7 +125,8 @@ GalliumContext::CreateContext(Bitmap *bitmap)
context-read = NULL;
context-st = NULL;
 
-   context-api = st_gl_api_create();
+   // Create st_gl_api
+   context-api = hgl_create_st_api();
if (!context-api) {
ERROR(%s: Couldn't obtain Mesa state tracker API!\n, 
__func__);
return -1;
@@ -159,12 +158,10 @@ GalliumContext::CreateContext(Bitmap *bitmap)
attribs.minor = 0;
//attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
 
-   struct st_api* api = context-api;
-
// Create context using state tracker api call
enum st_context_error result;
-   context-st = api-create_context(api, context-manager, attribs,
-   result, context-st);
+   context-st = context-api-create_context(context-api, 
context-manager,
+   attribs, result, context-st);
 
if (!context-st) {
ERROR(%s: Couldn't create mesa state tracker context!\n,
@@ -289,10 +286,8 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, 
context_id contextID)
return B_ERROR;
}
 
-   struct st_api* api = context-api;
-
if (!bitmap) {
-   api-make_current(context-api, NULL, NULL, NULL);
+   context-api-make_current(context-api, NULL, NULL, NULL);
return B_OK;
}
 
@@ -305,7 +300,7 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, 
context_id contextID)
}
 
// We need to lock and unlock framebuffers before accessing them
-   api-make_current(context-api, context-st, context-draw-stfbi,
+   context-api-make_current(context-api, context-st, 
context-draw-stfbi,
context-read-stfbi);
 
//if (context-textures[ST_ATTACHMENT_BACK_LEFT]
diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.h 
b/src/gallium/targets/haiku-softpipe/GalliumContext.h
index b50d528..22076cb 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.h
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.h
@@ -12,14 +12,10 @@
 #include stddef.h
 #include kernel/image.h
 
-extern C {
-//#include state_tracker/st_api.h
 #include pipe/p_compiler.h
 #include pipe/p_screen.h
 #include postprocess/filters.h
-#include os/os_thread.h
 #include hgl_context.h
-}
 
 #include bitmap_wrapper.h
 
@@ -56,6 +52,6 @@ private:
context_id  fCurrentContext;
pipe_mutex  fMutex;
 };
-   
+
 
 #endif /* GALLIUMCONTEXT_H */
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/5] gallium/aux: Add needed extern C wrappers

2015-05-15 Thread Alexander von Gluck IV
---
 src/gallium/auxiliary/postprocess/postprocess.h |9 +
 src/gallium/auxiliary/util/u_tests.h|8 
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/postprocess/postprocess.h 
b/src/gallium/auxiliary/postprocess/postprocess.h
index c72f2c4..9b9f981 100644
--- a/src/gallium/auxiliary/postprocess/postprocess.h
+++ b/src/gallium/auxiliary/postprocess/postprocess.h
@@ -30,6 +30,10 @@
 
 #include pipe/p_state.h
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct cso_context;
 
 struct pp_queue_t;  /* Forward definition */
@@ -85,4 +89,9 @@ void pp_celshade_free(struct pp_queue_t *, unsigned int);
 void pp_nocolor_free(struct pp_queue_t *, unsigned int);
 void pp_jimenezmlaa_free(struct pp_queue_t *, unsigned int);
 
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/gallium/auxiliary/util/u_tests.h 
b/src/gallium/auxiliary/util/u_tests.h
index 49ae54f..106b0a0 100644
--- a/src/gallium/auxiliary/util/u_tests.h
+++ b/src/gallium/auxiliary/util/u_tests.h
@@ -30,8 +30,16 @@
 
 #include pipe/p_compiler.h
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 
 void util_run_tests(struct pipe_screen *screen);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] egl/haiku: Drop extern C. No longer needed

2015-05-14 Thread Alexander von Gluck IV

On , Brian Paul wrote:

On 05/13/2015 04:14 PM, Alexander von Gluck IV wrote:

---
  src/egl/drivers/haiku/egl_haiku.cpp |2 --
  1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/haiku/egl_haiku.cpp 
b/src/egl/drivers/haiku/egl_haiku.cpp

index 4cf2ccb..4d9888d 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -27,7 +27,6 @@
  #include stdint.h
  #include stdio.h

-extern C {
  #include loader.h
  #include eglconfig.h
  #include eglcontext.h
@@ -38,7 +37,6 @@ extern C {
  #include eglsurface.h
  #include eglimage.h
  #include egltypedefs.h
-}

  #include InterfaceKit.h
  #include OpenGLKit.h



Both look OK to me.

Reviewed-by: Brian Paul bri...@vmware.com


Thanks! :-)

imirkin_ mentioned my commit messages aren't inline with the format mesa 
generally uses.
I'll adhere better future commits. (there was also some unicode 
character that got copied and

pasted in, uugh)

 -- Alex


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/5] gallium/st: Move st_api creation to st and extern C it

2015-05-14 Thread Alexander von Gluck IV
---
 src/gallium/state_trackers/hgl/hgl.c |   16 
 src/gallium/state_trackers/hgl/hgl_context.h |   14 ++
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/src/gallium/state_trackers/hgl/hgl.c 
b/src/gallium/state_trackers/hgl/hgl.c
index 77f7c22..1e804c0 100644
--- a/src/gallium/state_trackers/hgl/hgl.c
+++ b/src/gallium/state_trackers/hgl/hgl.c
@@ -7,8 +7,7 @@
  *  Alexander von Gluck IV, kallis...@unixzen.com
  */
 
-
-#include GLView.h
+#include hgl_context.h
 
 #include stdio.h
 
@@ -17,8 +16,9 @@
 #include util/u_format.h
 #include util/u_memory.h
 #include util/u_inlines.h
+#include state_tracker/st_gl_api.h /* for st_gl_api_create */
 
-#include hgl_context.h
+#include GLView.h
 
 
 #ifdef DEBUG
@@ -93,7 +93,7 @@ hgl_st_framebuffer_validate_textures(struct 
st_framebuffer_iface *stfbi,
for (i = 0; i  ST_ATTACHMENT_COUNT; i++)
pipe_resource_reference(buffer-textures[i], NULL);
}
-   
+
memset(templat, 0, sizeof(templat));
templat.target = buffer-target;
templat.width0 = width;
@@ -258,6 +258,14 @@ hgl_create_st_framebuffer(struct hgl_context* context)
 }
 
 
+struct st_api*
+hgl_create_st_api()
+{
+   CALLED();
+   return st_gl_api_create();
+}
+
+
 struct st_manager *
 hgl_create_st_manager(struct hgl_context* context)
 {
diff --git a/src/gallium/state_trackers/hgl/hgl_context.h 
b/src/gallium/state_trackers/hgl/hgl_context.h
index 4840d9e..d2ec7fb 100644
--- a/src/gallium/state_trackers/hgl/hgl_context.h
+++ b/src/gallium/state_trackers/hgl/hgl_context.h
@@ -9,9 +9,6 @@
 #define HGL_CONTEXT_H
 
 
-#ifdef __cplusplus
-extern C {
-#endif
 #include state_tracker/st_api.h
 #include state_tracker/st_manager.h
 #include pipe/p_compiler.h
@@ -20,8 +17,10 @@ extern C {
 #include os/os_thread.h
 
 #include bitmap_wrapper.h
+
+
 #ifdef __cplusplus
-}
+extern C {
 #endif
 
 
@@ -82,6 +81,9 @@ struct hgl_context
 };
 
 
+// hgl state_tracker api
+struct st_api* hgl_create_st_api(void);
+
 // hgl state_tracker framebuffer
 struct hgl_buffer* hgl_create_st_framebuffer(struct hgl_context* context);
 
@@ -94,4 +96,8 @@ struct st_visual* hgl_create_st_visual(ulong options);
 void hgl_destroy_st_visual(struct st_visual* visual);
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* HGL_CONTEXT_H */
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/5] gallium/drivers: Add extern C wrappers to public entry

2015-05-14 Thread Alexander von Gluck IV
---
 src/gallium/drivers/llvmpipe/lp_public.h |8 
 src/gallium/drivers/rbug/rbug_public.h   |8 
 src/gallium/drivers/softpipe/sp_public.h |8 
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_public.h 
b/src/gallium/drivers/llvmpipe/lp_public.h
index ec6b660..27ab1ba 100644
--- a/src/gallium/drivers/llvmpipe/lp_public.h
+++ b/src/gallium/drivers/llvmpipe/lp_public.h
@@ -1,10 +1,18 @@
 #ifndef LP_PUBLIC_H
 #define LP_PUBLIC_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 struct sw_winsys;
 
 struct pipe_screen *
 llvmpipe_create_screen(struct sw_winsys *winsys);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/gallium/drivers/rbug/rbug_public.h 
b/src/gallium/drivers/rbug/rbug_public.h
index b66740b..83f9c94 100644
--- a/src/gallium/drivers/rbug/rbug_public.h
+++ b/src/gallium/drivers/rbug/rbug_public.h
@@ -28,6 +28,10 @@
 #ifndef RBUG_PUBLIC_H
 #define RBUG_PUBLIC_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 struct pipe_context;
 
@@ -37,4 +41,8 @@ rbug_screen_create(struct pipe_screen *screen);
 boolean
 rbug_enabled(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* RBUG_PUBLIC_H */
diff --git a/src/gallium/drivers/softpipe/sp_public.h 
b/src/gallium/drivers/softpipe/sp_public.h
index 62d0903..88a9b5e 100644
--- a/src/gallium/drivers/softpipe/sp_public.h
+++ b/src/gallium/drivers/softpipe/sp_public.h
@@ -1,10 +1,18 @@
 #ifndef SP_PUBLIC_H
 #define SP_PUBLIC_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 struct sw_winsys;
 
 struct pipe_screen *
 softpipe_create_screen(struct sw_winsys *winsys);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/5] gallium/aux: Add needed extern C wrappers

2015-05-14 Thread Alexander von Gluck IV
---
 src/gallium/auxiliary/os/os_thread.h|7 +++
 src/gallium/auxiliary/postprocess/postprocess.h |9 +
 src/gallium/auxiliary/util/u_tests.h|8 
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_thread.h 
b/src/gallium/auxiliary/os/os_thread.h
index e9da895..e2ae1f9 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -47,6 +47,10 @@
 #endif
 
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 /* pipe_thread
  */
 typedef thrd_t pipe_thread;
@@ -307,5 +311,8 @@ pipe_tsd_set(pipe_tsd *tsd, void *value)
 }
 
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* OS_THREAD_H_ */
diff --git a/src/gallium/auxiliary/postprocess/postprocess.h 
b/src/gallium/auxiliary/postprocess/postprocess.h
index c72f2c4..9b9f981 100644
--- a/src/gallium/auxiliary/postprocess/postprocess.h
+++ b/src/gallium/auxiliary/postprocess/postprocess.h
@@ -30,6 +30,10 @@
 
 #include pipe/p_state.h
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct cso_context;
 
 struct pp_queue_t;  /* Forward definition */
@@ -85,4 +89,9 @@ void pp_celshade_free(struct pp_queue_t *, unsigned int);
 void pp_nocolor_free(struct pp_queue_t *, unsigned int);
 void pp_jimenezmlaa_free(struct pp_queue_t *, unsigned int);
 
+
+#ifdef __cplusplus
+}
+#endif
+
 #endif
diff --git a/src/gallium/auxiliary/util/u_tests.h 
b/src/gallium/auxiliary/util/u_tests.h
index 49ae54f..106b0a0 100644
--- a/src/gallium/auxiliary/util/u_tests.h
+++ b/src/gallium/auxiliary/util/u_tests.h
@@ -30,8 +30,16 @@
 
 #include pipe/p_compiler.h
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct pipe_screen;
 
 void util_run_tests(struct pipe_screen *screen);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 5/5] gallium/targets: Move api init into st code

2015-05-14 Thread Alexander von Gluck IV
We also reduce the amount of need-to-know information about st_api
to require one less extern C in st_manager.h
---
 .../targets/haiku-softpipe/GalliumContext.cpp  |   23 +++
 .../targets/haiku-softpipe/GalliumContext.h|5 +---
 2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index b24aef7..1e3874b 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -15,14 +15,13 @@
 #include GLView.h
 
 #include bitmap_wrapper.h
-extern C {
+
 #include glapi/glapi.h
 #include pipe/p_format.h
-#include state_tracker/st_cb_fbo.h
-#include state_tracker/st_cb_flush.h
+//#include state_tracker/st_cb_fbo.h
+//#include state_tracker/st_cb_flush.h
 #include state_tracker/st_context.h
 #include state_tracker/st_gl_api.h
-#include state_tracker/st_manager.h
 #include state_tracker/sw_winsys.h
 #include sw/hgl/hgl_sw_winsys.h
 #include util/u_atomic.h
@@ -30,7 +29,6 @@ extern C {
 
 #include target-helpers/inline_sw_helper.h
 #include target-helpers/inline_debug_helper.h
-}
 
 
 #ifdef DEBUG
@@ -127,7 +125,8 @@ GalliumContext::CreateContext(Bitmap *bitmap)
context-read = NULL;
context-st = NULL;
 
-   context-api = st_gl_api_create();
+   // Create st_gl_api
+   context-api = hgl_create_st_api();
if (!context-api) {
ERROR(%s: Couldn't obtain Mesa state tracker API!\n, 
__func__);
return -1;
@@ -159,12 +158,10 @@ GalliumContext::CreateContext(Bitmap *bitmap)
attribs.minor = 0;
//attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
 
-   struct st_api* api = context-api;
-
// Create context using state tracker api call
enum st_context_error result;
-   context-st = api-create_context(api, context-manager, attribs,
-   result, context-st);
+   context-st = context-api-create_context(context-api, 
context-manager,
+   attribs, result, context-st);
 
if (!context-st) {
ERROR(%s: Couldn't create mesa state tracker context!\n,
@@ -289,10 +286,8 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, 
context_id contextID)
return B_ERROR;
}
 
-   struct st_api* api = context-api;
-
if (!bitmap) {
-   api-make_current(context-api, NULL, NULL, NULL);
+   context-api-make_current(context-api, NULL, NULL, NULL);
return B_OK;
}
 
@@ -305,7 +300,7 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, 
context_id contextID)
}
 
// We need to lock and unlock framebuffers before accessing them
-   api-make_current(context-api, context-st, context-draw-stfbi,
+   context-api-make_current(context-api, context-st, 
context-draw-stfbi,
context-read-stfbi);
 
//if (context-textures[ST_ATTACHMENT_BACK_LEFT]
diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.h 
b/src/gallium/targets/haiku-softpipe/GalliumContext.h
index b50d528..a13c4ce 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.h
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.h
@@ -12,14 +12,11 @@
 #include stddef.h
 #include kernel/image.h
 
-extern C {
-//#include state_tracker/st_api.h
 #include pipe/p_compiler.h
 #include pipe/p_screen.h
 #include postprocess/filters.h
 #include os/os_thread.h
 #include hgl_context.h
-}
 
 #include bitmap_wrapper.h
 
@@ -56,6 +53,6 @@ private:
context_id  fCurrentContext;
pipe_mutex  fMutex;
 };
-   
+
 
 #endif /* GALLIUMCONTEXT_H */
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/5] gallium/winsys: Add needed extern C to hgl winsys

2015-05-14 Thread Alexander von Gluck IV
---
 src/gallium/winsys/sw/hgl/hgl_sw_winsys.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h 
b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h
index bdcddfb..a81f890 100644
--- a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h
+++ b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.h
@@ -27,9 +27,16 @@
 #ifndef _HGL_SOFTWAREWINSYS_H
 #define _HGL_SOFTWAREWINSYS_H
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 struct sw_winsys;
 
 struct sw_winsys* hgl_create_sw_winsys(void);
 
+#ifdef __cplusplus
+}
+#endif
 
 #endif
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 5/5] gallium/targets: Move api init into st code

2015-05-14 Thread Alexander von Gluck IV


Good evening Brian,

Thanks, these were fixed.

I just realized that I can drop os_thread.h from our C++ code as we no 
longer depend on it and not do the extern C there. (tested working)


You ok with this changeset with the change above?
(I'd hate to commit it, then undo it)

Thanks!

 -- Alex



On , Brian Paul wrote:

In the past, you used the prefix target/haiku-softpipe: on changes
to this code.  I'd suggest using that again here.

With these changes,
Reviewed-by: Brian Paul bri...@vmware.com

On 05/14/2015 04:39 PM, Alexander von Gluck IV wrote:

We also reduce the amount of need-to-know information about st_api
to require one less extern C in st_manager.h
---
  .../targets/haiku-softpipe/GalliumContext.cpp  |   23 
+++

  .../targets/haiku-softpipe/GalliumContext.h|5 +---
  2 files changed, 10 insertions(+), 18 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp

index b24aef7..1e3874b 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -15,14 +15,13 @@
  #include GLView.h

  #include bitmap_wrapper.h
-extern C {
+
  #include glapi/glapi.h
  #include pipe/p_format.h
-#include state_tracker/st_cb_fbo.h
-#include state_tracker/st_cb_flush.h
+//#include state_tracker/st_cb_fbo.h
+//#include state_tracker/st_cb_flush.h
  #include state_tracker/st_context.h
  #include state_tracker/st_gl_api.h
-#include state_tracker/st_manager.h
  #include state_tracker/sw_winsys.h
  #include sw/hgl/hgl_sw_winsys.h
  #include util/u_atomic.h
@@ -30,7 +29,6 @@ extern C {

  #include target-helpers/inline_sw_helper.h
  #include target-helpers/inline_debug_helper.h
-}


  #ifdef DEBUG
@@ -127,7 +125,8 @@ GalliumContext::CreateContext(Bitmap *bitmap)
context-read = NULL;
context-st = NULL;

-   context-api = st_gl_api_create();
+   // Create st_gl_api
+   context-api = hgl_create_st_api();
if (!context-api) {
ERROR(%s: Couldn't obtain Mesa state tracker API!\n, 
__func__);
return -1;
@@ -159,12 +158,10 @@ GalliumContext::CreateContext(Bitmap *bitmap)
attribs.minor = 0;
//attribs.flags |= ST_CONTEXT_FLAG_DEBUG;

-   struct st_api* api = context-api;
-
// Create context using state tracker api call
enum st_context_error result;
-   context-st = api-create_context(api, context-manager, attribs,
-   result, context-st);
+	context-st = context-api-create_context(context-api, 
context-manager,

+   attribs, result, context-st);

if (!context-st) {
ERROR(%s: Couldn't create mesa state tracker context!\n,
@@ -289,10 +286,8 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, 
context_id contextID)

return B_ERROR;
}

-   struct st_api* api = context-api;
-
if (!bitmap) {
-   api-make_current(context-api, NULL, NULL, NULL);
+   context-api-make_current(context-api, NULL, NULL, NULL);
return B_OK;
}

@@ -305,7 +300,7 @@ GalliumContext::SetCurrentContext(Bitmap *bitmap, 
context_id contextID)

}

// We need to lock and unlock framebuffers before accessing them
-   api-make_current(context-api, context-st, context-draw-stfbi,
+	context-api-make_current(context-api, context-st, 
context-draw-stfbi,

context-read-stfbi);

//if (context-textures[ST_ATTACHMENT_BACK_LEFT]
diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.h 
b/src/gallium/targets/haiku-softpipe/GalliumContext.h

index b50d528..a13c4ce 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.h
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.h
@@ -12,14 +12,11 @@
  #include stddef.h
  #include kernel/image.h

-extern C {
-//#include state_tracker/st_api.h
  #include pipe/p_compiler.h
  #include pipe/p_screen.h
  #include postprocess/filters.h
  #include os/os_thread.h
  #include hgl_context.h
-}

  #include bitmap_wrapper.h

@@ -56,6 +53,6 @@ private:
context_id  fCurrentContext;
pipe_mutex  fMutex;
  };
-
+

  #endif /* GALLIUMCONTEXT_H */



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] glapi: Add extern C to glapi_priv.h

2015-05-13 Thread Alexander von Gluck IV
* The Haiku glapi has a C++ wrapper around
  the dispatch code.
---
 src/mapi/glapi/glapi_priv.h |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mapi/glapi/glapi_priv.h b/src/mapi/glapi/glapi_priv.h
index 50f710e..337913a 100644
--- a/src/mapi/glapi/glapi_priv.h
+++ b/src/mapi/glapi/glapi_priv.h
@@ -49,6 +49,10 @@ typedef void *GLeglImageOES;
 #include glapi/glapi.h
 
 
+#ifdef __cplusplus
+extern C {
+#endif
+
 /* getproc */
 
 extern void
@@ -106,4 +110,8 @@ get_entrypoint_address(unsigned int functionOffset);
 #define MAX_EXTENSION_FUNCS 256
 
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] glapi/hgl: Drop extern C as it was added to glapi

2015-05-13 Thread Alexander von Gluck IV
---
 src/hgl/GLDispatcher.cpp |5 +++--
 src/hgl/GLDispatcher.h   |4 +---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/hgl/GLDispatcher.cpp b/src/hgl/GLDispatcher.cpp
index 46b91d5..a1e9053 100644
--- a/src/hgl/GLDispatcher.cpp
+++ b/src/hgl/GLDispatcher.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
+ * Copyright 2000-2015 Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -10,10 +10,11 @@
  */
 
 
-extern C {
 #include glapi/glapi.h
 #include glapi/glapi_priv.h
 
+
+extern C {
 /*
  * NOTE: this file portion implements C-based dispatch of the OpenGL 
entrypoints
  * (glAccum, glBegin, etc).
diff --git a/src/hgl/GLDispatcher.h b/src/hgl/GLDispatcher.h
index 44bca8c..7ee095d 100644
--- a/src/hgl/GLDispatcher.h
+++ b/src/hgl/GLDispatcher.h
@@ -1,6 +1,6 @@
 /*
  * Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
- * Copyright 2000-2012 Haiku, Inc. All Rights Reserved.
+ * Copyright 2000-2015 Haiku, Inc. All Rights Reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -17,9 +17,7 @@
 
 #include glheader.h
 
-extern C {
 #include glapi/glapi.h
-}
 
 
 class BGLDispatcher
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium/state_tracker: Rewrite Haiku's state tracker

2014-12-31 Thread Alexander von Gluck IV
-SetCurrentContext(fBitmap, fContextID);
@@ -329,8 +324,8 @@ SoftwareRenderer::FrameResized(float width, float height)
TRACE(%s: %f x %f\n, __func__, width, height);
 
BAutolock lock(fInfoLocker);
-   fNewWidth = (GLuint)width;
-   fNewHeight = (GLuint)height;
+   fWidth = (GLuint)width;
+   fHeight = (GLuint)height;
 }
 
 
@@ -341,8 +336,9 @@ SoftwareRenderer::_AllocateBitmap()
 
// allocate new size of back buffer bitmap
BAutolock lock(fInfoLocker);
-   delete fBitmap;
-   fBitmap = NULL;
+   if (fBitmap)
+   delete fBitmap;
+
if (fWidth  1 || fHeight  1) {
TRACE(%s: Can't allocate bitmap of %dx%d\n, __func__,
fWidth, fHeight);
@@ -358,8 +354,6 @@ SoftwareRenderer::_AllocateBitmap()
TRACE(%s: New bitmap size: % B_PRId32  x % B_PRId32 \n, __func__,
fBitmap-Bounds().IntegerWidth(), 
fBitmap-Bounds().IntegerHeight());
 
-   fContextObj-ResizeViewport(fWidth, fHeight);
-
 #if 0
// debug..
void *data = fBitmap-Bits();
diff --git a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.h 
b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.h
index 8427ce1..10eaef8 100644
--- a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.h
+++ b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.h
@@ -51,8 +51,6 @@ private:
ulong   fOptions;   

GLuint  fWidth;
GLuint  fHeight;
-   GLuint  fNewWidth;
-   GLuint  fNewHeight;
color_space fColorSpace;
 };
 
diff --git a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c 
b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
index 8e8413b..a71d2a7 100644
--- a/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
+++ b/src/gallium/winsys/sw/hgl/hgl_sw_winsys.c
@@ -1,7 +1,7 @@
 /**
  *
  * Copyright 2009 Artur Wyszynski harak...@gmail.com
- * Copyright 2013 Alexander von Gluck IV kallis...@unixzen.com
+ * Copyright 2013-2014 Alexander von Gluck IV kallis...@unixzen.com
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the
@@ -25,6 +25,7 @@
  *
  **/
 
+#include stdio.h
 
 #include pipe/p_compiler.h
 #include pipe/p_defines.h
@@ -40,6 +41,16 @@
 #include hgl_sw_winsys.h
 
 
+#ifdef DEBUG
+#   define TRACE(x...) printf(hgl:winsys:  x)
+#   define CALLED() TRACE(CALLED: %s\n, __PRETTY_FUNCTION__)
+#else
+#   define TRACE(x...)
+#   define CALLED()
+#endif
+#define ERROR(x...) printf(hgl:winsys:  x)
+
+
 struct haiku_displaytarget
 {
enum pipe_format format;
@@ -75,7 +86,7 @@ hgl_winsys_is_displaytarget_format_supported(struct 
sw_winsys* winsys,
unsigned textureUsage, enum pipe_format format)
 {
// TODO STUB
-   return true;
+   return TRUE;
 }
 
 static color_space
@@ -85,8 +96,8 @@ hgl_winsys_convert_cs(enum pipe_format format)
switch(format) {
case PIPE_FORMAT_B5G6R5_UNORM:
return B_CMAP8;
-   case PIPE_FORMAT_A8R8G8B8_UNORM:
-   case PIPE_FORMAT_X8R8G8B8_UNORM:
+   case PIPE_FORMAT_A8B8G8R8_UNORM:
+   case PIPE_FORMAT_X8B8G8R8_UNORM:
default:
return B_RGB32;
}
@@ -101,6 +112,8 @@ hgl_winsys_displaytarget_create(struct sw_winsys* winsys,
= CALLOC_STRUCT(haiku_displaytarget);
assert(haikuDisplayTarget);
 
+   TRACE(%s: %d x %d\n, __func__, width, height);
+
haikuDisplayTarget-colorSpace = hgl_winsys_convert_cs(format);
haikuDisplayTarget-format = format;
haikuDisplayTarget-width = width;
@@ -193,6 +206,9 @@ hgl_winsys_displaytarget_display(struct sw_winsys* winsys,
haikuDisplayTarget-size, haikuDisplayTarget-stride,
haikuDisplayTarget-colorSpace);
 
+   // Dump the rendered bitmap to disk for debugging
+   //dump_bitmap(bitmap);
+
return;
 }
 
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] gallium/target: Drop no longer needed Haiku viewport override

2014-12-26 Thread Alexander von Gluck IV
* Drop no longer needed mesa headers
* Haiku LLVM pipe working with LLVM 3.5.0 on x86_64
---
 .../targets/haiku-softpipe/GalliumContext.cpp  |   31 +---
 1 files changed, 1 insertions(+), 30 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index 5df5234..62db7e2 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -15,9 +15,6 @@
 #include bitmap_wrapper.h
 extern C {
 #include glapi/glapi.h
-#include main/context.h
-#include main/framebuffer.h
-#include main/renderbuffer.h
 #include main/viewport.h
 #include pipe/p_format.h
 #include state_tracker/st_cb_fbo.h
@@ -44,31 +41,6 @@ extern C {
 #define ERROR(x...) printf(GalliumContext:  x)
 
 
-static void
-hgl_viewport(struct gl_context* glContext)
-{
-   // TODO: We should try to eliminate this function
-
-   GLint x = glContext-ViewportArray[0].X;
-   GLint y = glContext-ViewportArray[0].Y;
-   GLint width = glContext-ViewportArray[0].Width;
-   GLint height = glContext-ViewportArray[0].Height;
-
-   TRACE(%s(glContext: %p, x: %d, y: %d, w: %d, h: %d\n, __func__,
-   glContext, x, y, width, height);
-
-   _mesa_check_init_viewport(glContext, width, height);
-
-   struct gl_framebuffer *draw = glContext-WinSysDrawBuffer;
-   struct gl_framebuffer *read = glContext-WinSysReadBuffer;
-
-   if (draw)
-   _mesa_resize_framebuffer(glContext, draw, width, height);
-   if (read)
-   _mesa_resize_framebuffer(glContext, read, width, height);
-}
-
-
 GalliumContext::GalliumContext(ulong options)
:
fOptions(options),
@@ -228,8 +200,6 @@ GalliumContext::CreateContext(Bitmap *bitmap)
 
struct st_context *stContext = (struct st_context*)context-st;

-   stContext-ctx-Driver.Viewport = hgl_viewport;
-
// Init Gallium3D Post Processing
// TODO: no pp filters are enabled yet through postProcessEnable
context-postProcess = pp_init(stContext-pipe, 
context-postProcessEnable,
@@ -406,6 +376,7 @@ GalliumContext::ResizeViewport(int32 width, int32 height)
for (context_id i = 0; i  CONTEXT_MAX; i++) {
if (fContext[i]  fContext[i]-st) {
struct st_context *stContext = (struct 
st_context*)fContext[i]-st;
+   // TODO: _mesa_set_viewport needs to be removed for 
something st_api?
_mesa_set_viewport(stContext-ctx, 0, 0, 0, width, 
height);
st_manager_validate_framebuffers(stContext);
}
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] gallium/st: Clean up Haiku depth mapping, fix colorspace errors

2014-12-26 Thread Alexander von Gluck IV
---
 src/gallium/state_trackers/hgl/hgl.c |   48 +
 1 files changed, 19 insertions(+), 29 deletions(-)

diff --git a/src/gallium/state_trackers/hgl/hgl.c 
b/src/gallium/state_trackers/hgl/hgl.c
index 4d7c479..0b30290 100644
--- a/src/gallium/state_trackers/hgl/hgl.c
+++ b/src/gallium/state_trackers/hgl/hgl.c
@@ -232,9 +232,10 @@ hgl_create_st_visual(ulong options)
const GLboolean alphaFlag   = ((options  BGL_ALPHA) == BGL_ALPHA);
const GLboolean dblFlag = ((options  BGL_DOUBLE) == BGL_DOUBLE);
const GLboolean stereoFlag  = false;
-   const GLint depth   = (options  BGL_DEPTH) ? 24 : 0;
-   const GLint stencil = (options  BGL_STENCIL) ? 8 : 0;
-   const GLint accum   = (options  BGL_ACCUM) ? 16 : 0;
+   const GLboolean depthFlag   = ((options  BGL_DEPTH) == BGL_DEPTH);
+   const GLboolean stencilFlag = ((options  BGL_STENCIL) == BGL_STENCIL);
+   const GLboolean accumFlag   = ((options  BGL_ACCUM) == BGL_ACCUM);
+
const GLint red = rgbFlag ? 8 : 5;
const GLint green   = rgbFlag ? 8 : 5;
const GLint blue= rgbFlag ? 8 : 5;
@@ -244,9 +245,9 @@ hgl_create_st_visual(ulong options)
TRACE(alpha:\t%d\n, (bool)alphaFlag);
TRACE(dbl  :\t%d\n, (bool)dblFlag);
TRACE(stereo   :\t%d\n, (bool)stereoFlag);
-   TRACE(depth:\t%d\n, depth);
-   TRACE(stencil  :\t%d\n, stencil);
-   TRACE(accum:\t%d\n, accum);
+   TRACE(depth:\t%d\n, (bool)depthFlag);
+   TRACE(stencil  :\t%d\n, (bool)stencilFlag);
+   TRACE(accum:\t%d\n, (bool)accumFlag);
TRACE(red  :\t%d\n, red);
TRACE(green:\t%d\n, green);
TRACE(blue :\t%d\n, blue);
@@ -254,34 +255,23 @@ hgl_create_st_visual(ulong options)
 
// Determine color format
if (red == 8) {
+   // Color format
if (alpha == 8)
-   visual-color_format = PIPE_FORMAT_A8R8G8B8_UNORM;
+   visual-color_format = PIPE_FORMAT_B8G8R8A8_UNORM;
else
-   visual-color_format = PIPE_FORMAT_X8R8G8B8_UNORM;
+   visual-color_format = PIPE_FORMAT_B8G8R8X8_UNORM;
+
+   // Depth buffer
+   if (depthFlag)
+   visual-depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
+   else
+   visual-depth_stencil_format = PIPE_FORMAT_NONE;
} else {
-   // TODO: I think this should be RGB vs BGR
visual-color_format = PIPE_FORMAT_B5G6R5_UNORM;
-}
 
-   // Determine depth stencil format
-   switch (depth) {
-   default:
-   case 0:
-   visual-depth_stencil_format = PIPE_FORMAT_NONE;
-   break;
-   case 16:
-   visual-depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
-   break;
-   case 24:
-   if ((options  BGL_STENCIL) != 0)
-   visual-depth_stencil_format = 
PIPE_FORMAT_S8_UINT_Z24_UNORM;
-   else
-   visual-depth_stencil_format = 
PIPE_FORMAT_X8Z24_UNORM;
-   break;
-   case 32:
-   visual-depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
-   break;
-   }
+   // TODO: Indexed color depth buffer?
+   visual-depth_stencil_format = PIPE_FORMAT_NONE;
+}
 
visual-accum_format = (options  BGL_ACCUM)
? PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] egl: Fix non-dri SCons builds re #87657

2014-12-24 Thread Alexander von Gluck IV
* Revert change to egl main producing Shared Libraries
* Check for dri before including dri code
---
 src/SConscript  |3 ++-
 src/egl/main/SConscript |   17 +++--
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/SConscript b/src/SConscript
index eb4cd3c..c25adc7 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -33,7 +33,8 @@ 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']:
-SConscript('egl/drivers/dri2/SConscript')
+if env['dri']:
+SConscript('egl/drivers/dri2/SConscript')
 SConscript('egl/main/SConscript')
 if env['platform'] == 'haiku':
 SConscript('egl/drivers/haiku/SConscript')
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 2ea2261..5d0073e 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -33,10 +33,11 @@ else:
 '_EGL_NATIVE_PLATFORM=_EGL_PLATFORM_X11',
 '_EGL_OS_UNIX',
 ])
-env.Prepend(LIBS = [
-egl_dri2,
-libloader,
-])
+if env['dri']:
+env.Prepend(LIBS = [
+egl_dri2,
+libloader,
+])
 
 env.Append(CPPPATH = [
 '#/include',
@@ -46,12 +47,8 @@ env.Append(CPPPATH = [
 # parse Makefile.sources
 egl_sources = env.ParseSourceList('Makefile.sources', 'LIBEGL_C_FILES')
 
-# libEGL.dll
-env['LIBPREFIX'] = 'lib'
-env['SHLIBPREFIX'] = 'lib'
-
-egl = env.SharedLibrary(
-target = 'EGL',
+egl = env.ConvenienceLibrary(
+target = 'egl',
 source = egl_sources,
 )
 
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/12] egl: More functions for Haiku

2014-12-22 Thread Alexander von Gluck IV
From: Adrián Arroyo Calle adrian.arroyoca...@gmail.com

---
 src/egl/drivers/dri2/egl_dri2.h |   13 
 src/egl/drivers/dri2/platform_haiku.cpp |  117 +--
 2 files changed, 123 insertions(+), 7 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 52f05fb..6f5fd17 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -197,6 +197,11 @@ struct dri2_egl_display
int  formats;
uint32_t  capabilities;
 #endif
+
+#ifdef HAVE_EGL_PLATFORM_HAIKU
+   void*bwindow;
+   void*glview;
+#endif
 };
 
 struct dri2_egl_context
@@ -332,4 +337,12 @@ dri2_initialize_wayland(_EGLDriver *drv, _EGLDisplay 
*disp);
 EGLBoolean
 dri2_initialize_android(_EGLDriver *drv, _EGLDisplay *disp);
 
+#ifdef __cplusplus
+
+extern C
+EGLBoolean
+dri2_initialize_haiku(_EGLDriver *drv, _EGLDisplay *disp);
+#endif
+
+
 #endif /* EGL_DRI2_INCLUDED */
diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
index d182663..f31e458 100644
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -24,19 +24,122 @@
  
 #include errno.h
 #include dlfcn.h
+#include stdio.h
 
-/*#include loader.h
 #include egl_dri2.h
 #include egl_dri2_fallbacks.h
-#include gralloc_drm.h
+#include ../../../loader/loader.h
+//#include gralloc_drm.h
+
+#include InterfaceKit.h
+
+static void
+haiku_log(EGLint level, const char *msg)
+{
+   switch (level) {
+   case _EGL_DEBUG:
+  printf(%s, msg);
+  break;
+   case _EGL_INFO:
+  printf(%s, msg);
+  break;
+   case _EGL_WARNING:
+  printf(%s, msg);
+  break;
+   case _EGL_FATAL:
+  fprintf(stderr,%s, msg);
+  break;
+   default:
+  break;
+   }
+}
+
+BWindow* 
+haiku_create_window()
+{
+   BWindow* win=new BWindow(BRect(100,100,500,500),EGL 
Test,B_TITLED_WINDOW,0);
+   return win;
+}
 
 static EGLBoolean
-haiku_window_dequeue_buffer(struct dri2_egl_surface* dri2_surf)
+dri2_haiku_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy, 
_EGLDisplay *disp)
 {
-   if (dri2_surf-window-dequeueBuffer(dri2_surf-window, 
dri2_surf-buffer))
+   if (!_eglGetArraySize(disp-Configs)) {
+  _eglLog(_EGL_WARNING, DRI2: failed to create any config);
   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;
-}*/
+}
+
+extern C
+EGLBoolean
+dri2_initialize_haiku(_EGLDriver *drv, _EGLDisplay *dpy)
+{
+   printf(INITIALIZING HAIKU);
+   struct dri2_egl_display_vtbl dri2_haiku_display_vtbl;
+   dri2_haiku_display_vtbl={};
+   dri2_haiku_display_vtbl.authenticate = NULL;
+   dri2_haiku_display_vtbl.create_window_surface = NULL;
+   dri2_haiku_display_vtbl.create_pixmap_surface = NULL;
+   dri2_haiku_display_vtbl.create_pbuffer_surface = NULL;
+   dri2_haiku_display_vtbl.destroy_surface = NULL;
+   dri2_haiku_display_vtbl.create_image = NULL;
+   dri2_haiku_display_vtbl.swap_interval = dri2_fallback_swap_interval;
+   dri2_haiku_display_vtbl.swap_buffers = NULL;
+   dri2_haiku_display_vtbl.swap_buffers_region = 
dri2_fallback_swap_buffers_region;
+   dri2_haiku_display_vtbl.post_sub_buffer = dri2_fallback_post_sub_buffer;
+   dri2_haiku_display_vtbl.copy_buffers = NULL;
+   dri2_haiku_display_vtbl.query_buffer_age = dri2_fallback_query_buffer_age,
+   dri2_haiku_display_vtbl.create_wayland_buffer_from_image = 
dri2_fallback_create_wayland_buffer_from_image;
+   dri2_haiku_display_vtbl.get_sync_values = dri2_fallback_get_sync_values;
+   
+   struct dri2_egl_display *dri2_dpy;
+   const char *err;
+   
+   _eglSetLogProc(haiku_log);
+   
+   //loader_set_logger(_eglLog);
+   
+   dri2_dpy =(struct dri2_egl_display*) calloc(1, sizeof(*dri2_dpy));
+   if (!dri2_dpy)
+   return _eglError(EGL_BAD_ALLOC, eglInitialize);
+   dpy-DriverData=(void*) dri2_dpy;
+   if(dpy-PlatformDisplay == NULL)
+   {
+   /* OPEN DEVICE */
+   dri2_dpy-bwindow=(void*)haiku_create_window();
+   dri2_dpy-own_device=true;  
+   }else{
+   BWindow* win=(BWindow*)dpy-PlatformDisplay;
+   dri2_dpy-bwindow=win;
+   }
+   
+   dri2_dpy-driver_name = strdup(Haiku OpenGL);
+   if (!dri2_load_driver_swrast(dpy))
+   return EGL_FALSE;
+   
+   dri2_dpy-swrast_loader_extension.base.name = __DRI_SWRAST_LOADER;
+   dri2_dpy-swrast_loader_extension.base.version = 
__DRI_SWRAST_LOADER_VERSION;
+   //dri2_dpy-swrast_loader_extension.getDrawableInfo = swrastGetDrawableInfo;
+   //dri2_dpy-swrast_loader_extension.putImage = swrastPutImage;
+   //dri2_dpy-swrast_loader_extension.getImage = swrastGetImage;
+   
+  

[Mesa-dev] [PATCH 04/12] egl_dri2/haiku: whitespace cleanup

2014-12-22 Thread Alexander von Gluck IV
From: Emil Velikov emil.l.veli...@gmail.com

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/egl/drivers/dri2/platform_haiku.cpp |  102 +++---
 1 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
index 77b88a9..dc5ed40 100644
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -21,7 +21,7 @@
  * 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 stdio.h
@@ -53,17 +53,19 @@ haiku_log(EGLint level, const char *msg)
}
 }
 
-BWindow* 
+BWindow*
 haiku_create_window()
 {
-   BWindow* win=new BWindow(BRect(100,100,500,500),EGL 
Test,B_TITLED_WINDOW,0);
-   return win;
+   BWindow* win = new BWindow(BRect(100, 100, 500, 500), EGL Test,
+  B_TITLED_WINDOW, 0);
+   return win;
 }
 
 static EGLBoolean
-dri2_haiku_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy, 
_EGLDisplay *disp)
+dri2_haiku_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
+   _EGLDisplay *disp)
 {
-   if (!_eglGetArraySize(disp-Configs)) {
+   if (!_eglGetArraySize(disp-Configs)) {
   _eglLog(_EGL_WARNING, DRI2: failed to create any config);
   return EGL_FALSE;
}
@@ -75,10 +77,10 @@ extern C
 EGLBoolean
 dri2_initialize_haiku(_EGLDriver *drv, _EGLDisplay *dpy)
 {
-   printf(INITIALIZING HAIKU);
-   struct dri2_egl_display_vtbl dri2_haiku_display_vtbl;
-   dri2_haiku_display_vtbl={};
-   dri2_haiku_display_vtbl.authenticate = NULL;
+   printf(INITIALIZING HAIKU);
+   struct dri2_egl_display_vtbl dri2_haiku_display_vtbl;
+   dri2_haiku_display_vtbl={};
+   dri2_haiku_display_vtbl.authenticate = NULL;
dri2_haiku_display_vtbl.create_window_surface = NULL;
dri2_haiku_display_vtbl.create_pixmap_surface = NULL;
dri2_haiku_display_vtbl.create_pbuffer_surface = NULL;
@@ -92,53 +94,51 @@ dri2_initialize_haiku(_EGLDriver *drv, _EGLDisplay *dpy)
dri2_haiku_display_vtbl.query_buffer_age = dri2_fallback_query_buffer_age,
dri2_haiku_display_vtbl.create_wayland_buffer_from_image = 
dri2_fallback_create_wayland_buffer_from_image;
dri2_haiku_display_vtbl.get_sync_values = dri2_fallback_get_sync_values;
-   
-   struct dri2_egl_display *dri2_dpy;
-   const char *err;
-   
-   _eglSetLogProc(haiku_log);
-   
-   //loader_set_logger(_eglLog);
-   
-   dri2_dpy =(struct dri2_egl_display*) calloc(1, sizeof(*dri2_dpy));
-   if (!dri2_dpy)
-   return _eglError(EGL_BAD_ALLOC, eglInitialize);
-   dpy-DriverData=(void*) dri2_dpy;
-   if(dpy-PlatformDisplay == NULL)
-   {
-   /* OPEN DEVICE */
-   dri2_dpy-bwindow=(void*)haiku_create_window();
-   dri2_dpy-own_device=true;  
-   }else{
-   BWindow* win=(BWindow*)dpy-PlatformDisplay;
-   dri2_dpy-bwindow=win;
-   }
-   
-   dri2_dpy-driver_name = strdup(Haiku OpenGL);
-   if (!dri2_load_driver_swrast(dpy))
-   return EGL_FALSE;
-   
-   dri2_dpy-swrast_loader_extension.base.name = __DRI_SWRAST_LOADER;
+
+   struct dri2_egl_display *dri2_dpy;
+   const char *err;
+
+   _eglSetLogProc(haiku_log);
+
+   //loader_set_logger(_eglLog);
+
+   dri2_dpy =(struct dri2_egl_display*) calloc(1, sizeof(*dri2_dpy));
+   if (!dri2_dpy)
+  return _eglError(EGL_BAD_ALLOC, eglInitialize);
+   dpy-DriverData=(void*) dri2_dpy;
+   if(dpy-PlatformDisplay == NULL)
+   {
+  /* OPEN DEVICE */
+  dri2_dpy-bwindow=(void*)haiku_create_window();
+  dri2_dpy-own_device=true;
+   }else{
+  BWindow* win=(BWindow*)dpy-PlatformDisplay;
+  dri2_dpy-bwindow=win;
+   }
+
+   dri2_dpy-driver_name = strdup(Haiku OpenGL);
+   if (!dri2_load_driver_swrast(dpy))
+  return EGL_FALSE;
+
+   dri2_dpy-swrast_loader_extension.base.name = __DRI_SWRAST_LOADER;
dri2_dpy-swrast_loader_extension.base.version = 
__DRI_SWRAST_LOADER_VERSION;
//dri2_dpy-swrast_loader_extension.getDrawableInfo = swrastGetDrawableInfo;
//dri2_dpy-swrast_loader_extension.putImage = swrastPutImage;
//dri2_dpy-swrast_loader_extension.getImage = swrastGetImage;
-   
-  dri2_dpy-extensions[0] = dri2_dpy-swrast_loader_extension.base;
+
+   dri2_dpy-extensions[0] = dri2_dpy-swrast_loader_extension.base;
dri2_dpy-extensions[1] = NULL;
dri2_dpy-extensions[2] = NULL;
-   
-   if (dri2_dpy-bwindow) {
+
+   if (dri2_dpy-bwindow) {
   if (!dri2_haiku_add_configs_for_visuals(dri2_dpy, dpy))
-   return EGL_FALSE;
+ return EGL_FALSE;
 }
-   
-   
-   dpy-VersionMajor=1;
-   dpy-VersionMinor=4;
-   
-   dri2_dpy-vtbl = dri2_haiku_display_vtbl;
-   
-   return EGL_TRUE;
-   
+
+   dpy-VersionMajor=1;
+   

[Mesa-dev] [PATCH 09/12] egl: Adding Haiku configs, not stable yet

2014-12-22 Thread Alexander von Gluck IV
From: Adrián Arroyo Calle adrian.arroyoca...@gmail.com

---
 src/egl/drivers/dri2/egl_dri2.c |7 ++
 src/egl/drivers/dri2/platform_haiku.cpp |  172 +--
 src/egl/main/SConscript |   14 ++-
 src/egl/main/egldisplay.c   |4 +
 4 files changed, 160 insertions(+), 37 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 062fb54..5bda4fd 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -398,9 +398,16 @@ dri2_open_driver(_EGLDisplay *disp)
   %.*s/tls/%s_dri.so, len, p, dri2_dpy-driver_name);
   dri2_dpy-driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
 #endif
+
+
   if (dri2_dpy-driver == NULL) {
+#ifndef HAVE_HAIKU_PLATFORM
 snprintf(path, sizeof path,
  %.*s/%s_dri.so, len, p, dri2_dpy-driver_name);
+#else
+snprintf(path, sizeof path,
+ lib%s.so,len,p,dri2_dpy-driver_name);
+#endif
 dri2_dpy-driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
 if (dri2_dpy-driver == NULL)
_eglLog(_EGL_DEBUG, failed to open %s: %s\n, path, dlerror());
diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
index ef85e27..22633ff 100644
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -35,19 +35,57 @@ extern C {
 }
 
 #include InterfaceKit.h
+static void
+swrastCreateDrawable(struct dri2_egl_display * dri2_dpy,
+ struct dri2_egl_surface * dri2_surf,
+ int depth)
+{
+
+}
+
+static void
+swrastDestroyDrawable(struct dri2_egl_display * dri2_dpy,
+  struct dri2_egl_surface * dri2_surf)
+{
+
+}
+
+static void
+swrastGetDrawableInfo(__DRIdrawable * draw,
+  int *x, int *y, int *w, int *h,
+  void *loaderPrivate)
+{
+
+}
+
+static void
+swrastPutImage(__DRIdrawable * draw, int op,
+   int x, int y, int w, int h,
+   char *data, void *loaderPrivate)
+{
+
+}
+
+static void
+swrastGetImage(__DRIdrawable * read,
+   int x, int y, int w, int h,
+   char *data, void *loaderPrivate)
+{
+
+}
 
 static void
 haiku_log(EGLint level, const char *msg)
 {
switch (level) {
case _EGL_DEBUG:
-  printf(%s, msg);
+  fprintf(stderr,%s, msg);
   break;
case _EGL_INFO:
-  printf(%s, msg);
+  fprintf(stderr,%s, msg);
   break;
case _EGL_WARNING:
-  printf(%s, msg);
+  fprintf(stderr,%s, msg);
   break;
case _EGL_FATAL:
   fprintf(stderr,%s, msg);
@@ -57,23 +95,76 @@ haiku_log(EGLint level, const char *msg)
}
 }
 
-BWindow*
-haiku_create_window()
+/**
+ * Called via eglCreateWindowSurface(), drv-API.CreateWindowSurface().
+ */
+static _EGLSurface *
+dri2_haiku_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
+_EGLConfig *conf, void *native_surface,
+const EGLint *attrib_list)
+{
+
+   return NULL;
+}
+
+/**
+ * Called via eglCreateWindowSurface(), drv-API.CreateWindowSurface().
+ */
+static _EGLSurface *
+dri2_haiku_create_window_surface(_EGLDriver *drv, _EGLDisplay *disp,
+   _EGLConfig *conf, void *native_window,
+   const EGLint *attrib_list)
+{
+   return NULL;
+}
+
+static _EGLSurface *
+dri2_haiku_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
+   _EGLConfig *conf, void *native_pixmap,
+   const EGLint *attrib_list)
 {
-   BWindow* win = new BWindow(BRect(100, 100, 500, 500), EGL Test,
-  B_TITLED_WINDOW, 0);
-   return win;
+   return NULL;
 }
 
+static _EGLSurface *
+dri2_haiku_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
+_EGLConfig *conf, const EGLint *attrib_list)
+{
+   return NULL;
+}
+
+static EGLBoolean
+dri2_haiku_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface 
*surf)
+{
+   return EGL_TRUE;
+}
 static EGLBoolean
 dri2_haiku_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
-   _EGLDisplay *disp)
+   _EGLDisplay *dpy)
 {
-   if (!_eglGetArraySize(disp-Configs)) {
+   /*EGLint config_attrs[] = {
+  EGL_NATIVE_VISUAL_ID,   0,
+  EGL_NATIVE_VISUAL_TYPE, 0,
+  EGL_NONE
+   };
+   static const unsigned int rgb_masks[4] = { 0xff, 0xff00, 0xff, 0 };
+   dri2_add_config(dpy,dri2_dpy-driver_configs[0],1,
+   EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT | 
+   EGL_SWAP_BEHAVIOR_PRESERVED_BIT,config_attrs,rgb_masks);*/
+   struct dri2_egl_config *conf;
+   _EGLConfig base;
+   _eglInitConfig(base, dpy, 1);
+   
+   if (!_eglValidateConfig(base, EGL_FALSE)) {
+  _eglLog(_EGL_DEBUG, 

[Mesa-dev] [PATCH 11/12] Haiku: Remove DRI2 code as it doesn't support Haiku yet.

2014-12-22 Thread Alexander von Gluck IV
From: Adrián Arroyo Calle adrian.arroyoca...@gmail.com

* EGL on Haiku now working
---
 src/SConscript  |5 +-
 src/egl/drivers/dri2/egl_dri2.c |5 -
 src/egl/drivers/dri2/egl_dri2.h |5 -
 src/egl/drivers/dri2/platform_haiku.cpp |  300 --
 src/egl/drivers/haiku/SConscript|   35 +++
 src/egl/drivers/haiku/egl_haiku.cpp |  412 +++
 src/egl/main/SConscript |   16 +-
 src/egl/main/egldriver.c|   14 +-
 8 files changed, 470 insertions(+), 322 deletions(-)
 delete mode 100644 src/egl/drivers/dri2/platform_haiku.cpp
 create mode 100644 src/egl/drivers/haiku/SConscript
 create mode 100644 src/egl/drivers/haiku/egl_haiku.cpp

diff --git a/src/SConscript b/src/SConscript
index 9c69b42..0db4611 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -32,9 +32,12 @@ 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', 'sunos']:
+if env['platform'] not in ['darwin', 'sunos','haiku']:
 SConscript('egl/drivers/dri2/SConscript')
 SConscript('egl/main/SConscript')
+if env['platform'] == 'haiku':
+   SConscript('egl/drivers/haiku/SConscript')
+   SConscript('egl/main/SConscript')
 
 if env['gles']:
 SConscript('mapi/shared-glapi/SConscript')
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 5bda4fd..4538905 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -401,13 +401,8 @@ dri2_open_driver(_EGLDisplay *disp)
 
 
   if (dri2_dpy-driver == NULL) {
-#ifndef HAVE_HAIKU_PLATFORM
 snprintf(path, sizeof path,
  %.*s/%s_dri.so, len, p, dri2_dpy-driver_name);
-#else
-snprintf(path, sizeof path,
- lib%s.so,len,p,dri2_dpy-driver_name);
-#endif
 dri2_dpy-driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
 if (dri2_dpy-driver == NULL)
_eglLog(_EGL_DEBUG, failed to open %s: %s\n, path, dlerror());
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 0486b4f..90a25cc 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -339,10 +339,5 @@ dri2_initialize_android(_EGLDriver *drv, _EGLDisplay 
*disp);
 
 #ifdef __cplusplus
 
-extern C
-EGLBoolean
-dri2_initialize_haiku(_EGLDriver *drv, _EGLDisplay *disp);
-#endif
-
 
 #endif /* EGL_DRI2_INCLUDED */
diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
deleted file mode 100644
index f62e8ed..000
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 2014 Adrián Arroyo Calle adrian.arroyoca...@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 stdio.h
-
-extern C {
-
-#include loader.h
-#include egl_dri2.h
-#include egl_dri2_fallbacks.h
-
-}
-
-#include InterfaceKit.h
-static void
-swrastCreateDrawable(struct dri2_egl_display * dri2_dpy,
- struct dri2_egl_surface * dri2_surf,
- int depth)
-{
-
-}
-
-static void
-swrastDestroyDrawable(struct dri2_egl_display * dri2_dpy,
-  struct dri2_egl_surface * dri2_surf)
-{
-
-}
-
-static void
-swrastGetDrawableInfo(__DRIdrawable * draw,
-  int *x, int *y, int *w, int *h,
-  void *loaderPrivate)
-{
-
-}
-
-static void
-swrastPutImage(__DRIdrawable * draw, int op,
-   int x, int y, int w, int h,
-   char *data, void *loaderPrivate)
-{
-
-}
-
-static void
-swrastGetImage(__DRIdrawable * read,
-   int x, int y, int w, int h,
-   char *data, void 

[Mesa-dev] [PATCH 06/12] egl_dri2: a ton of blob

2014-12-22 Thread Alexander von Gluck IV
From: Emil Velikov emil.l.veli...@gmail.com

Attempt to get a egl_dri2 SConscript
 - Drop going into the gallium egl-static
 - Promote the main library to a shared one.
 - Convert libEGL_Haiku into a conv. library - shove a demo platform_x11.
 - s/HAVE_EGL_PLATFORM_HAIKU/HAVE_HAIKU_PLATFORM/
 - A ton of extra crap all over.

Not even build tested, and I don't expect it to build properly yet.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/SConscript  |2 +-
 src/egl/drivers/dri2/SConscript |   33 -
 src/egl/drivers/dri2/egl_dri2.c |6 ++
 src/egl/drivers/dri2/egl_dri2.h |2 +-
 src/egl/main/SConscript |   12 ++--
 src/gallium/SConscript  |6 --
 6 files changed, 42 insertions(+), 19 deletions(-)

diff --git a/src/SConscript b/src/SConscript
index 6cac490..9c69b42 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -24,7 +24,6 @@ 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')
 
@@ -34,6 +33,7 @@ if not env['embedded']:
 if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 
'windows'):
 SConscript('glx/SConscript')
 if env['platform'] not in ['darwin', 'sunos']:
+SConscript('egl/drivers/dri2/SConscript')
 SConscript('egl/main/SConscript')
 
 if env['gles']:
diff --git a/src/egl/drivers/dri2/SConscript b/src/egl/drivers/dri2/SConscript
index b122182..2c081d2 100644
--- a/src/egl/drivers/dri2/SConscript
+++ b/src/egl/drivers/dri2/SConscript
@@ -3,22 +3,37 @@ Import('*')
 env = env.Clone()
 
 env.Append(CPPDEFINES = [
-   'HAVE_EGL_PLATFORM_HAIKU',
-   'DEFAULT_DRIVER_DIR='
+'DEFAULT_DRIVER_DIR='
 ])
 
 env.Append(CPPPATH = [
-   '#/src/egl/main',
+'#/include',
+'#/src/egl/main',
+'#/src/loader',
 ])
 
 sources = [
-   'egl_dri2.c',
-   'platform_haiku.cpp',
+'egl_dri2.c',
 ]
 
-libEGL_Haiku = env.SharedLibrary(
-   target = 'egl_haiku.so',
-   source = sources,
+if env['platform'] == 'haiku':
+sources.append('platform_haiku.cpp')
+env.Append(CPPDEFINES = [
+'HAVE_HAIKU_PLATFORM',
+])
+
+if env['x11']:
+sources.append('platform_x11.cpp')
+env.Append(CPPDEFINES = [
+'HAVE_X11_PLATFORM',
+])
+env.Append([CPPPATH = [
+#'XCB_DRI2_CFLAGS',
+])
+
+egl_dri2 = env.ConvenienceLibrary(
+target = 'egl_dri2',
+source = sources,
 )
 
-Export('libEGL_Haiku')
+Export('egl_dri2')
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 2a6811c..062fb54 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -657,6 +657,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp)
  return EGL_TRUE;
   return dri2_initialize_android(drv, disp);
 #endif
+#ifdef HAVE_HAIKU_PLATFORM
+   case _EGL_PLATFORM_HAIKU:
+  if (disp-Options.TestOnly)
+ return EGL_TRUE;
+  return dri2_initialize_haiku(drv, disp);
+#endif
 
default:
   _eglLog(_EGL_WARNING, No EGL platform enabled.);
diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 8cdf810..0486b4f 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -198,7 +198,7 @@ struct dri2_egl_display
uint32_t  capabilities;
 #endif
 
-#ifdef HAVE_EGL_PLATFORM_HAIKU
+#ifdef HAVE_HAIKU_PLATFORM
void *bwindow;
void *glview;
 #endif
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 87c5b81..08cc42e 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -28,11 +28,19 @@ env.Append(CPPPATH = [
 '#/include',
 ])
 
+env.Prepend(LIBS = [
+'egl_dri2',
+])
+
 # parse Makefile.sources
 egl_sources = env.ParseSourceList('Makefile.sources', 'LIBEGL_C_FILES')
 
-egl = env.ConvenienceLibrary(
-target = 'egl',
+# libEGL.dll
+env['LIBPREFIX'] = 'lib'
+env['SHLIBPREFIX'] = 'lib'
+
+egl = env.SharedLibrary(
+target = 'EGL',
 source = egl_sources,
 )
 
diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index 977e3fb..aef972c 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -63,12 +63,6 @@ SConscript([
 
 if not env['embedded']:
 SConscript('state_trackers/vega/SConscript')
-if env['platform'] not in ('cygwin', 'darwin', 'freebsd', 'haiku', 
'sunos'):
-SConscript([
-'state_trackers/egl/SConscript',
-'targets/egl-static/SConscript',
-])
-
 if env['x11']:
 SConscript([
 'state_trackers/glx/xlib/SConscript',
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 07/12] egl: scons: link against libloader

2014-12-22 Thread Alexander von Gluck IV
From: Emil Velikov emil.l.veli...@gmail.com

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/egl/main/SConscript |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 08cc42e..6582621 100644
--- a/src/egl/main/SConscript
+++ b/src/egl/main/SConscript
@@ -30,6 +30,7 @@ env.Append(CPPPATH = [
 
 env.Prepend(LIBS = [
 'egl_dri2',
+libloader,
 ])
 
 # parse Makefile.sources
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/12] egl_dri2: fix plafrom_haiku includes

2014-12-22 Thread Alexander von Gluck IV
From: Emil Velikov emil.l.veli...@gmail.com

Drop the gralloc_drm which is android specific header and
remove the leading .. in the loader inclusion.

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/egl/drivers/dri2/platform_haiku.cpp |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
index f31e458..77b88a9 100644
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -26,10 +26,9 @@
 #include dlfcn.h
 #include stdio.h
 
+#include loader.h
 #include egl_dri2.h
 #include egl_dri2_fallbacks.h
-#include ../../../loader/loader.h
-//#include gralloc_drm.h
 
 #include InterfaceKit.h
 
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2014-12-22 Thread Alexander von Gluck IV
From: Adrián Arroyo Calle adrian.arroyoca...@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 000..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 000..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.arroyoca...@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


[Mesa-dev] [PATCH 10/12] egl: Improve configuration creation for Haiku.

2014-12-22 Thread Alexander von Gluck IV
From: Adrián Arroyo Calle adrian.arroyoca...@gmail.com

* Creates a configuration, but it does not work
---
 src/egl/drivers/dri2/platform_haiku.cpp |   51 ++-
 1 files changed, 50 insertions(+), 1 deletions(-)

diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
index 22633ff..f62e8ed 100644
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -115,6 +115,8 @@ dri2_haiku_create_window_surface(_EGLDriver *drv, 
_EGLDisplay *disp,
_EGLConfig *conf, void *native_window,
const EGLint *attrib_list)
 {
+   //BWindow* win=new BWindow(BRect(100,100,500,500),NULL);
+   //win-Show();
return NULL;
 }
 
@@ -142,6 +144,7 @@ static EGLBoolean
 dri2_haiku_add_configs_for_visuals(struct dri2_egl_display *dri2_dpy,
_EGLDisplay *dpy)
 {
+   printf(Adding configs\n);
/*EGLint config_attrs[] = {
   EGL_NATIVE_VISUAL_ID,   0,
   EGL_NATIVE_VISUAL_TYPE, 0,
@@ -153,17 +156,63 @@ dri2_haiku_add_configs_for_visuals(struct 
dri2_egl_display *dri2_dpy,
EGL_SWAP_BEHAVIOR_PRESERVED_BIT,config_attrs,rgb_masks);*/
struct dri2_egl_config *conf;
_EGLConfig base;
-   _eglInitConfig(base, dpy, 1);
+   _eglInitConfig(base, dpy, 0x8);
+   printf(Config inited\n);
+   _eglSetConfigKey(base, EGL_RED_SIZE ,8);
+   _eglSetConfigKey(base, EGL_BLUE_SIZE ,8);
+   _eglSetConfigKey(base, EGL_GREEN_SIZE ,8);
+   _eglSetConfigKey(base, EGL_LUMINANCE_SIZE ,0);
+   _eglSetConfigKey(base, EGL_ALPHA_SIZE ,8);
+   _eglSetConfigKey(base, EGL_COLOR_BUFFER_TYPE ,EGL_RGB_BUFFER);
+   EGLint r = (_eglGetConfigKey(base, EGL_RED_SIZE) 
+   + _eglGetConfigKey(base, EGL_GREEN_SIZE)
+   + _eglGetConfigKey(base, EGL_BLUE_SIZE)
+   + _eglGetConfigKey(base, EGL_ALPHA_SIZE));
+   _eglSetConfigKey(base, EGL_BUFFER_SIZE, r);
+   _eglSetConfigKey(base, EGL_CONFIG_CAVEAT, EGL_NONE);
+   _eglSetConfigKey(base, EGL_CONFIG_ID, 0x8);
+   _eglSetConfigKey(base, EGL_BIND_TO_TEXTURE_RGB ,EGL_FALSE);
+   _eglSetConfigKey(base, EGL_BIND_TO_TEXTURE_RGBA ,EGL_FALSE);
+   _eglSetConfigKey(base, EGL_STENCIL_SIZE ,0);
+   _eglSetConfigKey(base, EGL_TRANSPARENT_TYPE ,EGL_NONE);
+_eglSetConfigKey(base, EGL_NATIVE_RENDERABLE ,EGL_TRUE); // Let's say 
yes
+   _eglSetConfigKey(base, EGL_NATIVE_VISUAL_ID ,0); // No visual
+   _eglSetConfigKey(base, EGL_NATIVE_VISUAL_TYPE ,EGL_NONE); // No visual
+   //_eglSetConfigKey(base, EGL_RENDERABLE_TYPE ,glv);
+   _eglSetConfigKey(base, EGL_SAMPLE_BUFFERS ,0); // TODO: How to get the 
right value ?
+   _eglSetConfigKey(base, EGL_SAMPLES ,_eglGetConfigKey(base, 
EGL_SAMPLE_BUFFERS) == 0 ? 0 : 0);
+   _eglSetConfigKey(base, EGL_DEPTH_SIZE ,24); // TODO: How to get the 
right value ?
+   _eglSetConfigKey(base, EGL_LEVEL ,0);
+   _eglSetConfigKey(base, EGL_MAX_PBUFFER_WIDTH ,0); // TODO: How to get 
the right value ?
+   _eglSetConfigKey(base, EGL_MAX_PBUFFER_HEIGHT ,0); // TODO: How to get 
the right value ?
+   _eglSetConfigKey(base, EGL_MAX_PBUFFER_PIXELS ,0); // TODO: How to get 
the right value ?

+   base.NativeRenderable = EGL_TRUE;
+   base.SurfaceType = EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT;
+   
+   base.RenderableType = dpy-ClientAPIs;
+   base.Conformant = dpy-ClientAPIs;
+
+   base.MinSwapInterval = dri2_dpy-min_swap_interval;
+   base.MaxSwapInterval = dri2_dpy-max_swap_interval;
+   printf(Config configurated\n);
if (!_eglValidateConfig(base, EGL_FALSE)) {
   _eglLog(_EGL_DEBUG, DRI2: failed to validate config);
   return NULL;
}
+   printf(Validated config\n);
+   conf =(struct dri2_egl_config*) malloc(sizeof *conf);
+   memcpy(conf-base, base, sizeof base);
+   conf-base.ConfigID = base.ConfigID;
+   base.ConfigID= EGL_DONT_CARE;
+   base.SurfaceType = EGL_DONT_CARE;
+   
_eglLinkConfig(conf-base);
if (!_eglGetArraySize(dpy-Configs)) {
   _eglLog(_EGL_WARNING, DRI2: failed to create any config);
   return EGL_FALSE;
}
+   printf(Config succesfull\n);

return EGL_TRUE;
 }
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 08/12] egl: Resolve Haiku build issues

2014-12-22 Thread Alexander von Gluck IV
From: Adrián Arroyo Calle adrian.arroyoca...@gmail.com

* Builds perfect and it loads the driver.
* It still reports EGL_NOT_INITIALIZED
---
 src/egl/drivers/dri2/SConscript |8 +++-
 src/egl/drivers/dri2/platform_haiku.cpp |4 
 src/egl/main/SConscript |4 ++--
 src/egl/main/egldisplay.c   |3 ++-
 src/egl/main/egldisplay.h   |1 +
 5 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/egl/drivers/dri2/SConscript b/src/egl/drivers/dri2/SConscript
index 2c081d2..26765c5 100644
--- a/src/egl/drivers/dri2/SConscript
+++ b/src/egl/drivers/dri2/SConscript
@@ -20,6 +20,7 @@ if env['platform'] == 'haiku':
 sources.append('platform_haiku.cpp')
 env.Append(CPPDEFINES = [
 'HAVE_HAIKU_PLATFORM',
+'_EGL_NATIVE_PLATFORM=haiku',
 ])
 
 if env['x11']:
@@ -27,11 +28,16 @@ if env['x11']:
 env.Append(CPPDEFINES = [
 'HAVE_X11_PLATFORM',
 ])
-env.Append([CPPPATH = [
+env.Append(CPPPATH = [
 #'XCB_DRI2_CFLAGS',
 ])
 
+env.Prepend(LIBS = [
+libloader,
+])
+
 egl_dri2 = env.ConvenienceLibrary(
+#egl_dri2 = env.SharedLibrary(
 target = 'egl_dri2',
 source = sources,
 )
diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
index 15e6c95..ef85e27 100644
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -26,10 +26,14 @@
 #include dlfcn.h
 #include stdio.h
 
+extern C {
+
 #include loader.h
 #include egl_dri2.h
 #include egl_dri2_fallbacks.h
 
+}
+
 #include InterfaceKit.h
 
 static void
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
index 6582621..a8725ca 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_DRI2',
 '_EGL_DRIVER_SEARCH_DIR=',
 ])
 
@@ -29,7 +29,7 @@ env.Append(CPPPATH = [
 ])
 
 env.Prepend(LIBS = [
-'egl_dri2',
+egl_dri2,
 libloader,
 ])
 
diff --git a/src/egl/main/egldisplay.c b/src/egl/main/egldisplay.c
index 76dfee7..259ab6b 100644
--- a/src/egl/main/egldisplay.c
+++ b/src/egl/main/egldisplay.c
@@ -75,7 +75,8 @@ static const struct {
{ _EGL_PLATFORM_DRM, drm },
{ _EGL_PLATFORM_FBDEV, fbdev },
{ _EGL_PLATFORM_NULL, null },
-   { _EGL_PLATFORM_ANDROID, android }
+   { _EGL_PLATFORM_ANDROID, android },
+   { _EGL_PLATFORM_HAIKU, haiku }
 };
 
 
diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h
index d4b9602..bcdc2b2 100644
--- a/src/egl/main/egldisplay.h
+++ b/src/egl/main/egldisplay.h
@@ -46,6 +46,7 @@ enum _egl_platform_type {
_EGL_PLATFORM_FBDEV,
_EGL_PLATFORM_NULL,
_EGL_PLATFORM_ANDROID,
+   _EGL_PLATFORM_HAIKU,
 
_EGL_NUM_PLATFORMS,
_EGL_INVALID_PLATFORM = -1
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 05/12] egl_dri2/haiku: coding style fixes

2014-12-22 Thread Alexander von Gluck IV
From: Emil Velikov emil.l.veli...@gmail.com

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/egl/drivers/dri2/egl_dri2.h |4 ++--
 src/egl/drivers/dri2/platform_haiku.cpp |   27 ---
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/egl/drivers/dri2/egl_dri2.h b/src/egl/drivers/dri2/egl_dri2.h
index 6f5fd17..8cdf810 100644
--- a/src/egl/drivers/dri2/egl_dri2.h
+++ b/src/egl/drivers/dri2/egl_dri2.h
@@ -199,8 +199,8 @@ struct dri2_egl_display
 #endif
 
 #ifdef HAVE_EGL_PLATFORM_HAIKU
-   void*bwindow;
-   void*glview;
+   void *bwindow;
+   void *glview;
 #endif
 };
 
diff --git a/src/egl/drivers/dri2/platform_haiku.cpp 
b/src/egl/drivers/dri2/platform_haiku.cpp
index dc5ed40..15e6c95 100644
--- a/src/egl/drivers/dri2/platform_haiku.cpp
+++ b/src/egl/drivers/dri2/platform_haiku.cpp
@@ -77,9 +77,9 @@ extern C
 EGLBoolean
 dri2_initialize_haiku(_EGLDriver *drv, _EGLDisplay *dpy)
 {
-   printf(INITIALIZING HAIKU);
-   struct dri2_egl_display_vtbl dri2_haiku_display_vtbl;
-   dri2_haiku_display_vtbl={};
+   struct dri2_egl_display_vtbl dri2_haiku_display_vtbl = {};
+   struct dri2_egl_display *dri2_dpy;
+
dri2_haiku_display_vtbl.authenticate = NULL;
dri2_haiku_display_vtbl.create_window_surface = NULL;
dri2_haiku_display_vtbl.create_pixmap_surface = NULL;
@@ -95,25 +95,22 @@ dri2_initialize_haiku(_EGLDriver *drv, _EGLDisplay *dpy)
dri2_haiku_display_vtbl.create_wayland_buffer_from_image = 
dri2_fallback_create_wayland_buffer_from_image;
dri2_haiku_display_vtbl.get_sync_values = dri2_fallback_get_sync_values;
 
-   struct dri2_egl_display *dri2_dpy;
-   const char *err;
-
+   printf(INITIALIZING HAIKU);
_eglSetLogProc(haiku_log);
 
-   //loader_set_logger(_eglLog);
+   loader_set_logger(_eglLog);
 
-   dri2_dpy =(struct dri2_egl_display*) calloc(1, sizeof(*dri2_dpy));
+   dri2_dpy = (struct dri2_egl_display*) calloc(1, sizeof(*dri2_dpy));
if (!dri2_dpy)
   return _eglError(EGL_BAD_ALLOC, eglInitialize);
+
dpy-DriverData=(void*) dri2_dpy;
-   if(dpy-PlatformDisplay == NULL)
-   {
+   if (!dpy-PlatformDisplay) {
   /* OPEN DEVICE */
-  dri2_dpy-bwindow=(void*)haiku_create_window();
-  dri2_dpy-own_device=true;
-   }else{
-  BWindow* win=(BWindow*)dpy-PlatformDisplay;
-  dri2_dpy-bwindow=win;
+  dri2_dpy-bwindow = (void*)haiku_create_window();
+  dri2_dpy-own_device = true;
+   } else {
+  dri2_dpy-bwindow = (BWindow*)dpy-PlatformDisplay;
}
 
dri2_dpy-driver_name = strdup(Haiku OpenGL);
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 12/12] Works if we disable the EGL_BAD_SURFACE error

2014-12-22 Thread Alexander von Gluck IV
From: Adrián Arroyo Calle adrian.arroyoca...@gmail.com

---
 src/egl/drivers/haiku/egl_haiku.cpp |  175 +--
 src/egl/main/eglapi.c   |2 +
 2 files changed, 87 insertions(+), 90 deletions(-)

diff --git a/src/egl/drivers/haiku/egl_haiku.cpp 
b/src/egl/drivers/haiku/egl_haiku.cpp
index eaee11e..a35ddda 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -37,10 +37,16 @@ extern C {
 #include egllog.h
 #include eglsurface.h
 #include eglimage.h
+#include egltypedefs.h
 
 }
 
 #include InterfaceKit.h
+#include OpenGLKit.h
+
+#define CALLOC_STRUCT(T)   (struct T *) calloc(1, sizeof(struct T))
+
+_EGL_DRIVER_STANDARD_TYPECASTS(haiku_egl)
 
 struct haiku_egl_driver
 {
@@ -58,6 +64,11 @@ struct haiku_egl_context
 {
_EGLContext ctx;
 };
+struct haiku_egl_surface
+{
+   _EGLSurface surf;
+   BGLView* gl;
+};
 /*static void
 swrastCreateDrawable(struct dri2_egl_display * dri2_dpy,
  struct dri2_egl_surface * dri2_surf,
@@ -138,9 +149,20 @@ haiku_create_window_surface(_EGLDriver *drv, _EGLDisplay 
*disp,
_EGLConfig *conf, void *native_window,
const EGLint *attrib_list)
 {
-   //BWindow* win=new BWindow(BRect(100,100,500,500),NULL);
-   //win-Show();
-   return NULL;
+   struct haiku_egl_surface* surface;
+   surface=(struct haiku_egl_surface*)calloc(1,sizeof (*surface));
+   _eglInitSurface(surface-surf, disp, EGL_WINDOW_BIT, conf, 
attrib_list);
+   (surface-surf)-SwapInterval = 1;
+   _eglLog(_EGL_DEBUG, Creating window);
+   //BWindow* win=new 
BWindow(BRect(100,100,500,500),EGL,B_TITLED_WINDOW,0);
+   BWindow* win=(BWindow*)native_window;
+   _eglLog(_EGL_DEBUG, Creating GL view);
+   surface-gl=new 
BGLView(win-Bounds(),OpenGL,B_FOLLOW_ALL_SIDES,0,BGL_RGB | BGL_DOUBLE | 
BGL_ALPHA);
+   _eglLog(_EGL_DEBUG, Adding GL);
+   win-AddChild(surface-gl);
+   _eglLog(_EGL_DEBUG, Showing window);
+   win-Show();
+   return surface-surf;
 }
 
 static _EGLSurface *
@@ -167,67 +189,52 @@ static EGLBoolean
 haiku_add_configs_for_visuals(_EGLDisplay *dpy)
 {
printf(Adding configs\n);
-   /*EGLint config_attrs[] = {
-  EGL_NATIVE_VISUAL_ID,   0,
-  EGL_NATIVE_VISUAL_TYPE, 0,
-  EGL_NONE
-   };
-   static const unsigned int rgb_masks[4] = { 0xff, 0xff00, 0xff, 0 };
-   dri2_add_config(dpy,dri2_dpy-driver_configs[0],1,
-   EGL_WINDOW_BIT | EGL_PIXMAP_BIT | EGL_PBUFFER_BIT | 
-   EGL_SWAP_BEHAVIOR_PRESERVED_BIT,config_attrs,rgb_masks);*/
-   struct haiku_egl_config* conf;
-   conf=(struct haiku_egl_config*)calloc(1,sizeof (*conf));
-   _eglInitConfig(conf-base, dpy, 1);
+   struct haiku_egl_config conf, *final;
+   //conf=CALLOC_STRUCT(haiku_egl_config);
+   memset(conf, 0, sizeof(conf));
+   _eglInitConfig(conf.base, dpy, 1);
_eglLog(_EGL_DEBUG,Config inited\n);
-   _eglSetConfigKey(conf-base, EGL_RED_SIZE ,8);
-   _eglSetConfigKey(conf-base, EGL_BLUE_SIZE ,8);
-   _eglSetConfigKey(conf-base, EGL_GREEN_SIZE ,8);
-   _eglSetConfigKey(conf-base, EGL_LUMINANCE_SIZE ,0);
-   _eglSetConfigKey(conf-base, EGL_ALPHA_SIZE ,8);
-   _eglSetConfigKey(conf-base, EGL_COLOR_BUFFER_TYPE ,EGL_RGB_BUFFER);
-   EGLint r = (_eglGetConfigKey(conf-base, EGL_RED_SIZE) 
-   + _eglGetConfigKey(conf-base, EGL_GREEN_SIZE)
-   + _eglGetConfigKey(conf-base, EGL_BLUE_SIZE)
-   + _eglGetConfigKey(conf-base, EGL_ALPHA_SIZE));
-   _eglSetConfigKey(conf-base, EGL_BUFFER_SIZE, r);
-   _eglSetConfigKey(conf-base, EGL_CONFIG_CAVEAT, EGL_NONE);
-   _eglSetConfigKey(conf-base, EGL_CONFIG_ID, 1);
-   _eglSetConfigKey(conf-base, EGL_BIND_TO_TEXTURE_RGB ,EGL_FALSE);
-   _eglSetConfigKey(conf-base, EGL_BIND_TO_TEXTURE_RGBA ,EGL_FALSE);
-   _eglSetConfigKey(conf-base, EGL_STENCIL_SIZE ,0);
-   _eglSetConfigKey(conf-base, EGL_TRANSPARENT_TYPE ,EGL_NONE);
-_eglSetConfigKey(conf-base, EGL_NATIVE_RENDERABLE ,EGL_TRUE); // 
Let's say yes
-   _eglSetConfigKey(conf-base, EGL_NATIVE_VISUAL_ID ,0); // No visual
-   _eglSetConfigKey(conf-base, EGL_NATIVE_VISUAL_TYPE ,EGL_NONE); // No 
visual
-   _eglSetConfigKey(conf-base, EGL_RENDERABLE_TYPE ,0x8);
-   _eglSetConfigKey(conf-base, EGL_SAMPLE_BUFFERS ,0); // TODO: How to 
get the right value ?
-   _eglSetConfigKey(conf-base, EGL_SAMPLES 
,_eglGetConfigKey(conf-base, EGL_SAMPLE_BUFFERS) == 0 ? 0 : 0);
-   _eglSetConfigKey(conf-base, EGL_DEPTH_SIZE ,24); // TODO: How to get 
the right value ?
-   _eglSetConfigKey(conf-base, EGL_LEVEL ,0);
-   _eglSetConfigKey(conf-base, EGL_MAX_PBUFFER_WIDTH ,0); // TODO: How 
to get the right value ?
-   _eglSetConfigKey(conf-base, EGL_MAX_PBUFFER_HEIGHT ,0); // TODO: How 
to get the right value ?
-   

[Mesa-dev] [PATCH 2/4] egl: Clean up Haiku visual creation

2014-12-22 Thread Alexander von Gluck IV
* Only create one struct
* 'final' also is a language conflict
* Some style cleanup
---
 src/egl/drivers/haiku/egl_haiku.cpp |   96 +--
 1 files changed, 47 insertions(+), 49 deletions(-)

diff --git a/src/egl/drivers/haiku/egl_haiku.cpp 
b/src/egl/drivers/haiku/egl_haiku.cpp
index ff6e171..f94a34b 100644
--- a/src/egl/drivers/haiku/egl_haiku.cpp
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -51,16 +51,16 @@ _EGL_DRIVER_STANDARD_TYPECASTS(haiku_egl)
 
 struct haiku_egl_driver
 {
-   _EGLDriver base;
+   _EGLDriver base;
 
-   void *handle;
-   _EGLProc (*get_proc_address)(const char *procname);
-   void (*glFlush)(void);
+   void *handle;
+   _EGLProc (*get_proc_address)(const char *procname);
+   void (*glFlush)(void);
 };
 
 struct haiku_egl_config
 {
-   _EGLConfig base;
+   _EGLConfig base;
 };
 
 struct haiku_egl_context
@@ -146,7 +146,7 @@ static _EGLSurface *
 haiku_create_surface(_EGLDriver *drv, _EGLDisplay *disp, EGLint type,
_EGLConfig *conf, void *native_surface, const EGLint *attrib_list)
 {
-   return NULL;
+   return NULL;
 }
 
 
@@ -183,7 +183,7 @@ static _EGLSurface *
 haiku_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, void *native_pixmap, const EGLint *attrib_list)
 {
-   return NULL;
+   return NULL;
 }
 
 
@@ -191,7 +191,7 @@ static _EGLSurface *
 haiku_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
_EGLConfig *conf, const EGLint *attrib_list)
 {
-   return NULL;
+   return NULL;
 }
 
 
@@ -206,57 +206,55 @@ static EGLBoolean
 haiku_add_configs_for_visuals(_EGLDisplay *dpy)
 {
printf(Adding configs\n);
-   struct haiku_egl_config conf, *final;
-   //conf=CALLOC_STRUCT(haiku_egl_config);
-   memset(conf, 0, sizeof(conf));
-   _eglInitConfig(conf.base, dpy, 1);
+
+   struct haiku_egl_config* conf;
+   conf = CALLOC_STRUCT(haiku_egl_config);
+
+   _eglInitConfig(conf-base, dpy, 1);
_eglLog(_EGL_DEBUG,Config inited\n);
-   _eglSetConfigKey(conf.base, EGL_RED_SIZE ,8);
-   _eglSetConfigKey(conf.base, EGL_BLUE_SIZE ,8);
-   _eglSetConfigKey(conf.base, EGL_GREEN_SIZE ,8);
-   _eglSetConfigKey(conf.base, EGL_LUMINANCE_SIZE ,0);
-   _eglSetConfigKey(conf.base, EGL_ALPHA_SIZE ,8);
-   _eglSetConfigKey(conf.base, EGL_COLOR_BUFFER_TYPE ,EGL_RGB_BUFFER);
-   EGLint r = (_eglGetConfigKey(conf.base, EGL_RED_SIZE) 
-   + _eglGetConfigKey(conf.base, EGL_GREEN_SIZE)
-   + _eglGetConfigKey(conf.base, EGL_BLUE_SIZE)
-   + _eglGetConfigKey(conf.base, EGL_ALPHA_SIZE));
-   _eglSetConfigKey(conf.base, EGL_BUFFER_SIZE, r);
-   _eglSetConfigKey(conf.base, EGL_CONFIG_CAVEAT, EGL_NONE);
-   _eglSetConfigKey(conf.base, EGL_CONFIG_ID, 1);
-   _eglSetConfigKey(conf.base, EGL_BIND_TO_TEXTURE_RGB ,EGL_FALSE);
-   _eglSetConfigKey(conf.base, EGL_BIND_TO_TEXTURE_RGBA ,EGL_FALSE);
-   _eglSetConfigKey(conf.base, EGL_STENCIL_SIZE ,0);
-   _eglSetConfigKey(conf.base, EGL_TRANSPARENT_TYPE ,EGL_NONE);
-   _eglSetConfigKey(conf.base, EGL_NATIVE_RENDERABLE ,EGL_TRUE); // Let's 
say yes
-   _eglSetConfigKey(conf.base, EGL_NATIVE_VISUAL_ID ,0); // No visual
-   _eglSetConfigKey(conf.base, EGL_NATIVE_VISUAL_TYPE ,EGL_NONE); // No 
visual
-   _eglSetConfigKey(conf.base, EGL_RENDERABLE_TYPE ,0x8);
-   _eglSetConfigKey(conf.base, EGL_SAMPLE_BUFFERS ,0); // TODO: How to 
get the right value ?
-   _eglSetConfigKey(conf.base, EGL_SAMPLES ,_eglGetConfigKey(conf.base, 
EGL_SAMPLE_BUFFERS) == 0 ? 0 : 0);
-   _eglSetConfigKey(conf.base, EGL_DEPTH_SIZE ,24); // TODO: How to get 
the right value ?
-   _eglSetConfigKey(conf.base, EGL_LEVEL ,0);
-   _eglSetConfigKey(conf.base, EGL_MAX_PBUFFER_WIDTH ,0); // TODO: How to 
get the right value ?
-   _eglSetConfigKey(conf.base, EGL_MAX_PBUFFER_HEIGHT ,0); // TODO: How 
to get the right value ?
-   _eglSetConfigKey(conf.base, EGL_MAX_PBUFFER_PIXELS ,0); // TODO: How 
to get the right value ?
-   _eglSetConfigKey(conf.base, EGL_SURFACE_TYPE, EGL_WINDOW_BIT /*| 
EGL_PIXMAP_BIT | EGL_PBUFFER_BIT*/);
-
-   printf(Config configurated\n);
-   if (!_eglValidateConfig(conf.base, EGL_FALSE)) {
+   _eglSetConfigKey(conf-base, EGL_RED_SIZE, 8);
+   _eglSetConfigKey(conf-base, EGL_BLUE_SIZE, 8);
+   _eglSetConfigKey(conf-base, EGL_GREEN_SIZE, 8);
+   _eglSetConfigKey(conf-base, EGL_LUMINANCE_SIZE, 0);
+   _eglSetConfigKey(conf-base, EGL_ALPHA_SIZE, 8);
+   _eglSetConfigKey(conf-base, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
+   EGLint r = (_eglGetConfigKey(conf-base, EGL_RED_SIZE) 
+   + _eglGetConfigKey(conf-base, EGL_GREEN_SIZE)
+   + _eglGetConfigKey(conf-base, EGL_BLUE_SIZE)
+   + _eglGetConfigKey(conf-base, EGL_ALPHA_SIZE));
+   _eglSetConfigKey(conf-base, EGL_BUFFER_SIZE, r);
+   

[Mesa-dev] [PATCH 3/4] egl/dri2: Fix build of dri2 egl driver with SCons

2014-12-22 Thread Alexander von Gluck IV
* egl/dri2 was missing a SConscript
* Problem caught by Adrián Arroyo Calle
---
 src/egl/drivers/dri2/SConscript |   40 +++
 1 files changed, 40 insertions(+), 0 deletions(-)
 create mode 100644 src/egl/drivers/dri2/SConscript

diff --git a/src/egl/drivers/dri2/SConscript b/src/egl/drivers/dri2/SConscript
new file mode 100644
index 000..5b03107
--- /dev/null
+++ b/src/egl/drivers/dri2/SConscript
@@ -0,0 +1,40 @@
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPDEFINES = [
+   'DEFAULT_DRIVER_DIR='
+])
+
+env.Append(CPPPATH = [
+   '#/include',
+   '#/src/egl/main',
+   '#/src/loader',
+])
+
+sources = [
+   'egl_dri2.c',
+]
+
+if env['x11']:
+   sources.append('platform_x11.c')
+   env.Append(CPPDEFINES = [
+   'HAVE_X11_PLATFORM',
+   ])
+   #env.Append(CPPPATH = [
+   #   'XCB_DRI2_CFLAGS',
+   #])
+
+if env['drm']:
+   env.PkgUseModules('DRM')
+
+env.Prepend(LIBS = [
+   libloader,
+])
+
+egl_dri2 = env.ConvenienceLibrary(
+   target = 'egl_dri2',
+   source = sources,
+)
+
+Export('egl_dri2')
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/4] egl/haiku: Clean up SConscript whitespace

2014-12-22 Thread Alexander von Gluck IV
---
 src/egl/drivers/haiku/SConscript |   25 -
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/egl/drivers/haiku/SConscript b/src/egl/drivers/haiku/SConscript
index 2c38599..9dd2f70 100644
--- a/src/egl/drivers/haiku/SConscript
+++ b/src/egl/drivers/haiku/SConscript
@@ -3,33 +3,32 @@ Import('*')
 env = env.Clone()
 
 env.Append(CPPDEFINES = [
-'DEFAULT_DRIVER_DIR=',
+   'DEFAULT_DRIVER_DIR=',
 ])
 
 env.Append(CPPPATH = [
-'#/include',
-'#/src/egl/main',
-'#/src/loader',
+   '#/include',
+   '#/src/egl/main',
+   '#/src/loader',
 ])
 
 sources = [
-'egl_haiku.cpp'
+   'egl_haiku.cpp'
 ]
 
 if env['platform'] == 'haiku':
-env.Append(CPPDEFINES = [
-'HAVE_HAIKU_PLATFORM',
-'_EGL_NATIVE_PLATFORM=haiku',
-])
+   env.Append(CPPDEFINES = [
+   'HAVE_HAIKU_PLATFORM',
+   '_EGL_NATIVE_PLATFORM=haiku',
+   ])
 
 env.Prepend(LIBS = [
-libloader,
+   libloader,
 ])
 
 egl_haiku = env.ConvenienceLibrary(
-#egl_dri2 = env.SharedLibrary(
-target = 'egl_haiku',
-source = sources,
+   target = 'egl_haiku',
+   source = sources,
 )
 
 Export('egl_haiku')
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] egl: Add Haiku code and support

2014-12-22 Thread Alexander von Gluck IV
* This is the cleaned up work of the Haiku GCI student
  Adrián Arroyo Calle adrian.arroyoca...@gmail.com
* Several patches were consolidated to prevent
  unnecessary touching of non-related code
---
 include/EGL/eglplatform.h   |   10 +-
 src/SConscript  |4 +
 src/egl/drivers/haiku/SConscript|   35 +++
 src/egl/drivers/haiku/egl_haiku.cpp |  438 +++
 src/egl/main/SConscript |   23 ++-
 src/egl/main/eglapi.c   |2 +
 src/egl/main/egldisplay.c   |7 +-
 src/egl/main/egldisplay.h   |1 +
 src/egl/main/egldriver.c|6 +
 src/gallium/SConscript  |2 +-
 10 files changed, 523 insertions(+), 5 deletions(-)
 create mode 100644 src/egl/drivers/haiku/SConscript
 create mode 100644 src/egl/drivers/haiku/egl_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..eb4cd3c 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -33,6 +33,10 @@ 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']:
+SConscript('egl/drivers/dri2/SConscript')
+SConscript('egl/main/SConscript')
+if env['platform'] == 'haiku':
+SConscript('egl/drivers/haiku/SConscript')
 SConscript('egl/main/SConscript')
 
 if env['gles']:
diff --git a/src/egl/drivers/haiku/SConscript b/src/egl/drivers/haiku/SConscript
new file mode 100644
index 000..2c38599
--- /dev/null
+++ b/src/egl/drivers/haiku/SConscript
@@ -0,0 +1,35 @@
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPDEFINES = [
+'DEFAULT_DRIVER_DIR=',
+])
+
+env.Append(CPPPATH = [
+'#/include',
+'#/src/egl/main',
+'#/src/loader',
+])
+
+sources = [
+'egl_haiku.cpp'
+]
+
+if env['platform'] == 'haiku':
+env.Append(CPPDEFINES = [
+'HAVE_HAIKU_PLATFORM',
+'_EGL_NATIVE_PLATFORM=haiku',
+])
+
+env.Prepend(LIBS = [
+libloader,
+])
+
+egl_haiku = env.ConvenienceLibrary(
+#egl_dri2 = env.SharedLibrary(
+target = 'egl_haiku',
+source = sources,
+)
+
+Export('egl_haiku')
diff --git a/src/egl/drivers/haiku/egl_haiku.cpp 
b/src/egl/drivers/haiku/egl_haiku.cpp
new file mode 100644
index 000..ff6e171
--- /dev/null
+++ b/src/egl/drivers/haiku/egl_haiku.cpp
@@ -0,0 +1,438 @@
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 2014 Adrián Arroyo Calle adrian.arroyoca...@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 stdio.h
+
+extern C {
+#include loader.h
+#include eglconfig.h
+#include eglcontext.h
+#include egldisplay.h
+#include egldriver.h
+#include eglcurrent.h
+#include egllog.h
+#include eglsurface.h
+#include eglimage.h
+#include egltypedefs.h
+}
+
+#include InterfaceKit.h
+#include OpenGLKit.h
+
+
+#define CALLOC_STRUCT(T)   (struct T *) calloc(1, sizeof(struct T))
+
+
+_EGL_DRIVER_STANDARD_TYPECASTS(haiku_egl)
+
+
+struct haiku_egl_driver
+{
+   _EGLDriver 

[Mesa-dev] [PATCH] mesa/drivers: Add missing mesautil lib to Haiku swrast

2014-12-10 Thread Alexander von Gluck IV
* Resolves missing util_format_linear_to_srgb_8unorm_table symbol.
---
 src/mesa/drivers/haiku/swrast/SConscript | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/mesa/drivers/haiku/swrast/SConscript 
b/src/mesa/drivers/haiku/swrast/SConscript
index 2c25f72..907325e 100644
--- a/src/mesa/drivers/haiku/swrast/SConscript
+++ b/src/mesa/drivers/haiku/swrast/SConscript
@@ -13,6 +13,7 @@ env.Append(CPPPATH = [
 ])
 
 env.Prepend(LIBS = [
+mesautil,
 glsl,
 mesa,
 ])
-- 
1.8.3.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium/aux: Avoid redefining MAX

2014-12-09 Thread Alexander von Gluck IV
* Can be redefined on some platforms through u_debug.h
---
 src/gallium/auxiliary/cso_cache/cso_hash.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.c 
b/src/gallium/auxiliary/cso_cache/cso_hash.c
index e04d8ed..2a3f361 100644
--- a/src/gallium/auxiliary/cso_cache/cso_hash.c
+++ b/src/gallium/auxiliary/cso_cache/cso_hash.c
@@ -35,7 +35,9 @@
 
 #include cso_hash.h
 
+#ifndef MAX
 #define MAX(a, b) ((a  b) ? (a) : (b))
+#endif
 
 static const int MinNumBits = 4;
 
-- 
1.8.3.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium/aux: Avoid redefining MAX

2014-12-09 Thread Alexander von Gluck IV

* Can be redefined on some platforms through u_debug.h
---
 src/gallium/auxiliary/cso_cache/cso_hash.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.c 
b/src/gallium/auxiliary/cso_cache/cso_hash.c

index e04d8ed..2a3f361 100644
--- a/src/gallium/auxiliary/cso_cache/cso_hash.c
+++ b/src/gallium/auxiliary/cso_cache/cso_hash.c
@@ -35,7 +35,9 @@

 #include cso_hash.h

+#ifndef MAX
 #define MAX(a, b) ((a  b) ? (a) : (b))
+#endif

 static const int MinNumBits = 4;

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] gallium/aux: Avoid redefining MAX

2014-12-09 Thread Alexander von Gluck IV
* Can be redefined on some platforms through u_debug.h
---
 src/gallium/auxiliary/cso_cache/cso_hash.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.c 
b/src/gallium/auxiliary/cso_cache/cso_hash.c
index e04d8ed..2a3f361 100644
--- a/src/gallium/auxiliary/cso_cache/cso_hash.c
+++ b/src/gallium/auxiliary/cso_cache/cso_hash.c
@@ -35,7 +35,9 @@
 
 #include cso_hash.h
 
+#ifndef MAX
 #define MAX(a, b) ((a  b) ? (a) : (b))
+#endif
 
 static const int MinNumBits = 4;
 
-- 
1.8.3.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] gallium/target: Haiku softpipe

2014-12-09 Thread Alexander von Gluck IV
* Use print macro to fix warning on 64-bit systems
---
 src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp 
b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
index 0ae9e52..77cafd4 100644
--- a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
+++ b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
@@ -355,7 +355,7 @@ SoftwareRenderer::_AllocateBitmap()
return;
}
 
-   TRACE(%s: New bitmap size: %ld x %ld\n, __func__,
+   TRACE(%s: New bitmap size: % B_PRId32  x % B_PRId32 \n, __func__,
fBitmap-Bounds().IntegerWidth(), 
fBitmap-Bounds().IntegerHeight());
 
fContextObj-ResizeViewport(fWidth, fHeight);
-- 
1.8.3.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] hgl: traverse add-on entries

2014-12-09 Thread Alexander von Gluck IV
From: Adrien Destugues pulkoma...@gmail.com

* Allow using symlinks to add-ons when developing.
---
 src/hgl/GLRendererRoster.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/hgl/GLRendererRoster.cpp b/src/hgl/GLRendererRoster.cpp
index d29f7ec..9e5d847 100644
--- a/src/hgl/GLRendererRoster.cpp
+++ b/src/hgl/GLRendererRoster.cpp
@@ -144,7 +144,7 @@ GLRendererRoster::AddPath(const char* path)
entry_ref ref;
BEntry entry;
while (directory.GetNextRef(ref) == B_OK) {
-   entry.SetTo(ref);
+   entry.SetTo(ref, true);
if (entry.InitCheck() == B_OK  !entry.IsFile())
continue;
 
@@ -187,7 +187,7 @@ GLRendererRoster::AddRenderer(BGLRenderer* renderer,
 status_t
 GLRendererRoster::CreateRenderer(const entry_ref ref)
 {
-   BEntry entry(ref);
+   BEntry entry(ref, true);
node_ref nodeRef;
status_t status = entry.GetNodeRef(nodeRef);
if (status  B_OK)
-- 
1.8.3.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] gallium/aux: Avoid redefining MAX

2014-12-09 Thread Alexander von Gluck IV

On , Matt Turner wrote:

On Tue, Dec 9, 2014 at 1:21 PM, Alexander von Gluck
kallist...@gmail.com wrote:

* Can be redefined on some platforms through u_debug.h


I think this is now the fourth copy of this message I've received?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Sorry, it wasn't on purpose :-(
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] st/hgl: Move st_visual create/destroy into hgl state_tracker

2014-08-29 Thread Alexander von Gluck IV
---
 src/gallium/state_trackers/hgl/hgl.c   |  103 +++-
 src/gallium/state_trackers/hgl/hgl_context.h   |4 +
 .../targets/haiku-softpipe/GalliumContext.cpp  |  102 +--
 .../targets/haiku-softpipe/GalliumContext.h|2 -
 4 files changed, 111 insertions(+), 100 deletions(-)

diff --git a/src/gallium/state_trackers/hgl/hgl.c 
b/src/gallium/state_trackers/hgl/hgl.c
index 66abc61..ce2ffb1 100644
--- a/src/gallium/state_trackers/hgl/hgl.c
+++ b/src/gallium/state_trackers/hgl/hgl.c
@@ -8,6 +8,8 @@
  */
 
 
+#include GLView.h
+
 #include main/context.h
 #include main/framebuffer.h
 #include main/renderbuffer.h
@@ -134,7 +136,7 @@ hgl_st_framebuffer_validate(struct st_context_iface *stctx,
 static int
 hgl_st_manager_get_param(struct st_manager *smapi, enum st_manager_param param)
 {
-CALLED();
+   CALLED();
 
switch (param) {
case ST_MANAGER_BROKEN_INVALIDATE:
@@ -215,3 +217,102 @@ hgl_destroy_st_manager(struct st_manager *manager)
if (manager)
FREE(manager);
 }
+
+
+struct st_visual*
+hgl_create_st_visual(ulong options)
+{
+   struct st_visual* visual = CALLOC_STRUCT(st_visual);
+   if (!visual) {
+   ERROR(%s: Couldn't allocate st_visual\n, __func__);
+   return NULL;
+   }
+
+   // Calculate visual configuration
+   const GLboolean rgbFlag = ((options  BGL_INDEX) == 0);
+   const GLboolean alphaFlag   = ((options  BGL_ALPHA) == BGL_ALPHA);
+   const GLboolean dblFlag = ((options  BGL_DOUBLE) == BGL_DOUBLE);
+   const GLboolean stereoFlag  = false;
+   const GLint depth   = (options  BGL_DEPTH) ? 24 : 0;
+   const GLint stencil = (options  BGL_STENCIL) ? 8 : 0;
+   const GLint accum   = (options  BGL_ACCUM) ? 16 : 0;
+   const GLint red = rgbFlag ? 8 : 5;
+   const GLint green   = rgbFlag ? 8 : 5;
+   const GLint blue= rgbFlag ? 8 : 5;
+   const GLint alpha   = alphaFlag ? 8 : 0;
+
+   TRACE(rgb  :\t%d\n, (bool)rgbFlag);
+   TRACE(alpha:\t%d\n, (bool)alphaFlag);
+   TRACE(dbl  :\t%d\n, (bool)dblFlag);
+   TRACE(stereo   :\t%d\n, (bool)stereoFlag);
+   TRACE(depth:\t%d\n, depth);
+   TRACE(stencil  :\t%d\n, stencil);
+   TRACE(accum:\t%d\n, accum);
+   TRACE(red  :\t%d\n, red);
+   TRACE(green:\t%d\n, green);
+   TRACE(blue :\t%d\n, blue);
+   TRACE(alpha:\t%d\n, alpha);
+
+   // Determine color format
+   if (red == 8) {
+   if (alpha == 8)
+   visual-color_format = PIPE_FORMAT_A8R8G8B8_UNORM;
+   else
+   visual-color_format = PIPE_FORMAT_X8R8G8B8_UNORM;
+   } else {
+   // TODO: I think this should be RGB vs BGR
+   visual-color_format = PIPE_FORMAT_B5G6R5_UNORM;
+}
+
+   // Determine depth stencil format
+   switch (depth) {
+   default:
+   case 0:
+   visual-depth_stencil_format = PIPE_FORMAT_NONE;
+   break;
+   case 16:
+   visual-depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
+   break;
+   case 24:
+   if ((options  BGL_STENCIL) != 0)
+   visual-depth_stencil_format = 
PIPE_FORMAT_S8_UINT_Z24_UNORM;
+   else
+   visual-depth_stencil_format = 
PIPE_FORMAT_X8Z24_UNORM;
+   break;
+   case 32:
+   visual-depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
+   break;
+   }
+
+   visual-accum_format = (options  BGL_ACCUM)
+   ? PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
+
+   visual-buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
+   visual-render_buffer = ST_ATTACHMENT_FRONT_LEFT;
+
+   if (dblFlag) {
+   visual-buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
+   visual-render_buffer = ST_ATTACHMENT_BACK_LEFT;
+   }
+
+   if (stereoFlag) {
+   visual-buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
+   if (dblFlag)
+   visual-buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
+}
+
+   if ((options  BGL_DEPTH) || (options  BGL_STENCIL))
+   visual-buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
+
+   return visual;
+}
+
+
+void
+hgl_destroy_st_visual(struct st_visual* visual)
+{
+   CALLED();
+
+   if (visual)
+   FREE(visual);
+}
diff --git a/src/gallium/state_trackers/hgl/hgl_context.h 
b/src/gallium/state_trackers/hgl/hgl_context.h
index a520d49..1d98414 100644
--- a/src/gallium/state_trackers/hgl/hgl_context.h
+++ b/src/gallium/state_trackers/hgl/hgl_context.h
@@ -80,5 +80,9 @@ struct hgl_buffer* 

[Mesa-dev] [PATCH 1/2] st/hgl: Move st_manager create/destroy into hgl state_tracker

2014-08-29 Thread Alexander von Gluck IV
---
 src/gallium/state_trackers/hgl/hgl.c   |   50 +++-
 src/gallium/state_trackers/hgl/hgl_context.h   |5 ++
 .../targets/haiku-softpipe/GalliumContext.cpp  |   32 ++---
 3 files changed, 58 insertions(+), 29 deletions(-)

diff --git a/src/gallium/state_trackers/hgl/hgl.c 
b/src/gallium/state_trackers/hgl/hgl.c
index 8dcd6e3..66abc61 100644
--- a/src/gallium/state_trackers/hgl/hgl.c
+++ b/src/gallium/state_trackers/hgl/hgl.c
@@ -131,6 +131,23 @@ hgl_st_framebuffer_validate(struct st_context_iface *stctx,
 }
 
 
+static int
+hgl_st_manager_get_param(struct st_manager *smapi, enum st_manager_param param)
+{
+CALLED();
+
+   switch (param) {
+   case ST_MANAGER_BROKEN_INVALIDATE:
+   TRACE(%s: TODO: How should we handle BROKEN_INVALIDATE 
calls?\n,
+   __func__);
+   // For now we force validation of the framebuffer.
+   return 1;
+   }
+
+   return 0;
+}
+
+
 /**
  * Create new framebuffer
  */
@@ -148,7 +165,7 @@ hgl_create_st_framebuffer(struct hgl_context* context)
// Copy context visual into framebuffer
memcpy(buffer-visual, context-stVisual, sizeof(struct 
st_visual));
 
-   // calloc our st_framebuffer interface
+   // calloc and configure our st_framebuffer interface
buffer-stfbi = CALLOC_STRUCT(st_framebuffer_iface);
if (!buffer-stfbi) {
ERROR(%s: Couldn't calloc framebuffer!\n, __func__);
@@ -167,3 +184,34 @@ hgl_create_st_framebuffer(struct hgl_context* context)
 
return buffer;
 }
+
+
+struct st_manager *
+hgl_create_st_manager(struct pipe_screen* screen)
+{
+   CALLED();
+
+   assert(screen);
+   struct st_manager* manager = CALLOC_STRUCT(st_manager);
+
+   if (!manager) {
+   ERROR(%s: Couldn't allocate state tracker manager!\n, 
__func__);
+   return NULL;
+   }
+
+   //manager-display = dpy;
+   manager-screen = screen;
+   manager-get_param = hgl_st_manager_get_param;
+
+   return manager;
+}
+
+
+void
+hgl_destroy_st_manager(struct st_manager *manager)
+{
+   CALLED();
+
+   if (manager)
+   FREE(manager);
+}
diff --git a/src/gallium/state_trackers/hgl/hgl_context.h 
b/src/gallium/state_trackers/hgl/hgl_context.h
index f1f43fa..a520d49 100644
--- a/src/gallium/state_trackers/hgl/hgl_context.h
+++ b/src/gallium/state_trackers/hgl/hgl_context.h
@@ -73,7 +73,12 @@ struct hgl_context
 };
 
 
+// hgl state_tracker framebuffer
 struct hgl_buffer* hgl_create_st_framebuffer(struct hgl_context* context);
 
+// hgl state_tracker manager
+struct st_manager* hgl_create_st_manager(struct pipe_screen* screen);
+void hgl_destroy_st_manager(struct st_manager *manager);
+
 
 #endif /* HGL_CONTEXT_H */
diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index d7d5d9d..ed41712 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -69,23 +69,6 @@ hgl_viewport(struct gl_context* glContext)
 }
 
 
-static int
-hook_stm_get_param(struct st_manager *smapi, enum st_manager_param param)
-{
-   CALLED();
-
-   switch (param) {
-   case ST_MANAGER_BROKEN_INVALIDATE:
-   TRACE(%s: TODO: How should we handle BROKEN_INVALIDATE 
calls?\n,
-   __func__);
-   // For now we force validation of the framebuffer.
-   return 1;
-   }
-
-   return 0;
-}
-
-
 GalliumContext::GalliumContext(ulong options)
:
fOptions(options),
@@ -264,12 +247,8 @@ GalliumContext::CreateContext(Bitmap *bitmap)
return -1;
}
 
-   context-manager = CALLOC_STRUCT(st_manager);
-   if (!context-manager) {
-   ERROR(%s: Couldn't allocate Mesa state tracker manager!\n, 
__func__);
-   return -1;
-   }
-   context-manager-get_param = hook_stm_get_param;
+   // Create state_tracker manager
+   context-manager = hgl_create_st_manager(fScreen);
 
// Create state tracker visual
context-stVisual = CreateVisual();
@@ -287,9 +266,6 @@ GalliumContext::CreateContext(Bitmap *bitmap)
return -1;
}
 
-   // We need to assign the screen *before* calling st_api create_context
-   context-manager-screen = fScreen;
-
// Build state tracker attributes
struct st_context_attribs attribs;
memset(attribs, 0, sizeof(attribs));
@@ -405,7 +381,7 @@ GalliumContext::DestroyContext(context_id contextID)
FREE(fContext[contextID]-stVisual);
 
if (fContext[contextID]-manager)
-   FREE(fContext[contextID]-manager);
+   hgl_destroy_st_manager(fContext[contextID]-manager);
 

Re: [Mesa-dev] [PATCH 3/4] targets/haiku-softpipe: explicitly prefix sw/hgl header

2014-08-28 Thread Alexander von Gluck IV

On , Emil Velikov wrote:

Cc: Alexander von Gluck IV kallis...@unixzen.com

Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/targets/haiku-softpipe/GalliumContext.cpp | 2 +-
 src/gallium/targets/haiku-softpipe/SConscript | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index c740458..d7d5d9d 100644


Woot!

I have a rather large patch on the ML that isn't applied yet...

Can I get your sign-off on it?  I have a feeling these patches
are going to collide.

http://patchwork.freedesktop.org/patch/32512/
http://patchwork.freedesktop.og/patch/32513/


 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] gallium/targets: Break haiku state_tracker out to own directory

2014-08-28 Thread Alexander von Gluck IV

On , Emil Velikov wrote:

On 28/08/14 01:31, Alexander von Gluck IV wrote:

Hi Alex,
Does that mean that we'll get non-softpipe hgl drivers soon :P


Maybe!

I'm mostly cleaning all of this up in preperation for work on a 
haiku-intel
target on my github. Not sure if it will go anywhere, but I really want 
to

make some progress on the hardware rendering front.

Feel free to squash the attached patch. It cleans up a couple of 
whitespace
issues + adds st/hgl to EXTRA_DIST (so that it gets picked up by 'make 
dist')




Thanks!

I *always* am looking for cleanup / help with this stuff. Even if those 
changes
cause minor breakage, i'm definitely not the most knowledgeable person 
on Mesa :-)



P.S. Is it worth prefixing the functions exported by bitmap_wrapper.h ?


Yeah, I likely should be.
bitmap_wrapper is so we can manage Haiku C++ BBitmaps from the C gallium 
code.


 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: Correct string.h to strings.h

2014-08-27 Thread Alexander von Gluck IV

On , Kenneth Graunke wrote:

On Wednesday, August 27, 2014 11:35:06 AM Alexander von Gluck IV wrote:

* IEEE Std 1003.1-2001 placed strcasecmp() in strings.h.
* On a lot of platforms, strcasecmp is in strings.h and string.h
* Technically strcasecmp should be only in strings.h
* Haiku decided to stop providing strcasecmp in string.h as it
  is a crutch to code looking in the wrong place.
---
 src/glsl/glsl_parser.yy |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 2f30b85..33c2f20 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -23,7 +23,7 @@
  */
 #include stdio.h
 #include stdlib.h
-#include string.h
+#include strings.h
 #include assert.h

 #include ast.h



But it also uses strcmp(), which is definitely defined in string.h.
It sounds like we should include both.


I agree... however I hear that windows doesn't do strings.h.

Thinking maybe #include string.h and ifndef _MSC_VER #include 
strings.h ?


I confirmed that ISO C99 doesn't mention strcase* in string.h and IEEE 
std

1003.1-2001 shows strcase* only in strings.h

Any operating systems including strcase* in strings.h is doing it for 
legacy

compatibility for software pre-2001.

Man page for strcasecmp also confirms it's in strings.h:
http://linux.die.net/man/3/strcasecmp

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glsl: Add strings.h on non-MSC platforms

2014-08-27 Thread Alexander von Gluck IV
* IEEE Std 1003.1-2001 placed strcasecmp() in strings.h.
* ISO C99 doesn't mention strcase* in string.h
* On all platforms I could find, strcasecmp is in strings.h and string.h
  as a compatibility layer for software written pre-2001 POSIX
* Technically strcasecmp should be only in strings.h and the man
  pages back this up.
---
 src/glsl/glsl_parser.yy |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
index 2f30b85..6160e26 100644
--- a/src/glsl/glsl_parser.yy
+++ b/src/glsl/glsl_parser.yy
@@ -24,6 +24,9 @@
 #include stdio.h
 #include stdlib.h
 #include string.h
+#ifndef _MSC_VER
+#include strings.h
+#endif
 #include assert.h
 
 #include ast.h
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] gallium/targets: Haiku softpipe, perform better framebuffer validation

2014-08-27 Thread Alexander von Gluck IV
* Check for back left attachment as well
* Set and act on pipe format none
---
 .../targets/haiku-softpipe/GalliumFramebuffer.cpp  |   20 +---
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
index 84c8bd2..d6bfdb4 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
@@ -100,8 +100,10 @@ hgl_framebuffer_validate(struct st_context_iface* stctx,

switch(statts[i]) {
case ST_ATTACHMENT_FRONT_LEFT:
+   case ST_ATTACHMENT_BACK_LEFT:
format = 
context-stVisual-color_format;
-   bind = PIPE_BIND_RENDER_TARGET;
+   bind = PIPE_BIND_DISPLAY_TARGET
+   | PIPE_BIND_RENDER_TARGET;
break;
case ST_ATTACHMENT_DEPTH_STENCIL:
format = 
context-stVisual-depth_stencil_format;
@@ -112,14 +114,18 @@ hgl_framebuffer_validate(struct st_context_iface* stctx,
bind = PIPE_BIND_RENDER_TARGET;
break;
default:
-   ERROR(%s: Unexpected attachment 
type!\n, __func__);
+   format = PIPE_FORMAT_NONE;
+   break;
}
-   templat.format = format;
-   templat.bind = bind;
 
-   struct pipe_screen* screen = context-manager-screen;
-   context-textures[i] = screen-resource_create(screen, 
templat);
-   out[i] = context-textures[i];
+   if (format != PIPE_FORMAT_NONE) {
+   templat.format = format;
+   templat.bind = bind;
+
+   struct pipe_screen* screen = 
context-manager-screen;
+   context-textures[i] = 
screen-resource_create(screen, templat);
+   out[i] = context-textures[i];
+   }
}
}
 
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] gallium/targets: Break haiku state_tracker out to own directory

2014-08-27 Thread Alexander von Gluck IV
---
 src/gallium/SConscript |1 +
 src/gallium/state_trackers/hgl/SConscript  |   23 +++
 src/gallium/state_trackers/hgl/bitmap_wrapper.cpp  |  146 +++
 src/gallium/state_trackers/hgl/bitmap_wrapper.h|   62 +++
 src/gallium/state_trackers/hgl/hgl.c   |  169 ++
 src/gallium/state_trackers/hgl/hgl_context.h   |   79 
 .../targets/haiku-softpipe/GalliumContext.cpp  |   14 +-
 .../targets/haiku-softpipe/GalliumContext.h|   34 +
 .../targets/haiku-softpipe/GalliumFramebuffer.cpp  |  188 
 .../targets/haiku-softpipe/GalliumFramebuffer.h|   34 
 src/gallium/targets/haiku-softpipe/SConscript  |3 +-
 src/gallium/winsys/sw/hgl/SConscript   |2 +-
 src/gallium/winsys/sw/hgl/bitmap_wrapper.cpp   |  146 ---
 src/gallium/winsys/sw/hgl/bitmap_wrapper.h |   62 ---
 src/hgl/GLRendererRoster.cpp   |2 +-
 15 files changed, 492 insertions(+), 473 deletions(-)
 create mode 100644 src/gallium/state_trackers/hgl/SConscript
 create mode 100644 src/gallium/state_trackers/hgl/bitmap_wrapper.cpp
 create mode 100644 src/gallium/state_trackers/hgl/bitmap_wrapper.h
 create mode 100644 src/gallium/state_trackers/hgl/hgl.c
 create mode 100644 src/gallium/state_trackers/hgl/hgl_context.h
 delete mode 100644 src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
 delete mode 100644 src/gallium/targets/haiku-softpipe/GalliumFramebuffer.h
 delete mode 100644 src/gallium/winsys/sw/hgl/bitmap_wrapper.cpp
 delete mode 100644 src/gallium/winsys/sw/hgl/bitmap_wrapper.h

diff --git a/src/gallium/SConscript b/src/gallium/SConscript
index 98d017e..977e3fb 100644
--- a/src/gallium/SConscript
+++ b/src/gallium/SConscript
@@ -85,6 +85,7 @@ if not env['embedded']:
 
 if env['platform'] == 'haiku':
 SConscript([
+'state_trackers/hgl/SConscript',
 'targets/haiku-softpipe/SConscript',
 ])
 
diff --git a/src/gallium/state_trackers/hgl/SConscript 
b/src/gallium/state_trackers/hgl/SConscript
new file mode 100644
index 000..05b8214
--- /dev/null
+++ b/src/gallium/state_trackers/hgl/SConscript
@@ -0,0 +1,23 @@
+###
+# SConscript for Haiku state_tracker
+
+Import('*')
+
+env = env.Clone()
+
+env.Append(CPPPATH = [
+'#/src',
+'#/src/mapi',
+'#/src/mesa',
+])
+
+sources = [
+'hgl.c',
+   'bitmap_wrapper.cpp',
+]
+
+st_haiku = env.ConvenienceLibrary(
+target = 'st_haiku',
+source = sources
+)
+Export('st_haiku')
diff --git a/src/gallium/state_trackers/hgl/bitmap_wrapper.cpp 
b/src/gallium/state_trackers/hgl/bitmap_wrapper.cpp
new file mode 100644
index 000..ef81edc
--- /dev/null
+++ b/src/gallium/state_trackers/hgl/bitmap_wrapper.cpp
@@ -0,0 +1,146 @@
+/**
+ *
+ * Copyright 2009 Artur Wyszynski harak...@gmail.com
+ * Copyright 2013 Alexander von Gluck IV kallis...@unixzen.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, sub license, 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 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS 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.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ **/
+
+
+#include stdio.h
+#include interface/Bitmap.h
+#include storage/File.h
+#include support/String.h
+#include translation/BitmapStream.h
+#include translation/TranslatorRoster.h
+
+#include bitmap_wrapper.h
+
+
+extern C {
+static int frameNo = 0;
+
+
+Bitmap*
+create_bitmap(int32 width, int32 height, color_space colorSpace)
+{
+   BBitmap *bb = new BBitmap(BRect(0, 0, width, height), colorSpace);
+   if (bb)
+   return (Bitmap*)bb;
+   return NULL;
+}
+
+
+void
+get_bitmap_size(const Bitmap* bitmap, int32* width, int32* height)
+{
+   BBitmap *bb = (BBitmap*)bitmap;
+   if (bb  width  height) {
+   uint32

[Mesa-dev] Haiku GLTeapot, an example of llvmpipe rendering calls

2014-08-24 Thread Alexander von Gluck IV
I have a feeling the Haiku gallium softpipe driver is doing a lot of 
extra work resulting in some performance hits.


In this example, I have tracing enabled and am running the simple 
GLTeapot Be demo.


http://unixzen.com/patchwork/glteapot-log.txt

The terminology should be easy to follow. Anyone see us doing too much 
of anything?


 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/2] gallium/targets: Haiku, Fix some improper type warnings

2014-08-21 Thread Alexander von Gluck IV
---
 .../targets/haiku-softpipe/GalliumFramebuffer.cpp  |2 +-
 .../targets/haiku-softpipe/SoftwareRenderer.cpp|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
index f367d9d..84c8bd2 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
@@ -93,7 +93,7 @@ hgl_framebuffer_validate(struct st_context_iface* stctx,
 
if (context-stVisual  context-manager  context-manager-screen) {
TRACE(%s: Updating resources\n, __func__);
-   int i;
+   unsigned i;
for (i = 0; i  count; i++) {
enum pipe_format format = PIPE_FORMAT_NONE;
unsigned bind = 0;
diff --git a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp 
b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
index 9d85b8d..0ae9e52 100644
--- a/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
+++ b/src/gallium/targets/haiku-softpipe/SoftwareRenderer.cpp
@@ -355,7 +355,7 @@ SoftwareRenderer::_AllocateBitmap()
return;
}
 
-   TRACE(%s: New bitmap size: %d x %d\n, __func__,
+   TRACE(%s: New bitmap size: %ld x %ld\n, __func__,
fBitmap-Bounds().IntegerWidth(), 
fBitmap-Bounds().IntegerHeight());
 
fContextObj-ResizeViewport(fWidth, fHeight);
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] gallium/targets: Clean up Haiku softpipe renderer visual

2014-08-21 Thread Alexander von Gluck IV
* Drop creating gl_config first as it's only really used
  to create the state tracker visual.
---
 .../targets/haiku-softpipe/GalliumContext.cpp  |  196 ++--
 .../targets/haiku-softpipe/GalliumContext.h|2 +
 2 files changed, 96 insertions(+), 102 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index d6b5f85..e64ea65 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -69,70 +69,6 @@ hgl_viewport(struct gl_context* glContext)
 }
 
 
-static st_visual*
-hgl_fill_st_visual(gl_config* glVisual)
-{
-   struct st_visual* stVisual = CALLOC_STRUCT(st_visual);
-   if (!stVisual) {
-   ERROR(%s: Couldn't allocate st_visual\n, __func__);
-   return NULL;
-   }
-
-   // Determine color format
-   if (glVisual-redBits == 8) {
-   if (glVisual-alphaBits == 8)
-   stVisual-color_format = PIPE_FORMAT_A8R8G8B8_UNORM;
-   else
-   stVisual-color_format = PIPE_FORMAT_X8R8G8B8_UNORM;
-   } else {
-   // TODO: I think this should be RGB vs BGR
-   stVisual-color_format = PIPE_FORMAT_B5G6R5_UNORM;
-   }
-
-   // Determine depth stencil format
-   switch (glVisual-depthBits) {
-   default:
-   case 0:
-   stVisual-depth_stencil_format = PIPE_FORMAT_NONE;
-   break;
-   case 16:
-   stVisual-depth_stencil_format = PIPE_FORMAT_Z16_UNORM;
-   break;
-   case 24:
-   if (glVisual-stencilBits == 0) {
-   stVisual-depth_stencil_format = 
PIPE_FORMAT_X8Z24_UNORM;
-   } else {
-   stVisual-depth_stencil_format = 
PIPE_FORMAT_S8_UINT_Z24_UNORM;
-   }
-   break;
-   case 32:
-   stVisual-depth_stencil_format = PIPE_FORMAT_Z32_UNORM;
-   break;
-   }
-
-   stVisual-accum_format = (glVisual-haveAccumBuffer)
-   ? PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;
-
-   stVisual-buffer_mask |= ST_ATTACHMENT_FRONT_LEFT_MASK;
-   stVisual-render_buffer = ST_ATTACHMENT_FRONT_LEFT;
-   if (glVisual-doubleBufferMode) {
-   stVisual-buffer_mask |= ST_ATTACHMENT_BACK_LEFT_MASK;
-   stVisual-render_buffer = ST_ATTACHMENT_BACK_LEFT;
-   }
-
-   if (glVisual-stereoMode) {
-   stVisual-buffer_mask |= ST_ATTACHMENT_FRONT_RIGHT_MASK;
-   if (glVisual-doubleBufferMode)
-   stVisual-buffer_mask |= ST_ATTACHMENT_BACK_RIGHT_MASK;
-   }
-
-   if (glVisual-haveDepthBuffer || glVisual-haveStencilBuffer)
-   stVisual-buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
-
-   return stVisual;
-}
-
-
 static int
 hook_stm_get_param(struct st_manager *smapi, enum st_manager_param param)
 {
@@ -184,6 +120,95 @@ GalliumContext::~GalliumContext()
 }
 
 
+struct st_visual*
+GalliumContext::CreateVisual()
+{
+   struct st_visual* visual = CALLOC_STRUCT(st_visual);
+   if (!visual) {
+   ERROR(%s: Couldn't allocate st_visual\n, __func__);
+   return NULL;
+   }
+
+   // Calculate visual configuration
+   const GLboolean rgbFlag = ((fOptions  BGL_INDEX) == 0);
+   const GLboolean alphaFlag   = ((fOptions  BGL_ALPHA) == BGL_ALPHA);
+   const GLboolean dblFlag = ((fOptions  BGL_DOUBLE) == 
BGL_DOUBLE);
+   const GLboolean stereoFlag  = false;
+   const GLint depth   = (fOptions  BGL_DEPTH) ? 24 : 
0;
+   const GLint stencil = (fOptions  BGL_STENCIL) ? 8 
: 0;
+   const GLint accum   = (fOptions  BGL_ACCUM) ? 16 : 
0;
+   const GLint red = rgbFlag ? 8 : 5;
+   const GLint green   = rgbFlag ? 8 : 5;
+   const GLint blue= rgbFlag ? 8 : 5;
+   const GLint alpha   = alphaFlag ? 8 : 0;
+
+   TRACE(rgb  :\t%d\n, (bool)rgbFlag);
+   TRACE(alpha:\t%d\n, (bool)alphaFlag);
+   TRACE(dbl  :\t%d\n, (bool)dblFlag);
+   TRACE(stereo   :\t%d\n, (bool)stereoFlag);
+   TRACE(depth:\t%d\n, depth);
+   TRACE(stencil  :\t%d\n, stencil);
+   TRACE(accum:\t%d\n, accum);
+   TRACE(red  :\t%d\n, red);
+   TRACE(green:\t%d\n, green);
+   TRACE(blue :\t%d\n, blue);
+   TRACE(alpha:\t%d\n, alpha);
+
+   // Determine color format
+   if (red == 8) {
+   if (alpha == 8)
+   visual-color_format = PIPE_FORMAT_A8R8G8B8_UNORM;
+   else
+

Re: [Mesa-dev] [PATCH 1/2] gallium/targets: Clean up Haiku softpipe renderer visual

2014-08-21 Thread Alexander von Gluck IV

On , Alexander von Gluck IV wrote:

* Drop creating gl_config first as it's only really used
  to create the state tracker visual.
---
 .../targets/haiku-softpipe/GalliumContext.cpp  |  196 
++--

 .../targets/haiku-softpipe/GalliumContext.h|2 +
 2 files changed, 96 insertions(+), 102 deletions(-)

if (!context-draw || !context-read) {
ERROR(%s: Problem allocating framebuffer!\n, __func__);
-   _mesa_destroy_visual(glVisual);
+   //FREE(context-stVisual);
return -1;
}



Whoops, without commenting out the FREE. I was debugging a crash.

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/3] gallium/target: Add needed mesautil lib to haiku-softpipe

2014-08-19 Thread Alexander von Gluck IV
---
 src/gallium/targets/haiku-softpipe/SConscript |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/SConscript 
b/src/gallium/targets/haiku-softpipe/SConscript
index 0381d05..c730fde 100644
--- a/src/gallium/targets/haiku-softpipe/SConscript
+++ b/src/gallium/targets/haiku-softpipe/SConscript
@@ -4,6 +4,7 @@ env.Prepend(LIBS = [
 ws_haiku,
 trace,
 rbug,
+mesautil,
 mesa,
 glsl,
 gallium
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/3] haiku/swrast: Add missing src include search path for missing util/macros.h

2014-08-19 Thread Alexander von Gluck IV
---
 src/mesa/drivers/haiku/swrast/SConscript |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/haiku/swrast/SConscript 
b/src/mesa/drivers/haiku/swrast/SConscript
index aef7300..2c25f72 100644
--- a/src/mesa/drivers/haiku/swrast/SConscript
+++ b/src/mesa/drivers/haiku/swrast/SConscript
@@ -3,6 +3,7 @@ Import('*')
 env = env.Clone()
 
 env.Append(CPPPATH = [
+'#/src',
 '#/src/mapi',
 '#/src/mesa',
 '#/src/mesa/main',
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] gallium/aux: Fill in Haiku get process name code

2014-08-19 Thread Alexander von Gluck IV
---
 src/gallium/auxiliary/os/os_process.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/os/os_process.c 
b/src/gallium/auxiliary/os/os_process.c
index 3e060b9..a626228 100644
--- a/src/gallium/auxiliary/os/os_process.c
+++ b/src/gallium/auxiliary/os/os_process.c
@@ -36,6 +36,9 @@
 #  include errno.h
 #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE)
 #  include stdlib.h
+#elif defined(PIPE_OS_HAIKU)
+#  include kernel/OS.h
+#  include kernel/image.h
 #else
 #warning unexpected platform in os_process.c
 #endif
@@ -73,6 +76,10 @@ os_get_process_name(char *procname, size_t size)
 #elif defined(PIPE_OS_BSD) || defined(PIPE_OS_APPLE)
/* *BSD and OS X */
name = getprogname();
+#elif defined(PIPE_OS_HAIKU)
+   image_info info;
+   get_image_info(B_CURRENT_TEAM, info);
+   name = info.name;
 #else
 #warning unexpected platform in os_process.c
return FALSE;
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 10/19] auxiliary/os: introduce os_get_total_physical_memory helper function

2014-08-18 Thread Alexander von Gluck IV

On , Emil Velikov wrote:

Cc: Alexander von Gluck IV kallis...@unixzen.com
Signed-off-by: Emil Velikov emil.l.veli...@gmail.com
---
 src/gallium/auxiliary/os/os_misc.c | 64 
++

 src/gallium/auxiliary/os/os_misc.h |  7 +
 2 files changed, 71 insertions(+)


The Haiku portion of this patch looks good btw.  I'll do a test build 
shortly.


Thanks for cc'ing me :-)

 -- Alex
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] haiku: Add missing u_memory.h for FREE()

2014-05-20 Thread Alexander von Gluck IV
---
 .../targets/haiku-softpipe/GalliumContext.cpp  |1 +
 .../targets/haiku-softpipe/GalliumFramebuffer.cpp  |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
index 52cd764..d6b5f85 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumContext.cpp
@@ -26,6 +26,7 @@ extern C {
 #include state_tracker/st_gl_api.h
 #include state_tracker/st_manager.h
 #include state_tracker/sw_winsys.h
+#include util/u_memory.h
 #include hgl_sw_winsys.h
 
 #include target-helpers/inline_sw_helper.h
diff --git a/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp 
b/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
index dd726ef..f367d9d 100644
--- a/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
+++ b/src/gallium/targets/haiku-softpipe/GalliumFramebuffer.cpp
@@ -16,6 +16,7 @@ extern C {
 #include main/renderbuffer.h
 #include pipe/p_format.h
 #include state_tracker/st_manager.h
+#include util/u_memory.h
 }
 
 #include GalliumContext.h
-- 
1.7.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


  1   2   >