Jump to content

H3/H5/A64 DRM display driver


jernej

Recommended Posts

On 7. 9. 2017 at 5:11 PM, Da Alchemist said:

I have tested HDMI Audio on my Opi +2e, it is limited to 2 channels.(tested with speaker-test) Anyway it is good to know, that there is still developement on H5/H3 Boards.

 

Can you test this patch if it brings multichannel support? http://sprunge.us/YDAN

 

Please note that I didn't do any test besides make sure it compiles. If it works, it is only starting point for implementing proper support since some hacks are made.

Link to comment
Share on other sites

57 minutes ago, jernej said:

Can you test this patch if it brings multichannel support? http://sprunge.us/YDAN

For me it kills the audio completely:

# speaker-test -c2 -D hw:0

Channels count (2) not available for playbacks: Invalid argument

speaker-test 1.1.0

Playback device is hw:0
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Setting of hwparams failed: Invalid argument

But at least resolution switching, rotation and mirroring works for all available resolutions after the CMA memory increase.

 

Edit: Forgot to check the dmesg, sorry, will try to repeat the test later.

Edit 2: Should channels_min be set to 8? Typo?

 		.stream_name = "Playback",
-		.channels_min = 2,
-		.channels_max = 2,
+		.channels_min = 8,
+		.channels_max = 8,
 		.rates = SNDRV_PCM_RATE_8000_192000,
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,

 

Link to comment
Share on other sites

5 minutes ago, zador.blood.stained said:

Typo?

Yes, please try with 2. Uh, another issue - it will work with only even channel count (2, 4, 6, 8). Currently I'm not at my computer, so it will have to wait. But you can find line with "int lines =..." and round it up instead of round down.

Link to comment
Share on other sites

4 minutes ago, jernej said:

Uh, another issue - it will work with only even channel count (2, 4, 6, 8). Currently I'm not at my computer, so it will have to wait. But you can find line with "int lines =..." and round it up instead of round down.

I don't think I have anything that can properly receive/decode multi-channel sound anyway.  And is this unrelated to odd/even channel count?

+	switch (hparms->channels) {
+	case 2:
+		conf0 = HDMI_AUD_CONF0_I2S_2CHANNEL_ENABLE;
+		break;
+	case 4:
+		conf0 = HDMI_AUD_CONF0_I2S_4CHANNEL_ENABLE;
+		break;
+	case 6:
+		conf0 = HDMI_AUD_CONF0_I2S_6CHANNEL_ENABLE;
+		break;
+	case 8:
+		conf0 = HDMI_AUD_CONF0_I2S_8CHANNEL_ENABLE;
+		break;
+	default:
+		dev_err(dev, "unsupported channels [%d]\n", hparms->channels);
+		return -EINVAL;
 	}

 

Link to comment
Share on other sites

4 minutes ago, zador.blood.stained said:

And is this unrelated to odd/even channel count?

I really have no idea. It is the same issue as in I2S driver. However, that code is taken from Rockchip BSP driver, so it might be right.

 

Did you retry with 2 channels now?

Link to comment
Share on other sites

Ok, something is happening:

ek@orangepiplus2e:~$ speaker-test -D hw:0 -c8

speaker-test 1.1.0

Playback device is hw:0
Stream parameters are 48000Hz, S16_LE, 8 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 32 to 32768
Period size range from 16 to 4096
Using max buffer size 32768
Periods = 4
was set period_size = 4096
was set buffer_size = 32768
 0 - Front Left
 1 - Front Right
 2 - Unknown
 3 - Unknown
 4 - Unknown
 5 - Unknown
 6 - Unknown
 7 - Unknown
Time per period = 23,245443

 but: there is no sound on any Channel , just silence.  I can here the relays clicking on my AVR and it shows me "Dolby Digital"  instead of  expected "Multichannel PCM" (that is what i get with my Hummingboard and Raspberry with modified Kernel)

 

I will build a new Kernel with "channels_min = 2" to check if there is sound with only 2 channels.

Link to comment
Share on other sites

Compiling is running!

 

speaker-test gives 2 channel output with 2, 4, 6, 8 channels testing. There is only noise coming from fronts, channel enumeration is different on -c8, active channels are 0 and 7. (possible wrong channel mapping)

speaker-test is running without errors. My AVR only indicates the samplerate, no Dolby Digital anymore, but also no Multichannel PCM.

On RK3328 (z28) i found something similar, speaker-test without errors, sound only on the fronts (mapping ok). Kwiboo thinks that there are multichannel patches missing on ayufans kernel.

 

 

Link to comment
Share on other sites

10 hours ago, Da Alchemist said:

On RK3328 (z28) i found something similar, speaker-test without errors, sound only on the fronts (mapping ok).

I took latest code from Rockchip BSP kernel (almost same HDMI controller), so similar result is not surprising. Can you post dmesg?

 

I will take a look if something obvious is missing, but since I don't have soundbar or something similar, I can't promise anything.

