This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3358: OpenGL issue

Part Number: AM3358

I have a custom board with an AM3358 for use in a mobile graphics/AR application. I also have a Beaglebone Black for development purposes. Currently I am trying to run an example OpenGL ES application on the BBB to validate the graphics drivers and start development of a custom OpenGL ES application. I have installed the latest TI Processors Linux (am335x-evm-linux-06.03.00.106.img) by using the Instructions for creating SD card on Windows (Processors SDK Linux section 1.1.2). 

After making the changes described at Processors SDK Linux section 3.9.11 I can see the Matrix GUI home screen on an attached HDMI LCD. I can also display a static test pattern using kmstest -f RG16

Both kmscube and OGLES2ChameleonMan / related demos fail with messages related to EGL initialization. Full output, as well as baseline SGX debug info referencing Processors SDK Linux section 3.8, are pasted below.

kmscube outputs:

### Display [0]: CRTC = 29, Connector = 31, format = 0x36314752
	Mode chosen [800x480] : Clock => 29570, Vertical refresh => 60, Type => 72
	Horizontal => 800, 816, 896, 992, 0
	Vertical => 480, 481, 484, 497, 0
### Primary display => ConnectorId = 31, Resolution = 800x480
Using display 0x37de0 with EGL version 1.5
EGL Version "1.5"
EGL Vendor "Mesa Project"
EGL Extensions "EGL_EXT_buffer_age EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import EGL_IMG_cl_image EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_WL_bind_wayland_display "
failed to create egl surface
failed to initialize EGL

Also, trying /usr/bin/SGX/demos/DRM/OGLES2ChameleonMan gives:

display failed to set mode: Invalid argument
display failed to set mode: Invalid argument
display failed to set mode: Invalid argument
display failed to set mode: Invalid argument
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glClear: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawElements: Can't prepare to draw [0, ]
PVRImageDrawableGetNativeInfo: Image get buffers call failed
PVR:(Error): KEGLGetDrawableParameters: Couldn't recreate drawable
 [0, ]
PVR:(Error): PrepareToDraw: Invalid drawable [0, ]
PVR:(Error): glDrawArrays: Can't prepare to draw [0, ]
eglSwapBuffers failed
Segmentation fault (core dumped)

Section 3.8 commands output:

root@am335x-evm:~# cat /etc/powervr.ini
[default]
DefaultPixelFormat=RGB565
root@am335x-evm:~# cat /proc/cpuinfo
processor    : 0
model name    : ARMv7 Processor rev 2 (v7l)
BogoMIPS    : 796.91
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpd32
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x3
CPU part    : 0xc08
CPU revision    : 2

Hardware    : Generic AM33XX (Flattened Device Tree)
Revision    : 0000
Serial   	 : 4219BBBK06C8
root@am335x-evm:~# cat /proc/pvr/version
Version SGX_DDK_Linux_XOrg sgxddk 1.17@4948957 (release) omap_linux
System Version String: SGX revision = 125
root@am335x-evm:~# fbset -i

mode "800x480"
	geometry 800 480 800 480 16
	timings 0 0 0 0 0 0 0
	accel true
	rgba 5/11,6/5,5/0,0/0
endmode

Frame buffer device information:
	Name    	: DRM emulated
	Address 	: (nil)
	Size    	: 768000
	Type    	: PACKED PIXELS
	Visual  	: TRUECOLOR
	XPanStep	: 1
	YPanStep	: 1
	YWrapStep   : 0
	LineLength  : 1600
	Accelerator : No
