directfb2 / DirectFB2

Core DirectFB library
GNU Lesser General Public License v2.1
131 stars 15 forks source link

Cant get screen working on amlogic s905x #132

Open dhanyweb opened 11 months ago

dhanyweb commented 11 months ago

Arch:ARM64 OS:Openwrt

im trying to get working on HDMI screen, i get blank screen,even set the mode manual via /etc/directfbrc not working.the SOC board have 2 connectors,composite video & HDMI. another test using psplash ported to DRM psplash-drm working succesfully. here are directFB-examples output :

root@DeviceLink:~# df_andi


        (c) 2017-2023  DirectFB2 Open Source Project (fork of DirectFB)
        (c) 2012-2016  DirectFB integrated media GmbH
        (c) 2001-2016  The world wide DirectFB Open Source Community
        (c) 2000-2004  Convergence (integrated media) GmbH
      ----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2023-07-29 15:41)
(*) DRMKMS/System: Using device /dev/dri/card0 (default)
(*) DRMKMS/System: Found 2 connectors, 2 encoders, 2 planes
(*) DirectFB/Input: meson_ao_cec 0.1 (DirectFB)
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input
(*) DirectFB/Graphics: Genefx Software Rasterizer 0.7 (DirectFB)
(*) DRMKMS/Screen: Default mode is 720x576 (2 modes in total)
(*) DRMKMS/Layer: Supported properties for layer id 39
(*)      zpos
(*) DirectFB/Core/WM: Default 0.3 (DirectFB)
(*) Direct/Interface: Loaded 'DGIFF' implementation of 'IDirectFBFont'
(*) Direct/Interface: Loaded 'DFIFF' implementation of 'IDirectFBImageProvider'

here are the drm test output : 

Device /dev/dri/card0:
  Capabilities:
    DRM_CAP_DUMB_BUFFER: 1
    DRM_CAP_VBLANK_HIGH_CRTC: 1
    DRM_CAP_DUMB_PREFERRED_DEPTH: 0
    DRM_CAP_DUMB_PREFER_SHADOW: 0
    DRM_CAP_PRIME: 3

  Resources:
    Width: 0 - 3840
    Height: 0 - 2160
    Framebuffers: 0
    CRTCs: 1
      CRTC 42:
        Dimensions: 720 x 480
        Buffer: 43
        Position: 0, 0
        Gamma size: 0
        Mode:    720x480:  720x 480 ( 60fps), ( 27000kHz, h: 736- 798  858  0, v: 489- 495  525  0), 0x0000000a,    64

    Encoders: 2
      Encoder 32:
        Type: TVDAC
        CRTC: 0
        Possible CRTCs: 1, 0x000001, 0000000000000001,  0
        Possible Clones: 1, 0x000001, 0000000000000001,  0

      Encoder 33:
        Type: TMDS
        CRTC: 42
        Possible CRTCs: 1, 0x000001, 0000000000000001,  0
        Possible Clones: 2, 0x000002, 0000000000000002,  1

    Connectors: 2
      Connector 31:
        Type: Composite
        Dimensions: 0mm x 0mm
        SubPixel: unknown
        Connection: connected
        Encoders: 1: 32
        Properties: 5:
          Property: 1
            Name: EDID
            Flags: 0x00000014
            Values: 0:
            BLOB: error getting blob 0

          Property: 2
            Name: DPMS
            Flags: 0x00000008
            Values: 4: 0, 1, 2, 3
            Enum: 3
                   0 = On
                   1 = Standby
                   2 = Suspend
              *    3 = Off

          Property: 5
            Name: link-status
            Flags: 0x00000008
            Values: 2: 0, 1
            Enum: 0
              *    0 = Good
                   1 = Bad

          Property: 6
            Name: non-desktop
            Flags: 0x00000006
            Values: 2: 0, 1
            Enum: 0

          Property: 4
            Name: TILE
            Flags: 0x00000014
            Values: 0:
            BLOB: error getting blob 0

        Modes: 2:
           0.   720x576i:  720x 576 ( 50fps), ( 13500kHz, h: 732- 795  864  0, v: 580- 586  625  0), 0x00000010,    64
           1.   720x480i:  720x 480 ( 60fps), ( 13500kHz, h: 739- 801  858  0, v: 488- 494  525  0), 0x00000010,    64

      Connector 34:
        Type: HDMIA
        Dimensions: 340mm x 190mm
        SubPixel: unknown
        Connection: connected
        Encoders: 1: 33
        Properties: 7:
          Property: 1
            Name: EDID
            Flags: 0x00000014
            Values: 0:
            BLOB: 256 bytes, FFFFFF00...

          Property: 2
            Name: DPMS
            Flags: 0x00000008
            Values: 4: 0, 1, 2, 3
            Enum: 0
              *    0 = On
                   1 = Standby
                   2 = Suspend
                   3 = Off

          Property: 5
            Name: link-status
            Flags: 0x00000008
            Values: 2: 0, 1
            Enum: 0
              *    0 = Good
                   1 = Bad

          Property: 6
            Name: non-desktop
            Flags: 0x00000006
            Values: 2: 0, 1
            Enum: 0

          Property: 4
            Name: TILE
            Flags: 0x00000014
            Values: 0:
            BLOB: error getting blob 0

          Property: 7
            Name: HDR_OUTPUT_METADATA
            Flags: 0x00000010
            Values: 0:
            BLOB: error getting blob 0

          Property: 35
            Name: max bpc
            Flags: 0x00000002
            Values: 2: 8, 8
            Enum: 0

        Modes: 9:
           0.   1366x768: 1366x 768 ( 60fps), ( 72000kHz, h:1380-1436 1500  0, v: 769- 772  800  0), 0x00000005,    72
           1.  1920x1080: 1920x1080 ( 60fps), (148500kHz, h:2008-2052 2200  0, v:1084-1089 1125  0), 0x00000005,    64
           2.  1920x1080: 1920x1080 ( 60fps), (148352kHz, h:2008-2052 2200  0, v:1084-1089 1125  0), 0x00000005,    64
           3.   1280x720: 1280x 720 ( 60fps), ( 74250kHz, h:1390-1430 1650  0, v: 725- 730  750  0), 0x00000005,    64
           4.   1280x720: 1280x 720 ( 60fps), ( 74176kHz, h:1390-1430 1650  0, v: 725- 730  750  0), 0x00000005,    64
           5.   1024x768: 1024x 768 ( 60fps), ( 65000kHz, h:1048-1184 1344  0, v: 771- 777  806  0), 0x0000000a,    64
           6.    800x600:  800x 600 ( 60fps), ( 40000kHz, h: 840- 968 1056  0, v: 601- 605  628  0), 0x00000005,    64
           7.    800x600:  800x 600 ( 56fps), ( 36000kHz, h: 824- 896 1024  0, v: 601- 603  625  0), 0x00000005,    64
           8.    720x480:  720x 480 ( 60fps), ( 27000kHz, h: 736- 798  858  0, v: 489- 495  525  0), 0x0000000a,    64
caramelli commented 11 months ago

Displaying is done only on the first connector found by default, so you probably get df_andi displaying on your composite video connector.

With multiple connectors, setting connected-outputs=multihead in /etc/directfbrc allows to select which connector to use: in this case it is necessary to use dfbinfo from DirectFB-tools to list the primary layer ids. Then add in /etc/directfbrc: primary-layer="id of the primary layer corresponding to the HDMI connector in your case"

This is the principle, but a few months have passed since the last time I tested this kind of configuration.

dhanyweb commented 11 months ago

Thank you but its not working.

