Bug 1082303 - Mesa: push u_mesa-python3-only.patch upstream
Mesa: push u_mesa-python3-only.patch upstream
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: X.Org
Current
Other Other
: P2 - High : Normal (vote)
: ---
Assigned To: Stefan Dirsch
E-mail List
:
Depends on:
Blocks: 1082292
  Show dependency treegraph
 
Reported: 2018-02-22 14:23 UTC by Stefan Dirsch
Modified: 2018-06-21 21:36 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
output.orig (100.95 KB, text/x-csrc)
2018-03-01 14:25 UTC, Tomáš Chvátal
Details
output.python2 (100.95 KB, text/x-csrc)
2018-03-01 14:26 UTC, Tomáš Chvátal
Details
0001-r600-egd_tables.py-added-support-for-python-3.patch (4.23 KB, patch)
2018-03-01 14:27 UTC, Tomáš Chvátal
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Dirsch 2018-02-22 14:23:49 UTC
- u_mesa-python3-only.patch
The shebang line should not be needed, looks fine otherwise.

--> send upstream
Comment 1 Stefan Dirsch 2018-02-23 14:38:40 UTC
Still need to send 

  obs://X11:XOrg/Mesa/u_r600-egd_tables.py-added-support-for-python-3.patch 

upstream.
Comment 4 Stefan Dirsch 2018-02-23 15:06:39 UTC
Sent upstream.
Comment 5 Swamp Workflow Management 2018-02-23 15:40:15 UTC
This is an autogenerated message for OBS integration:
This bug (1082303) was mentioned in
https://build.opensuse.org/request/show/579528 Factory / Mesa
Comment 6 Stefan Dirsch 2018-02-28 11:15:24 UTC
Received feedback. Patch redone.

https://lists.freedesktop.org/archives/mesa-dev/2018-February/187207.html
Comment 7 Stefan Dirsch 2018-02-28 11:56:58 UTC
Build fails with the updated patch.

[  315s] make[4]: Entering directory '/home/abuild/rpmbuild/BUILD/mesa-18.0.0-rc4/src/gallium/drivers/r600'
[  315s]   GEN      egd_tables.h
[  315s] Traceback (most recent call last):
[  315s]   File "./egd_tables.py", line 309, in <module>
[  315s]     main()
[  315s]   File "./egd_tables.py", line 304, in main
[  315s]     parse(arg, regs, packets)
[  315s]   File "./egd_tables.py", line 150, in parse
[  315s]     stream = io.open('filename', 'b')
[  315s] NameError: name 'io' is not defined
[  315s] make[4]: *** [Makefile:1128: egd_tables.h] Error 1

Now I noticed that you need to run:

  python2/python3 ./egd_tables.py evergreend.h

Means I've tested *without* the parse file. The patch is complete crap!
Comment 8 Stefan Dirsch 2018-02-28 14:48:47 UTC
Additional patch, but different results. :-(

--- python2
+++ python3

[...]
 static const char egd_strings[] =
-       "NOP\0" /* 0 */
-       "DEALLOC_STATE\0" /* 4 */
[...]
+       "b'NOP'\0" /* 0 */
+       "b'DEALLOC_STATE'\0" /* 4 */


diff --git a/src/gallium/drivers/r600/egd_tables.py b/src/gallium/drivers/r600/egd_tables.py
index ee62157141..2d4091e55a 100644
--- a/src/gallium/drivers/r600/egd_tables.py
+++ b/src/gallium/drivers/r600/egd_tables.py
@@ -28,6 +28,7 @@ CopyRight = '''
 
 import sys
 import re
+import io
 
 
 class StringTable:
@@ -147,7 +148,7 @@ def strip_prefix(s):
     return s[s[2:].find('_')+3:]
 
 def parse(filename, regs, packets):
-    stream = io.open('filename', 'b')
+    stream = io.open(filename, 'rt')
 
     for line in stream:
         if not line.startswith('#define '):
Comment 9 Stefan Dirsch 2018-03-01 11:14:52 UTC
Just noticed that the original patch we're currently using suffers from the same issue. :-(

So I would say we're currently generating broken code ...
Comment 10 Tomáš Chvátal 2018-03-01 13:55:12 UTC
(In reply to Stefan Dirsch from comment #9)
> Just noticed that the original patch we're currently using suffers from the
> same issue. :-(
> 
> So I would say we're currently generating broken code ...

Hmm I will look at it in a bit.
Comment 11 Stefan Dirsch 2018-03-01 14:15:41 UTC
(In reply to Tomáš Chvátal from comment #10)
> (In reply to Stefan Dirsch from comment #9)
> > Just noticed that the original patch we're currently using suffers from the
> > same issue. :-(
> > 
> > So I would say we're currently generating broken code ...
> 
> Hmm I will look at it in a bit.

Thanks a lot! Please make sure that the output with python3 is the same as with python2.

cd src/gallium/drivers/r600
python2/python3 ./egd_tables.py evergreend.h

I got hints how to do it right in

https://lists.freedesktop.org/archives/mesa-dev/2018-February/187056.html
Comment 12 Tomáš Chvátal 2018-03-01 14:25:45 UTC
Created attachment 762335 [details]
output.orig
Comment 13 Tomáš Chvátal 2018-03-01 14:26:06 UTC
Created attachment 762336 [details]
output.python2
Comment 14 Tomáš Chvátal 2018-03-01 14:27:02 UTC
Created attachment 762337 [details]
0001-r600-egd_tables.py-added-support-for-python-3.patch

Added orig output with the initial script.

The patch now generates 1:1 file using both python2 and python3.
Comment 15 Tomáš Chvátal 2018-03-01 14:29:16 UTC
(In reply to Stefan Dirsch from comment #9)
> Just noticed that the original patch we're currently using suffers from the
> same issue. :-(
> 
> So I would say we're currently generating broken code ...

On a bright side there were no unicode characters used in the header files as such it does not require us to play with io and biteness.
Comment 17 Stefan Dirsch 2018-03-01 15:55:29 UTC
Thanks. I've double checked, that the issue is fixed with the new patch.
Comment 19 Swamp Workflow Management 2018-03-01 16:00:06 UTC
This is an autogenerated message for OBS integration:
This bug (1082303) was mentioned in
https://build.opensuse.org/request/show/581743 Factory / Mesa
Comment 21 Stefan Dirsch 2018-03-01 16:33:57 UTC
done
Comment 23 Swamp Workflow Management 2018-03-01 17:10:07 UTC
This is an autogenerated message for OBS integration:
This bug (1082303) was mentioned in
https://build.opensuse.org/request/show/581791 Factory / Mesa
Comment 25 Stefan Dirsch 2018-03-08 11:27:44 UTC
(In reply to Stefan Dirsch from comment #24)
> https://lists.freedesktop.org/archives/mesa-dev/2018-March/187492.html

Wrong one. This one is the latest version:

https://lists.freedesktop.org/archives/mesa-dev/2018-March/187565.html