Hi again,

On Sun, 19 Jul 2015 23:03:32 +0200
"Denis 'GNUtoo' Carikli" <[email protected]> wrote:
> Now I'll try to find the time to:
> -> Work on a clean patch for linux-libre.
> -> Make the deblob script do the same modification than the clean
> patch.  

I've attached the a patch against deblob-4.5.
I wasn't sure which file to patch since there are different deblob
scripts, like the ones in the svn. I hope it's the correct file.

On Wed, 15 Jul 2015 22:06:38 -0300
Alexandre Oliva <[email protected]> wrote:

> > Integration:
> > ------------
> > So if integrating a way to do that automatically in linux-libre is
> > desirable, how would I have to do it:
> > - Trough sed/awk scripts that would break easily between
> > releases ?  
> 
> This would probably be best.  Having to adjust changes between major
> releases is not unusual, and I'd prefer that over additional
> dependencies.
The deblob-4.5 didn't use awk, so not to add more dependencies, I used
grep.
Should I rewrite it using awk, to be less fragile?

Tests:
------
To test I've built parabola's linux-libre 4.5.1, replacing their radeon
patch by the one generated by the test.sh[1] script attached.

The machine then rebooted fine. The radeon driver and xf86-video-ati
worked fine (without 3D or XV acceleration).

The internal GPU of the Asus M4A785T-M mainboard was used to test:
> 01:05.0 VGA compatible controller [0300]: Advanced Micro Devices,
> Inc. [AMD/ATI] RS880 [Radeon HD 4200] [1002:9710]

This gpu is handled by the r600.c file that the patch touches.

I've not tried to support other GPUs because:
- Testing the patch on other GPU families would require access to such
  GPUs, and it's for me, either time consuming or not possible,
  depending on the family.
- Adapting such patch to another GPU is trivial.
  To do that one needs to find code that looks like that in the the .c
  file handling a given GPU family:
> if (!rdev->me_fw || !rdev->pfp_fw || !rdev->rlc_fw) {
>        r = r600_init_microcode(rdev);
>        if (r) {
>                DRM_ERROR("Failed to load firmware!\n");
>                return r;
>       }
> }
  Then if the number of lines to remove (7 here) matches "func_len" in
  radeon_skip_init_microcode_check, one just need to call
  radeon_skip_init_microcode_check with the right file, like it is done
  for r600.c

References:
-----------
[1] Patches integrity checks was disable while building.

Denis.
Index: patch/deblob-4.5
===================================================================
--- patch.orig/deblob-4.5
+++ patch/deblob-4.5
@@ -249,6 +249,19 @@ undefault_firmware () {
     "disabled non-Free firmware" "$@"
 }
 
+radeon_skip_init_microcode_check() {
+  #$1 = file
+  filetest $1 || return 0
+
+  func_len=7
+  func_begin=$(grep -n "if (\!rdev\->me_fw || \!rdev\->pfp_fw || \!rdev\->rlc_fw) {" "$1" | sed 's,:.*,,')
+  file_len=$(wc -l "$1" | sed 's, .*,,')
+  cat "$1" | head -n $(expr ${func_begin} \- 1 ) > "$1.deblob"
+  cat "$1" | tail -n $(expr ${file_len} \- ${func_begin} \- ${func_len} + 1) \
+		  >> "$1.deblob"
+  check_changed "$1"
+}
+
 # First, check that files that contain firmwares and their
 # corresponding sources are present.
 
@@ -744,6 +757,7 @@ reject_firmware drivers/gpu/drm/radeon/r
 clean_blob drivers/gpu/drm/radeon/radeon_vce.c
 clean_kconfig drivers/gpu/drm/Kconfig DRM_RADEON
 clean_mk CONFIG_DRM_RADEON drivers/gpu/drm/Makefile
+radeon_skip_init_microcode_check drivers/gpu/drm/radeon/r600.c
 
 announce DRM_STI - "DRM Support for STMicroelectronics SoC stiH41x Series"
 reject_firmware drivers/gpu/drm/sti/sti_hqvdp.c

Attachment: test.sh
Description: application/shellscript

Attachment: pgpZwl2mum9Jg.pgp
Description: OpenPGP digital signature

_______________________________________________
linux-libre mailing list
[email protected]
http://www.fsfla.org/cgi-bin/mailman/listinfo/linux-libre

Reply via email to