[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*/
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);
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_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]


  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

[Outreachy] Struggle makes it work !

A strong man pushing a big rock up the hill to reach the goal on top.

Yes, its true that struggle makes it work.

Before starting on actual tasks, one of my warm up task was to learn about Igt test cases, for which I needed to install Igt-gpu-tools on my system.I cloned from official repo[1] and started as per the instructions mentioned. I installed dependencies. But the stumbling block appeared when it was time to build and run tests.

I got lot of dependency related errors and in the process tried to fix it by installing each of the library dependencies right away from .tar file. And sooner realized this will take a lot of time and effort and some how greatly I altered pkg-config and my Kernel crashed 😦 .

Compiler for C supports arguments -Wimplicit-fallthrough=0: YES
Found pkg-config: /usr/local/bin/pkg-config (0.29.1)
Dependency libdrm found: YES 2.4.90
Dependency libdrm_intel found: YES 2.4.90
Dependency libdrm_nouveau found: YES 2.4.90
Dependency libdrm_amdgpu found: YES 2.4.90
Dependency pciaccess found: YES 0.14
Dependency libkmod found: YES 25
Dependency libprocps found: YES 3.3.12
Dependency libunwind found: YES 1.2.1
Dependency libdw found: NO
meson.build:106:0: ERROR: Could not generate cargs for libdw:

And then I realised I should look for the root cause and sooner updated my Linux distro to Ubuntu 18.04. So no error related to meson – build. Soon learnt to debug the problems and got to know about few hacks as well related to pkg-config such as –

1.To check where pkg-config looks for all packages use-

pkg-config   --variable pc_path pkg-config

2. To check if same path appears or not-


3. Most of the packages have .pc file , so using the ‘locate’ command find the .pc file location and add using command below.

4. To add a new path for pkg-config use-

export PKG_CONFIG_PATH =" /new path"

Still I missed one of the dependencies which I thought is not relevant. So I decided to approach my mentor and he helped me with the dependency related issue and also taught me few better commands to debug the issues. And finally got all the tests built and running for driver to be tested. So all the struggle during installation taught me how to debug and learn about how so many dependencies work. So along with getting things working, this proved to be a learning experience. Not only struggle ultimately  made things work but also helped to think about a problem from multiple perspectives.

I started working on my first task which was to Add Igt test to check extreme alpha values i.e. fully opaque and fully transparent for cursor plane. Before jumping off to write actual code and submit it as patch , I started exploring and digging deeper to understand how Igt tests are actually written and what properties for each driver is tested. To test a particular driver I made changes in the kernel , enabling only the driver for which I want to run the tests and disabling GUI and removing rest of the graphics related drivers. Installing the kernel again and then bringing it back to normal mode with enabled GUI and driver. At first it seems easy ,but repeating this seemed tedious job later. So I decided to ask for alternative and greatly got to know about FORCE-MODULE option which was added by previous intern but patch was not in main-line. So this option added through this patch[2] simplified things. Further I finished my task and the patch [3] is under review.So mentioning about struggles , even you feel it’s not relevant, actually can bring out some better solutions.

Struggles are actually the part of process and it brings a lot of lessons. Therefore it’s good to struggle 🙂 .

 “If there is no Struggle, there is no Progress ” .

References –

[1] https://cgit.freedesktop.org/drm/igt-gpu-tools/