root@am335x-evm:~# cat /sys/class/graphics/fb0/rotate
0
root@am335x-evm:~# lsmod
Module              	Size  Used by
pvrsrvkm          	401408  0
xfrm_user          	32768  2
xfrm4_tunnel       	16384  0
ipcomp             	16384  0
xfrm_ipcomp        	16384  1 ipcomp
esp4               	20480  0
ah4                	16384  0
af_key             	36864  0
xfrm_algo          	16384  5 xfrm_user,esp4,ah4,af_key,xfrm_ipcomp
usb_f_acm          	16384  1
u_serial           	20480  3 usb_f_acm
usb_f_ecm          	16384  1
g_multi            	16384  0
usb_f_mass_storage 	45056  2 g_multi
usb_f_rndis        	28672  2 g_multi
u_ether            	20480  3 usb_f_ecm,g_multi,usb_f_rndis
libcomposite       	53248  5 usb_f_ecm,usb_f_acm,usb_f_mass_storage,g_multi,usb_f_rndis
usbhid             	28672  0
pru_rproc          	24576  0
irq_pruss_intc     	16384  1 pru_rproc
pruss              	16384  1 pru_rproc
musb_dsps          	20480  0
musb_hdrc         	106496  1 musb_dsps
phy_am335x         	16384  2
udc_core           	28672  8 usb_f_ecm,usb_f_acm,usb_f_mass_storage,u_serial,musb_hdrc,u_ether,usb_f_rndis,libcomposite
phy_generic        	16384  1 phy_am335x
phy_am335x_control 	16384  1 phy_am335x
snd_soc_simple_card	16384  0
snd_soc_simple_card_utils	16384  1 snd_soc_simple_card
pm33xx             	16384  0
wkup_m3_ipc        	16384  1 pm33xx
wkup_m3_rproc      	16384  1
remoteproc         	49152  3 pru_rproc,wkup_m3_rproc,wkup_m3_ipc
omap_aes_driver    	24576  0
crypto_engine      	16384  1 omap_aes_driver
omap_crypto        	16384  1 omap_aes_driver
omap_sham          	28672  0
ti_emif_sram       	16384  1 pm33xx
pruss_soc_bus      	16384  0
at24               	20480  0
rtc_omap           	20480  2
omap_wdt           	16384  0
musb_am335x        	16384  0
sch_fq_codel       	20480  3
uio_module_drv     	16384  0
uio                	20480  1 uio_module_drv
ftdi_sio           	45056  0
usbserial          	36864  1 ftdi_sio
usbcore           	217088  4 usbhid,ftdi_sio,musb_hdrc,usbserial
usb_common         	16384  6 phy_am335x,udc_core,musb_hdrc,libcomposite,musb_dsps,usbcore
cryptodev          	49152  0
root@am335x-evm:~# cat /proc/cmdline
console=ttyO0,115200n8 root=PARTUUID=55c1f8d5-02 rw rootfstype=ext4 rootwait
root@am335x-evm:~# uname -a
Linux am335x-evm 4.19.94-gbe5389fd85 #1 PREEMPT Sun Apr 19 03:43:09 UTC 2020 armv7l GNU/Linux


 

  • Hello Jensen,

    Our graphics expert is on vacation the rest of the week. He will take a look at your question next week.

    In the meantime:

    * Do you see the same behavior with SDK 6.1?

    * Are you installing the entire Linux Processor SDK on the BeagleBone Black? (i.e. software development occurs on the BBB). Or are you just using create-sdcard.sh to create an SD card with a Linux kernel and filesystem (i.e. software development occurs on your computer).

    Regards,

    Nick

  • Hi Nick,

    I actually had success with SDK 6.1 after working out some issues flashing the SD card under Linux. I am able to run any of the SGX demos from Matrix now. I will continue with development under 6.1 for the time being. 

    For context, I had been using create-sdcard.sh, and planning to stick with that approach.

    I do have a couple additional questions now - if they should be moved somewhere else please let me know.

    - Is there available source code on the SGX demos (ChameleonMan, CoverFlow, etc.)? I have not seen it under <sdk_root>/example-applications; maybe I am not looking hard enough?

    - When using the Multimedia demos (H.264/MPEG4 video decode), i.e. GStreamer video playback, I'm getting about one frame drawn every three seconds on a 800x480 display. Is this bottlenecked by the frame buffer driver (fbdevsink), MPEG decoding/scaling, or the playback process itself? In other words, could I play back a raw encoded video at full 800x480 and expect 30fps or higher, or is the architecture not set up for this?

  • Hello Jensen,

    With regards to source code, I am internally confirming with our developers and I will get back to you. I ran the MPEG4 video decode example and I do not see a slow frame rate. I disabled weston and ran the following pipeline "gst-launch-1.0 playbin uri=file:///usr/share/ti/video/TearOfSteel-Short-720x420.m4v video-sink=fbdevsink audio-sink=fakesink". I have also attached the output of my am335x EVM and the video was played on a 800x480 panel. I ran the above test on PSDK6.1

    Regards,
    Krunal

  • Hello;

    I am running a beaglebone black and having the exact same issues with the exact same output.

    I have a feeling that HDMI output is broken with the latest am335x-evm-bin-06.03.00.106 although I do not have an LVDS display to test with to confirm the problem.

    I have also tried building arago from scratch and also received the exact same output.

    To say the least, this is incredibly frustrating, as one would think HDMI output would be tested before releasing a new SDK version. :(

    Any help would be greatly appreciated!

    Adam

  • Hi Adam,

    Unfortunately, we do not have a solution as of now. Based on our internal testing, we noticed a bunch of Qt patches that were introduced during the PSDK6.1 to PSDK6.3 migration. The Qt application expects XRGB8888 to be supported by default but with HDMI we support RGB565/XBGR8888. We have noticed that adding the format in the Qt JSON file has no effect. We are trying to biscest the exact point of failure and I will update the thread once we have a solution.

    Regards,
    Krunal

  • Hi Krunal,

    I apologize for the delay in getting back to you.

    I tried the MPEG4 decode from matrix on fresh installs of versions 6.1 and 6.3 and observe the slow frame rate on both. I also see the slow framerate when following your exact process on SDK6.1 - stop matrix gui and Weston and run the exact gstreamer pipeline you specified.

    The issue is present both when the LCD is connected via HDMI and directly to the parallel LCD interface. 

    I have attached a video file of the playback experience to this post. It is a bit small but there is a limit on file size.

    It seems the only difference between our setups is that you are using the EVM and I am using the BeagleBone Black. 

    Monitoring resources with top while gstreamer is active, the cpu is binned at 100% with 98% to gstreamer, and about 50% ram usage up from 1% cpu and 40% ram at idle.

    I do get more usable results when playing a 400x240 video file and using the videoscale element to scale it up to 800x480. I have tried this with MPEG-4 video in MPEG-TS containers as well as Theora video in Ogg containers with similar results.

    Could there be any difference in the configuration between our boards that could cause something like this?

  • Hello Jensen,

    The source code that you requested earlier is from IMG SDK suite and it is now available on github: https://github.com/powervr-graphics/Native_SDK. I have not tried running the test on BBB and I will try it next week. With regards to CPU usage, please keep in mind that we do not have HW acceleration on AM335x. All the video encoding/decoding is performed on the ARM core.

    Regards,
    Krunal

  • Hi Adam,

    We now have a fix for AM335x and please refer to the following thread: https://e2e.ti.com/support/processors/f/791/p/913245/3405591#3405591

    Regards,
    Krunal