1. 03 Sep, 2024 1 commit
  2. 02 May, 2024 2 commits
  3. 15 Apr, 2024 1 commit
    • Jocelyn Falempe's avatar
      drm/panic: Add a drm panic handler · bf9fb17c
      Jocelyn Falempe authored
      
      This module displays a user friendly message when a kernel panic
      occurs. It currently doesn't contain any debug information,
      but that can be added later.
      
      v2
       * Use get_scanout_buffer() instead of the drm client API.
        (Thomas Zimmermann)
       * Add the panic reason to the panic message (Nerdopolis)
       * Add an exclamation mark (Nerdopolis)
      
      v3
       * Rework the drawing functions, to write the pixels line by line and
       to use the drm conversion helper to support other formats.
       (Thomas Zimmermann)
      
      v4
       * Use drm_fb_r1_to_32bit for fonts (Thomas Zimmermann)
       * Remove the default y to DRM_PANIC config option (Thomas Zimmermann)
       * Add foreground/background color config option
       * Fix the bottom lines not painted if the framebuffer height
         is not a multiple of the font height.
       * Automatically register the device to drm_panic, if the function
         get_scanout_buffer exists. (Thomas Zimmermann)
      
      v5
       * Change the drawing API, use drm_fb_blit_from_r1() to draw the font.
       * Also add drm_fb_fill() to fill area with background color.
       * Add draw_pixel_xy() API for drivers that can't provide a linear buffer.
       * Add a flush() callback for drivers that needs to synchronize the buffer.
       * Add a void *private field, so drivers can pass private data to
         draw_pixel_xy() and flush().
      
      v6
       * Fix sparse warning for panic_msg and logo.
      
      v7
       * Add select DRM_KMS_HELPER for the color conversion functions.
      
      v8
       * Register directly each plane to the panic notifier (Sima)
       * Add raw_spinlock to properly handle concurrency (Sima)
       * Register plane instead of device, to avoid looping through plane
         list, and simplify code.
       * Replace get_scanout_buffer() logic with drm_panic_set_buffer()
        (Thomas Zimmermann)
       * Removed the draw_pixel_xy() API, will see later if it can be added back.
      
      v9
       * Revert to using get_scanout_buffer() (Sima)
       * Move get_scanout_buffer() and panic_flush() to the plane helper
         functions (Thomas Zimmermann)
       * Register all planes with get_scanout_buffer() to the panic notifier
       * Use drm_panic_lock() to protect against race (Sima)
      
      v10
       * Move blit and fill functions back in drm_panic (Thomas Zimmermann).
       * Simplify the text drawing functions.
       * Use kmsg_dumper instead of panic_notifier (Sima).
      
      v12
       * Use array for map and pitch in struct drm_scanout_buffer
         to support multi-planar format later. (Thomas Zimmermann)
       * Better indent struct drm_scanout_buffer declaration. (Thomas Zimmermann)
      Signed-off-by: default avatarJocelyn Falempe <jfalempe@redhat.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20240409163432.352518-3-jfalempe@redhat.com
      
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      bf9fb17c
  4. 05 Mar, 2024 2 commits
  5. 01 Mar, 2024 1 commit
  6. 12 Dec, 2023 1 commit
  7. 06 Dec, 2023 1 commit
  8. 23 Nov, 2023 1 commit
  9. 09 Nov, 2023 1 commit
  10. 25 Sep, 2023 2 commits
  11. 20 Jul, 2023 1 commit
    • Danilo Krummrich's avatar
      drm: manager to keep track of GPUs VA mappings · e6303f32
      Danilo Krummrich authored
      
      Add infrastructure to keep track of GPU virtual address (VA) mappings
      with a decicated VA space manager implementation.
      
      New UAPIs, motivated by Vulkan sparse memory bindings graphics drivers
      start implementing, allow userspace applications to request multiple and
      arbitrary GPU VA mappings of buffer objects. The DRM GPU VA manager is
      intended to serve the following purposes in this context.
      
      1) Provide infrastructure to track GPU VA allocations and mappings,
         using an interval tree (RB-tree).
      
      2) Generically connect GPU VA mappings to their backing buffers, in
         particular DRM GEM objects.
      
      3) Provide a common implementation to perform more complex mapping
         operations on the GPU VA space. In particular splitting and merging
         of GPU VA mappings, e.g. for intersecting mapping requests or partial
         unmap requests.
      Acked-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
      Acked-by: default avatarMatthew Brost <matthew.brost@intel.com>
      Reviewed-by: Boris Brezillon...
      e6303f32
  12. 12 Jul, 2023 1 commit
  13. 04 Jul, 2023 1 commit
    • Sui Jingfeng's avatar
      drm: Add kms driver for loongson display controller · f39db26c
      Sui Jingfeng authored
      
      Loongson display controller IP has been integrated in both Loongson north
      bridge chipset (ls7a1000/ls7a2000) and Loongson SoCs (ls2k1000/ls2k2000).
      It has even been included in Loongson's BMC products. It has two display
      pipes, and each display pipe supports a primary plane and a cursor plane.
      
      For the DC in the LS7a1000, each display pipe has a DVO output interface,
      which is able to support 1920x1080@60Hz. For the DC in the LS7A2000, each
      display pipe is equipped with a built-in HDMI encoder, which is compliant
      with the HDMI 1.4 specification. The first display pipe is also equipped
      with a transparent VGA encoder, which is parallel with the HDMI encoder.
      To get a decent performance for writing framebuffer data to the VRAM, the
      write combine support should be enabled.
      
      v1 -> v2:
       1) Use hpd status reg when polling for ls7a2000.
       2) Fix all warnings that emerged when compiling with W=1.
      
      v2 -> v3:
       1) Add COMPILE_TEST to Kconfig and make the driver off by default
       2) Alphabetical sorting headers (Thomas)
       3) Untangle register access functions as much as possible (Thomas)
       4) Switch to TTM-based memory manager (Thomas)
       5) Add the chip ID detection function which can be used to distinguish
          chip models
       6) Revise the built-in HDMI phy driver, nearly all main stream mode below
          4K@30Hz is tested, and this driver supports clone(mirror) display mode
          and extend(joint) display mode.
      
      v3 -> v4:
       1) Quickly fix a small mistake.
      
      v4 -> v5:
       1) Add per display pipe debugfs support to the builtin HDMI encoder.
      
      v5 -> v6:
       1) Remove stray code which didn't get used, say lsdc_of_get_reserved_ram
       2) Fix all typos I could found, make sentences and code more readable
       3) Untangle lsdc_hdmi*_connector_detect() function according to the pipe
       4) Rename this driver as loongson.
      
      v6 -> v7:
      1) Add prime support for buffer self-sharing, sharing buffer with
         drm/etnaviv is also tested and it works with limitations.
      2) Implement buffer object tracking with list_head.
      3) Add S3(sleep to RAM) support
      4) Rewrite lsdc_bo_move since TTM core stop allocating resources
          during BO creation. Patch V1 ~ V6 of this series no longer work.
          Thus, we send V7.
      
      v7 -> v8:
       1) Zero a compile warning on a 32-bit platform, compile with W=1
       2) Revise lsdc_bo_gpu_offset() and make minor cleanups.
       3) Pageflip tested on the virtual terminal with the following commands:
      
          modetest -M loongson -s 32:1920x1080 -v
          modetest -M loongson -s 34:1920x1080 -v -F tiles
      
         It works like a charm, when running the pageflip test with dual screens
         configuration, another two additional BOs were created by the modetest,
         VRAM usage up to 40+ MB, well we have at least 64MB, still enough.
      
         # cat bos
      
             bo[0000]: size:     8112kB VRAM
             bo[0001]: size:       16kB VRAM
             bo[0002]: size:       16kB VRAM
             bo[0003]: size:    16208kB VRAM
             bo[0004]: size:     8112kB VRAM
             bo[0005]: size:     8112kB VRAM
      
      v8 -> v9:
       1) Select I2C and I2C_ALGOBIT in Kconfig, should depend on MMU.
       2) Using pci_get_domain_bus_and_slot to get the GPU device.
      
      v9 -> v10:
       1) Revise lsdc_drm_freeze() to implement S3 correctly. We realized that
          the pinned BO could not be moved, the VRAM lost power when sleeping
          to RAM. Thus, the data in the buffer who is pinned in VRAM will get
          lost when resumed. Yet it's not a big problem because this driver
          relies on the CPU to update the front framebuffer. We can see the
          garbage data when resume from S3, but the screen will show the right
          image as I move the cursor. This is due to the CPU repaint. v10 of
          this patch makes S3 perfect by unpin all of the BOs in VRAM, evict
          them all to system RAM in lsdc_drm_freeze().
      
      v10 -> v11:
       1) On a double-screen case, The buffer object backing the single giant
          framebuffer is referenced by two GEM objects; hence, it will be
          pinned at least twice by prepare_fb() function. This causes its pin
          count > 1. V10 of this patch only unpins VRAM BOs once when suspend,
          which is not correct on double-screen case. V11 of this patch unpin
          the BOs until its pin count reaches zero when suspend. Then, we make
          the S3 support complete finally. With v11, I can't see any garbage
          data when resume.
      
       2) Fix vblank wait timeout when disable CRTC.
       3) Test against IGT, at least fbdev test and kms_flip test passed.
       4) Rewrite pixel PLL update function, magic numbers eliminated (Emil)
       5) Drop a few common hardware features description in lsdc_desc (Emil)
       6) Drop lsdc_mode_config_mode_valid(), instead add restrictions in dumb
          create function. (Emil)
       7) Untangle the ls7a1000 case and ls7a2000 case completely (Thomas)
      
      v11 -> v12:
       none
      
      v12 -> v13:
       1) Add benchmarks to figure out the bandwidth of the hardware platform.
          Usage:
          # cd /sys/kernel/debug/dri/0/
          # cat benchmark
      
       2) VRAM is filled with garbage data if uninitialized, add a buffer
          clearing procedure (lsdc_bo_clear), clear the BO on creation time.
       3) Update copyrights and adjust coding style (Huacai)
      
      v13 -> v14:
       1) Trying to add async update support for cursor plane.
      
      v14 -> v15:
       1) Add lsdc_vga_set_decode() funciton, which allow us remove multi-video
          cards workaround, now it allow drm/loongson, drm/amdgpu, drm/etnaviv
          co-exist in the system, more is also possible (Emil and Xuerui)
       2) Fix typos and grammar mistakes as much as possible (Xuerui)
       3) Unify copyrights as GPL-2.0+ (Xuerui)
       4) Fix a bug introduce since V13, TTM may import BO from other drivers,
          we shouldn't clear it on such a case.
      
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: David Airlie <airlied@gmail.com>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: "Christian König" <christian.koenig@amd.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Emil Velikov <emil.l.velikov@gmail.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: loongson-kernel@lists.loongnix.cn
      Tested-by: default avatarLiu Peibao <liupeibao@loongson.cn>
      Tested-by: default avatarLi Yi  <liyi@loongson.cn>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Signed-off-by: default avatarSui Jingfeng <suijingfeng@loongson.cn>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230615143613.1236245-2-15330273260@189.cn
      f39db26c
  14. 09 Jun, 2023 1 commit
  15. 29 May, 2023 1 commit
  16. 14 Mar, 2023 1 commit
  17. 01 Mar, 2023 1 commit
  18. 13 Jan, 2023 7 commits
  19. 08 Dec, 2022 1 commit
  20. 22 Nov, 2022 1 commit
    • Oded Gabbay's avatar
      drivers/accel: define kconfig and register a new major · 8bf48897
      Oded Gabbay authored
      
      Add a new Kconfig for the accel subsystem. The Kconfig currently
      contains only the basic CONFIG_DRM_ACCEL option that will be used to
      decide whether to compile the accel registration code. Therefore, the
      kconfig option is defined as bool.
      
      The accel code will be compiled as part of drm.ko and will be called
      directly from the DRM core code. The reason we compile it as part of
      drm.ko and not as a separate module is because of cyclic dependency
      between drm.ko and the separate module (if it would have existed).
      This is due to the fact that DRM core code calls accel functions and
      vice-versa.
      
      The accelerator devices will be exposed to the user space with a new,
      dedicated major number - 261.
      
      The accel init function registers the new major number as a char device
      and create corresponding sysfs and debugfs root entries, similar to
      what is done in DRM init function.
      
      I added a new header called drm_accel.h to include/drm/, that will hold
      the prototypes of the drm_accel.c functions. In case CONFIG_DRM_ACCEL
      is set to 'N', that header will contain empty inline implementations of
      those functions, to allow DRM core code to compile successfully
      without dependency on CONFIG_DRM_ACCEL.
      
      I Updated the MAINTAINERS file accordingly with the newly added folder
      and I have taken the liberty to appropriate the dri-devel mailing list
      and the dri-devel IRC channel for the accel subsystem.
      Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: default avatarJeffrey Hugo <quic_jhugo@quicinc.com>
      Reviewed-by: default avatarDave Airlie <airlied@redhat.com>
      Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
      Acked-by: default avatarJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
      Tested-by: default avatarJacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
      Reviewed-by: default avatarMelissa Wen <mwen@igalia.com>
      8bf48897
  21. 16 Nov, 2022 1 commit
  22. 05 Nov, 2022 1 commit
  23. 12 Oct, 2022 1 commit
  24. 24 Sep, 2022 1 commit
  25. 03 Aug, 2022 2 commits
    • Danilo Krummrich's avatar
      drm/gem: rename GEM CMA helpers to GEM DMA helpers · 4a83c26a
      Danilo Krummrich authored
      Rename "GEM CMA" helpers to "GEM DMA" helpers - considering the
      hierarchy of APIs (mm/cma -> dma -> gem dma) calling them "GEM
      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}*)(GEM)_CMA_(${REGEX_SYM_UPPER}*)"
      	REGEX_GREP_LOWER="(${REGEX_SYM_LOWER}*)(gem)_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
      
      	# Rename all 'cma_obj's to 'dma_obj'.
      	for ff in $(grep -RiHl "cma_obj" $DIRS)
      	do
      		sed -i -E "s/cma_obj/dma_obj/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 "GEM CMA", but not "FB CMA".
      
      Also drivers/gpu/drm/Makefile was fixed up manually after renaming
      drm_gem_cma_helper.c to drm_gem_dma_helper.c.
      
      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-4-dakr@redhat.com
      4a83c26a
    • 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
  26. 11 Jul, 2022 1 commit
  27. 28 Jun, 2022 1 commit
  28. 27 Jun, 2022 1 commit
  29. 09 Jun, 2022 1 commit
    • Paul Kocialkowski's avatar
      drm: Add support for the LogiCVC display controller · efeeaefe
      Paul Kocialkowski authored
      
      Introduces a driver for the LogiCVC display controller, a programmable
      logic controller optimized for use in Xilinx Zynq-7000 SoCs and other
      Xilinx FPGAs. The controller is mostly configured at logic synthesis
      time so only a subset of configuration is left for the driver to
      handle.
      
      The following features are implemented and tested:
      - LVDS 4-bit interface;
      - RGB565 pixel formats;
      - Multiple layers and hardware composition;
      - Layer-wide alpha mode;
      
      The following features are implemented but untested:
      - Other RGB pixel formats;
      - Layer framebuffer configuration for version 4;
      - Lowest-layer used as background color;
      - Per-pixel alpha mode.
      
      The following features are not implemented:
      - YUV pixel formats;
      - DVI, LVDS 3-bit, ITU656 and camera link interfaces;
      - External parallel input for layer;
      - Color-keying;
      - LUT-based alpha modes.
      
      Additional implementation-specific notes:
      - Panels are only enabled after the first page flip to avoid flashing a
        white screen.
      - Depth used in context of the LogiCVC driver only counts color components
        to match the definition of the synthesis parameters.
      
      Support is implemented for both version 3 and 4 of the controller.
      
      With version 3, framebuffers are stored in a dedicated contiguous
      memory area, with a base address hardcoded for each layer. This requires
      using a dedicated CMA pool registered at the base address and tweaking a
      few offset-related registers to try to use any buffer allocated from
      the pool. This is done on a best-effort basis to have the hardware cope
      with the DRM framebuffer allocation model and there is no guarantee
      that each buffer allocated by GEM CMA can be used for any layer.
      In particular, buffers allocated below the base address for a layer are
      guaranteed not to be configurable for that layer. See the implementation of
      logicvc_layer_buffer_find_setup for specifics.
      
      Version 4 allows configuring each buffer address directly, which
      guarantees that any buffer can be configured.
      Signed-off-by: default avatarPaul Kocialkowski <paul.kocialkowski@bootlin.com>
      Reviewed-by: default avatarMaxime Ripard <mripard@kernel.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220520141555.1429041-2-paul.kocialkowski@bootlin.com
      efeeaefe
  30. 25 Apr, 2022 1 commit