Link to comment
Share on other sites

3 minutes ago, jernej said:

@zador.blood.stained You follow IRC log closely :). Did you try it out? I don't have access to OrangePi over this weekend...

Trying to integrate the Mali kernel driver to build in-tree... For some reason it ignores MALI_PLATFORM define in the Makefile. so I'm trying to find a workaround without adding ugly hacks, or rather trying to make hacks less ugly.

Link to comment
Share on other sites

4 minutes ago, jernej said:

Maybe something like I had done for legacy kernel here https://github.com/jernejsk/linux/tree/master/drivers/gpu ?

I believe I've found the docs that state that if Kbuild and Makefile are both present in a directory, then Kbuild is used and Makefile is simply ignored, and my experimentation confirms that. So I just need to clean up the Makefile and source it from Kbuild.

Link to comment
Share on other sites

I got it running (more or less), but not without issues - very low subjective performance and kernel driver issues

 

 

[  279.692516] Unhandled fault: page domain fault (0x01b) at 0x01e0fa5c
[  279.698873] pgd = eb610000
[  279.701577] [01e0fa5c] *pgd=befc0835
[  279.705157] Internal error: : 1b [#1] SMP THUMB2
[  279.709768] Modules linked in: fuse ir_lirc_codec snd_soc_simple_card snd_soc_simple_card_utils lirc_dev snd_soc_hdmi_codec sunxi_cir sun8i_codec_analog sun4i_codec sun4i_i2s snd_soc_core snd_pcm_dmaengine snd_pcm input_leds evdev snd_timer sun4i_gpadc_iio snd soundcore cpufreq_dt uio_pdrv_genirq uio dw_hdmi_i2s_audio hid_logitech_hidpp hid_logitech_dj sun8i_dw_hdmi dw_hdmi mali sun4i_tcon sun8i_mixer sun4i_drm realtek
[  279.746878] CPU: 2 PID: 3058 Comm: es2gears_x11 Not tainted 4.13.0-sunxi #1
[  279.753827] Hardware name: Allwinner sun8i Family
[  279.758524] task: eb5a4380 task.stack: eb618000
[  279.763177] PC is at mali_gp_job_create+0x103/0x4e0 [mali]
[  279.768699] LR is at mali_gp_job_create+0xee/0x4e0 [mali]
[  279.774090] pc : [<bf830178>]    lr : [<bf830163>]    psr: 40070033
[  279.780346] sp : eb619ea8  ip : 00000010  fp : ed5d7700
[  279.785563] r10: ec0101ac  r9 : 00000004  r8 : 00000000
[  279.790780] r7 : 01e0f9f8  r6 : ed710108  r5 : ed7100f8  r4 : ed710000
[  279.797299] r3 : eb618000  r2 : eb5a4380  r1 : 00040000  r0 : 00000bf2
[  279.803817] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA Thumb  Segment none
[  279.811114] Control: 50c5387d  Table: 6b61006a  DAC: 00000051
[  279.816852] Process es2gears_x11 (pid: 3058, stack limit = 0xeb618210)
[  279.823369] Stack: (0xeb619ea8 to 0xeb61a000)
[  279.827725] 9ea0:                   ed5d7700 bf83c3f8 00000051 ec010000 00000004 01e0ff20
[  279.835894] 9ec0: ec1d15c0 00000051 00000004 ffffe000 ed5d7700 ec010000 00000000 01e0f9f8
[  279.844062] 9ee0: 00000004 00000000 01e02a80 bf83199f 00000004 00000000 01e0f9f8 00000000
[  279.852230] 9f00: 01e102f0 00000000 be9d40c0 c9e71268 c0188404 eb6a4900 be9d40c0 bf82ae25
[  279.860399] 9f20: c0188404 c0227857 eb619f60 00000129 c0106424 c02303d7 be9d402c 00000000
[  279.868567] 9f40: ebd28fc0 00000129 c0106424 c0706075 be9d402c c0706075 00000000 c02303d7
[  279.876735] 9f60: 00000004 00000000 eb6a4901 00000000 eb6a4900 c0188404 be9d40c0 00000004
[  279.884903] 9f80: 00000000 c0227ed7 00000000 00000004 00000000 01e102f0 00000036 c0106424
[  279.893071] 9fa0: eb618000 c0106261 00000004 00000000 00000004 c0188404 be9d40c0 00000000
[  279.901239] 9fc0: 00000004 00000000 01e102f0 00000036 00000000 00000000 06000003 01e02a80
[  279.909407] 9fe0: b6fc00fc be9d40ac b6f2dfc3 b6cdada6 00070030 00000004 00000000 00000000
[  279.917679] [<bf830178>] (mali_gp_job_create [mali]) from [<bf83199f>] (_mali_ukk_pp_and_gp_start_job+0x8e/0x194 [mali])
[  279.928619] [<bf83199f>] (_mali_ukk_pp_and_gp_start_job [mali]) from [<bf82ae25>] (pp_and_gp_start_job_wrapper+0x14/0x28 [mali])
[  279.940218] [<bf82ae25>] (pp_and_gp_start_job_wrapper [mali]) from [<c0227857>] (do_vfs_ioctl+0x7f/0x6b8)
[  279.949778] [<c0227857>] (do_vfs_ioctl) from [<c0227ed7>] (SyS_ioctl+0x47/0x50)
[  279.957084] [<c0227ed7>] (SyS_ioctl) from [<c0106261>] (ret_fast_syscall+0x1/0x4c)
[  279.964648] Code: f8c4 6108 f8c4 610c (6e79) b9d1
[  279.969435] ---[ end trace c5c28b0ee20139fa ]---
 

 

 

Edit: actually es2info crashes and es2gears is stuck not displaying anything, so "working" is relative. I wonder if this issue (or at least one of possible issues) is similar to previous issue on 2GB boards (I'm testing on OPI+2E)

Edit 2: same issue on OPi PC, so it's probably not related.

Link to comment
Share on other sites

2 minutes ago, jernej said:

Is performance any better?

No. I tried playing with some armsoc settings (like disabling UMP_LOCK) and it still +/- the same, but since CPU DVFS is currently missing performance may be mostly CPU bound.

 

3 minutes ago, jernej said:

Can you commit your patches so I can do few tests?

Only Mali kernel driver patch was not pushed (I didn't make a package for libmali yet and copied and symlinked it by hand), and wouldn't it be easier to build it out of tree instead of rebuilding the whole kernel? I think about adding a lot of printk() in mali_gp_job_create to find at least where exactly it crashes, and I probably will be building it out of tree now too.

Link to comment
Share on other sites

Also es2_info crashes without producing any kernel messages.

Spoiler

root@orangepiplus2e:~# DISPLAY=:0 es2_info
EGL_VERSION: 1.4 Linux-r6p0-01rel0
EGL_VENDOR: ARM
EGL_EXTENSIONS:
    EGL_KHR_image, EGL_KHR_image_base, EGL_KHR_image_pixmap,
    EGL_EXT_image_dma_buf_import, EGL_KHR_gl_texture_2D_image,
    EGL_KHR_gl_texture_cubemap_image, EGL_KHR_gl_renderbuffer_image,
    EGL_KHR_reusable_sync, EGL_KHR_fence_sync,
    EGL_KHR_swap_buffers_with_damage, EGL_EXT_swap_buffers_with_damage,
    EGL_KHR_lock_surface, EGL_KHR_lock_surface2,
    EGL_EXT_create_context_robustness, EGL_ANDROID_blob_cache,
    EGL_KHR_create_context, EGL_KHR_partial_update
EGL_CLIENT_APIS: OpenGL_ES
GL_VERSION: OpenGL ES 2.0
GL_RENDERER: Mali-400 MP
GL_EXTENSIONS:
    GL_OES_texture_npot, GL_OES_vertex_array_object,
    GL_OES_compressed_ETC1_RGB8_texture,
    GL_EXT_compressed_ETC1_RGB8_sub_texture, GL_OES_standard_derivatives,
    GL_OES_EGL_image, GL_OES_depth24, GL_ARM_rgba8,
    GL_ARM_mali_shader_binary, GL_OES_depth_texture,
    GL_OES_packed_depth_stencil, GL_EXT_texture_format_BGRA8888,
    GL_OES_vertex_half_float, GL_EXT_blend_minmax, GL_OES_EGL_image_external,
    GL_OES_EGL_sync, GL_OES_rgb8_rgba8, GL_EXT_multisampled_render_to_texture,
    GL_EXT_discard_framebuffer, GL_OES_get_program_binary,
    GL_ARM_mali_program_binary, GL_EXT_shader_texture_lod, GL_EXT_robustness,
    GL_OES_depth_texture_cube_map, GL_KHR_debug,
    GL_ARM_shader_framebuffer_fetch,
    GL_ARM_shader_framebuffer_fetch_depth_stencil, GL_OES_mapbuffer
[xcb] Unknown request in queue while appending request
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
*** Error in `es2_info': malloc(): memory corruption: 0x01d3000c ***
Aborted
root@orangepiplus2e:~#

 

 

Link to comment
Share on other sites

8 minutes ago, zador.blood.stained said:

wouldn't it be easier to build it out of tree instead of rebuilding the whole kernel?

That's true.

 

9 minutes ago, zador.blood.stained said:

(like disabling UMP_LOCK)

That userspace driver doesn't support ump. Did you disabled support for it while building? It is dma-buf version.

Link to comment
Share on other sites

2 minutes ago, jernej said:

That userspace driver doesn't support ump.

I know :) But I saw UMP related entries in Xorg.0.log and misread that it was enabled by default (now that I checked the man page again it is disabled by default)

 

2 minutes ago, jernej said:

Did you disabled support for it while building?

Kernel driver? It is disabled by default

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines