Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-12 Thread andrey simiklit
Hello,

I will fix it.
Thanks for review.

Regards,
Andrii.

On Tue, Dec 11, 2018 at 5:04 PM Emil Velikov 
wrote:

> Hi Andrii,
>
> Pardon for joining so late. The patch looks ok, although a few bits I'm
> unsure
> about - see the "Note" below.
>
> There's a bunch of cosmetic suggestions as well - I won't read too much
> into
> them though.
>
> On Mon, 3 Dec 2018 at 15:07,  wrote:
>
> [snip]
> > +#define TW 64
> > +#define TH 64
> #define LEVELS 7 // aka log2(min(TW,TH)) + 1 ?
> Then swap nlevels with LEVELS throughout the file.
>
> static const GLubyte fancy_pixel = [255, 128, 64, 32];
>




>
> > +static void
> > +get_rect_bounds(int pos, int *x, int *y, int *w, int *h)
> > +{
> > +   *x = pos * (piglit_width / 3) + 5;
> > +   *y = 5;
> > +   *w = piglit_width / 3 - 10;
> > +   *h = piglit_height - 10;
> > +}
> Note: The variable "pos" is always 0. If that's intentional - I'd just
> drop and simplify.
> Alternatively
>
>
> > +   const GLfloat expected[4] = { oneby255 * 255.0,
> > +
>oneby255 * 128.0,
> > +
>oneby255 * 64.0,
> > +
>oneby255 * 32.0 };
> Use fancy_pixel for expected[]
>
>
> [snip]
> > +   for(level = 1; level < nlevels && pass; ++level)
> > +   {
> Style nits: space after "for", "{" should be trailing on previous
> line, post increment
>
> > +   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL,
> level);
> > +   glClear(GL_COLOR_BUFFER_BIT);
> > +   /* If we the draw_rect function doesn't cause
> crash/assertion
> > +   * it means everything is okay and test will be marked
> > +   * as pass
> > +   */
> > +   draw_rect(pos);
> > +   /** Just in case we check it
> > +*/
> > +   pass = pass && probe_pos(pos, expected);
>
> Note: In piglit we try to run all the tests, even if one fails. Some tests
> could
> be doing it wrong though :-(
>
> Personally I would drop the "&& pass" from the loop condition and use:
> pass = foo() && pass;
>
> [snip]
> > +   for (i = 0; i < TH; i++) {
> > +   for (j = 0; j < TW; j++) {
> > +   img[i][j][0] = 255;
> > +   img[i][j][1] = 128;
> > +   img[i][j][2] = 64;
> > +   img[i][j][3] = 32;
>
> for (i = 0; i < TH; i++)
> for (j = 0; j < TW; j++)
> img[i][j] = fancy_pixel;
>
>
> [snip]
>
> > +   w = TW;
> > +   h = TH;
> > +   for (nlevels = 0; w > 0 && h > 0; nlevels++) {
> > +   w /= 2;
> > +   h /= 2;
> > +   }
> > +   w = TW;
> > +   h = TH;
> > +   for (i = 0; w > 0 && h > 0; i++) {
> > +   glTexImage2D(GL_TEXTURE_2D, nlevels - 1 - i, GL_RGBA, w,
> h, 0,
> > +GL_RGBA, GL_UNSIGNED_BYTE, img);
> > +   w /= 2;
> > +   h /= 2;
> > +   }
> > +
> With the LEVELS, all the above becomes:
>
>for (i = 0; i < LEVELS; i++) {
>glTexImage2D(GL_TEXTURE_2D, nlevels - 1 - i, GL_RGBA, w, h,
> 0,
> GL_RGBA, GL_UNSIGNED_BYTE, img);
>w /= 2;
>h /= 2;
>}
>
>
> HTH
> Emil
> ___
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
>
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-11 Thread Emil Velikov
Hi Andrii,

Pardon for joining so late. The patch looks ok, although a few bits I'm unsure
about - see the "Note" below.

There's a bunch of cosmetic suggestions as well - I won't read too much into
them though.

On Mon, 3 Dec 2018 at 15:07,  wrote:

[snip]
> +#define TW 64
> +#define TH 64
#define LEVELS 7 // aka log2(min(TW,TH)) + 1 ?
Then swap nlevels with LEVELS throughout the file.

static const GLubyte fancy_pixel = [255, 128, 64, 32];

> +static void
> +get_rect_bounds(int pos, int *x, int *y, int *w, int *h)
> +{
> +   *x = pos * (piglit_width / 3) + 5;
> +   *y = 5;
> +   *w = piglit_width / 3 - 10;
> +   *h = piglit_height - 10;
> +}
Note: The variable "pos" is always 0. If that's intentional - I'd just
drop and simplify.
Alternatively


> +   const GLfloat expected[4] = { oneby255 * 255.0,
> + 
>   oneby255 * 128.0,
> + 
>   oneby255 * 64.0,
> + 
>   oneby255 * 32.0 };
Use fancy_pixel for expected[]


[snip]
> +   for(level = 1; level < nlevels && pass; ++level)
> +   {
Style nits: space after "for", "{" should be trailing on previous
line, post increment

> +   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, level);
> +   glClear(GL_COLOR_BUFFER_BIT);
> +   /* If we the draw_rect function doesn't cause crash/assertion
> +   * it means everything is okay and test will be marked
> +   * as pass
> +   */
> +   draw_rect(pos);
> +   /** Just in case we check it
> +*/
> +   pass = pass && probe_pos(pos, expected);

Note: In piglit we try to run all the tests, even if one fails. Some tests could
be doing it wrong though :-(

Personally I would drop the "&& pass" from the loop condition and use:
pass = foo() && pass;

[snip]
> +   for (i = 0; i < TH; i++) {
> +   for (j = 0; j < TW; j++) {
> +   img[i][j][0] = 255;
> +   img[i][j][1] = 128;
> +   img[i][j][2] = 64;
> +   img[i][j][3] = 32;

for (i = 0; i < TH; i++)
for (j = 0; j < TW; j++)
img[i][j] = fancy_pixel;


[snip]

> +   w = TW;
> +   h = TH;
> +   for (nlevels = 0; w > 0 && h > 0; nlevels++) {
> +   w /= 2;
> +   h /= 2;
> +   }
> +   w = TW;
> +   h = TH;
> +   for (i = 0; w > 0 && h > 0; i++) {
> +   glTexImage2D(GL_TEXTURE_2D, nlevels - 1 - i, GL_RGBA, w, h, 0,
> +GL_RGBA, GL_UNSIGNED_BYTE, img);
> +   w /= 2;
> +   h /= 2;
> +   }
> +
With the LEVELS, all the above becomes:

   for (i = 0; i < LEVELS; i++) {
   glTexImage2D(GL_TEXTURE_2D, nlevels - 1 - i, GL_RGBA, w, h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, img);
   w /= 2;
   h /= 2;
   }


HTH
Emil
___
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit


Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-10 Thread andrey simiklit
Hello,

Could I ask you for a push if this patch looks good for you?

Thanks,
Andrii.

On Mon, Dec 3, 2018 at 8:01 PM Mark Janes  wrote:

> It's preferable to push piglit tests first, and produce the CI test
> failure.  CI staff will track the failure, and attribute it to the
> piglit patch.  When the subsequent mesa patch is pushed, we track the
> resolution.  The process gives us artifacts in git that help to analyze
> driver differences between stable releases.
>
> -Mark
>
> andrey simiklit  writes:
>
> > Hello,
> >
> > If this patch is acceptable by everybody then
> > I guess that we need to push the following mesa patch before this one
> > to avoid errors from Intel CI because the fix for an issue which is
> tested
> > by this test is still there.
> >
> > https://patchwork.freedesktop.org/patch/254397/
> > One of the last comment from Kenneth Graunke :
> >
> >>".
> >> So, back to Reviewed-by.  I think once we get a Piglit test, I'm
> happy
> >> to land this patch.
> >>
> >>--Ken"
> >>
> >
> > Thanks,
> > Andrii.
> >
> > On Mon, Dec 3, 2018 at 5:07 PM  wrote:
> >
> >> From: Andrii Simiklit 
> >>
> >> Test that usage of upside down miptree doesn't cause assertion
> >>
> >> The miptree:
> >>
> >> level 0 = 1x1
> >> level 1 = 2x2
> >> level 2 = 4x4
> >> ...
> >> level n = NxN
> >>
> >> should be acceptable for case when we don't use a min filter.
> >>
> >> v2: - Unnecessary function calls were removed
> >> - The 'glClearColor' call was moved to 'piglit_display' function
> >> - The program creation was moved to 'piglit_init' function
> >> - The requirements check was moved to 'piglit_init' function
> >>( Erik Faye-Lund  )
> >>
> >> - Fixed a leak of texture which is created in 'setup_texture'
> >>
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> >> Signed-off-by: Andrii Simiklit 
> >> Reviewed-by: Erik Faye-Lund 
> >> ---
> >>  tests/opengl.py   |   1 +
> >>  tests/texturing/CMakeLists.gl.txt |   1 +
> >>  tests/texturing/tex-upside-down-miptree.c | 171 ++
> >>  3 files changed, 173 insertions(+)
> >>  create mode 100644 tests/texturing/tex-upside-down-miptree.c
> >>
> >> diff --git a/tests/opengl.py b/tests/opengl.py
> >> index f7e408cd5..f6a38e40e 100644
> >> --- a/tests/opengl.py
> >> +++ b/tests/opengl.py
> >> @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
> >>  g(['getteximage-targets', '1D'])
> >>  g(['getteximage-targets', '2D'])
> >>  g(['teximage-scale-bias'])
> >> +g(['tex-upside-down-miptree'])
> >>  add_msaa_visual_plain_tests(g, ['draw-pixels'])
> >>  add_msaa_visual_plain_tests(g, ['read-front'],
> run_concurrent=False)
> >>  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
> >> diff --git a/tests/texturing/CMakeLists.gl.txt
> >> b/tests/texturing/CMakeLists.gl.txt
> >> index e5d41e432..02b572c79 100644
> >> --- a/tests/texturing/CMakeLists.gl.txt
> >> +++ b/tests/texturing/CMakeLists.gl.txt
> >> @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
> >>  piglit_add_executable (texture-rg texture-rg.c)
> >>  piglit_add_executable (teximage-colors teximage-colors.c)
> >>  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> >> +piglit_add_executable (tex-upside-down-miptree
> tex-upside-down-miptree.c)
> >>
> >>  # vim: ft=cmake:
> >> diff --git a/tests/texturing/tex-upside-down-miptree.c
> >> b/tests/texturing/tex-upside-down-miptree.c
> >> new file mode 100644
> >> index 0..8e8f7154b
> >> --- /dev/null
> >> +++ b/tests/texturing/tex-upside-down-miptree.c
> >> @@ -0,0 +1,171 @@
> >> +/*
> >> + * Copyright (c) 2018 Andrii Simiklit
> >> + *
> >> + * Permission is hereby granted, free of charge, to any person
> obtaining a
> >> + * copy of this software and associated documentation files (the
> >> "Software"),
> >> + * to deal in the Software without restriction, including without
> >> limitation
> >> + * the rights to use, copy, modify, merge, publish, distribute,
> >> sublicense,
> >> + * and/or sell copies of the Software, and to permit persons to whom
> the
> >> + * Software is furnished to do so, subject to the following conditions:
> >> + *
> >> + * The above copyright notice and this permission notice (including the
> >> next
> >> + * paragraph) shall be included in all copies or substantial portions
> of
> >> the
> >> + * Software.
> >> + *
> >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> >> EXPRESS OR
> >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> >> MERCHANTABILITY,
> >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> >> SHALL
> >> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> >> OTHER
> >> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING
> >> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> >> DEALINGS
> >> + * IN THE 

Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-04 Thread andrey simiklit
Hello,

Didn't know it, thanks for clarification :)

Regards,
Andrii.


On Mon, Dec 3, 2018 at 8:01 PM Mark Janes  wrote:

> It's preferable to push piglit tests first, and produce the CI test
> failure.  CI staff will track the failure, and attribute it to the
> piglit patch.  When the subsequent mesa patch is pushed, we track the
> resolution.  The process gives us artifacts in git that help to analyze
> driver differences between stable releases.
>
> -Mark
>
> andrey simiklit  writes:
>
> > Hello,
> >
> > If this patch is acceptable by everybody then
> > I guess that we need to push the following mesa patch before this one
> > to avoid errors from Intel CI because the fix for an issue which is
> tested
> > by this test is still there.
> >
> > https://patchwork.freedesktop.org/patch/254397/
> > One of the last comment from Kenneth Graunke :
> >
> >>".
> >> So, back to Reviewed-by.  I think once we get a Piglit test, I'm
> happy
> >> to land this patch.
> >>
> >>--Ken"
> >>
> >
> > Thanks,
> > Andrii.
> >
> > On Mon, Dec 3, 2018 at 5:07 PM  wrote:
> >
> >> From: Andrii Simiklit 
> >>
> >> Test that usage of upside down miptree doesn't cause assertion
> >>
> >> The miptree:
> >>
> >> level 0 = 1x1
> >> level 1 = 2x2
> >> level 2 = 4x4
> >> ...
> >> level n = NxN
> >>
> >> should be acceptable for case when we don't use a min filter.
> >>
> >> v2: - Unnecessary function calls were removed
> >> - The 'glClearColor' call was moved to 'piglit_display' function
> >> - The program creation was moved to 'piglit_init' function
> >> - The requirements check was moved to 'piglit_init' function
> >>( Erik Faye-Lund  )
> >>
> >> - Fixed a leak of texture which is created in 'setup_texture'
> >>
> >> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> >> Signed-off-by: Andrii Simiklit 
> >> Reviewed-by: Erik Faye-Lund 
> >> ---
> >>  tests/opengl.py   |   1 +
> >>  tests/texturing/CMakeLists.gl.txt |   1 +
> >>  tests/texturing/tex-upside-down-miptree.c | 171 ++
> >>  3 files changed, 173 insertions(+)
> >>  create mode 100644 tests/texturing/tex-upside-down-miptree.c
> >>
> >> diff --git a/tests/opengl.py b/tests/opengl.py
> >> index f7e408cd5..f6a38e40e 100644
> >> --- a/tests/opengl.py
> >> +++ b/tests/opengl.py
> >> @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
> >>  g(['getteximage-targets', '1D'])
> >>  g(['getteximage-targets', '2D'])
> >>  g(['teximage-scale-bias'])
> >> +g(['tex-upside-down-miptree'])
> >>  add_msaa_visual_plain_tests(g, ['draw-pixels'])
> >>  add_msaa_visual_plain_tests(g, ['read-front'],
> run_concurrent=False)
> >>  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
> >> diff --git a/tests/texturing/CMakeLists.gl.txt
> >> b/tests/texturing/CMakeLists.gl.txt
> >> index e5d41e432..02b572c79 100644
> >> --- a/tests/texturing/CMakeLists.gl.txt
> >> +++ b/tests/texturing/CMakeLists.gl.txt
> >> @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
> >>  piglit_add_executable (texture-rg texture-rg.c)
> >>  piglit_add_executable (teximage-colors teximage-colors.c)
> >>  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> >> +piglit_add_executable (tex-upside-down-miptree
> tex-upside-down-miptree.c)
> >>
> >>  # vim: ft=cmake:
> >> diff --git a/tests/texturing/tex-upside-down-miptree.c
> >> b/tests/texturing/tex-upside-down-miptree.c
> >> new file mode 100644
> >> index 0..8e8f7154b
> >> --- /dev/null
> >> +++ b/tests/texturing/tex-upside-down-miptree.c
> >> @@ -0,0 +1,171 @@
> >> +/*
> >> + * Copyright (c) 2018 Andrii Simiklit
> >> + *
> >> + * Permission is hereby granted, free of charge, to any person
> obtaining a
> >> + * copy of this software and associated documentation files (the
> >> "Software"),
> >> + * to deal in the Software without restriction, including without
> >> limitation
> >> + * the rights to use, copy, modify, merge, publish, distribute,
> >> sublicense,
> >> + * and/or sell copies of the Software, and to permit persons to whom
> the
> >> + * Software is furnished to do so, subject to the following conditions:
> >> + *
> >> + * The above copyright notice and this permission notice (including the
> >> next
> >> + * paragraph) shall be included in all copies or substantial portions
> of
> >> the
> >> + * Software.
> >> + *
> >> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> >> EXPRESS OR
> >> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> >> MERCHANTABILITY,
> >> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> >> SHALL
> >> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> >> OTHER
> >> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
> ARISING
> >> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> >> DEALINGS
> >> + * IN THE SOFTWARE.
> >> 

Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-03 Thread Mark Janes
It's preferable to push piglit tests first, and produce the CI test
failure.  CI staff will track the failure, and attribute it to the
piglit patch.  When the subsequent mesa patch is pushed, we track the
resolution.  The process gives us artifacts in git that help to analyze
driver differences between stable releases.

-Mark

andrey simiklit  writes:

> Hello,
>
> If this patch is acceptable by everybody then
> I guess that we need to push the following mesa patch before this one
> to avoid errors from Intel CI because the fix for an issue which is tested
> by this test is still there.
>
> https://patchwork.freedesktop.org/patch/254397/
> One of the last comment from Kenneth Graunke :
>
>>".
>> So, back to Reviewed-by.  I think once we get a Piglit test, I'm happy
>> to land this patch.
>>
>>--Ken"
>>
>
> Thanks,
> Andrii.
>
> On Mon, Dec 3, 2018 at 5:07 PM  wrote:
>
>> From: Andrii Simiklit 
>>
>> Test that usage of upside down miptree doesn't cause assertion
>>
>> The miptree:
>>
>> level 0 = 1x1
>> level 1 = 2x2
>> level 2 = 4x4
>> ...
>> level n = NxN
>>
>> should be acceptable for case when we don't use a min filter.
>>
>> v2: - Unnecessary function calls were removed
>> - The 'glClearColor' call was moved to 'piglit_display' function
>> - The program creation was moved to 'piglit_init' function
>> - The requirements check was moved to 'piglit_init' function
>>( Erik Faye-Lund  )
>>
>> - Fixed a leak of texture which is created in 'setup_texture'
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
>> Signed-off-by: Andrii Simiklit 
>> Reviewed-by: Erik Faye-Lund 
>> ---
>>  tests/opengl.py   |   1 +
>>  tests/texturing/CMakeLists.gl.txt |   1 +
>>  tests/texturing/tex-upside-down-miptree.c | 171 ++
>>  3 files changed, 173 insertions(+)
>>  create mode 100644 tests/texturing/tex-upside-down-miptree.c
>>
>> diff --git a/tests/opengl.py b/tests/opengl.py
>> index f7e408cd5..f6a38e40e 100644
>> --- a/tests/opengl.py
>> +++ b/tests/opengl.py
>> @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
>>  g(['getteximage-targets', '1D'])
>>  g(['getteximage-targets', '2D'])
>>  g(['teximage-scale-bias'])
>> +g(['tex-upside-down-miptree'])
>>  add_msaa_visual_plain_tests(g, ['draw-pixels'])
>>  add_msaa_visual_plain_tests(g, ['read-front'], run_concurrent=False)
>>  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
>> diff --git a/tests/texturing/CMakeLists.gl.txt
>> b/tests/texturing/CMakeLists.gl.txt
>> index e5d41e432..02b572c79 100644
>> --- a/tests/texturing/CMakeLists.gl.txt
>> +++ b/tests/texturing/CMakeLists.gl.txt
>> @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
>>  piglit_add_executable (texture-rg texture-rg.c)
>>  piglit_add_executable (teximage-colors teximage-colors.c)
>>  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
>> +piglit_add_executable (tex-upside-down-miptree tex-upside-down-miptree.c)
>>
>>  # vim: ft=cmake:
>> diff --git a/tests/texturing/tex-upside-down-miptree.c
>> b/tests/texturing/tex-upside-down-miptree.c
>> new file mode 100644
>> index 0..8e8f7154b
>> --- /dev/null
>> +++ b/tests/texturing/tex-upside-down-miptree.c
>> @@ -0,0 +1,171 @@
>> +/*
>> + * Copyright (c) 2018 Andrii Simiklit
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the
>> "Software"),
>> + * to deal in the Software without restriction, including without
>> limitation
>> + * the rights to use, copy, modify, merge, publish, distribute,
>> sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including the
>> next
>> + * paragraph) shall be included in all copies or substantial portions of
>> the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
>> SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
>> OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> DEALINGS
>> + * IN THE SOFTWARE.
>> + *
>> + * Authors:
>> + *Andrii Simiklit 
>> + *
>> + */
>> +
>> +/**
>> + * Test what there no an assertion when we use upside down miptree and
>> + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
>> + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
>> + */
>> +
>> +#include "piglit-util-gl.h"
>> +#define TW 64
>> +#define TH 64
>> +
>> +PIGLIT_GL_TEST_CON

Re: [Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-03 Thread andrey simiklit
Hello,

If this patch is acceptable by everybody then
I guess that we need to push the following mesa patch before this one
to avoid errors from Intel CI because the fix for an issue which is tested
by this test is still there.

https://patchwork.freedesktop.org/patch/254397/
One of the last comment from Kenneth Graunke :

>".
> So, back to Reviewed-by.  I think once we get a Piglit test, I'm happy
> to land this patch.
>
>--Ken"
>

Thanks,
Andrii.

On Mon, Dec 3, 2018 at 5:07 PM  wrote:

> From: Andrii Simiklit 
>
> Test that usage of upside down miptree doesn't cause assertion
>
> The miptree:
>
> level 0 = 1x1
> level 1 = 2x2
> level 2 = 4x4
> ...
> level n = NxN
>
> should be acceptable for case when we don't use a min filter.
>
> v2: - Unnecessary function calls were removed
> - The 'glClearColor' call was moved to 'piglit_display' function
> - The program creation was moved to 'piglit_init' function
> - The requirements check was moved to 'piglit_init' function
>( Erik Faye-Lund  )
>
> - Fixed a leak of texture which is created in 'setup_texture'
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> Signed-off-by: Andrii Simiklit 
> Reviewed-by: Erik Faye-Lund 
> ---
>  tests/opengl.py   |   1 +
>  tests/texturing/CMakeLists.gl.txt |   1 +
>  tests/texturing/tex-upside-down-miptree.c | 171 ++
>  3 files changed, 173 insertions(+)
>  create mode 100644 tests/texturing/tex-upside-down-miptree.c
>
> diff --git a/tests/opengl.py b/tests/opengl.py
> index f7e408cd5..f6a38e40e 100644
> --- a/tests/opengl.py
> +++ b/tests/opengl.py
> @@ -704,6 +704,7 @@ with profile.test_list.group_manager(
>  g(['getteximage-targets', '1D'])
>  g(['getteximage-targets', '2D'])
>  g(['teximage-scale-bias'])
> +g(['tex-upside-down-miptree'])
>  add_msaa_visual_plain_tests(g, ['draw-pixels'])
>  add_msaa_visual_plain_tests(g, ['read-front'], run_concurrent=False)
>  add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
> diff --git a/tests/texturing/CMakeLists.gl.txt
> b/tests/texturing/CMakeLists.gl.txt
> index e5d41e432..02b572c79 100644
> --- a/tests/texturing/CMakeLists.gl.txt
> +++ b/tests/texturing/CMakeLists.gl.txt
> @@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
>  piglit_add_executable (texture-rg texture-rg.c)
>  piglit_add_executable (teximage-colors teximage-colors.c)
>  piglit_add_executable (zero-tex-coord zero-tex-coord.c)
> +piglit_add_executable (tex-upside-down-miptree tex-upside-down-miptree.c)
>
>  # vim: ft=cmake:
> diff --git a/tests/texturing/tex-upside-down-miptree.c
> b/tests/texturing/tex-upside-down-miptree.c
> new file mode 100644
> index 0..8e8f7154b
> --- /dev/null
> +++ b/tests/texturing/tex-upside-down-miptree.c
> @@ -0,0 +1,171 @@
> +/*
> + * Copyright (c) 2018 Andrii Simiklit
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> "Software"),
> + * to deal in the Software without restriction, including without
> limitation
> + * the rights to use, copy, modify, merge, publish, distribute,
> sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the
> next
> + * paragraph) shall be included in all copies or substantial portions of
> the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT
> SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
> OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> DEALINGS
> + * IN THE SOFTWARE.
> + *
> + * Authors:
> + *Andrii Simiklit 
> + *
> + */
> +
> +/**
> + * Test what there no an assertion when we use upside down miptree and
> + * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
> + * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
> + */
> +
> +#include "piglit-util-gl.h"
> +#define TW 64
> +#define TH 64
> +
> +PIGLIT_GL_TEST_CONFIG_BEGIN
> +
> +   config.supports_gl_compat_version = 10;
> +
> +   config.window_visual = PIGLIT_GL_VISUAL_RGBA |
> PIGLIT_GL_VISUAL_DOUBLE;
> +   config.khr_no_error_support = PIGLIT_NO_ERRORS;
> +
> +PIGLIT_GL_TEST_CONFIG_END
> +
> +GLuint prog = 0;
> +GLuint texture = 0;
> +static unsigned nlevels = 0;
> +static const char *fragShaderText =
> +   "uniform sampler2D tex;\n"
> +   "void main()\n"
> +   "{\n"
> +   "   gl_FragColor = texture2D(tex, gl_TexCoord[0]

[Piglit] [PATCH v2] miptree: test ability to use upside down miptree

2018-12-03 Thread asimiklit . work
From: Andrii Simiklit 

Test that usage of upside down miptree doesn't cause assertion

The miptree:

level 0 = 1x1
level 1 = 2x2
level 2 = 4x4
...
level n = NxN

should be acceptable for case when we don't use a min filter.

v2: - Unnecessary function calls were removed
- The 'glClearColor' call was moved to 'piglit_display' function
- The program creation was moved to 'piglit_init' function 
- The requirements check was moved to 'piglit_init' function
   ( Erik Faye-Lund  )

- Fixed a leak of texture which is created in 'setup_texture'

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
Signed-off-by: Andrii Simiklit 
Reviewed-by: Erik Faye-Lund 
---
 tests/opengl.py   |   1 +
 tests/texturing/CMakeLists.gl.txt |   1 +
 tests/texturing/tex-upside-down-miptree.c | 171 ++
 3 files changed, 173 insertions(+)
 create mode 100644 tests/texturing/tex-upside-down-miptree.c

diff --git a/tests/opengl.py b/tests/opengl.py
index f7e408cd5..f6a38e40e 100644
--- a/tests/opengl.py
+++ b/tests/opengl.py
@@ -704,6 +704,7 @@ with profile.test_list.group_manager(
 g(['getteximage-targets', '1D'])
 g(['getteximage-targets', '2D'])
 g(['teximage-scale-bias'])
+g(['tex-upside-down-miptree'])
 add_msaa_visual_plain_tests(g, ['draw-pixels'])
 add_msaa_visual_plain_tests(g, ['read-front'], run_concurrent=False)
 add_msaa_visual_plain_tests(g, ['read-front', 'clear-front-first'],
diff --git a/tests/texturing/CMakeLists.gl.txt 
b/tests/texturing/CMakeLists.gl.txt
index e5d41e432..02b572c79 100644
--- a/tests/texturing/CMakeLists.gl.txt
+++ b/tests/texturing/CMakeLists.gl.txt
@@ -98,5 +98,6 @@ piglit_add_executable (texture-al texture-al.c)
 piglit_add_executable (texture-rg texture-rg.c)
 piglit_add_executable (teximage-colors teximage-colors.c)
 piglit_add_executable (zero-tex-coord zero-tex-coord.c)
+piglit_add_executable (tex-upside-down-miptree tex-upside-down-miptree.c)
 
 # vim: ft=cmake:
diff --git a/tests/texturing/tex-upside-down-miptree.c 
b/tests/texturing/tex-upside-down-miptree.c
new file mode 100644
index 0..8e8f7154b
--- /dev/null
+++ b/tests/texturing/tex-upside-down-miptree.c
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2018 Andrii Simiklit
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *Andrii Simiklit 
+ *
+ */
+
+/**
+ * Test what there no an assertion when we use upside down miptree and
+ * GL_TEXTURE_MIN_FILTER is GL_LINEAR, base level is not 0
+ * Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107987
+ */
+
+#include "piglit-util-gl.h"
+#define TW 64
+#define TH 64
+
+PIGLIT_GL_TEST_CONFIG_BEGIN
+
+   config.supports_gl_compat_version = 10;
+
+   config.window_visual = PIGLIT_GL_VISUAL_RGBA | PIGLIT_GL_VISUAL_DOUBLE;
+   config.khr_no_error_support = PIGLIT_NO_ERRORS;
+
+PIGLIT_GL_TEST_CONFIG_END
+
+GLuint prog = 0;
+GLuint texture = 0;
+static unsigned nlevels = 0;
+static const char *fragShaderText =
+   "uniform sampler2D tex;\n"
+   "void main()\n"
+   "{\n"
+   "   gl_FragColor = texture2D(tex, gl_TexCoord[0].xy).rgba;\n"
+   "}\n";
+
+static void
+get_rect_bounds(int pos, int *x, int *y, int *w, int *h)
+{
+   *x = pos * (piglit_width / 3) + 5;
+   *y = 5;
+   *w = piglit_width / 3 - 10;
+   *h = piglit_height - 10;
+}
+
+
+static void
+draw_rect(int pos)
+{
+   int x, y, w, h;
+   get_rect_bounds(pos, &x, &y, &w, &h);
+   piglit_draw_rect_tex(x, y, w, h, 0, 0, 1, 1);
+}
+
+
+static GLboolean
+probe_pos(int pos, const GLfloat expected[4])
+{
+   int x, y, w, h;
+   get_rect_bounds(pos, &x, &y, &w, &h);
+   return piglit_probe_rect_rgba(x, y, w, h, expected);
+}
+
+
+enum piglit_result
+piglit_display(void)
+{
+   GLboolean pass = GL_TRUE;
+   unsigned level;
+   const GLfloat oneby255 = (1.0 / 255.0);
+