iMX8MM/P: limit gpu to 30 fps

Hello,

we are using a Verdin iMX8MM Q 2GB WB IT with a 1920x1200 MIPI-DSI panel with the following timings and patch:

diff --git a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
index fbd71669248f..3f2b9f17f49c 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml
@@ -43,6 +43,8 @@ properties:
       - lg,acx467akm-7
         # LG Corporation 7" WXGA TFT LCD panel
       - lg,ld070wx3-sl01
+        # Multi-Inno Technology Co.,Ltd 10.1" WUXGA TFT LCD panel
+      - mit,mi1010aqt-1
         # One Stop Displays OSD101T2587-53TS 10.1" 1920x1200 panel
       - osddisplays,osd101t2587-53ts
         # Panasonic 10" WUXGA TFT LCD panel
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 23767dcb75bc..ebab8c4aef9d 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -482,12 +482,6 @@ static int panel_simple_prepare(struct drm_panel *panel)
 	if (p->prepared)
 		return 0;
 
-	ret = pm_runtime_get_sync(panel->dev);
-	if (ret < 0) {
-		pm_runtime_put_autosuspend(panel->dev);
-		return ret;
-	}
-
 	p->prepared = true;
 
 	return 0;
@@ -5163,6 +5157,35 @@ static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
 	.format = MIPI_DSI_FMT_RGB888,
 	.lanes = 4,
 };
+ 
+static const struct drm_display_mode mit_mi1010aqt_1_mode = {
+	.clock = 159420,
+	.hdisplay = 1200,
+	.hsync_start = 1200 + 80,
+	.hsync_end = 1200 + 80 + 24,
+	.htotal = 1200 + 80 + 24 + 60,
+	.vdisplay = 1920,
+	.vsync_start = 1920 + 16,
+	.vsync_end = 1920 + 16 + 4,
+	.vtotal = 1920 + 16 + 4 + 16,
+};
+
+static const struct panel_desc_dsi mit_mi1010aqt_1 = {
+	.desc = {
+		.modes = &mit_mi1010aqt_1_mode,
+		.num_modes = 1,
+		.bpc = 8,
+		.size = {
+			.width = 136,
+			.height = 217,
+		},
+		.connector_type = DRM_MODE_CONNECTOR_DSI,
+	},
+	.flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+		 MIPI_DSI_CLOCK_NON_CONTINUOUS,
+	.format = MIPI_DSI_FMT_RGB888,
+	.lanes = 4,
+};
 
 static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
 	.clock = 157200,
@@ -5265,6 +5288,9 @@ static const struct of_device_id dsi_of_match[] = {
 	}, {
 		.compatible = "lg,lh500wx1-sd03",
 		.data = &lg_lh500wx1_sd03
+	}, {
+		.compatible = "mit,mi1010aqt-1",
+		.data = &mit_mi1010aqt_1
 	}, {
 		.compatible = "panasonic,vvx10f004b00",
 		.data = &panasonic_vvx10f004b00

The demo weston-simple-egl -f is running with 56 fps. To reduce power consumption, I want to limit the frame rate to 30 fps.

What is the right place to achieve this? Do I have to halve the pixel rate of the panel in the struct drm_display_mode? Or do I have to modify the clock of the gpu in the devicetree?

Best regards,
Markus

Dear @Mowlwurf
Thank you for contacting us. May I ask what the reason for limiting the fps is? The framerate during our the demo does not necessarily correspond to the one you will have, while running your own application, so you might be confronted with a decrease of framerate anyhow, depending on you application.

Best regards

Collin

Hello @collin.tx,

thank you for your response.
As I wrote we want to limit the fps to reduce power consumption. There is no need to have more than 30 fps in our application.

Best regards,
Markus

Hello @Mowlwurf

May I ask what OS you are using? Are you using a BSP or Torizon?

If you are using a BSP you can follow the instruction on this link. it mentions the following line in your weston.ini file:

mode=800x600@75.0

the number after @ is the framerate set for Weston (In your case 30.0)

Should you use Torizon, I suggest the same general change, but according to the instructions on this page.

In this link you can find more information on Weston itself.

Best regards
Collin

Hi @collin.tx
I found this topic just before opening a new one: I work with Torizon OS and I followed the steps here bind mounting a custom configuration file.
What I saw is that if I pass --developer the custom file bound into /etc/xdg/weston-dev/weston.ini is used (I see it because I added an image as background for weston).
On the other side, if I don’t pass --developer, the custom file bound into /etc/xdg/weston/weston.ini is not used.
Do you know why?

Moreover,
the item

[output]
...
mode=1920x1200@30.0

is not honored in any way.
I mean that you can change it, but nothing changes.

As an example

[output]
...
transform=rotate-270

works as expected.

Do you know why?

Hello @collin.tx,

I’m using a Yocto image with BSP v6.2.
I tried your suggestion but the demo weston-simple-egl -f and our Qt application are still running with 55 to 60 fps.

Here is my weston.ini:

[core]
shell=kiosk-shell.so
idle-time=0
use-g2d=1
xwayland=true
repaint-window=16
modules=kiosk-shell-dpms.so

[shell]
cursor-theme=hicolor
cursor-size=24

[libinput]
enable_tap=true
touchscreen_calibrator=true
calibration_helper=/usr/bin/toradex-save-touchscreen-calibration

[output]
name=DSI-1
mode=1920x1200@30.0
transform=rotate-270

Best regards,
Markus

Hi @Mowlwurf !

Another indirect way of limiting the fps could be to slow down the GPU.

Please refer to NXP’s documentation for i.MX8M Mini: go to Embedded Linux for i.MX Applications Processors | NXP Semiconductors and download the file Documentation from the Linux Kernel version you are using (you can refer to Embedded Linux Release Matrix | Toradex Developer Center to find it out).

From that file you can check i.MX Graphics User’s Guide.

We have never done thorough tests with this approach.

Here is a screenshot of the section from i.MX Graphics User’s Guide where you can find out how to change the GPU’s clock:

Let us know if this helps you.

Best regards,

Hi @henrique.tx,

well, it helps somehow.

I halved the GPU clock with

echo 0 32 32 > /sys/kernel/debug/gc/clk

The weston demo still runs at 56 fps, but the glmark2 score has roughly halved from 80 to 45. This should significantly reduce energy consumption.

However, it is probably better to limit the frame/render rate directly in our application (Qt) than to artificially limit the GPU.

Thanks for the help anyway.
Best regards,
Markus

Hi @Mowlwurf !

Thanks for you feedback!

Please note that both solutions are valid. It just depends on your use case. By limiting on Qt, you will be targeting specifically your application, which I guess it is good enough since it is an embedded system and usually there is only one GUI application that “owns” the display. Changing the GPU clock you are affecting the GPU “as a whole” and not only for one application.

For sure you can try both and check which gives you the best outcome according to your needs :slight_smile:

Also, thanks for checking the solution and let us know if we can further help you in any way :grin:

Have a nice day!

Best regards,