tests: fix fourcc check (on intel at least)

- virgl maps VIRGL_FORMAT_B8G8R8X8_UNORM to GL_RGBA8

- _mesa_choose_tex_format() maps GL_RGBA8 to
  MESA_FORMAT_R8G8B8A8_UNORM or MESA_FORMAT_A8B8G8R8_UNORM or
  MESA_FORMAT_B8G8R8A8_UNORM.

- it ends up in (gl_texture_image *)img->TexFormat

- then in intel (_DRIImage *) image->format.

- on create image, image->dri_format = driGLFormatToImageFormat() (to
  ex: MESA_FORMAT_R8G8B8A8_UNORM -> __DRI_IMAGE_FORMAT_ABGR8888)

- on query, intel_lookup_fourcc() ->  __DRI_IMAGE_FOURCC_ABGR8888 == GBM_FORMAT_ABGR8888.

For some reason, driGLFormatToImageFormat() doesn't map
MESA_FORMAT_A8B8G8R8_UNORM, so I only check the two possible values I
could find.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Marc-André Lureau 9 years ago committed by Dave Airlie
parent 031d582bc1
commit 8a3dcd4c7b
  1. 4
      tests/test_virgl_init.c

@ -328,7 +328,9 @@ START_TEST(virgl_test_get_resource_info)
ret = virgl_renderer_resource_get_info(res.handle, &info); ret = virgl_renderer_resource_get_info(res.handle, &info);
ck_assert_int_eq(ret, 0); ck_assert_int_eq(ret, 0);
ck_assert_int_eq(info.drm_fourcc, GBM_FORMAT_XRGB8888);
ck_assert_int(info.drm_fourcc == GBM_FORMAT_ABGR8888 ||
info.drm_fourcc == GBM_FORMAT_ARGB8888);
ck_assert_int_eq(info.virgl_format, res.format); ck_assert_int_eq(info.virgl_format, res.format);
ck_assert_int_eq(res.width, info.width); ck_assert_int_eq(res.width, info.width);
ck_assert_int_eq(res.height, info.height); ck_assert_int_eq(res.height, info.height);

Loading…
Cancel
Save