summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Ciccani <[email protected]>2006-12-01 14:12:05 +0000
committerClaudio Ciccani <[email protected]>2006-12-01 14:12:05 +0000
commit73fdecca9fdd9e63aa5e57bcd67911fbb761d318 (patch)
tree1405577ce7b5412eeeca70c118db9ac831e57aec
parent682393944c72ecfabe8df674af0b48975e90b98c (diff)
Remove DirectFBGL header from Mesa bacause since 1.0.0 DirectFB installs its own header.
Updated to the current DirectFBGL interface (i.e. added GetProcAddress()).
-rw-r--r--docs/README.directfb2
-rw-r--r--progs/directfb/df_gears.c2
-rw-r--r--progs/directfb/df_morph3d.c2
-rw-r--r--progs/directfb/df_reflect.c2
-rw-r--r--src/glut/directfb/ext.c7
-rw-r--r--src/glut/directfb/internal.h3
-rw-r--r--src/mesa/drivers/directfb/idirectfbgl_mesa.c80
7 files changed, 65 insertions, 33 deletions
diff --git a/docs/README.directfb b/docs/README.directfb
index 169ebe486ee..e3bada4888b 100644
--- a/docs/README.directfb
+++ b/docs/README.directfb
@@ -6,7 +6,7 @@ Requirements
============
To build Mesa with DirectFB (DirectFBGL) support you need:
- - DirectFB at least 0.9.21 (http://directfb.org)
+ - DirectFB at least 1.0.0 (http://directfb.org)
- pkg-config at least 0.9 (http://pkgconfig.sf.net)
diff --git a/progs/directfb/df_gears.c b/progs/directfb/df_gears.c
index 27df900115f..c480767bd33 100644
--- a/progs/directfb/df_gears.c
+++ b/progs/directfb/df_gears.c
@@ -27,9 +27,9 @@
#include <math.h>
#include <directfb.h>
+#include <directfbgl.h>
#include <GL/gl.h>
-#include <GL/directfbgl.h>
/* the super interface */
diff --git a/progs/directfb/df_morph3d.c b/progs/directfb/df_morph3d.c
index f7f143447f4..2730fa61569 100644
--- a/progs/directfb/df_morph3d.c
+++ b/progs/directfb/df_morph3d.c
@@ -159,9 +159,9 @@ So the angle is:
#include <unistd.h>
#include <directfb.h>
+#include <directfbgl.h>
#include <GL/gl.h>
-#include <GL/directfbgl.h>
/* the super interface */
diff --git a/progs/directfb/df_reflect.c b/progs/directfb/df_reflect.c
index ce4d12f749f..a0e789c3871 100644
--- a/progs/directfb/df_reflect.c
+++ b/progs/directfb/df_reflect.c
@@ -27,9 +27,9 @@
#include <math.h>
#include <directfb.h>
+#include <directfbgl.h>
#include <GL/glu.h>
-#include <GL/directfbgl.h>
#include "util/showbuffer.c"
#include "util/readtex.c"
diff --git a/src/glut/directfb/ext.c b/src/glut/directfb/ext.c
index d7338ce5f7b..e37ecf5afad 100644
--- a/src/glut/directfb/ext.c
+++ b/src/glut/directfb/ext.c
@@ -156,6 +156,13 @@ glutGetProcAddress( const char *name )
return glut_functions[i].address;
}
+#if DIRECTFBGL_INTERFACE_VERSION >= 1
+ if (g_current) {
+ void *address = NULL;
+ g_current->gl->GetProcAddress( g_current->gl, name, &address );
+ return address;
+ }
+#endif
return NULL;
}
diff --git a/src/glut/directfb/internal.h b/src/glut/directfb/internal.h
index 2e986c9f286..bc3e20e93e7 100644
--- a/src/glut/directfb/internal.h
+++ b/src/glut/directfb/internal.h
@@ -26,8 +26,9 @@
#include <directfb.h>
#include <directfb_version.h>
+#include <directfbgl.h>
+
#include "GL/glut.h"
-#include "GL/directfbgl.h"
#define VERSION_CODE( M, m, r ) (((M) << 16) | ((m) << 8) | ((r)))
diff --git a/src/mesa/drivers/directfb/idirectfbgl_mesa.c b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
index eefc964889c..f5bbd127c28 100644
--- a/src/mesa/drivers/directfb/idirectfbgl_mesa.c
+++ b/src/mesa/drivers/directfb/idirectfbgl_mesa.c
@@ -25,24 +25,16 @@
#include <pthread.h>
-#include <direct/messages.h>
-#include <direct/interface.h>
-#include <direct/mem.h>
-
#include <directfb.h>
#include <directfb_version.h>
-#define VERSION_CODE( M, m, r ) (((M) * 1000) + ((m) * 100) + ((r)))
-#define DIRECTFB_VERSION_CODE VERSION_CODE( DIRECTFB_MAJOR_VERSION, \
- DIRECTFB_MINOR_VERSION, \
- DIRECTFB_MICRO_VERSION )
-
+#include <directfbgl.h>
-#ifdef CLAMP
-# undef CLAMP
-#endif
+#include <direct/mem.h>
+#include <direct/messages.h>
+#include <direct/interface.h>
-#include "GL/directfbgl.h"
+#undef CLAMP
#include "glheader.h"
#include "buffers.h"
#include "context.h"
@@ -62,6 +54,12 @@
#include "drivers/common/driverfuncs.h"
+#define VERSION_CODE( M, m, r ) (((M) * 1000) + ((m) * 100) + ((r)))
+#define DIRECTFB_VERSION_CODE VERSION_CODE( DIRECTFB_MAJOR_VERSION, \
+ DIRECTFB_MINOR_VERSION, \
+ DIRECTFB_MICRO_VERSION )
+
+
static DFBResult
Probe( void *data );
@@ -79,7 +77,7 @@ DIRECT_INTERFACE_IMPLEMENTATION( IDirectFBGL, Mesa )
typedef struct {
int ref; /* reference counter */
- DFBBoolean locked;
+ int locked;
IDirectFBSurface *surface;
DFBSurfacePixelFormat format;
@@ -189,8 +187,10 @@ IDirectFBGL_Mesa_Lock( IDirectFBGL *thiz )
DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
- if (data->locked)
- return DFB_LOCKED;
+ if (data->locked) {
+ data->locked++;
+ return DFB_OK;
+ }
if (directfbgl_lock())
return DFB_LOCKED;
@@ -202,6 +202,7 @@ IDirectFBGL_Mesa_Lock( IDirectFBGL *thiz )
(void*)&data->video.start, &data->video.pitch );
if (ret) {
D_ERROR( "DirectFBGL/Mesa: couldn't lock surface.\n" );
+ directfbgl_unlock();
return ret;
}
data->video.end = data->video.start + (height-1) * data->video.pitch;
@@ -218,7 +219,7 @@ IDirectFBGL_Mesa_Lock( IDirectFBGL *thiz )
&data->framebuffer, width, height);
}
- data->locked = DFB_TRUE;
+ data->locked++;
return DFB_OK;
}
@@ -230,14 +231,14 @@ IDirectFBGL_Mesa_Unlock( IDirectFBGL *thiz )
if (!data->locked)
return DFB_OK;
-
- _mesa_make_current( NULL, NULL, NULL );
+
+ if (--data->locked == 0) {
+ _mesa_make_current( NULL, NULL, NULL );
- data->surface->Unlock( data->surface );
-
- directfbgl_unlock();
+ data->surface->Unlock( data->surface );
- data->locked = DFB_FALSE;
+ directfbgl_unlock();
+ }
return DFB_OK;
}
@@ -276,6 +277,26 @@ IDirectFBGL_Mesa_GetAttributes( IDirectFBGL *thiz,
return DFB_OK;
}
+#if DIRECTFBGL_INTERFACE_VERSION >= 1
+static DFBResult
+IDirectFBGL_Mesa_GetProcAddress( IDirectFBGL *thiz,
+ const char *name,
+ void **ret_address )
+{
+ DIRECT_INTERFACE_GET_DATA( IDirectFBGL );
+
+ if (!name)
+ return DFB_INVARG;
+
+ if (!ret_address)
+ return DFB_INVARG;
+
+ *ret_address = _glapi_get_proc_address( name );
+
+ return (*ret_address) ? DFB_OK : DFB_UNSUPPORTED;
+}
+#endif
+
/* exported symbols */
@@ -326,11 +347,14 @@ Construct( IDirectFBGL *thiz, IDirectFBSurface *surface )
}
/* Assign interface pointers. */
- thiz->AddRef = IDirectFBGL_Mesa_AddRef;
- thiz->Release = IDirectFBGL_Mesa_Release;
- thiz->Lock = IDirectFBGL_Mesa_Lock;
- thiz->Unlock = IDirectFBGL_Mesa_Unlock;
- thiz->GetAttributes = IDirectFBGL_Mesa_GetAttributes;
+ thiz->AddRef = IDirectFBGL_Mesa_AddRef;
+ thiz->Release = IDirectFBGL_Mesa_Release;
+ thiz->Lock = IDirectFBGL_Mesa_Lock;
+ thiz->Unlock = IDirectFBGL_Mesa_Unlock;
+ thiz->GetAttributes = IDirectFBGL_Mesa_GetAttributes;
+#if DIRECTFBGL_INTERFACE_VERSION >= 1
+ thiz->GetProcAddress = IDirectFBGL_Mesa_GetProcAddress;
+#endif
return DFB_OK;
}