Skip to content
  1. Aug 09, 2021
    • Thomas Zimmermann's avatar
      drm/mgag200: Store values (not bits) in struct mgag200_pll_values · 2dd04094
      Thomas Zimmermann authored
      
      
      The fields in struct mgag200_pll_values currently hold the bits of
      each register. Store the PLL values instead and let the PLL-update
      code figure out the bits for each register.
      
      Until now, the compute function either stored plain values or register
      bits in struct mgag200_pll_values. The rsp update function used the
      values as-is. This made it very hard to correctly interpret the stored
      values (e.g., for logging or debugging). With the cleanup, the stored
      values now have a clear meaning.
      
      v2:
      	* add a bit more context in the commit message (Sam)
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-7-tzimmermann@suse.de
      2dd04094
    • Thomas Zimmermann's avatar
      drm/mgag200: Introduce separate variable for PLL S parameter · d9d99223
      Thomas Zimmermann authored
      
      
      The S parameter is controls the loop filter bandwidth when programming
      the PLL. It's currently stored as part of P (i.e., the clock divider.)
      
      Add a separate variable for S prepares the PLL code for further
      refactoring. The value of s is currently 0, so it has not yet an effect
      on the programming.
      
      v2:
      	* add a note on the current value of s to commit message
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-6-tzimmermann@suse.de
      d9d99223
    • Thomas Zimmermann's avatar
      drm/mgag200: Split PLL setup into compute and update functions · f86c3ed5
      Thomas Zimmermann authored
      
      
      The _set_plls() functions compute a pixel clock's PLL values
      and program the hardware accordingly. This happens during atomic
      commits.
      
      For atomic modesetting, it's better to separate computation and
      programming from each other. This will allow to compute the PLL
      value during atomic checks and catch unsupported modes early.
      
      Split the PLL setup into a compute and an update functions, and
      call them one after the other. Computed PLL values are store in
      struct mgag200_pll_values. There are four parameters for the PLL,
      m, n, p and s. Every compute function stores a value for each
      of these parameters, and the rsp update function makes the register
      bits from them. The values stored by the compute function are
      either plain values or register bits. An additional change is
      required to always store plain values.
      
      No functional changes.
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-5-tzimmermann@suse.de
      f86c3ed5
    • Thomas Zimmermann's avatar
      drm/mgag200: Remove P_ARRAY_SIZE · 83c90cdb
      Thomas Zimmermann authored
      
      
      Replace P_ARRAY_SIZE by array pre-initializing and ARRAY_SIZE(). No
      functional changes.
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-4-tzimmermann@suse.de
      83c90cdb
    • Thomas Zimmermann's avatar
      drm/mgag200: Return errno codes from PLL compute functions · 08a70946
      Thomas Zimmermann authored
      
      
      Return -EINVAL if there's no PLL configuration for the given pixel
      clock. The returned errors are currently ignored by the caller, but
      the errno codes will become useful when the compute functions run
      during atomic checks.
      
      v2:
      	* give a rational for this change (Sam)
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-3-tzimmermann@suse.de
      08a70946
    • Thomas Zimmermann's avatar
      drm/mgag200: Select clock in PLL update functions · 14769672
      Thomas Zimmermann authored
      
      
      Put the clock-selection code into each of the PLL-update functions to
      make them select the correct pixel clock. Instead of copying the code,
      introduce a new helper WREG_MISC_MASKED, which does masked writes into
      <MISC>. Use it from each individual PLL update function.
      
      The pixel clock for video output was not actually set before programming
      the clock's values. It worked because the device had the correct clock
      pre-set.
      
      v2:
      	* don't duplicate <MISC> update code (Sam)
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Fixes: db05f8d3
      
       ("drm/mgag200: Split MISC register update into PLL selection, SYNC and I/O")
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Emil Velikov <emil.velikov@collabora.com>
      Cc: Dave Airlie <airlied@redhat.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: <stable@vger.kernel.org> # v5.9+
      Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-2-tzimmermann@suse.de
      14769672
  2. Aug 06, 2021
  3. Aug 05, 2021
  4. Aug 02, 2021
    • Thomas Zimmermann's avatar
      drm/vkms: Map output framebuffer BOs with drm_gem_fb_vmap() · 50fff206
      Thomas Zimmermann authored
      
      
      Abstract the framebuffer details by mappings its BOs with a call
      to drm_gem_fb_vmap(). Unmap with drm_gem_fb_vunamp().
      
      Before, the output address with stored as raw pointer in the priv
      field of struct drm_writeback_job. Introduce the new type
      struct vkms_writeback_job, which holds the output mappings addresses
      while the writeback job is active.
      
      The patchset also cleans up some internal casting an setup of the
      output addresses. No functional changes.
      
      v3:
      	* free instances of struct vkms_writeback_job on cleanup
      	  or errors
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730183511.20080-6-tzimmermann@suse.de
      50fff206
    • Thomas Zimmermann's avatar
      drm/gud: Map framebuffer BOs with drm_gem_fb_vmap() · 0029d318
      Thomas Zimmermann authored
      
      
      Abstract the framebuffer details by mapping its BOs with a call
      to drm_gem_fb_vmap(). Unmap with drm_gem_fb_vunmap().
      
      The call to drm_gem_fb_vmap() ensures that all BOs are mapped
      correctly. Gud still only supports single-plane formats.
      
      No functional changes.
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730183511.20080-5-tzimmermann@suse.de
      0029d318
    • Thomas Zimmermann's avatar
      drm/gem: Clear mapping addresses for unused framebuffer planes · 0ec77bd9
      Thomas Zimmermann authored
      
      
      Set the returned mapping address to NULL if a framebuffer plane does
      not have a BO associated with it. Likewise, ignore mappings of NULL
      during framebuffer unmap operations. Allows users of the functions to
      perform unmap operations of certain BOs by themselfes.
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730183511.20080-4-tzimmermann@suse.de
      0ec77bd9
    • Thomas Zimmermann's avatar
      drm/gem: Provide drm_gem_fb_{vmap,vunmap}() · f6424ecd
      Thomas Zimmermann authored
      
      
      Move framebuffer vmap code from shadow-buffered plane state into the new
      interfaces drm_gem_fb_vmap() and drm_gem_fb_vunmap(). These functions
      provide mappings of a framebuffer's BOs into kernel address space. No
      functional changes.
      
      v4:
      	* remove duplicated blank line
      v2:
      	* using [static N] for array parameters enables compile-time checks
      	* include <drm/drm_fourcc.h> for DRM_FORMAT_MAX_PLANES (kernel
      	  test robot)
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730183511.20080-3-tzimmermann@suse.de
      f6424ecd
    • Thomas Zimmermann's avatar
      drm: Define DRM_FORMAT_MAX_PLANES · 279cc2e9
      Thomas Zimmermann authored
      
      
      DRM uses a magic number of 4 for the maximum number of planes per color
      format. Declare this constant via DRM_FORMAT_MAX_PLANES and update the
      related code. Some code depends on the length of arrays that are now
      declared with DRM_FORMAT_MAX_PLANES. Convert it from '4' to ARRAY_SIZE.
      
      v2:
      	* mention usage of ARRAY_SIZE() in the commit message (Maxime)
      	* also fix error handling in drm_gem_fb_init_with_funcs()
      	  (kernel test robot)
      	* include <drm/drm_fourcc.h> for DRM_FORMAT_MAX_PLANES
      
      Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730183511.20080-2-tzimmermann@suse.de
      279cc2e9
    • Simon Ser's avatar
      drm: document drm_mode_get_property · 6e5b47a4
      Simon Ser authored
      
      
      It's not obvious what the fields mean and how they should be used.
      The most important detail is the link to drm_property.flags, which
      describes how property types work.
      
      v2: document enum drm_mode_property_enum, add ref to "Modeset Base
      Object Abstraction" (Daniel)
      
      Signed-off-by: default avatarSimon Ser <contact@emersion.fr>
      Acked-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Cc: Leandro Ribeiro <leandro.ribeiro@collabora.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210802072826.500078-1-contact@emersion.fr
      6e5b47a4
    • Daniel Vetter's avatar
      drm: Fix oops in damage self-tests by mocking damage property · 2f425cf5
      Daniel Vetter authored
      
      
      I've added a new check to make sure that drivers which insepct the
      damage property have it set up correctly, but somehow missed that this
      borke the damage selftest in the CI result noise.
      
      Fix it up by mocking enough of drm_device and drm_plane so we can call
      drm_plane_enable_fb_damage_clips() to make the new check happy.
      
      Since there's a lot of duplicated mock code already copy-pasted into
      each test I've also refactored this a bit to trim it down.
      
      v2: Squash in fixup from 0day for
      
      drivers/gpu/drm/selftests/test-drm_damage_helper.c:15:19: warning: symbol 'mock_device' was not declared. Should it be static?
      drivers/gpu/drm/selftests/test-drm_damage_helper.c:16:30: warning: symbol 'mock_obj_props' was not declared. Should it be static?
      drivers/gpu/drm/selftests/test-drm_damage_helper.c:17:18: warning: symbol 'mock_plane' was not declared. Should it be static?
      drivers/gpu/drm/selftests/test-drm_damage_helper.c:18:21: warning: symbol 'mock_prop' was not declared. Should it be static?
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarkernel test robot <lkp@intel.com>
      
      Reviewed-by: default avatarMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
      Fixes: c7fcbf25 ("drm/plane: check that fb_damage is set up when used")
      Cc: José Roberto de Souza <jose.souza@intel.com> (v1)
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Cc: Gwan-gyeong Mun <gwan-gyeong.mun@intel.com>
      Cc: José Roberto de Souza <jose.souza@intel.com>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Daniel Vetter <daniel.vetter@intel.com>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730095251.4343-1-daniel.vetter@ffwll.ch
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730141948.GA11955@243d74413310
      2f425cf5
    • Cai Huoqing's avatar
      drm: Fix typo in comments · 0ae865ef
      Cai Huoqing authored
      
      
      fix typo for drm
      
      v1->v2:
      respin with the change "iff ==> implies that"
      
      Signed-off-by: default avatarCai Huoqing <caihuoqing@baidu.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730132729.376-1-caihuoqing@baidu.com
      0ae865ef
    • Simon Ser's avatar
      drm/connector: add ref to drm_connector_get in iter docs · 33e1fc06
      Simon Ser authored
      
      
      Mention that connectors need to be referenced manually if they are
      to be accessed after the iteration has progressed or ended.
      
      Signed-off-by: default avatarSimon Ser <contact@emersion.fr>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/KRoUI7OC9lRIvk3YzdGm6tcMVAVlG1fR78Ll7kTZZT4@cp3-web-051.plabs.ch
      33e1fc06
  5. Aug 01, 2021
  6. Jul 30, 2021
    • Desmond Cheong Zhi Xi's avatar
      drm: clean up unused kerneldoc in drm_lease.c · 676f11b5
      Desmond Cheong Zhi Xi authored
      
      
      The kerneldoc in drm_lease.c is unused because none of the functions
      are driver interfaces as the symbols are not exported.
      
      Since they aren't used and much of the existing comments don't provide
      any insights (e.g. they just repeat the function name or list out the
      function parameters), they should be removed to make them easier to
      maintain and to make useful info more obvious.
      
      As a note, many of the comments mention whether idr_mutex should be
      held, but these are mostly redundant in cases where the function
      contains lockdep assertions or grabs the mutex.
      
      To simplify review, here's the reasoning behind each update.
      
      drm_lease_owner:
      function name is self-descriptive
      
      _drm_find_lessee:
      function name is self-descriptive
      
      _drm_lease_held_master:
      function name and signature are self-descriptive
      
      _drm_has_leased:
      kerneldoc is summarized into a comment because the function name could
      be interpreted ambiguously (check if the object has been leased VS
      check if the master has a lease on the object)
      
      _drm_lease_held:
      Retain the idr_mutex comment because the function does not directly
      grab the mutex or use a lockdep assertion.
      Otherwise, the function name is self-descriptive.
      
      drm_lease_held:
      function name is self-descriptive
      
      drm_lease_filter_crtcs:
      Kerneldoc is summarized into a comment because the function name could
      be interpreted ambiguously (filter leases based on crtcs mask VS
      filter crtcs mask based on leases)
      
      drm_lease_create:
      Kerneldoc removed.
      Useful function details such as atomic leasing are retained.
      Errno interpretations are useful and retained.
      
      drm_lease_destroy:
      function name is self-descriptive. Additional information is also
      removed as they're already present as comments inside the function.
      
      _drm_lease_revoke:
      function name is self-descriptive
      
      drm_lease_revoke:
      function name is self-descriptive
      
      drm_mode_create_lease_ioctl:
      Kerneldoc removed, but useful function details retained.
      
      drm_mode_list_lessees_ioctl:
      function name is self-descriptive. Additional details restate what the
      code does.
      
      drm_mode_get_lease_ioctl:
      Function summary retained to clarify that it's the leased objects that
      are returned, not the lease structure.
      
      drm_mode_revoke_lease_ioctl:
      Kerneldoc removed, but useful function details retained.
      
      Signed-off-by: default avatarDesmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730051759.1570630-1-desmondcheongzx@gmail.com
      676f11b5
    • Dave Airlie's avatar
      Merge tag 'amd-drm-next-5.15-2021-07-29' of... · 04d505de
      Dave Airlie authored
      
      Merge tag 'amd-drm-next-5.15-2021-07-29' of https://gitlab.freedesktop.org/agd5f/linux into drm-next
      
      amd-drm-next-5.15-2021-07-29:
      
      amdgpu:
      - VCN/JPEG power down sequencing fixes
      - Various navi pcie link handling fixes
      - Clockgating fixes
      - Yellow Carp fixes
      - Beige Goby fixes
      - Misc code cleanups
      - S0ix fixes
      - SMU i2c bus rework
      - EEPROM handling rework
      - PSP ucode handling cleanup
      - SMU error handling rework
      - AMD HDMI freesync fixes
      - USB PD firmware update rework
      - MMIO based vram access rework
      - Misc display fixes
      - Backlight fixes
      - Add initial Cyan Skillfish support
      - Overclocking fixes suspend/resume
      
      amdkfd:
      - Sysfs leak fix
      - Add counters for vm faults and migration
      - GPUVM TLB optimizations
      
      radeon:
      - Misc fixes
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Alex Deucher <alexander.deucher@amd.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210730033455.3852-1-alexander.deucher@amd.com
      04d505de
    • Dave Airlie's avatar
      Merge tag 'drm-msm-next-2021-07-28' of https://gitlab.freedesktop.org/drm/msm into drm-next · f1b79965
      Dave Airlie authored
      
      
      An early pull for v5.15 (there'll be more coming in a week or two),
      consisting of the drm/scheduler conversion and a couple other small
      series that one was based one.  Mostly sending this now because IIUC
      danvet wanted it in drm-next so he could rebase on it.  (Daniel, if
      you disagree then speak up, and I'll instead include this in the main
      pull request once that is ready.)
      
      This also has a core patch to drop drm_gem_object_put_locked() now
      that the last use of it is removed.
      
      [airlied: add NULL to drm_sched_init]
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      From: Rob Clark <robdclark@gmail.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/CAF6AEGumRk7H88bqV=H9Fb1SM0zPBo5B7NsCU3jFFKBYxf5k+Q@mail.gmail.com
      f1b79965
    • Dave Airlie's avatar
      Merge tag 'drm-misc-next-2021-07-29' of git://anongit.freedesktop.org/drm/drm-misc into drm-next · cfeeb0b5
      Dave Airlie authored
      
      
      drm-misc-next for v5.15:
      
      UAPI Changes:
      - Add modifiers for arm fixed rate compression.
      
      Cross-subsystem Changes:
      - Assorted dt binding fixes.
      - Convert ssd1307fb to json-schema.
      - Update a lot of irc channels to point to OFTC, as everyone moved there.
      - Fix the same divide by zero for asilantfb, kyro, rivafb.
      
      Core Changes:
      - Document requirements for new atomic properties.
      - Add drm_gem_fb_(begin/end)_cpu_access helpers, and use them in some drivers.
      - Document drm_property_enum.value for bitfields.
      - Add explicit _NO_ for MIPI_DSI flags that disable features.
      - Assorted documentation fixes.
      - Update fb_damage handling, and move drm_plane_enable_fb_damage_clips to core.
      - Add logging and docs to RMFB ioctl.
      - Assorted small fixes to dp_mst, master handling.
      - Clarify drm lease usage.
      
      Driver Changes:
      - Assorted small fixes to panfrost, hibmc, bridge/nwl-dsi, rockchip, vc4.
      - More drm -> linux irq conversions.
      - Add support for some Logic Technologies and Multi-Inno panels.
      - Expose phy-functionality for drm/rockchip, to allow controlling from the media subsystem.
      - Add support for 2 AUO panels.
      - Add damage handling to ssd1307fb.
      - Improve FIFO handling on mxsfb.
      - Assorted small fixes to vmwgfx, and bump version to 2.19 for the new ioctls.
      - Improve sony acx424akp backlight handling.
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/a753221a-e23e-0dc4-7ca6-8c1b179738d0@linux.intel.com
      cfeeb0b5
    • Dave Airlie's avatar
      Merge tag 'du-next-20210728' of git://linuxtv.org/pinchartl/media into drm-next · 988dbd25
      Dave Airlie authored
      
      
      - R-Car DU shutdown fixes
      - R-Car DU conversion to bridge connector helper
      - Misc small fixes
      
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      
      From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/YQGHjOSOw2G4+A3x@pendragon.ideasonboard.com
      988dbd25