[Outreachy] IGT Subtest to check extreme Alpha values

One of my task was to add alpha blending support in VKMS driver. In the process to keep a track whether the changes added in VKMS are correct and adhere to norms of the driver in DRM Subsystem, Intel GPU Tools are used. These tools are quite a help in adding a feature and testing the VKMS driver.

So what exactly are IGT GPU Tools? IGT GPU Tools , formerly known as Intel GPU Tools consists of wide test coverage for KMS(Kernel Mode Setting ) drivers . Though it has most of the part for testing and debugging i915 driver , but it can easily be adopted for other drivers as well with minimal changes. Know more here [1]

What is an Alpha Channel ?
RGB( Red, Green and Blue) is a color model which represents color space of an image. Alpha Channel is an extension to RGB color model as ARGB , which defines the opacity of an image. The alpha value lies between 0 and 1(255 in hex) , where 0 depicts transparency and 1 depicts opacity. This alpha channel helps in combining /compositing two images with transparent areas and anti-aliasing of the edges of opaque regions.

Alpha Channel in Cursor plane: Cursor plane is represented with ARGB format. Here alpha channel provides the provision to blend cursor plane with primary plane.

Here, the subtest is added in existing test for cursor plane in kms_cursor_crc IGT test [2].

 /*Hardware Test*/
cursor_enable(data);
igt_display_commit(display);
ret = drmModeSetCursor(data->drm_fd, data->output->config.crtc->crtc_id, data->fb.gem_handle, curw, curh);
igt_assert_eq(ret, 0);
igt_wait_for_vblank(data->drm_fd, data->pipe);
igt_pipe_crc_collect_crc(pipe_crc, &crc);
cursor_disable(data);
igt_remove_fb(data->drm_fd, &data->fb);

/*Software Test*/
cr = igt_get_cairo_ctx(data->drm_fd, &data->primary_fb);
igt_paint_color_alpha(cr, 0, 0, curw, curh, 1.0, 1.0, 1.0, a);
igt_put_cairo_ctx(data->drm_fd, &data->primary_fb, cr);
igt_display_commit(display);
igt_wait_for_vblank(data->drm_fd, data->pipe);
igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
igt_assert_crc_equal(&crc, &ref_crc);

The subtest added above checks the alpha value of cursor plane by first composing it by following the display pipeline involving the role of hardware and CRTC and stores the corresponding CRC value observed as &crc. ALso, CRC value for software rendered cursor is stored as &ref_crc. CRC (Cyclic Redundancy Check) helps in the validating the contents of the identical frames. Functions used here can be referred here [3]. The complete patch for this subtest can be found here[4]

References:

  1. https://github.com/karolherbst/igt-gpu-tools
  2. https://drm.pages.freedesktop.org/igt-gpu-tools/igt-kms-tests.html#kms_cursor_crc
  3. https://drm.pages.freedesktop.org/igt-gpu-tools/
  4. https://cgit.freedesktop.org/drm/igt-gpu-tools/log/?qt=grep&q=Mamta+Shukla




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s