i.MX8QXP gamma tuning - a gui test code

Document created by PengFushi Employee on May 21, 2020
Version 1Show Document
  • View in full screen mode

SW: Linux 4.14.98_2.2.0 bsp release , gpu sdk 5.3.0 and patch in this doc

HW: i.MX8QXP MEK board


Inspired by the GIMP adjust color curve tool,  I write similar gui test code for i.MX8QXP gamma curve tuning.

That is on display will show one linear curve first, use mouse to change any part of this curve, after that calculate value of point on changed curve , then pass related value to i.MX8QXP DPU gammcor unit , at last the display effect will be changed by DPU.

When test code start up , will draw Y=X curve on display, that will from (0,0) to (500, 500) to (1023,1023). After you use mouse drag some part of the curve, will generated a new point (x_new, y_new) which is not on original Y=X curve. Then need draw a new curve that pass  through the (0,0) , (500, 500) , (x_new, y_new), (1023,1023).  That new curve , i choose to use Catmull-Rom Splines to get it.

Use Catmull-Rom Splines for approximate a curve that pass through n point, then need n+2 control point. Extra 2 point could be selected as you want ,and they will affect the shape of the curve.

Catmull-Rom Splines could pass through all control point, it is C1 continuity, no convex hull property.

For example, there is four control point p0, p1 , p2 , p3,  to draw the curve pass through all of them, it could divide to segment p0 to p1 , segment p1 to p2 , segment p2 to p3.

For segment p1 to p2 , select four control point as p0,p1, p2, p3, use Catmull-Rom Splines as below:

For segment p0 to p1 , need use four control point as p0, p0, p1, p2:

For segment p2 to p3, need use four control point as p1, p2, p3, p3:

In this test code,  i will use gpu vertex shader to calculate each segment of curve, then use transform feedback to read back point value of each segment to cpu side, cpu side will pass related value to DPU gammcor unit for gamma tuning.



Test steps:

Apply 8qxp_dpu_gammacor_4.14.98_2.2.0.diff on linux-imx for i.MX8QXP DPU device driver.

Apply dpu_gamma_curve_gpusdk5.3.0.diff on imx-gpu-sdk for build this gui test code.

Update the new kernel image, and copy test code to rootfs.

Run any other application first to draw some thing on screen, for example  /usr/share/cinematicexperience-1.0/Qt5_CinematicExperience.

Then run gui test code in this code, S01_SimpleTriangle_Wayland.

Then there will show one linear curve on display , use mouse to change the curve as you like by put mouse cursor close to the curve, press the mouse button , drag it and release the mouse button, you will see the new curve on display , and also the display effect also be changed.