An error occurred fetching the project authors.
  1. 18 Aug, 2023 1 commit
  2. 08 Dec, 2022 1 commit
  3. 08 Nov, 2022 1 commit
  4. 03 Aug, 2022 1 commit
    • Danilo Krummrich's avatar
      drm/fb: rename FB CMA helpers to FB DMA helpers · 6bcfe8ea
      Danilo Krummrich authored
      Rename "FB CMA" helpers to "FB DMA" helpers - considering the hierarchy
      of APIs (mm/cma -> dma -> fb dma) calling them "FB DMA" seems to be
      more applicable.
      
      Besides that, commit e57924d4 ("drm/doc: Task to rename CMA helpers")
      requests to rename the CMA helpers and implies that people seem to be
      confused about the naming.
      
      In order to do this renaming the following script was used:
      
      ```
      	#!/bin/bash
      
      	DIRS="drivers/gpu include/drm Documentation/gpu"
      
      	REGEX_SYM_UPPER="[0-9A-Z_\-]"
      	REGEX_SYM_LOWER="[0-9a-z_\-]"
      
      	REGEX_GREP_UPPER="(${REGEX_SYM_UPPER}*)(FB)_CMA_(${REGEX_SYM_UPPER}*)"
      	REGEX_GREP_LOWER="(${REGEX_SYM_LOWER}*)(fb)_cma_(${REGEX_SYM_LOWER}*)"
      
      	REGEX_SED_UPPER="s/${REGEX_GREP_UPPER}/\1\2_DMA_\3/g"
      	REGEX_SED_LOWER="s/${REGEX_GREP_LOWER}/\1\2_dma_\3/g"
      
      	# Find all upper case 'CMA' symbols and replace them with 'DMA'.
      	for ff in $(grep -REHl "${REGEX_GREP_UPPER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_UPPER" $ff
      	done
      
      	# Find all lower case 'cma' symbols and replace them with 'dma'.
      	for ff in $(grep -REHl "${REGEX_GREP_LOWER}" $DIRS)
      	do
      	       sed -i -E "$REGEX_SED_LOWER" $ff
      	done
      
      	# Replace all occurrences of 'CMA' / 'cma' in comments and
      	# documentation files with 'DMA' / 'dma'.
      	for ff in $(grep -RiHl " cma " $DIRS)
      	do
      		sed -i -E "s/ cma / dma /g" $ff
      		sed -i -E "s/ CMA / DMA /g" $ff
      	done
      ```
      
      Only a few more manual modifications were needed, e.g. reverting the
      following modifications in some DRM Kconfig files
      
          -       select CMA if HAVE_DMA_CONTIGUOUS
          +       select DMA if HAVE_DMA_CONTIGUOUS
      
      as well as manually picking the occurrences of 'CMA'/'cma' in comments and
      documentation which relate to "FB CMA", but not "GEM CMA".
      
      This patch is compile-time tested building a x86_64 kernel with
      `make allyesconfig && make drivers/gpu/drm`.
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Signed-off-by: default avatarDanilo Krummrich <dakr@redhat.com>
      Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> #drivers/gpu/drm/arm
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220802000405.949236-3-dakr@redhat.com
      6bcfe8ea
  5. 25 Apr, 2022 5 commits
  6. 21 Jan, 2022 1 commit
  7. 14 Oct, 2021 1 commit
    • Hans de Goede's avatar
      drm: Add privacy-screen class (v4) · a1a98689
      Hans de Goede authored
      On some new laptops the LCD panel has a builtin electronic privacy-screen.
      We want to export this functionality as a property on the drm connector
      object. But often this functionality is not exposed on the GPU but on some
      other (ACPI) device.
      
      This commit adds a privacy-screen class allowing the driver for these
      other devices to register themselves as a privacy-screen provider; and
      allowing the drm/kms code to get a privacy-screen provider associated
      with a specific GPU/connector combo.
      
      Changes in v2:
      - Make CONFIG_DRM_PRIVACY_SCREEN a bool which controls if the drm_privacy
        code gets built as part of the main drm module rather then making it
        a tristate which builds its own module.
      - Add a #if IS_ENABLED(CONFIG_DRM_PRIVACY_SCREEN) check to
        drm_privacy_screen_consumer.h and define stubs when the check fails.
        Together these 2 changes fix several dependency issues.
      - Remove module related code now that this is part of the main drm.ko
      - Use drm_class as class for the privacy-screen devices instead of
        adding a separate class for this
      
      Changes in v3:
      - Make the static inline drm_privacy_screen_get_state() stub set sw_state
        and hw_state to PRIVACY_SCREEN_DISABLED to squelch an uninitialized
        variable warning when CONFIG_DRM_PRIVICAY_SCREEN is not set
      
      Changes in v4:
      - Make drm_privacy_screen_set_sw_state() skip calling out to the hw if
        hw_state == new_sw_state
      Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
      Reviewed-by: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20211005202322.700909-3-hdegoede@redhat.com
      a1a98689
  8. 24 Sep, 2021 2 commits
  9. 08 Feb, 2021 1 commit
  10. 03 Jun, 2020 1 commit
  11. 26 Feb, 2020 2 commits
  12. 09 Oct, 2019 1 commit
  13. 25 Jul, 2019 1 commit
  14. 13 Jun, 2019 1 commit
  15. 09 May, 2019 1 commit
  16. 17 Apr, 2019 1 commit
  17. 14 Mar, 2019 1 commit
  18. 30 Jan, 2019 1 commit
  19. 12 Jan, 2019 1 commit
  20. 11 Jan, 2019 1 commit
    • Lyude Paul's avatar
      drm/dp_mst: Introduce new refcounting scheme for mstbs and ports · ebcc0e6b
      Lyude Paul authored
      The current way of handling refcounting in the DP MST helpers is really
      confusing and probably just plain wrong because it's been hacked up many
      times over the years without anyone actually going over the code and
      seeing if things could be simplified.
      
      To the best of my understanding, the current scheme works like this:
      drm_dp_mst_port and drm_dp_mst_branch both have a single refcount. When
      this refcount hits 0 for either of the two, they're removed from the
      topology state, but not immediately freed. Both ports and branch devices
      will reinitialize their kref once it's hit 0 before actually destroying
      themselves. The intended purpose behind this is so that we can avoid
      problems like not being able to free a remote payload that might still
      be active, due to us having removed all of the port/branch device
      structures in memory, as per:
      
      commit 91a25e46 ("drm/dp/mst: deallocate payload on port destruction")
      
      Which may have worked, but then it caused use-after-free errors. Being
      new to MST at the time, I tried fixing it;
      
      commit 263efde3 ("drm/dp/mst: Get validated port ref in drm_dp_update_payload_part1()")
      
      But, that was broken: both drm_dp_mst_port and drm_dp_mst_branch structs
      are validated in almost every DP MST helper function. Simply put, this
      means we go through the topology and try to see if the given
      drm_dp_mst_branch or drm_dp_mst_port is still attached to something
      before trying to use it in order to avoid dereferencing freed memory
      (something that has happened a LOT in the past with this library).
      Because of this it doesn't actually matter whether or not we keep keep
      the ports and branches around in memory as that's not enough, because
      any function that validates the branches and ports passed to it will
      still reject them anyway since they're no longer in the topology
      structure. So, use-after-free errors were fixed but payload deallocation
      was completely broken.
      
      Two years later, AMD informed me about this issue and I attempted to
      come up with a temporary fix, pending a long-overdue cleanup of this
      library:
      
      commit c54c7374 ("drm/dp_mst: Skip validating ports during destruction, just ref")
      
      But then that introduced use-after-free errors, so I quickly reverted
      it:
      
      commit 9765635b ("Revert "drm/dp_mst: Skip validating ports during destruction, just ref"")
      
      And in the process, learned that there is just no simple fix for this:
      the design is just broken. Unfortunately, the usage of these helpers are
      quite broken as well. Some drivers like i915 have been smart enough to
      avoid accessing any kind of information from MST port structures, but
      others like nouveau have assumed, understandably so, that
      drm_dp_mst_port structures are normal and can just be accessed at any
      time without worrying about use-after-free errors.
      
      After a lot of discussion, me and Daniel Vetter came up with a better
      idea to replace all of this.
      
      To summarize, since this is documented far more indepth in the
      documentation this patch introduces, we make it so that drm_dp_mst_port
      and drm_dp_mst_branch structures have two different classes of
      refcounts: topology_kref, and malloc_kref. topology_kref corresponds to
      the lifetime of the given drm_dp_mst_port or drm_dp_mst_branch in it's
      given topology. Once it hits zero, any associated connectors are removed
      and the branch or port can no longer be validated. malloc_kref
      corresponds to the lifetime of the memory allocation for the actual
      structure, and will always be non-zero so long as the topology_kref is
      non-zero. This gives us a way to allow callers to hold onto port and
      branch device structures past their topology lifetime, and dramatically
      simplifies the lifetimes of both structures. This also finally fixes the
      port deallocation problem, properly.
      
      Additionally: since this now means that we can keep ports and branch
      devices allocated in memory for however long we need, we no longer need
      a significant amount of the port validation that we currently do.
      
      Additionally, there is one last scenario that this fixes, which couldn't
      have been fixed properly beforehand:
      
      - CPU1 unrefs port from topology (refcount 1->0)
      - CPU2 refs port in topology(refcount 0->1)
      
      Since we now can guarantee memory safety for ports and branches
      as-needed, we also can make our main reference counting functions fix
      this problem by using kref_get_unless_zero() internally so that topology
      refcounts can only ever reach 0 once.
      
      Changes since v4:
      * Change the kernel-figure summary for dp-mst/topology-figure-1.dot a
        bit - danvet
      * Remove figure numbers - danvet
      
      Changes since v3:
      * Remove rebase detritus - danvet
      * Split out purely style changes into separate patches - hwentlan
      
      Changes since v2:
      * Fix commit message - checkpatch
      * s/)-1/) - 1/g - checkpatch
      
      Changes since v1:
      * Remove forward declarations - danvet
      * Move "Branch device and port refcounting" section from documentation
        into kernel-doc comments - danvet
      * Export internal topology lifetime functions into their own section in
        the kernel-docs - danvet
      * s/@/&/g for struct references in kernel-docs - danvet
      * Drop the "when they are no longer being used" bits from the kernel
        docs - danvet
      * Modify diagrams to show how the DRM driver interacts with the topology
        and payloads - danvet
      * Make suggested documentation changes for
        drm_dp_mst_topology_get_mstb() and drm_dp_mst_topology_get_port() -
        danvet
      * Better explain the relationship between malloc refs and topology krefs
        in the documentation for drm_dp_mst_topology_get_port() and
        drm_dp_mst_topology_get_mstb() - danvet
      * Fix "See also" in drm_dp_mst_topology_get_mstb() - danvet
      * Rename drm_dp_mst_topology_get_(port|mstb)() ->
        drm_dp_mst_topology_try_get_(port|mstb)() and
        drm_dp_mst_topology_ref_(port|mstb)() ->
        drm_dp_mst_topology_get_(port|mstb)() - danvet
      * s/should/must in docs - danvet
      * WARN_ON(refcount == 0) in topology_get_(mstb|port) - danvet
      * Move kdocs for mstb/port structs inline - danvet
      * Split drm_dp_get_last_connected_port_and_mstb() changes into their own
        commit - danvet
      Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
      Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Reviewed-by: default avatarDaniel Vetter <daniel@ffwll.ch>
      Cc: David Airlie <airlied@redhat.com>
      Cc: Jerry Zuo <Jerry.Zuo@amd.com>
      Cc: Juston Li <juston.li@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20190111005343.17443-7-lyude@redhat.com
      ebcc0e6b
  21. 28 Nov, 2018 1 commit
    • Manasi Navare's avatar
      drm/dsc: Add helpers for DSC picture parameter set infoframes · a408c857
      Manasi Navare authored
      According to Display Stream compression spec 1.2, the picture
      parameter set metadata is sent from source to sink device
      using the DP Secondary data packet. An infoframe is formed
      for the PPS SDP header and PPS SDP payload bytes.
      This patch adds helpers to fill the PPS SDP header
      and PPS SDP payload according to the DSC 1.2 specification.
      
      v7:
      * Use BUILD_BUG_ON() to protect changing struct size (Ville)
      * Remove typecaseting (Ville)
      * Include byteorder.h in drm_dsc.c (Ville)
      * Correct kernel doc spacing (Anusha)
      v6:
      * Use proper sequence points for breaking down the
      assignments (Chris Wilson)
      * Use SPDX identifier
      v5:
      Do not use bitfields for DRM structs (Jani N)
      v4:
      * Use DSC constants for params that dont change across
      configurations
      v3:
      * Add reference to added kernel-docs in
      Documentation/gpu/drm-kms-helpers.rst (Daniel Vetter)
      
      v2:
      * Add EXPORT_SYMBOL for the drm functions (Manasi)
      
      Cc: dri-devel@lists.freedesktop.org
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
      Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
      Cc: Harry Wentland <harry.wentland@amd.com>
      Signed-off-by: default avatarManasi Navare <manasi.d.navare@intel.com>
      Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Reviewed-by: default avatarAnusha Srivatsa <anusha.srivatsa@intel.com>
      Acked-by: Sean Paul <seanpaul@chromium.org> (For merging through
      drm-intel)
      Link: https://patchwork.freedesktop.org/patch/msgid/20181127214125.17658-5-manasi.d.navare@intel.com
      a408c857
  22. 05 Oct, 2018 1 commit
  23. 13 Jul, 2018 3 commits
  24. 15 Dec, 2017 1 commit
  25. 04 Dec, 2017 1 commit
    • Hans de Goede's avatar
      drm: Add panel orientation quirks, v6. · 404d1a3e
      Hans de Goede authored
      Some x86 clamshell design devices use portrait tablet screens and a display
      engine which cannot rotate in hardware, so the firmware just leaves things
      as is and we cannot figure out that the display is oriented non upright
      from the hardware.
      
      So at least on x86, we need a quirk table for this. This commit adds a DMI
      based quirk table which is initially populated with 5 such devices: Asus
      T100HA, GPD Pocket, GPD win, I.T.Works TW891 and the VIOS LTH17.
      
      This quirk table will be used by the drm code to let userspace know that
      the display is not mounted upright inside the devices case through a new
      panel orientation drm-connector property, as well as to tell fbcon to
      rotate the console so that it shows the right way up.
      
      Changes in v5:
      -Add a kernel-doc comment documenting drm_get_panel_orientation_quirk()
      -Remove board_* matches from the dmi-matches for the VIOS LTH17 laptop,
       keeping only the (identical) sys_vendor and product_name matches.
       This is necessary because an older version of the bios has
       board_vendor set to VOIS instead of VIOS
      
      Changes in v6:
      -Add reference to added kernel-docs in Documentation/gpu/drm-kms-helpers.rst
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20171125193553.23986-3-hdegoede@redhat.com
      404d1a3e
  26. 16 Aug, 2017 1 commit
  27. 05 Jun, 2017 1 commit
  28. 21 Mar, 2017 1 commit
  29. 14 Mar, 2017 3 commits
  30. 22 Nov, 2016 1 commit