root@DeviceLink:~# df_andi


        (c) 2017-2023  DirectFB2 Open Source Project (fork of DirectFB)
        (c) 2012-2016  DirectFB integrated media GmbH
        (c) 2001-2016  The world wide DirectFB Open Source Community
        (c) 2000-2004  Convergence (integrated media) GmbH
      ----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2023-07-29 15:41)
(*) DRMKMS/System: Using device /dev/dri/card0 as specified in DirectFB configuration
(*) DRMKMS/System: Multi-head display
(*) DRMKMS/System: Found 2 connectors, 2 encoders, 2 planes
(*) DirectFB/Input: meson_ao_cec 0.1 (DirectFB)
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input
(*) DirectFB/Graphics: Genefx Software Rasterizer 0.7 (DirectFB)
(*) DRMKMS/Screen: Default mode is 720x576 (2 modes in total)
(!) *** ONCE [no mode found for 720x576 at 50 Hz
] *** [../systems/drmkms/drmkms_mode.c:87 in drmkms_find_mode()]
(*) DRMKMS/Layer: Supported properties for layer id 36
(*)      zpos
(*) DirectFB/Core/WM: Default 0.3 (DirectFB)
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
(*) Direct/Interface: Loaded 'DGIFF' implementation of 'IDirectFBFont'
(*) Direct/Interface: Loaded 'DFIFF' implementation of 'IDirectFBImageProvider'
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified

dfbinfo output :

root@DeviceLink:~# ./dfbinfo

   ~~~~~~~~~~~~~~~~~~~~~~~~~~| DirectFB 2.0.0  |~~~~~~~~~~~~~~~~~~~~~~~~~~
        (c) 2017-2023  DirectFB2 Open Source Project (fork of DirectFB)
        (c) 2012-2016  DirectFB integrated media GmbH
        (c) 2001-2016  The world wide DirectFB Open Source Community
        (c) 2000-2004  Convergence (integrated media) GmbH
      ----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2023-07-29 15:41)
(*) DRMKMS/System: Using device /dev/dri/card0 as specified in DirectFB configuration
(*) DRMKMS/System: Multi-head display
(*) DRMKMS/System: Found 2 connectors, 2 encoders, 2 planes
(*) DirectFB/Input: meson_ao_cec 0.1 (DirectFB)
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input
(*) DirectFB/Graphics: Genefx Software Rasterizer 0.7 (DirectFB)
(*) DRMKMS/Screen: Default mode is 720x576 (2 modes in total)
(!) *** ONCE [no mode found for 720x576 at 50 Hz
] *** [../systems/drmkms/drmkms_mode.c:87 in drmkms_find_mode()]
(*) DRMKMS/Layer: Supported properties for layer id 36
(*)      zpos
(*) DirectFB/Core/WM: Default 0.3 (DirectFB)
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
Video Modes
   720x576-32

Screen (00) DRMKMS Screen                           (primary screen)
   Caps: MIXERS ENCODERS OUTPUTS
   Mixer (0) DRMKMS Mixer
     Caps:               FULL
     Layers (full mode): (00) (02)

   Mixer (1) DRMKMS Mixer
     Caps:               FULL
     Layers (full mode): (01)

   Encoder (0) DRMKMS Encoder
     Type:               TV
     Caps:               FREQUENCY RESOLUTION
     Output Resolutions: 720_480 720_576
     Mixer:              0

   Encoder (1) DRMKMS Encoder
     Type:               DIGITAL
     Caps:               FREQUENCY RESOLUTION
     Output Resolutions: 720_480 800_600 1024_768 1280_720 1920_1080 1366_768
     Mixer:              1

   Output (0) DRMKMS Output
     Caps:               RESOLUTION
     Resolutions:        720_480 720_576
     Signals:            CVBS
     Encoder:            0

   Output (1) DRMKMS Output
     Caps:               RESOLUTION
     Resolutions:        720_480 800_600 1024_768 1280_720 1920_1080 1366_768
     Signals:            HDMI
     Encoder:            1

     Layer (01) DRMKMS Primary Layer
        Type:    GRAPHICS
        Caps:    SURFACE

     Layer (00) DRMKMS Primary Layer                (primary layer)
        Type:    GRAPHICS
        Caps:    SURFACE

     Layer (02) DRMKMS Plane Layer 1
        Type:    GRAPHICS
        Caps:    SURFACE ALPHACHANNEL LEVELS SCREEN_POSITION

