directfb2 / DirectFB2

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

Using multiple overlay planes with opacity 0xFF only shows last initialized layer #98

Closed assertAp closed 1 year ago

assertAp commented 1 year ago

I need to use multiple planes for performance reasons. The planes are shown as intended if set the opacity level to e.g. 0x80: image

Only last initialized and setup layer is drawn when setting the opacity to 0xFF (or just default without setting opacity).

Any hint where to look at? With modetest tool it is working fine.

caramelli commented 1 year ago

I tested planes on Raspberry Pi (a change was needed when setting the alpha property, see commit https://github.com/directfb2/DirectFB2/commit/2d69fe606ae125b476508322683124567781c190). Not sure if this will solve your issue. I'll try to finalize an example code to test the layers: I'll push it when it's ready.

caramelli commented 1 year ago

Example code for testing layers: https://github.com/directfb2/DirectFB-examples/blob/master/src/df_layers.c

assertAp commented 1 year ago

Thanks for the example code. I updated my local version and this is the output:

# /usr/bin/df_layers

   ~~~~~~~~~~~~~~~~~~~~~~~~~~| 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: Multi Application Core. (2023-04-13 08:41)
(*) Fusion/SHM: Using MADV_REMOVE
(*) DRMKMS/System: Using device /dev/dri/card0 (default)
(*) DRMKMS/System: Found 1 connectors, 1 encoders, 5 planes
(*) DirectFB/Input: TSC200X touchscreen (1) 0.1 (DirectFB)
(!) Input/Linux: KDGKBMODE failed!
    --> Not a typewriter
(*) DirectFB/Input: rotary (2) 0.1 (DirectFB)
(!) Input/Linux: KDGKBMODE failed!
    --> Not a typewriter
(*) DirectFB/Input: gpio-keys (3) 0.1 (DirectFB)
(!) Input/Linux: KDGKBMODE failed!
    --> Not a typewriter
(*) DirectFB/Input: Hot-plug detection enabled with Linux Input
(*) DirectFB/Graphics: Genefx Software Rasterizer 0.7 (DirectFB)
(*) DRMKMS/Screen: Default mode is 1024x768 (1 modes in total)
(*) DRMKMS/Layer: Supported properties for layer id 31
(*)      alpha
(*) DRMKMS/Layer: Supported properties for layer id 33
(*)      alpha
(*) DRMKMS/Layer: Supported properties for layer id 35
(*)      alpha
(*) DRMKMS/Layer: Supported properties for layer id 37
(*)      alpha
(*) DirectFB/Core/WM: Default 0.3 (DirectFB)
(*) Direct/Interface: Loaded 'DGIFF' implementation of 'IDirectFBFont'
(!) DRMKMS/Layer: drmModeObjectSetProperty() failed setting alpha!
    --> 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: drmModeObjectSetProperty() failed setting alpha!
    --> 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: drmModeObjectSetProperty() failed setting alpha!
    --> 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: drmModeObjectSetProperty() failed setting alpha!
    --> 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: drmModeObjectSetProperty() failed setting alpha!
    --> 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: drmModeObjectSetProperty() failed setting alpha!
    --> 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: drmModeSetPlane( plane_id 37, fb_id 46, dest    0,   0-1024x 768, source    0,   0-1024x 768 ) failed!

Probably the drmkms driver code of atmel-hlcdc is not compatible.

caramelli commented 1 year ago

The alpha property seems supported, I wonder why drmModeObjectSetProperty() fails to set it. What output do you get when running the modetest tool provided by the libdrm library?

assertAp commented 1 year ago

Thanks. Turned out this was a driver issue of the older kernel atmel-hlcdc module.