On 8/28/2018 7:01 PM, Martijn van Duren wrote:
> On 08/28/18 23:17, Brian Callahan wrote:
>> On 08/28/18 17:08, Martijn van Duren wrote:
>>> On 08/28/18 22:08, Daniel Dickman wrote:
>>>>> On Aug 28, 2018, at 3:19 PM, Klemens Nanni <k...@openbsd.org> wrote:
>>>>>
>>>>>> On Tue, Aug 28, 2018 at 03:15:14PM -0400, Brian Callahan wrote:
>>>>>> I removed the BROKEN marker to see what would happen, and it turns out 
>>>>>> the
>>>>>> code uses functions that from Py-Pillow that have since been removed. And
>>>>>> "fixing" it as best I could ran into a different segfault (from pygame it
>>>>>> looks like).
>>>>> Given that, OK kn.
>>>>>
>>>> ok daniel for this one. i’d also tried to fix this one and failed.
>>>>
>>> I just applied the patch below and it runs just fine on my machine.
>>>
>>> @daniel: please don't send such reminders so late on a workday, this
>>> is going to affect my getting up tomorrow morning.
>>>
>>> martijn@
>>>
>> For completeness and the archives, tb and I both independently came up with 
>> similar diffs.
>> Users of radeon graphics might still encounter a problem, for instance on my 
>> machine with a radeon 6130 I get:
>>
>> /home/brian $ fretsonfire
>> radeon: Failed to allocate a buffer:
>> radeon:    size      : 1431658496 bytes
>> radeon:    alignment : 8192 bytes
>> radeon:    domains   : 6
>> radeon:    flags     : 20
>> pthread_mutex_destroy on mutex with waiters!
>> Fatal Python error: (pygame parachute) Segmentation Fault
>> Abort trap
>>
>> but it worked for tb on Intel graphics. With that said, I won't stand in the 
>> way of this being fixed in this way, but maybe a note somewhere would be 
>> helpful?
>>
>> ~Brian
> I found some other (in-game) notifications about s/tostring/tobytes/,
> so I did just that.
>
> I agree that we should mention that radeon cards are known to cause 
> issues, but I don't know the best place for them. Diff below places them
> in the Makefile, but maybe we want them somewhere where users can find  
> them more easily (readme?).

pkg/DESCR would be a good candidate too--that's something that users
(should) read at least.

~Brian

> Anyway, I've been playing this game for too long now; it's late and my
> fingers hurt.
>
> martijn@
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/fretsonfire/Makefile,v
> retrieving revision 1.15
> diff -u -p -r1.15 Makefile
> --- Makefile  29 Sep 2015 10:52:12 -0000      1.15
> +++ Makefile  28 Aug 2018 22:56:39 -0000
> @@ -1,6 +1,7 @@
>  # $OpenBSD: Makefile,v 1.15 2015/09/29 10:52:12 sthen Exp $
>  
> -BROKEN = fails at runtime "python2.7 in free(): error: modified 
> chunk-pointer 0x..."
> +# This port is known to generate errors on (some) radeon cards.
> +# Intel cards appear to work fine.
>  
>  V =                  1.3.110
>  COMMENT =            guitar hero clone
> Index: patches/patch-src_Texture_py
> ===================================================================
> RCS file: /cvs/ports/games/fretsonfire/patches/patch-src_Texture_py,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-src_Texture_py
> --- patches/patch-src_Texture_py      6 Apr 2014 21:10:25 -0000       1.1
> +++ patches/patch-src_Texture_py      28 Aug 2018 22:56:39 -0000
> @@ -1,6 +1,7 @@
>  $OpenBSD: patch-src_Texture_py,v 1.1 2014/04/06 21:10:25 sthen Exp $
> ---- src/Texture.py.orig      Sun Apr  6 18:28:33 2014
> -+++ src/Texture.py   Sun Apr  6 18:29:48 2014
> +Index: src/Texture.py
> +--- src/Texture.py.orig
> ++++ src/Texture.py
>  @@ -24,10 +24,10 @@ from __future__ import division
>   
>   import Log
> @@ -14,3 +15,62 @@ $OpenBSD: patch-src_Texture_py,v 1.1 201
>   from OpenGL.GL import *
>   from OpenGL.GLU import *
>   from Queue import Queue, Empty
> +@@ -210,13 +210,13 @@ class Texture:
> +     """Load the texture from a PIL image"""
> +     image = image.transpose(Image.FLIP_TOP_BOTTOM)
> +     if image.mode == "RGBA":
> +-      string = image.tostring('raw', 'RGBA', 0, -1)
> ++      string = image.tobytes('raw', 'RGBA', 0, -1)
> +       self.loadRaw(image.size, string, GL_RGBA, 4)
> +     elif image.mode == "RGB":
> +-      string = image.tostring('raw', 'RGB', 0, -1)
> ++      string = image.tobytes('raw', 'RGB', 0, -1)
> +       self.loadRaw(image.size, string, GL_RGB, 3)
> +     elif image.mode == "L":
> +-      string = image.tostring('raw', 'L', 0, -1)
> ++      string = image.tobytes('raw', 'L', 0, -1)
> +       self.loadRaw(image.size, string, GL_LUMINANCE, 1)
> +     else:
> +       raise TextureException("Unsupported image mode '%s'" % image.mode)
> +@@ -254,16 +254,16 @@ class Texture:
> +     if monochrome:
> +       # pygame doesn't support monochrome, so the fastest way
> +       # appears to be using PIL to do the conversion.
> +-      string = pygame.image.tostring(surface, "RGB")
> ++      string = pygame.image.tobytes(surface, "RGB")
> +       image = Image.fromstring("RGB", surface.get_size(), 
> string).convert("L")
> +-      string = image.tostring('raw', 'L', 0, -1)
> ++      string = image.tobytes('raw', 'L', 0, -1)
> +       self.loadRaw(surface.get_size(), string, GL_LUMINANCE, GL_INTENSITY8)
> +     else:
> +       if alphaChannel:
> +-        string = pygame.image.tostring(surface, "RGBA", True)
> ++        string = pygame.image.tobytes(surface, "RGBA", True)
> +         self.loadRaw(surface.get_size(), string, GL_RGBA, 4)
> +       else:
> +-        string = pygame.image.tostring(surface, "RGB", True)
> ++        string = pygame.image.tobytes(surface, "RGB", True)
> +         self.loadRaw(surface.get_size(), string, GL_RGB, 3)
> +     self.size = (w / w2, h / h2)
> + 
> +@@ -273,16 +273,16 @@ class Texture:
> +     if monochrome:
> +       # pygame doesn't support monochrome, so the fastest way
> +       # appears to be using PIL to do the conversion.
> +-      string = pygame.image.tostring(surface, "RGB")
> ++      string = pygame.image.tobytes(surface, "RGB")
> +       image = Image.fromstring("RGB", surface.get_size(), 
> string).convert("L")
> +-      string = image.tostring('raw', 'L', 0, -1)
> ++      string = image.tobytes('raw', 'L', 0, -1)
> +       self.loadSubRaw(surface.get_size(), position, string, GL_INTENSITY8)
> +     else:
> +       if alphaChannel:
> +-        string = pygame.image.tostring(surface, "RGBA", True)
> ++        string = pygame.image.tobytes(surface, "RGBA", True)
> +         self.loadSubRaw(surface.get_size(), position, string, GL_RGBA)
> +       else:
> +-        string = pygame.image.tostring(surface, "RGB", True)
> ++        string = pygame.image.tobytes(surface, "RGB", True)
> +         self.loadSubRaw(surface.get_size(), position, string, GL_RGB)
> + 
> +   def loadRaw(self, size, string, format, components):

Reply via email to