[Piglit] [PATCH] getteximage-simple: Stress an i965 blitter path

Ilia Mirkin imirkin at alum.mit.edu
Wed May 30 21:44:26 UTC 2018


Not all hardware supports 32K-wide textures. I believe GL's minimum
requirement is in the 4K range -- not 100% sure. There's a query for
it that you can use.

On Wed, May 30, 2018 at 4:39 PM, Nanley Chery <nanleychery at gmail.com> wrote:
> Change the dimension of the texture to test how i965 handles having a
> row pitch too large for the BLT engine.
> ---
>  tests/texturing/getteximage-simple.c | 23 +++++++++++++++++------
>  1 file changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/tests/texturing/getteximage-simple.c b/tests/texturing/getteximage-simple.c
> index 273f2b36c..9a3678acf 100644
> --- a/tests/texturing/getteximage-simple.c
> +++ b/tests/texturing/getteximage-simple.c
> @@ -8,6 +8,10 @@
>   * texture images is executed before the readback.
>   *
>   * This used to crash for R300+bufmgr.
> + *
> + * This also used to stress test the blit methods in i965. The BLT engine only
> + * supports pitch sizes up to but not including 32768 bytes. BLORP supports
> + * even larger sizes.
>   */
>
>  #include "piglit-util-gl.h"
> @@ -21,19 +25,26 @@ PIGLIT_GL_TEST_CONFIG_BEGIN
>
>  PIGLIT_GL_TEST_CONFIG_END
>
> -static GLubyte data[4096]; /* 64*16*4 */
> +#define BYTES_PER_PIXEL 4
> +#define WIDTH (32768 / BYTES_PER_PIXEL)
> +#define HEIGHT 2 // Ensure that the pitch is used without using too much memory
> +#define IMAGE_SIZE (WIDTH * BYTES_PER_PIXEL * HEIGHT)
> +
> +static GLubyte data[IMAGE_SIZE];
>
>  static int test_getteximage(void)
>  {
> -       GLubyte compare[4096];
> +       GLubyte compare[IMAGE_SIZE];
>         int i;
>
>         glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, compare);
>
> -       for(i = 0; i < 4096; ++i) {
> +       for(i = 0; i < IMAGE_SIZE; ++i) {
>                 if (data[i] != compare[i]) {
>                         printf("GetTexImage() returns incorrect data in byte %i\n", i);
> -                       printf("    corresponding to (%i,%i) channel %i\n", i / 64, (i / 4) % 16, i % 4);
> +                       printf("    corresponding to (%i,%i) channel %i\n",
> +                              i / WIDTH, (i / BYTES_PER_PIXEL) % HEIGHT,
> +                              i % BYTES_PER_PIXEL);
>                         printf("    expected: %i\n", data[i]);
>                         printf("    got: %i\n", compare[i]);
>                         return 0;
> @@ -75,14 +86,14 @@ void piglit_init(int argc, char **argv)
>         GLuint tex;
>         int i;
>
> -       for(i = 0; i < 4096; ++i)
> +       for(i = 0; i < IMAGE_SIZE; ++i)
>                 data[i] = rand() & 0xff;
>
>         glGenTextures(1, &tex);
>         glBindTexture(GL_TEXTURE_2D, tex);
>         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
>         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
> -       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 64, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
> +       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, WIDTH, HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
>
>         piglit_gen_ortho_projection(0.0, 1.0, 0.0, 1.0, -2.0, 6.0, GL_FALSE);
>  }
> --
> 2.17.0
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list