Re: Give A directFB surface to EGL

刘涛 <[email protected]>
Newsgroups gmane.comp.video.mesa3d.user
Message-ID <[email protected]>
I didn't have  “ (!) Direct/Modules: Unable to dlopen“ error,  did you start your program with "sudo"?  and I also have have some errors, but directFB test(attachment) can pass on my pc.  You may alse need direcfbrc file to configure directFB, and init it with command 'echo -e "mode=1366x768\nwm=default\ndepth=32\nsystem=x11" > ~/.directfbrc'.


在 2015-10-23 05:24:32,"Albert Freeman" <[email protected]> 写道:
>On 22 October 2015 at 15:35, Albert Freeman <[email protected]> wrote:
>> On 22 October 2015 at 15:31, Albert Freeman <[email protected]> wrote:
>>> On 22 October 2015 at 12:25, 刘涛 <[email protected]> wrote:
>>>> Attachment  need approval and main output see below:
>>>>
>>>> Build options:
>>>>   Version                   1.7.6
>>>>   Linux powered             yes
>>>>   Install prefix            /usr
>>>>   Config files in           /usr/etc
>>>>   Build shared libs         yes
>>>>   Build static libs         no
>>>>   Module directory          ${exec_prefix}/lib/directfb-1.7-6
>>>>   CC                        gcc
>>>>   CXX                       g++
>>>>   LD                        /usr/bin/ld -m elf_x86_64
>>>>   CPPFLAGS                  -D_REENTRANT
>>>>   CFLAGS                    -Wall -Wstrict-prototypes -Wmissing-prototypes
>>>> -Wno-strict-aliasing -Werror-implicit-function-declaration -O3 -g2
>>>> -ffast-math -pipe  -D_GNU_SOURCE  -std=gnu99
>>>> -Werror-implicit-function-declaration
>>>>   CXXFLAGS                  -Wall -Wno-strict-aliasing -std=c++0x -g -O2 -O3
>>>> -g2 -ffast-math -pipe  -D_GNU_SOURCE
>>>>   LDFLAGS
>>>>   LIBS                      -ldl -lrt -lpthread
>>>>   DYNLIB                    -ldl
>>>>   RTLIB                     -lrt
>>>>   THREADFLAGS               -D_REENTRANT
>>>>   THREADLIB                 -lpthread
>>>>
>>>> Misc options:
>>>>   Multi Application Core    no
>>>>   Fusion Kernel Device      yes
>>>>   Fusion message size       16384
>>>>   Fluxed args size          1024
>>>>   One (IPC)                 no
>>>>   Voodoo (network support)  no
>>>>   Pure Voodoo (net only)    no
>>>>   DiVine (virtual input)    no
>>>>   FusionDale                no
>>>>   Debug supported           yes
>>>>   Debug enabled             no
>>>>   Trace support             no
>>>>   MMX support               yes
>>>>   SSE support               yes
>>>>   GCC Atomics usage         no
>>>>   Network support           yes
>>>>   Include all strings       yes
>>>>   Software Rendering        yes
>>>>   Smooth SW Scaling         no
>>>>   Dithering                 none
>>>>   Dithering 565             none
>>>>   zlib compression          no
>>>>   Using setsockopt          yes
>>>>
>>>> Building Tests              no
>>>> Building Tools              yes
>>>>
>>>> Building System Modules:
>>>>   Linux FBDev support       yes
>>>>   Generic /dev/mem support  yes
>>>>   Mesa/DRM/KMS support      yes                -I/usr/include/libdrm
>>>> -lGLESv2 -lEGL -ldrm -lgbm
>>>>   DRM/KMS support           no
>>>>   PVR2D                     no
>>>>   EGL                       no                 -I/usr/include/libdrm   -lGL
>>>> -lEGL
>>>>   X11 support               yes                   -lX11 -lXext
>>>>   X11/VDPAU support         no
>>>>   OSX support               no
>>>>   SDL support               no
>>>>   VNC support               no
>>>>
>>>> Building Window Manager Modules:
>>>>   Default                   yes
>>>>   UniQuE                    no
>>>>   SaWMan                    no
>>>>
>>>> Building Image Provider Modules:
>>>>   GIF                       yes
>>>>   JPEG                      yes                 -ljpeg
>>>>   PNG                       yes                  -I/usr/include/libpng12
>>>> -lpng12
>>>>   Imlib2                    no
>>>>   PNM                       yes
>>>>   SVG                       no
>>>>   BMP                       yes
>>>>   WEBP                      no
>>>>   JPEG2000                  no
>>>>   MPEG2                     yes
>>>>   TIFF                      no
>>>>
>>>>
>>>>
>>>> Building Video Provider Modules:
>>>>   GIF                       yes
>>>>   Video4Linux               yes (v2: no)
>>>>   MNG                       no
>>>>   Gstreamer                 no (v1: no)
>>>>     with FusionSound        no
>>>>   AviFile                   no
>>>>   Flash                     no
>>>>   Libmpeg3                  no
>>>>   OpenQuicktime             no
>>>>   Xine                      no
>>>>   Xine/VDPAU                no
>>>>   Swfdec                    no
>>>>   FFmpeg                    no
>>>>
>>>> Building Font Modules:
>>>>   FreeType2                 yes                 -I/usr/include/freetype2
>>>> -lfreetype
>>>>   LinoType                  no
>>>>   Default font              yes
>>>>
>>>> Building FusionSound        no
>>>>
>>>> Building Graphics Drivers:
>>>>   3Dfx Voodoo               yes
>>>>   ATI Mach64                yes
>>>>   ATI Rage 128              yes
>>>>   ATI Radeon                no
>>>>   Cirrus EP9X               yes
>>>>   Intel i810                yes
>>>>   Intel i830                yes
>>>>   Matrox                    yes
>>>>   NeoMagic                  yes
>>>>   NSC Geode                 yes
>>>>   nVidia                    yes
>>>>   PVR2D                     no
>>>>   PXA 3xx                   yes
>>>>   Renesas R-Car GP2D        no
>>>>   Renesas SH7722/SH7723     no
>>>>   S3 Savage                 no
>>>>   SiS 315                   yes
>>>>   TI Davinci                no
>>>>   TI OMAP                   no
>>>>   TVIA CyberPro             no
>>>>   VIA CLE266                no
>>>>   VIA UniChrome             no
>>>>   VMWare                    no
>>>>   VDPAU                     no
>>>>   --
>>>>   OpenGL                    yes (GLX: yes)
>>>>   OpenGL ES 2.0             yes (Mesa:  yes, PVR2D: no)
>>>>                                         -I/usr/include/libdrm   -DGLES2_MESA
>>>> -lGLESv2 -lEGL -ldrm -lgbm
>>>>
>>>>   IDirectFBGL-EGL           yes       -I/usr/include/libdrm   -lGL -lEGL
>>>>
>>>> Building Input Drivers:
>>>>   DBox2 Remote              no
>>>>   DreamBox Remote           no
>>>>   Dynapro Touchscreen       no
>>>>   ELO Touchscreen           no
>>>>   Gunze Touchscreen         no
>>>>   H3600 Touchscreen         no
>>>>   Input Hub                 yes
>>>>   Joystick                  yes
>>>>   Keyboard                  yes
>>>>   Linux Input               yes
>>>>   LiRC                      yes
>>>>   MuTouch touchscreen       yes
>>>>   Zytronic touchscreen      yes
>>>>   PS/2 Mouse                yes
>>>>   Serial Mouse              yes
>>>>   SonyPI Jogdial            yes
>>>>   tslib                     yes                   -lts
>>>>   ucb1x00 Touchscreen       no
>>>>   WM97xx Touchscreen        yes
>>>>
>>>>
>>>>
>>>>
>>>> 在 2015-10-22 20:14:41,"刘涛" <[email protected]> 写道:
>>>>
>>>> Sorry ,  add attachment for this time.
>>>>
>>>>
>>>> 在 2015-10-22 20:13:36,"刘涛" <[email protected]> 写道:
>>>>
>>>> I use "./configure --prefix=/usr --enable-idirectfbgl-egl" to configure
>>>> DirectFB-1.7.6 and please see attachment config.log for output.
>>> I was really really wrong about what DirectFB can support. It uses gbm
>>> and therefore supports all the latest mesa hardware drivers. I have
>>> got a slight modification of your code (adding stuff you would already
>>> have setup) running on DirectFB with my r600 radeon card. I had to
>>> modify directfb. I did by commenting out functions to avoid a runtime
>>> dlopen warning that prevented stuff from working. Now to do it
>>> properly (I believe DirectFB is not loading function pointers for some
>>> EGL functions). I am not sure if it is the same issue you have though.
>>>
>>> My configuration is latest git mesa and Linux 4.2.3 and I actually had
>>> success with just ./configure && make -j16 && make install with
>>> DirectFB.
>> Just to make sure it is the same issue, do you have:
>> (!) Direct/Modules: Unable to dlopen
>> `/usr/local/lib/directfb-1.7-0/systems/libdirectfb_mesa_system.so'!
>>     --> /usr/local/lib/directfb-1.7-0/systems/libdirectfb_mesa_system.so:
>> undefined symbol:
>> in the DirectFB stdout/err log when you run your program (near the top
>> of the log)?
>Actually I did not solve the issue. I had setup a:
>glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
>glClear(GL_COLOR_BUFFER_BIT);
>which for the first time actually cleared something for about a second.
>But strangely enough EGL was erroring and it was still intermittently
>clearing the screen.
>The gles2 test DirectFB provides tests functionality that has since
>been deleted (even though the tests are in the same repo).
>DirectFBGL/EGL calls:
>eglGetDisplay
>eglInitialize
>eglChooseConfig
>eglBindAPI(EGL_OPENGL_ES_API)   which is hardwired, meaning no Desktop
>OpenGL allowed (I just feel like noting that for some reason).
>etc
>So if you actually want to use DirectFBGL/EGL completely then I don't
>think your supposed to call egl functions yourself.
>
>Your program fails on
>eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
>with a EGL_BAD_NATIVE_WINDOW (I may have also seen a EGL_BAD_DISPLAY
>but I doubt it)
>of course that could be due to the infrastructure I built around it,
>but I doubt that.
>
>I messed around for ages doing stuff, I got a DirectFB mouse cursor
>appearing both in X11 and with the test app started directly from the
>linux console.
>Although I think it is a matter of getting the DirectFB calls setup
>right (before any egl functions are called) with X11 on PC. Of course
>it could be a bug in DirectFB or EGL too.
>
>Anyway, I am going to bed.
>
>You might want to use this for debugging:
>    EGLint eglerror = eglGetError();
>        switch(eglerror) {
>        case EGL_SUCCESS:
>            printf("eglGetError indicated SUCCESS\n");
>            break;
>        case EGL_BAD_NATIVE_WINDOW:
>            printf("eglGetError indicated BAD_NATIVE_WINDOW\n");
>            break;
>        case EGL_NOT_INITIALIZED:
>            printf("eglGetError indicated NOT_INITIALIZED\n");
>            break;
>        case EGL_CONTEXT_LOST:
>            printf("eglGetError indicated CONTEXT_LOST\n");
>            break;
>        case EGL_BAD_ACCESS:
>            printf("eglGetError indicated BAD_ACCESS\n");
>            break;
>        case EGL_BAD_ALLOC:
>            printf("eglGetError indicated BAD_ALLOC\n");
>            break;
>        case EGL_BAD_ATTRIBUTE:
>            printf("eglGetError indicated BAD_ATTRIBUTE\n");
>            break;
>        case EGL_BAD_CONTEXT:
>            printf("eglGetError indicated BAD_CONTEXT\n");
>            break;
>        case EGL_BAD_CONFIG:
>            printf("eglGetError indicated BAD_CONFIG\n");
>            break;
>        case EGL_BAD_CURRENT_SURFACE:
>            printf("eglGetError indicated BAD_CURRENT_SURFACE\n");
>            break;
>        case EGL_BAD_DISPLAY:
>            printf("eglGetError indicated BAD_DISPLAY\n");
>            break;
>        case EGL_BAD_MATCH:
>            printf("eglGetError indicated BAD_MATCH\n");
>            break;
>        case EGL_BAD_PARAMETER:
>            printf("eglGetError indicated BAD_PARAMETER\n");
>            break;
>        case EGL_BAD_NATIVE_PIXMAP:
>            printf("eglGetError indicated BAD_NATIVE_PIXMAP\n");
>        default:
>            printf("eglGetError returned an unknown EGL error\n");
>            break;
>        }

_______________________________________________
mesa-users mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-users
draw_line.c (text/plain, 2.4 KB)
/*DirectFB源程序 程序名:draw_line.c
*功能:在屏幕中间画一条水平直线 
*/
#include <stdio.h> 
#include <unistd.h> 
#include <directfb.h> 
   
//这是最上层的接口,所有的函数入口均由它(IDirectFB)而来 
static IDirectFB *dfb = NULL;    
//主平面,也就是“屏幕”了。在交互层使用DFSCL_FULLSCREEN,它是主层平面。  
static IDirectFBSurface *primary = NULL;    
//这里存储主平面的高和宽,从而为其它的操作提供支持 
static int screen_width  = 0; 
static int screen_height = 0;    
//用以检测错误的宏定义,用来检测大部分的函数的返回值是否正常。只适合用在小的测试程序  
#define DFBCHECK(x...)  \ 
do{                \         
DFBResult err = x;   \           
if (err != DFB_OK)  \          
{  \                  
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \                 
DirectFBErrorFatal( #x, err );  \ 
} \
}while(0)
     
int main (int argc, char **argv) {         
	//为了创建一个平面,需要定义一个平面描述子(surface description)  
	DFBSurfaceDescription dsc; 
	//初始化      
	DFBCHECK (DirectFBInit (&argc, &argv));        
	DFBCHECK (DirectFBCreate (&dfb));         
	DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));           
	//设定dsc的一些属性,现在可以不用关心        
	dsc.flags = DSDESC_CAPS;        
	 dsc.caps  = DSCAPS_PRIMARY | DSCAPS_FLIPPING;           
	//使用我们设定的dsc创建主平面(primary)         
	DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));        
	//得到主平面的宽与高         
	DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));         
	//通过画一个和主平面同等大小的矩形来清空主平面;默认颜色为黑色 

	DFBCHECK (primary->FillRectangle (primary, 0, 0, screen_width, screen_height));         
	//为了能显示画出来的线,先设置一下线的颜色,线的位置在屏幕的中间  
	DFBCHECK (primary->SetColor (primary, 0x80, 0x80, 0xff, 0xff));        
	DFBCHECK (primary->DrawLine (primary,0, screen_height / 2,screen_width - 1, screen_height / 2));          
	//显示         
	DFBCHECK (primary->Flip (primary, NULL, 0));           
	//等待5秒后,程序自动退出        
	sleep (5);         
	primary->Release( primary );        
	dfb->Release( dfb );        
	return 23; 
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.