1. 22 Mar, 2018 14 commits
    • Pekka Paalanen's avatar
      doc: add example calibration-helper script · 598470d3
      Pekka Paalanen authored
      This is not to be installed, except maybe as a doc. It is just an
      example of what one might do.  It also has not been tested, it's just
      for giving an idea of what it should do.
      
      It also contains untested speculation.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      598470d3
    • Louis-Francis Ratté-Boulianne's avatar
      clients: add a new touchscreen calibrator · 7ad18a2d
      Louis-Francis Ratté-Boulianne authored
      The new calibrator uses weston_touch_calibration protocol extension and
      provides the following features:
      
      - chooses the physical touch device to be calibrated by DEVPATH or by
        the output/head name; device enumeration provided
      
      - the compositor ensures the calibrator window is shown in the correct
        position and size
      
      - no matter how wrong the old calibration is, the touch events will
        always arrive in the application
      
      - the calibration is complete, not incremental; the received touch
        events are guaranteed to be unmodified
      
      - computes a libinput style calibration matrix directly, not the
        WL_CALIBRATION format
      
      - supports multiple touch devices: calibrate one device at a time, and
        show user feedback on touching a wrong device instead of recording bad
        data
      
      - uses four touch point samples: three to compute the calibration, and
        one to verify the calibration is roughly correct
      
      - consistent exit codes
      
      - upload the new calibration into the server after successful
        and verified calibration
      
      Due to using special touchscreen calibration protocol extension, this
      application cannot be tested without touch input from the compositor.
      
      Practically all of the above mentioned are unlike how the old
      calibrator client worked.
      
      Co-developed by Louis-Francis and Pekka.
      Signed-off-by: 's avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      7ad18a2d
    • Louis-Francis Ratté-Boulianne's avatar
      weston: add touchscreen_calibrator option · eb0a738e
      Louis-Francis Ratté-Boulianne authored
      Add an option to enable the touchscreen calibrator interface. This is a
      global on/off toggle, in lack of more fine-grained access restrictions.
      
      As Weston should not hardcode system specifics, the actual permanent
      saving of a new calibration is left for a user supplied script or a
      program. Usually this script would write an appropriate udev rule to set
      LIBINPUT_CALIBRATION_MATRIX for the touch device.
      
      Co-developed by Louis-Francis and Pekka.
      Signed-off-by: 's avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      eb0a738e
    • Louis-Francis Ratté-Boulianne's avatar
      libweston: implement touch calibration protocol · 255f80f3
      Louis-Francis Ratté-Boulianne authored
      This implements a new global interface weston_touch_calibration, which
      allows one client at a time to perform touchscreen calibration. This
      also implements the calibrator window management.
      
      A client asks to calibrate a specific physical touch device (not a
      wl_seat which may have several physical touch devices aggregated).
      Libweston grabs all touch devices and prevents normal touch event
      handling during the calibation sequence.
      
      API is added to enable this new global interface, but it not yet called
      by anything. Since the implementation allows clients to grab touch devices
      arbitrarily, it is not enabled by default. The compositor should take
      measures to prevent unexpected access to the interface.
      
      A client may upload a new calibration to the compositor. There is a
      vfunc to allow the compositor to reject/accept it and save it to
      persistent storage. The persistent storage could be a udev rule
      setting LIBINPUT_CALIBRATION_MATRIX, so that all display server would
      load the new calibration automatically.
      
      Co-developed by Louis-Francis and Pekka.
      Signed-off-by: 's avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      255f80f3
    • Pekka Paalanen's avatar
      protocol: add weston_touch_calibration · 69fe47b1
      Pekka Paalanen authored
      This is a Wayland protocol extension to allow the calibration of
      touchscreens in Weston.
      
      See: https://phabricator.freedesktop.org/T7868Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      69fe47b1
    • Louis-Francis Ratté-Boulianne's avatar
      input: introduce touch event mode for calibrator · 43ef6fcd
      Louis-Francis Ratté-Boulianne authored
      In addition to the normal touch event processing mode, introduce a new
      mode for calibrating a touchscreen input device.
      
      In the calibration mode, normal touch event processing is skipped, and
      the raw events are forwarded to the calibrator instead. The calibrator
      is not yet implemented, so the calls will be added in a following patch.
      
      To switch between modes, two functions are added, one for entering each
      mode. The mode switch happens only when no touches are down on any touch
      device, to avoid confusing touch grabs and clients. To realise this, the
      state machine has four states: prepare and actual state for both normal
      and calibrator modes.
      
      At this point nothing will attempt to change the touch event mode.
      
      The new calibrator mode is necessary, because when calibrating a
      touchscreen, the touch events must be routed to the calibration client
      directly. The touch coordinates are expected to be wrong, so they cannot
      go through the normal focus surface picking. The calibrator code also
      cannot use the normal touch grab interface, because it needs to be able
      to distinguish between different physical touch input devices, even if
      they are part of the same weston_seat. This requirement makes
      calibration special enough to warrant the new mode, a sort of "super
      grab".
      
      Co-developed by Louis-Francis and Pekka.
      Signed-off-by: 's avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      43ef6fcd
    • Pekka Paalanen's avatar
      input: do not forward unmatched touch-ups · b159b126
      Pekka Paalanen authored
      Commit a30e29af introduced the code to
      deal with a touchscreen with touches already down when Weston starts
      using it. It fixed the touchpoint counting problem.
      
      However, Weston still should not forward or process the unmatched
      touch-ups either. Code inspection says it would confuse the
      idle-inhibit counting, and it could probably confuse clients as well.
      Hence, just drop unmatched touch-ups.
      
      Enhance the warning message to allow identifying where the event came
      from.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      b159b126
    • Louis-Francis Ratté-Boulianne's avatar
      input: move touchpoint counting up · b5077513
      Louis-Francis Ratté-Boulianne authored
      The touchpoint counting is needed regardless of what we do with the
      touch events, so move it out of process_touch_normal() into the caller
      notify_touch_cal().
      
      This is pure refactoring.
      Signed-off-by: 's avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      b5077513
    • Louis-Francis Ratté-Boulianne's avatar
      libweston: fix weston_touch_start_grab() arg name · 3f47c922
      Louis-Francis Ratté-Boulianne authored
      compositor.c has 'touch', so use 'touch' here as well. It is not a
      device to begin with.
      Signed-off-by: 's avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      3f47c922
    • Pekka Paalanen's avatar
      libweston: introduce notify_touch_cal() and doc · c4e15236
      Pekka Paalanen authored
      notify_touch_cal() is an extended form of notify_touch(), adding
      normalized touch coordinates which are necessary for calibrating a
      touchscreen.
      
      It would be possible to invert the transformation and convert from
      global coordinates to normalized device coordinates in input.c without
      adding this API, but this way it is more robust against code changes.
      
      Recovering normalized device coordinates is necessary because libinput
      calibration matrix must be given in normalized units, and it would be
      difficult to compute otherwise. Libinput API does not offer normalized
      coordinates directly either, but those can be fetched by pretending the
      output resolution is 1x1.
      
      Anticipating touch calibration mode, the old notify_touch() is renamed
      into a private process_touch_normal(), and the new notify_touch_cal()
      delegates to it.
      
      Co-developed by Louis-Francis and Pekka.
      
      Cc: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      c4e15236
    • Pekka Paalanen's avatar
      libweston: unexport weston_{pointer,keyboard,touch}_{create,destroy}() · 89a6a787
      Pekka Paalanen authored
      We have weston_seat_{init,release}_{pointer,keyboard,touch}() as the
      backend-facing API. There is no need to expose the create/destroy
      functions which have been for internal use only for quite a long time.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      89a6a787
    • Pekka Paalanen's avatar
      libweston: notify_touch API to use weston_touch_device · 3da5669f
      Pekka Paalanen authored
      Relay touch input events into libweston core through the
      weston_touch_device, so that the core can tell which individual physical
      device they come from.
      
      This is necessary for supporting touchscreen calibration, where one
      needs to process a single physical device at a time instead of the
      aggregate of all touch devices on the weston_seat.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      3da5669f
    • Pekka Paalanen's avatar
      libinput: move calibration printing into do_set_calibration() · e874f0b6
      Pekka Paalanen authored
      Move calibration printing here and call do_set_calibration() from
      evdev_device_set_calibration() so that all matrix setting paths print
      the same way.
      
      Print the matrix values in a matrix style to help readability, and
      mention the input device.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      e874f0b6
    • Louis-Francis Ratté-Boulianne's avatar
      input: introduce weston_touch_device · b53d0be7
      Louis-Francis Ratté-Boulianne authored
      Introduce weston_touch_device for libweston core to track individual
      touchscreen input devices. A weston_seat/weston_touch may be an
      aggregation of several physical touchscreen input devices. Separating
      the physical devices will be required for implementing touchscreen
      calibration. One can only calibrate one device at a time, and we want to
      make sure to handle the right one.
      
      Both backends that support touch devices are updated to create
      weston_touch_devices. Wayland-backend provides touch devices that cannot
      be calibrated, because we have no access to raw touch coordinates from
      the device - calibration is the responsibility of the parent display
      server. Libinput backend provides touch devices that can be calibrated,
      hence implementing the set and get calibration hooks.
      
      Backends need to maintain an output pointer in any case, so we have a
      get_output() hook instead of having to maintain an identical field in
      weston_touch_device. The same justification applies to
      get_calibration_head_name.
      
      Also update the test plugin to manage weston_touch_device objects.
      
      Co-developed by Louis-Francis and Pekka.
      Signed-off-by: 's avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      b53d0be7
  2. 21 Mar, 2018 10 commits
    • Pekka Paalanen's avatar
      tests: add test_seat_release() for symmetry · beaafc27
      Pekka Paalanen authored
      Add test_seat_release() as the counterpart of test_seat_init() instead
      of open-coding it. This helps adding more code to test_seat_release()
      later.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      beaafc27
    • Pekka Paalanen's avatar
      man: document WESTON_LIBINPUT_LOG_PRIORITY env · 506f261d
      Pekka Paalanen authored
      Commit c81c4241 added this environment
      variable. Document it.
      
      It applies also to the fbdev-backend but that has no man page.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      506f261d
    • Pekka Paalanen's avatar
      libinput: do not switch output associations on disable · 711f1f0b
      Pekka Paalanen authored
      If an input device is associated to an output that then gets disabled,
      there is no case where associating to a different output would be
      correct.
      
      The output association is used for absolute positioned input devices,
      and an input device like a touchscreen cannot ever be automatically
      valid for more than one possible output - the touchscreen display
      device.
      
      Therefore do not automatically reassing implicitly associated input
      devices to another output. This removes some log spam on shutdown.
      
      In fact, if there can be more than one output at any time, absolute
      input devices must be explicitly configured to associate with the
      correct output, or the results are essentially undefined in any case.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      711f1f0b
    • Pekka Paalanen's avatar
      libweston: require connected heads for input devices · 1620a7e3
      Pekka Paalanen authored
      The use case driving this change is a clone mode setup, where the user
      is hotplugging or unplugging a cloned touchscreen. Even if the output
      and head are force-enabled, the touch device should still follow the
      connector connection status. If there is no video signal for the
      touchscreen (disconnected connector), then the touch input should be
      ignored as well.
      
      When the output is force-enabled, we need to trigger
      output_heads_changed from connector status changes. If the head or
      output are not force-enabled, the compositor will likely attach and
      detach the head as appropriate. In clone mode, the attach or detach
      needs to trigger output_heads_changed directly. In other cases, it may
      be handled through the output getting enabled or disabled which are
      different signals.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      1620a7e3
    • Pekka Paalanen's avatar
      libinput: use head names for output matching · 88edf706
      Pekka Paalanen authored
      Associating input devices with weston_outputs by the output name fails
      when one output has several heads. We need to match against head names
      instead of output names to be able to find all names.
      
      This fixes touchscreen output association in shared-CRTC clone mode when
      outputs or input devices appear or disappear.
      
      Even though notify_output_create() is called only when new outputs
      appear, the implementation is prepared to also remove output
      associations. This will be handy in the future when this function will
      handle also head detaching from an output that remains enabled.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      88edf706
    • Pekka Paalanen's avatar
      libinput: allow evdev_device_set_output(dev, NULL) · 1a8ad778
      Pekka Paalanen authored
      Removing the output association from an evdev_device is more than just
      setting the pointer to NULL, one also needs to remove the destroy
      listener and flag the destroy listener as unused (notify == NULL).
      
      evdev_device_set_output() can already remove associations, so let it
      also handle an assignment to NULL output.
      
      Fix notify_output_destroy() to handle removing an association correctly.
      Previously, the listener was left "used", which would mean the next call
      to evdev_device_set_output() would have wl_list_remove()'d, accessing
      freed memory. This could be triggered by having a touchscreen with a
      specified output association, and unplugging then re-plugging the
      corresponding output.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      1a8ad778
    • Pekka Paalanen's avatar
      libinput: make setting the same output a no-op · dd17799d
      Pekka Paalanen authored
      In the future evdev_device_set_output() will start getting called more
      often, redundantly. Short-circuit the setting if the chosen output is
      already set for an input device. This reduces churn in the logs.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      dd17799d
    • Pekka Paalanen's avatar
      libinput: log input device to output associations · 5aaf1c61
      Pekka Paalanen authored
      Helps admins ensure the configuration is correct.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      5aaf1c61
    • Pekka Paalanen's avatar
      libinput: deprecate WL_CALIBRATION · 56a70757
      Pekka Paalanen authored
      The udev property WL_CALIBRATION is an old way of giving Weston a
      touchscreen calibration matrix. It is Weston-specific.
      
      The recommended way of setting up a calibration is to use the udev
      property LIBINPUT_CALIBRATION_MATRIX, which libinput will load
      automatically and therefore applies to all libinput using display
      servers and applications.
      
      The syntax of WL_CALIBRATION and LIBINPUT_CALIBRATION_MATRIX is
      different as well: WL_CALIBRATION uses pixels as the translation part
      units, which makes the values depend on the output resolution.
      LIBINPUT_CALIBRATION_MATRIX on the other hand uses normalized units.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      56a70757
    • Pekka Paalanen's avatar
      libinput: note if calibrating without an output · cf753aaa
      Pekka Paalanen authored
      Print a note that calibration got skipped if the input device supports a
      calibration matrix but there is no associated output to compute it from.
      Helps with debugging touchscreen calibration issues.
      
      The code is reorganized and commented a bit, but this does not change
      the behaviour.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      cf753aaa
  3. 14 Mar, 2018 16 commits
    • Pekka Paalanen's avatar
      libinput: remove evdev_device::devnode · 20072705
      Pekka Paalanen authored
      Struct 'evdev_device' has field 'devnode' which is initialized to NULL,
      never assigned, and finally free()'d. Therefore it is useless.
      
      Remove the dead field.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      20072705
    • Pekka Paalanen's avatar
      weston: support clone mode on DRM-frontend · fc038cb4
      Pekka Paalanen authored
      Add a new output section key "same-as" for configuring clone mode. An
      output marked "same-as" another output will be configured identically to
      the other output.
      
      The current implementation supports only CRTC sharing for clone mode.
      Independent CRTC clone mode cannot be supported until output layout
      logic is moved from libweston into the frontend and libweston's damage
      tracking issues stemming from overlapping outputs are solved.
      
      Quite a lot of infrastructure is needed to properly configure clone
      mode. The implemented logic allows easy addition of independent CRTC
      clone mode once libweston supports it. The idea is that wet_layoutput is
      the item to be laid out and all weston_outputs a wet_layoutput
      contains show exactly the same area of the desktop.
      
      The configuration logic attempts to automatically fall back to creating
      more weston_outputs when all heads do not work under the same
      weston_output. For now, the fallback path ends with an error message.
      
      Enabling a weston_output is bit complicated, because one needs to first
      collect all relevant heads, try to attach them all to the weston_output,
      and then back up head by head until enabling the weston_output succeeds.
      A new weston_output is created for the left-over heads and the process
      is repeated.
      
      CRTC-sharing clone mode is the most efficient clone mode, offering
      synchronized scanout timings, but it is not always supported by
      hardware.
      
      v6:
      - Add man-page note about cms-colord.
      - Don't create an output just to turn it off.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      fc038cb4
    • Pekka Paalanen's avatar
      weston: use wet.compositor consistently in main() · 6ba163c4
      Pekka Paalanen authored
      Rename user_data to wet, because it is called wet everywhere else.
      
      Drop the local variable ec, because that is available as wet.compositor.
      
      This models a little better that wet_compositor owns weston_compositor,
      and not the other way around.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      6ba163c4
    • Pekka Paalanen's avatar
      weston: store weston_compositor in wet_compositor · 29ae6581
      Pekka Paalanen authored
      This makes it easier to just pass wet_compositor around and take the
      weston_compositor from it.
      
      It feels weird to go from weston_compositor to wet_compositor all the
      time in internal functions. It's necessary in callbacks that cannot
      carry wet_compositor, but otherwise it is awkward.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      29ae6581
    • Pekka Paalanen's avatar
      compositor-drm: allow shared-CRTC cloning · 2c2f424a
      Pekka Paalanen authored
      Allow cloning up to 4 connectors from the same CRTC. All the
      implementation bits support more than one head per output already.
      
      Four is just an arbitary number, small but unlikely to ever be the
      limiting factor in cloning since hardware is usually very restricted.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      2c2f424a
    • Pekka Paalanen's avatar
      compositor-drm: head attach requires a modeset · 3d42e9b6
      Pekka Paalanen authored
      For the attach on an enabled output to have an effect, we need to go
      through drmModeSetCrtc or ATOMIC_ALLOW_MODESET.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      3d42e9b6
    • Pekka Paalanen's avatar
      compositor-drm: head detach requires a modeset · ab0e062b
      Pekka Paalanen authored
      When a head is detached from an enabled output, that output needs to go
      through a modeset (drmModeSetCrtc() / ATOMIC_ALLOW_MODESET) so that the
      connector is actually removed from the CRTC.
      
      This has not yet been a problem, because an output could only have one
      head at a time, and would be automatically disabled on detach. It would
      be a problem with clone mode.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      ab0e062b
    • Pekka Paalanen's avatar
      compositor-drm: preserve CRTC routing harder · cf323ed5
      Pekka Paalanen authored
      If we are processing a connector that does not have an existing routing,
      it is possible we pick a CRTC that was previously routed to a connector
      we have not enabled yet. If that happens, the latter connector cannot
      preserve its routing.
      
      Check that no other connector we might enable later had this CRTC
      before.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      cf323ed5
    • Pekka Paalanen's avatar
      compositor-drm: rewrite crtc picking for clone mode · 3feec70d
      Pekka Paalanen authored
      To support shared-CRTC clone mode, the chosen CRTC needs to support
      driving all the attached connectors. Replace the old algorithm with a
      new one that takes into account all associated connectors.
      
      Ideally it should use possible_clones mask to check which encoders (and
      therefore connectors) actually can be in a cloned set. However, the DRM
      documentation says about possible_clones and possible_crtcs masks both:
      "In reality almost every driver gets this wrong."
      - https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html#c.drm_encoder
      
      Looking at a target device and its kernel where clone mode is desired,
      possible_clones is indeed self-conflicting and would not allow cloning
      at all. Therefore the implemented algorithm replaces the checking of
      possible_clones with luck. It even goes out of its way to find any CRTC
      for a configuration, even if not advertised by the kernel as not
      supported.
      
      Libweston would need infrastructure to allow trial-and-error CRTC
      allocation: rather than picking one CRTC in advance and do or die, it
      should try all available CRTCs one by one. Unfortunately that is not yet
      possible, so this patch implements what it can. It is also the DRM
      upstream opinion that trial-and-error with ATOMIC_TEST would be the way
      to go.
      
      Unlike the old algorithm, the new algorithm prefers routings that were
      in place when Weston started instead of when enabling an output. When
      you never temporarily disable an output, this makes no difference.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      3feec70d
    • Pekka Paalanen's avatar
      compositor-drm: no need to clear inherited_mode · 5dd24a27
      Pekka Paalanen authored
      The head was just zalloc()'d, there is no need to memset it to zero.
      
      If a function fails, it is preferable it leaves the output arguments
      untouched.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      5dd24a27
    • Pekka Paalanen's avatar
      compositor-drm: introduce drm_head_read_current_setup() · c40825f5
      Pekka Paalanen authored
      Rename connector_get_current_mode() because it will be useful for
      storing not just the current mode on creating a head.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      c40825f5
    • Pekka Paalanen's avatar
      compositor-drm: update video mode printing · c65038b5
      Pekka Paalanen authored
      Stop using a head for printing the mode list, because there could be
      multiple heads. We already gather the mode list from all heads.
      
      No need to print the connector id here, because it is logged with DRM
      heads, and core prints the head names on output enable.
      
      The "built-in" flag seemed dead, because it could only be printed if the
      kernel provided no modes. If we want more detailed info on where modes
      come from, we would need to inspect mode_info or add new flags to
      drm_mode or weston_mode.
      
      Add printing the pixel clock, because that is used by the video mode
      duplicate removal code.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      c65038b5
    • Pekka Paalanen's avatar
      compositor-drm: backlight control for all heads · bc98075d
      Pekka Paalanen authored
      If an output has multiple (cloned) heads, it should be enough for any
      head to support backlight control for DRM-backend to expose it.
      
      Inspect all attached heads for backlight control and improve the
      logging.
      
      Pick the initial backlight level from whatever happens to be the "first"
      head, because it's simple.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      bc98075d
    • Pekka Paalanen's avatar
      compositor-drm: combine mode list from heads · aac13c82
      Pekka Paalanen authored
      A single list of modes needs to be combined from the mode lists in each
      attached head. We could just concatenate the lists, but that might
      introduce duplicates. Try to avoid duplicates instead by using partially
      fuzzy matching.
      
      When a duplicate is found, try to figure out which is more suitable to
      use in place of both. If one has the preferred flag and the other
      doesn't, take the preferred one. Otherwise use the one already in the
      list.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      aac13c82
    • Pekka Paalanen's avatar
      compositor-drm: unify head status logging · 817ee2b9
      Pekka Paalanen authored
      Previously the log contained one line for EDID data and another line for
      the head, and you just had to know they belong together. Make it more
      obvious to read by putting both head and EDID info on the same line.
      
      We no longer print EDID data every time it is parsed (on every hotplug
      event), but only if it changes. I did take a shortcut here and use
      weston_head::device_changed as the print condition which relies on the
      compositor clearing it, but a failure to do so just means we print stuff
      even if it didn't change.
      
      Head info updates also print the head info and not just the EDID data.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      817ee2b9
    • Pekka Paalanen's avatar
      compositor-drm: drm_set_backlight heads · e6240ede
      Pekka Paalanen authored
      Fix this function to support more than one head per output.
      Signed-off-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
      e6240ede