cancel
Showing results for 
Search instead for 
Did you mean: 

DRM/KMS framebuffer emulation - How to set format

jhi
Senior

Using the KMS/DRM driver, how can I change the emulated framebuffer format? I'm using simple-panel and the framebuffer has always only 16-bit color even though the driver explicit sets the format for 24-bit colors (.bus_format = MEDIA_BUS_FMT_RGB888_1X24).

fbset doesn't work:

fbset -g 800 480 800 480 24
fbset: FBIOPUT_VSCREENINFO: Invalid argument

modetest

modetest -M stm
Encoders:
id      crtc    type    possible crtcs  possible clones
32      38      DPI     0x00000001      0x00000001
 
Connectors:
id      encoder status          name            size (mm)       modes   encoders
33      32      connected       DPI-1           154x86          1       32
  modes:
        index name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot
  #0 800x480 57.29 800 1010 1011 1057 480 503 523 545 33000 flags: ; type: preferred, driver
  props:
        1 EDID:
                flags: immutable blob
                blobs:
 
                value:
        2 DPMS:
                flags: enum
                enums: On=0 Standby=1 Suspend=2 Off=3
                value: 0
        5 link-status:
                flags: enum
                enums: Good=0 Bad=1
                value: 0
        6 non-desktop:
                flags: immutable range
                values: 0 1
                value: 0
        4 TILE:
                flags: immutable blob
                blobs:
 
                value:
 
CRTCs:
id      fb      pos     size
38      43      (0,0)   (800x480)
  #0 800x480 57.29 800 1010 1011 1057 480 503 523 545 33000 flags: ; type: preferred, driver
  props:
        24 VRR_ENABLED:
                flags: range
                values: 0 1
                value: 0
        31 BACKGROUND_COLOR:
                flags: range
                values: 0 18446744073709551615
                value: 18446462598732840960
        28 GAMMA_LUT:
                flags: blob
                blobs:
 
                value:
        29 GAMMA_LUT_SIZE:
                flags: immutable range
                values: 0 4294967295
                value: 256
 
Planes:
id      crtc    fb      CRTC x,y        x,y     gamma size      possible crtcs
34      38      43      0,0             0,0     0               0x00000001
  formats: AR24 XR24 RG24 RG16 AR15 XR15 AR12 XR12 C8
  props:
        8 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 1
        30 IN_FORMATS:
                flags: immutable blob
                blobs:
 
                value:
                        01000000000000000900000018000000
                        01000000400000004152323458523234
                        52473234524731364152313558523135
                        41523132585231324338202000000000
                        ff010000000000000000000000000000
                        0000000000000000
                in_formats blob decoded:
                         AR24:  LINEAR
                         XR24:  LINEAR
                         RG24:  LINEAR
                         RG16:  LINEAR
                         AR15:  LINEAR
                         XR15:  LINEAR
                         AR12:  LINEAR
                         XR12:  LINEAR
                         C8  :  LINEAR
        36 alpha:
                flags: range
                values: 0 65535
                value: 65535
        37 zpos:
                flags: immutable range
                values: 0 0
                value: 0
39      0       0       0,0             0,0     0               0x00000001
  formats: AR24 RG24 RG16 AR15 AR12 C8
  props:
        8 type:
                flags: immutable enum
                enums: Overlay=0 Primary=1 Cursor=2
                value: 0
        30 IN_FORMATS:
                flags: immutable blob
                blobs:
 
                value:
                        01000000000000000600000018000000
                        01000000300000004152323452473234
                        52473136415231354152313243382020
                        3f000000000000000000000000000000
                        0000000000000000
                in_formats blob decoded:
                         AR24:  LINEAR
                         RG24:  LINEAR
                         RG16:  LINEAR
                         AR15:  LINEAR
                         AR12:  LINEAR
                         C8  :  LINEAR
        41 alpha:
                flags: range
                values: 0 65535
                value: 65535
        42 zpos:
                flags: immutable range
                values: 1 1
                value: 1
 
Frame buffers:
id      size    pitch

modetest -M stm -s 33@32:800x480-57.29@XR24 &
# failed to find CRTC for pipe
failed to create dumb buffer: Invalid argument

3 REPLIES 3
jhi
Senior

fbset

mode "800x480-0"
        # D: 0.000 MHz, H: 0.000 kHz, V: 0.000 Hz
        geometry 800 480 800 480 16
        timings 0 0 0 0 0 0 0
        accel true
        rgba 5/11,6/5,5/0,0/0
endmode

I also tried to change the kernel driver (drivers/gpu/drm/stm/drv.c), by adding

ddev->mode_config.preferred_depth = 24;

but it didn't change anything.

OlivierK
ST Employee

Hi jhi (Community Member)

According to your settings CRTC ID seems to be equal to 38 (not 32).

What about if you try modetest -M stm -s 33@38:800x480-57.29@XR24 &

Regards,

Olivier

Well the command "works" and it shows the test image, but I can't say if it is 24-bit or not because it seems that the mode lasts only as long the modetest is running. If it really sets it persistent, I can't see any difference with my test image and fbset shows the same as before.

# modetest -M stm -s 33@38:800x480-57.29@XR24 -d &
# setting mode 800x480-57.29Hz on connectors 33, crtc 38
 
[1]+  Done                       modetest -M stm -s 33@38:800x480-57.29@XR24 -d

How can I set this mode to be persistent or default? Are there any other ways to set the framebuffer color depth? Where does the stm kernel driver get the format information? I can see from the driver that it checks which color format is used so how can I change this format?