Bug 94197

Summary: SAD counting bug inintel/linux-4.0.4/drivers/gpu/drm/drm_edid.c
Product: DRI Reporter: Arturo Pérez <artur999555>
Component: DRM/IntelAssignee: Mengdong Lin <mengdong.lin>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: medium CC: intel-gfx-bugs
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: BSW/CHT i915 features:
Attachments:
Description Flags
EDID captured from Krell using OpenELEC/Kodi instructions
none
[PATCH] drm/edid: Extract SADs properly from multiple audio data blocks none

Description Arturo Pérez 2016-02-17 16:31:23 UTC
Created attachment 121817 [details]
EDID captured from Krell using OpenELEC/Kodi instructions

I have a Krell Foundation non-4K which has a strange EDID.  It does not have one audio block with multiple SAD within it as do Marantz receivers but rather it has several audio blocks, one after another.

When I connect the Foundation to an Asrock Beebox running OpenELEC the ELD data structure ends up with only one element.

I think that is because of these lines of code starting at line 3157 in intel/linux-4.0.4/drivers/gpu/drm/drm_edid.c

 case AUDIO_BLOCK:
 /* Audio Data Block, contains SADs */
 sad_count = dbl / 3;
 if (dbl >= 1)
     memcpy(eld + 20 + mnl, &db[1], dbl);
 break;

For the Krell, the sad_count would need to be incremented instead of just set to the value from the EDID.  I do not know how this code would keep all the audio blocks in such a fashion.

Now, if you tell me that the Foundation is doing this incorrectly I am more than willing to report that to Krell. ;-)

Krill Foundation manual: http://krellonline.com/downloads/FoundationProcessorOwnersReference_web.pdf
Comment 1 Arturo Pérez 2016-02-17 16:41:13 UTC
das-schoen:~ # uname -r
4.4.1
das-schoen:~ # uname -m
x86_64

Machine: Asrock Beebox n3000
OS: OpenELEC
OpenELEC (community) Version: devel-20160205163951-r22034-g76ba946
OpenELEC git: 76ba94657514eb7ed4c0b42546b7b9d9f7bb5ddb


Connected via HDMI.
Comment 2 Ville Syrjala 2016-03-01 20:04:57 UTC
Created attachment 122065 [details] [review]
[PATCH] drm/edid: Extract SADs properly from multiple audio data  blocks

Glanced at the specs a bit, and ended up writing a patch while reading. Please test.
Comment 3 Arturo Pérez 2016-03-05 18:20:53 UTC
Tested with the below build from OpenELEC group.  It correctly detects all the audio devices as show by the cat'ing the eld device.

das-schoen:/proc/asound/card0 # uname -r
4.3.0
das-schoen:/proc/asound/card0 # uname -m
x86_64

Linux version 4.3.0 (mattd@ubuntu1510-VirtualBox) (gcc version 4.9.3 (GCC) ) #1 SMP Wed Mar 2 10:50:09 CST 2016

In case you want to look at it
das-schoen:~ # dmesg | pastebinit
http://sprunge.us/YTiE

das-schoen:/proc/asound/card0 # cat eld\#2.0 | pastebinit
http://sprunge.us/RDQA
Comment 4 MattDevo 2016-03-05 21:52:07 UTC
Comment on attachment 122065 [details] [review]
[PATCH] drm/edid: Extract SADs properly from multiple audio data  blocks

Review of attachment 122065 [details] [review]:
-----------------------------------------------------------------

fix confirmed by reporter using custom OpenELEC build with kernel 4.3 and patch applied
Comment 5 Chris Wilson 2016-03-30 16:48:41 UTC
commit 7c01878254daadbb91f5b1137b7404d952e3931b
Author: Ville Syrjälä <ville.syrjala@linux.intel.com>
Date:   Wed Mar 9 22:07:46 2016 +0200

    drm/edid: Extract SADs properly from multiple audio data blocks

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.