Input Device (03) meson_ao_cec                      (primary remote control)
   Vendor  ID: 0x0000
   Product ID: 0x0000
   Type:       REMOTE
   Caps:       KEYS AXES

How to manually set resolution?
caramelli commented 11 months ago

Yes, it is necessary to also set a resolution supported by the connector when connected-outputs=multihead is set (if the default resolution with the first connector is not supported by the other connectors). This should be improved as a correct mode could be determined automatically.

To select the HDMI connector here, I would say that /etc/directfbrc contains for example:

connected-outputs=multihead
primary-layer=1
mode=1280x720

Do you have df_andi displayed on your composite video connector with the default configuration?

dhanyweb commented 11 months ago

i cant test composite display i dont have the cable,but the hdmi work for sure with splash-drm, i dont think its hardware problem.

i concern with "(!) *** ONCE [no mode found for 1280x720 at 0 Hz", and "!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!" which is connector id 34, crtc id 42 are belong to hdmi.

here are the output :

root@DeviceLink:~# df_andi


        (c) 2017-2023  DirectFB2 Open Source Project (fork of DirectFB)
        (c) 2012-2016  DirectFB integrated media GmbH
        (c) 2001-2016  The world wide DirectFB Open Source Community
        (c) 2000-2004  Convergence (integrated media) GmbH
      ----------------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2023-07-29 15:41)
(*) DRMKMS/System: Using device /dev/dri/card0 as specified in DirectFB configuration
(*) DRMKMS/System: Multi-head display
(*) DRMKMS/System: Found 2 connectors, 2 encoders, 2 planes
(*) DirectFB/Input: meson_ao_cec 0.1 (DirectFB)
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input
(*) DirectFB/Graphics: Genefx Software Rasterizer 0.7 (DirectFB)
(!) *** ONCE [no mode found for 1280x720 at 0 Hz
] *** [../systems/drmkms/drmkms_mode.c:87 in drmkms_find_mode()]
(*) DRMKMS/Screen: Default mode is 720x576 (2 modes in total)
(*) DRMKMS/Layer: Supported properties for layer id 36
(*)      zpos
(*) DirectFB/Core/WM: Default 0.3 (DirectFB)
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
(*) Direct/Interface: Loaded 'DGIFF' implementation of 'IDirectFBFont'
(*) Direct/Interface: Loaded 'DFIFF' implementation of 'IDirectFBImageProvider'
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
(!) DRMKMS/Layer: drmModeSetCrtc( crtc_id 42, fb_id 46, xy 0,0, connector_id 34, mode 720x576@50Hz ) failed at index 1!
    --> Invalid argument
(!) Core/LayerRegion: Could not set region!
    --> An invalid argument has been specified
(!) Core/LayerRegion: dfb_layer_region_realize() in dfb_layer_region_flip_update() failed!
    --> An invalid argument has been specified
dhanyweb commented 11 months ago

its work properly with this configuration

system=drmkms drmkms=/dev/dri/card0 module-dir=/lib/directfb-2.0-0 connected-outputs=multihead primary-layer=1 mode=720x480

not working with 1366x768 nor 1920x1080

dhanyweb commented 11 months ago

im create quick patch at here,the code not clean but its work just like i want, with this patch just need to set primary-layer to corresponding connector and set mode with widthxheight@vrefresh, in this case :

primary-layer=1 mode=1366x768@60Hz

caramelli commented 11 months ago

It's great that you can run DirectFB2 on your platform! I agree that the support for multiple connectors with the different possible modes needs to be improved in the drmkms system module.