Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-80976

Error getting current display settings via LibDRM (with fixed patch).



    • Bug
    • Status: Closed
    • P2: Important
    • Resolution: Done
    • 5.9.6, 5.14.0
    • 5.15
    • None
    • Raspberry Pi4B, Qt 5.9.6 (KMS), Debian streetch (+ libdrm and other packages from booster for compatiblity Rpi4)
    • Linux/Other display system
    • bd4a1b98b813dfbbb4a9db35a380bed8dd5f0ce3


      We have several Raspberry Pi4 and TVs connected to them.

      We have a TV, LG 49UJ6307-ZA, which for some reason does not return the mode marked with the flag DRM_MODE_TYPE_PREFERRED via LibDRM.

      Interestingly, the Raspberry Pi tvservice utility returns the preferred mode of 1920x1080 60Hz.
      `(prefer) mode 16: 1920x1080 @ 60Hz 16: 9, clock: 148MHz progressive`

      When I looked at the Qt code, I realized that DRM_MODE_TYPE_PREFERRED is initially selected, then, if it is not specified, the current mode is selected.
      If the current mode is not received, `best` is selected - that is, with the highest resolution.

      The problem is that with this monitor, 4096 x 2160 30Hz is the maximum, (however the matrix is ​​3840x2160!), And the Raspberry Pi cannot work correctly with such a high resolution, at all.

      Another problem was that in the source code of Qt, an error was made in the eglfs kms module.

      Because of which, in some cases it is impossible to get the current screen resolution.

      src / platformsupport / kmsconvenience / qkmsdevice.cpp When calling drmModeGetEncoder, `connector-> connector_id`=1 is specified, although I think` connector-> encoder_id`=50 should be specified in this case.
      Becouse `drmModeGetEncoder` at all received `encoder_id` in second argument.

      There is an error in all versions of Qt.
      After changing to `encoder_id`, the resolution of 1920x1080 60hz is selected, i.e. current resolution.
      I attach patch fixbug.diff for Qt 5.9.6 sources, and resolution list over libdrm, montor_modes_overlibdrm.txt and tvservice output tvserviceoutput.txt .


        1. fixbug.diff
          0.8 kB
        2. montor_modes_overlibdrm.txt
          4 kB
        3. tvserviceoutput.txt
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            lagocs Laszlo Agocs
            lubagov Nikolay Lubyagoc
            0 Vote for this issue
            1 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes