On 10/25/2011 02:07 PM, Denis Oliver Kropp wrote:
On 10/24/2011 10:06 PM, Holger Freyther wrote:
Denis Oliver Kropp<dok@...> writes:
What are the extensions to IDirectFBGL2? I guess some config stuff like
depth bits etc.
The current interface for Qt5 can be seen here[1]. What I am not sure with
DirectFB is if one should use IDirectFBGL and IDirectFBGL2 at the same time
or not. What I think is missing from IDirectFBGL2 is a GetAttribute call to
GetAttributes() returned data from configs that were chosen implicitly so far.
Now, you can specify depth bits etc in DFBGL2ContextDescription before creating
the context, similar to choosing an EGL configuration :)
BTW, I started adding IDirectFBGL2 support to Qt once as well, here's my patch
(from June 27th).
It will probably not help you.
--
Best regards,
Denis Oliver Kropp
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
index 85effc9..c669451 100644
--- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
@@ -41,49 +41,79 @@
#include "qdirectfbglcontext.h"
-#include <directfb/directfbgl.h>
+#include <directfbgl.h>
+#include <directfbgl2.h>
#include <QDebug>
-QDirectFbGLContext::QDirectFbGLContext(IDirectFBGL *glContext)
- : m_dfbGlContext(glContext)
+QDirectFbGLContext::QDirectFbGLContext(IDirectFBGL2 *gl2,IDirectFBGL2Context *gl2Context,IDirectFBSurface *surface)
+ : m_dfbGl2(gl2),m_dfbGl2Context(gl2Context),m_dfbSurface(surface)
{
DFBResult result;
DFBGLAttributes glAttribs;
- result = m_dfbGlContext->GetAttributes(glContext, &glAttribs);
+
+ m_dfbSurface->AddRef(m_dfbSurface);
+
+ m_dfbGl2->AddRef(m_dfbGl2);
+ m_dfbGl2Context->AddRef(m_dfbGl2Context);
+
+
+ result = DFB_OK;
+ //FIXME: m_dfbGl2Context->GetAttributes(m_dfbGl2Context, &glAttribs);
+
+ glAttribs.stereo = DFB_FALSE;
+ glAttribs.depth_size = 16;
+ glAttribs.stencil_size = 0;
+ glAttribs.accum_red_size = 0;
+ glAttribs.accum_alpha_size = 0;
+ glAttribs.red_size = 8;
+ glAttribs.green_size = 8;
+ glAttribs.blue_size = 8;
+ glAttribs.alpha_size = 8;
+ glAttribs.double_buffer = DFB_TRUE;
+
if (result == DFB_OK) {
+ m_windowFormat.setStereo(glAttribs.stereo);
+
m_windowFormat.setDepthBufferSize(glAttribs.depth_size);
m_windowFormat.setStencilBufferSize(glAttribs.stencil_size);
+ m_windowFormat.setAccumBufferSize(glAttribs.accum_red_size);
+ m_windowFormat.setAlpha(glAttribs.accum_alpha_size);
+
m_windowFormat.setRedBufferSize(glAttribs.red_size);
m_windowFormat.setGreenBufferSize(glAttribs.green_size);
m_windowFormat.setBlueBufferSize(glAttribs.blue_size);
m_windowFormat.setAlphaBufferSize(glAttribs.alpha_size);
- m_windowFormat.setAccumBufferSize(glAttribs.accum_red_size);
- m_windowFormat.setAlpha(glAttribs.accum_alpha_size);
-
m_windowFormat.setDoubleBuffer(glAttribs.double_buffer);
- m_windowFormat.setStereo(glAttribs.stereo);
}
}
+QDirectFbGLContext::~QDirectFbGLContext()
+{
+ m_dfbSurface->Release(m_dfbSurface);
+
+ m_dfbGl2->Release(m_dfbGl2);
+ m_dfbGl2Context->Release(m_dfbGl2Context);
+}
+
void QDirectFbGLContext::makeCurrent()
{
QPlatformGLContext::makeCurrent();
- m_dfbGlContext->Lock(m_dfbGlContext);
+ m_dfbGl2Context->Bind(m_dfbGl2Context, m_dfbSurface, m_dfbSurface);
}
void QDirectFbGLContext::doneCurrent()
{
QPlatformGLContext::doneCurrent();
- m_dfbGlContext->Unlock(m_dfbGlContext);
+ m_dfbGl2Context->Unbind(m_dfbGl2Context);
}
void *QDirectFbGLContext::getProcAddress(const QString &procName)
{
void *proc;
- DFBResult result = m_dfbGlContext->GetProcAddress(m_dfbGlContext,qPrintable(procName),&proc);
+ DFBResult result = m_dfbGl2->GetProcAddress(m_dfbGl2,qPrintable(procName),&proc);
if (result == DFB_OK)
return proc;
return 0;
@@ -91,7 +121,7 @@ void *QDirectFbGLContext::getProcAddress(const QString &procName)
void QDirectFbGLContext::swapBuffers()
{
-// m_dfbGlContext->Unlock(m_dfbGlContext); //maybe not in doneCurrent()
+// m_dfbGl2Context->Unlock(m_dfbGl2Context); //maybe not in doneCurrent()
qDebug() << "Swap buffers";
}
diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.h b/src/plugins/platforms/directfb/qdirectfbglcontext.h
index f25b1a7..b7e560e 100644
--- a/src/plugins/platforms/directfb/qdirectfbglcontext.h
+++ b/src/plugins/platforms/directfb/qdirectfbglcontext.h
@@ -49,7 +49,8 @@
class QDirectFbGLContext : public QPlatformGLContext
{
public:
- explicit QDirectFbGLContext(IDirectFBGL *glContext);
+ explicit QDirectFbGLContext(IDirectFBGL2 *gl2,IDirectFBGL2Context *gl2Context,IDirectFBSurface *surface);
+ virtual ~QDirectFbGLContext();
void makeCurrent();
void doneCurrent();
@@ -60,7 +61,9 @@ public:
private:
- IDirectFBGL *m_dfbGlContext;
+ IDirectFBGL2 *m_dfbGl2;
+ IDirectFBGL2Context *m_dfbGl2Context;
+ IDirectFBSurface *m_dfbSurface;
QPlatformWindowFormat m_windowFormat;
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
index 040580b..68afbd5 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
@@ -49,6 +49,9 @@
#include <directfb.h>
+#include <directfbgl.h>
+#include <directfbgl2.h>
+
QDirectFbWindow::QDirectFbWindow(QWidget *tlw, QDirectFbInput *inputhandler)
: QPlatformWindow(tlw), m_inputHandler(inputhandler), m_context(0)
{
@@ -179,13 +182,38 @@ QPlatformGLContext *QDirectFbWindow::glContext() const
qWarning("could not retrieve surface in QDirectFbWindow::glContext()");
return 0;
}
- IDirectFBGL *gl;
- result = surface->GetGL(surface,&gl);
+
+ IDirectFB *dfb;
+ IDirectFBGL2 *gl2;
+ IDirectFBGL2Context *gl2context;
+
+ result = DirectFBCreate(&dfb);
+ if (result != DFB_OK) {
+ qWarning("could not retrieve IDirectFB in QDirectFbWindow::glContext()");
+ return 0;
+ }
+
+ result = dfb->GetInterface(dfb, "IDirectFBGL2", NULL, NULL, (void**) &gl2);
if (result != DFB_OK) {
- qWarning("could not retrieve IDirectFBGL in QDirectFbWindow::glContext()");
+ qWarning("could not retrieve IDirectFBGL2 in QDirectFbWindow::glContext()");
+ dfb->Release( dfb );
return 0;
}
- const_cast<QDirectFbWindow *>(this)->m_context = new QDirectFbGLContext(gl);
+
+ result = gl2->CreateContext(gl2,NULL,&gl2context);
+ if (result != DFB_OK) {
+ qWarning("could not retrieve IDirectFBGL2Context in QDirectFbWindow::glContext()");
+ gl2->Release( gl2 );
+ dfb->Release( dfb );
+ return 0;
+ }
+ const_cast<QDirectFbWindow *>(this)->m_context = new QDirectFbGLContext(gl2,gl2context,surface);
+
+ gl2context->Release( gl2context );
+ gl2->Release( gl2 );
+ dfb->Release( dfb );
+
+ surface->Release( surface );
}
return m_context;
}
_______________________________________________
directfb-dev mailing list
directfb-dev@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev