From fceee460226ca55a3ae7f41b2f62ffd12c825407 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 31 Mar 2010 12:28:49 +0100 Subject: python/tests: Get the tests running again. --- progs/gallium/python/tests/surface_copy.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'progs/gallium/python/tests/surface_copy.py') diff --git a/progs/gallium/python/tests/surface_copy.py b/progs/gallium/python/tests/surface_copy.py index a3f1b3e130..37d210d904 100755 --- a/progs/gallium/python/tests/surface_copy.py +++ b/progs/gallium/python/tests/surface_copy.py @@ -99,21 +99,18 @@ class TextureTest(TestCase): w = dst_surface.width h = dst_surface.height - # ??? - stride = pf_get_stride(texture->format, w) - size = pf_get_nblocksy(texture->format) * stride + stride = util_format_get_stride(format, w) + size = util_format_get_nblocksy(format, h) * stride src_raw = os.urandom(size) - src_surface.put_tile_raw(0, 0, w, h, src_raw, stride) - ctx = self.dev.context_create() + ctx.surface_write_raw(src_surface, 0, 0, w, h, src_raw, stride) + ctx.surface_copy(dst_surface, 0, 0, src_surface, 0, 0, w, h) - ctx.flush() - - dst_raw = dst_surface.get_tile_raw(0, 0, w, h) + dst_raw = ctx.surface_read_raw(dst_surface, 0, 0, w, h) if dst_raw != src_raw: raise TestFailure -- cgit v1.2.3 From aae63a7109c963794b28e64078fd0fb1d454f5df Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 31 Mar 2010 13:12:08 +0100 Subject: python/tests: Speed up the tests by reusing the same pipe context. --- progs/gallium/python/tests/surface_copy.py | 5 +++-- progs/gallium/python/tests/texture_transfer.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'progs/gallium/python/tests/surface_copy.py') diff --git a/progs/gallium/python/tests/surface_copy.py b/progs/gallium/python/tests/surface_copy.py index 37d210d904..9364fd1110 100755 --- a/progs/gallium/python/tests/surface_copy.py +++ b/progs/gallium/python/tests/surface_copy.py @@ -56,6 +56,7 @@ class TextureTest(TestCase): def test(self): dev = self.dev + ctx = self.ctx target = self.target format = self.format @@ -103,8 +104,6 @@ class TextureTest(TestCase): size = util_format_get_nblocksy(format, h) * stride src_raw = os.urandom(size) - ctx = self.dev.context_create() - ctx.surface_write_raw(src_surface, 0, 0, w, h, src_raw, stride) ctx.surface_copy(dst_surface, 0, 0, @@ -119,6 +118,7 @@ class TextureTest(TestCase): def main(): dev = Device() + ctx = dev.context_create() suite = TestSuite() targets = [ @@ -178,6 +178,7 @@ def main(): while zslice < depth >> level: test = TextureTest( dev = dev, + ctx = ctx, target = target, format = format, width = size, diff --git a/progs/gallium/python/tests/texture_transfer.py b/progs/gallium/python/tests/texture_transfer.py index 3595e9c614..97a28e01a4 100755 --- a/progs/gallium/python/tests/texture_transfer.py +++ b/progs/gallium/python/tests/texture_transfer.py @@ -59,6 +59,7 @@ class TextureTest(TestCase): def test(self): dev = self.dev + ctx = self.ctx target = self.target format = self.format @@ -91,8 +92,6 @@ class TextureTest(TestCase): in_raw = os.urandom(size) - ctx = self.dev.context_create() - ctx.surface_write_raw(surface, 0, 0, surface.width, surface.height, in_raw, stride) out_raw = ctx.surface_read_raw(surface, 0, 0, surface.width, surface.height) @@ -103,6 +102,7 @@ class TextureTest(TestCase): def main(): dev = Device() + ctx = dev.context_create() suite = TestSuite() targets = [ @@ -162,6 +162,7 @@ def main(): while zslice < depth >> level: test = TextureTest( dev = dev, + ctx = ctx, target = target, format = format, width = size, -- cgit v1.2.3