Skip to content
  1. Jul 22, 2021
    • Noralf Trønnes's avatar
      drm/gud: Add Raspberry Pi Pico ID · 804206b5
      Noralf Trønnes authored
      [ drm-misc commit b3f4ef66 ]
      
      Add VID/PID for the Raspberry Pi Pico implementation.
      Source: https://github.com/notro/gud-pico
      
      
      
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Reviewed-by: default avatarPeter Stuge <peter@stuge.se>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210703141321.35494-1-noralf@tronnes.org
      804206b5
    • Noralf Trønnes's avatar
      drm/gud: Use scatter-gather USB bulk transfer · 13b0661e
      Noralf Trønnes authored
      [ drm-misc commit 2eecd93b
      
       ]
      
      There'a limit to how big a kmalloc buffer can be, and as memory gets
      fragmented it becomes more difficult to get big buffers. The downside of
      smaller buffers is that the driver has to split the transfer up which
      hampers performance. Compression might also take a hit because of the
      splitting.
      
      Solve this by allocating the transfer buffer using vmalloc and create a
      SG table to be passed on to the USB subsystem. vmalloc_32() is used to
      avoid DMA bounce buffers on USB controllers that can only access 32-bit
      addresses.
      
      This also solves the problem that split transfers can give host side
      tearing since flushing is decoupled from rendering.
      
      usb_sg_wait() doesn't have timeout handling builtin, so it is wrapped in
      a timer like 4 out of 6 users in the kernel have done.
      
      v2:
      - Use DIV_ROUND_UP (Linus)
      - Add timeout note to the commit log (Linus)
      - Expand note about upper buffer limit (Linus)
      - Change var name s/timer/ctx/ in gud_usb_bulk_timeout()
      
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210701170748.58009-2-noralf@tronnes.org
      13b0661e
    • Noralf Trønnes's avatar
      drm/gud: Free buffers on device removal · 6370efd2
      Noralf Trønnes authored
      [ drm-misc commit f8ac863b
      
       ]
      
      Free transfer and compression buffers on device removal instead of at
      DRM device removal time. This ensures that the usual 2x8MB buffers are
      released when the device is unplugged and not kept around should
      userspace keep the DRM device fd open.
      
      At least Ubuntu 20.04 doesn't release the DRM device on unplug.
      
      The damage_lock mutex is not destroyed because it is used outside the
      drm_dev_enter/exit block in gud_pipe_update(). AFAICT it's possible for
      an open fbdev descriptor to trigger a commit after the USB device is gone.
      
      v2: Don't destroy damage_lock
      
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210701170748.58009-1-noralf@tronnes.org
      6370efd2
    • Bernard Zhao's avatar
      drm/gud: cleanup coding style a bit · ad5cf5e1
      Bernard Zhao authored
      [ Upstream commit 6dd7efc4
      
       ]
      
      Fix coccicheck warning:
      drivers/gpu/drm/gud/gud_internal.h:89:2-3: Unneeded semicolon
      drivers/gpu/drm/gud/gud_internal.h:107:2-3: Unneeded semicolon
      
      Signed-off-by: default avatarBernard Zhao <bernard@vivo.com>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210402085523.76928-1-bernard@vivo.com
      ad5cf5e1
    • kernel test robot's avatar
      drm/gud: Remove unneeded semicolon · ea15c606
      kernel test robot authored
      [ Upstream commit 166633c8 ]
      
      drivers/gpu/drm/gud/gud_connector.c:658:2-3: Unneeded semicolon
      drivers/gpu/drm/gud/gud_connector.c:186:2-3: Unneeded semicolon
      drivers/gpu/drm/gud/gud_drv.c:511:3-4: Unneeded semicolon
      drivers/gpu/drm/gud/gud_pipe.c:127:4-5: Unneeded semicolon
      
       Remove unneeded semicolon.
      
      Generated by: scripts/coccinelle/misc/semicolon.cocci
      
      Fixes: 40e1a70b
      
       ("drm: Add GUD USB Display driver")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarkernel test robot <lkp@intel.com>
      [fix subject and squash 3 per file patches]
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210322174434.58849-2-noralf@tronnes.org
      ea15c606
    • kernel test robot's avatar
      drm/gud: fix sizeof use · a88ee695
      kernel test robot authored
      [ Upstream commit b91fbdc1 ]
      
      drivers/gpu/drm/gud/gud_connector.c:710:37-43: ERROR: application of sizeof to pointer
      
       sizeof when applied to a pointer typed expression gives the size of
       the pointer
      
      Generated by: scripts/coccinelle/misc/noderef.cocci
      
      Fixes: 40e1a70b
      
       ("drm: Add GUD USB Display driver")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarkernel test robot <lkp@intel.com>
      [fix subject]
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210322174434.58849-1-noralf@tronnes.org
      a88ee695
    • Noralf Trønnes's avatar
      drm: Add GUD USB Display driver · 5bd26a36
      Noralf Trønnes authored
      [ Upstream commit 40e1a70b
      
       ]
      
      This adds a USB display driver with the intention that it can be
      used with future USB interfaced low end displays/adapters. The Linux
      gadget device driver will serve as the canonical device implementation.
      
      The following DRM properties are supported:
      - Plane rotation
      - Connector TV properties
      
      There is also support for backlight brightness exposed as a backlight
      device.
      
      Display modes can be made available to the host driver either as DRM
      display modes or through EDID. If both are present, EDID is just passed
      on to userspace.
      
      Performance is preferred over color depth, so if the device supports
      RGB565, DRM_CAP_DUMB_PREFERRED_DEPTH will return 16.
      
      If the device transfer buffer can't fit an uncompressed framebuffer
      update, the update is split up into parts that do fit.
      
      Optimal user experience is achieved by providing damage reports either by
      setting FB_DAMAGE_CLIPS on pageflips or calling DRM_IOCTL_MODE_DIRTYFB.
      
      LZ4 compression is used if the device supports it.
      
      The driver supports a one bit monochrome transfer format: R1. This is not
      implemented in the gadget driver. It is added in preparation for future
      monochrome e-ink displays.
      
      The driver is MIT licensed to smooth the path for any BSD port of the
      driver.
      
      v2:
      - Use devm_drm_dev_alloc() and drmm_mode_config_init()
      - drm_fbdev_generic_setup: Use preferred_bpp=0, 16 was a copy paste error
      - The drm_backlight_helper is dropped, copy in the code
      - Support protocol version backwards compatibility for device
      
      v3:
      - Use donated Openmoko USB pid
      - Use direct compression from framebuffer when pitch matches, not only on
        full frames, so split updates can benefit
      - Use __le16 in struct gud_drm_req_get_connector_status
      - Set edid property when the device only provides edid
      - Clear compression fields in struct gud_drm_req_set_buffer
      - Fix protocol version negotiation
      - Remove mode->vrefresh, it's calculated
      
      v4:
      - Drop the status req polling which was a workaround for something that
        turned out to be a dwc2 udc driver problem
      - Add a flag for the Linux gadget to require a status request on
        SET operations. Other devices will only get status req on STALL errors
      - Use protocol specific error codes (Peter)
      - Add a flag for devices that want to receive the entire framebuffer on
        each flush (Lubomir)
      - Retry a failed framebuffer flush
      - If mode has changed wait for worker and clear pending damage before
        queuing up new damage, fb width/height might have changed
      - Increase error counter on bulk transfer failures
      - Use DRM_MODE_CONNECTOR_USB
      - Handle R1 kmalloc error (Peter)
      - Don't try and replicate the USB get descriptor request standard for the
        display descriptor (Peter)
      - Make max_buffer_size optional (Peter), drop the pow2 requirement since
        it's not necessary anymore.
      - Don't pre-alloc a control request buffer, it was only 4k
      - Let gud.h describe the whole protocol explicitly and don't let DRM
        leak into it (Peter)
      - Drop display mode .hskew and .vscan from the protocol
      - Shorten names: s/GUD_DRM_/GUD_/ s/gud_drm_/gud_/ (Peter)
      - Fix gud_pipe_check() connector picking when switching connector
      - Drop gud_drm_driver_gem_create_object() cached is default now
      - Retrieve USB device from struct drm_device.dev instead of keeping a
        pointer
      - Honour fb->offsets[0]
      - Fix mode fetching when connector status is forced
      - Check EDID length reported by the device
      - Use drm_do_get_edid() so userspace can overrride EDID
      - Set epoch counter to signal connector status change
      - gud_drm_driver can be const now
      
      v5:
      - GUD_DRM_FORMAT_R1: Use non-human ascii values (Daniel)
      - Change name to: GUD USB Display (Thomas, Simon)
      - Change one __u32 -> __le32 in protocol header
      - Always log fb flush errors, unless the previous one failed
      - Run backlight update in a worker to avoid upsetting lockdep (Daniel)
      - Drop backlight_ops.get_brightness, there's no readback from the device
        so it doesn't really add anything.
      - Set dma mask, needed by dma-buf importers
      
      v6:
      - Use obj-y in Makefile (Peter)
      - Fix missing le32_to_cpu() when using GUD_DISPLAY_MAGIC (Peter)
      - Set initial brightness on backlight device
      
      v7:
      - LZ4_compress_default() can return zero, check for that
      - Fix memory leak in gud_pipe_check() error path (Peter)
      - Improve debug and error messages (Peter)
      - Don't pass length in protocol structs (Peter)
      - Pass USB interface to gud_usb_control_msg() et al. (Peter)
      - Improve gud_connector_fill_properties() (Peter)
      - Add GUD_PIXEL_FORMAT_RGB111 (Peter)
      - Remove GUD_REQ_SET_VERSION (Peter)
      - Fix DRM_IOCTL_MODE_OBJ_SETPROPERTY and the rotation property
      - Fix dma-buf import (Thomas)
      
      v8:
      - Forgot to filter RGB111 from reaching userspace
      - Handle a device that only returns unknown device properties (Peter)
      - s/GUD_PIXEL_FORMAT_RGB111/GUD_PIXEL_FORMAT_XRGB1111/ (Peter)
      - Fix R1 and XRGB1111 format conversion
      - Add FIXME about Big Endian being broken (Peter, Ilia)
      
      Cc: Lubomir Rintel <lkundrak@v3.sk>
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Reviewed-by: default avatarPeter Stuge <peter@stuge.se>
      Tested-by: default avatarPeter Stuge <peter@stuge.se>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210313112545.37527-4-noralf@tronnes.org
      
      
      [ backport changes:
        - Remove include drm_gem_atomic_helper.h
        - s/drm_gem_simple_display_pipe_prepare_fb/drm_gem_fb_simple_display_pipe_prepare_fb/
        - Remove const from gud_drm_driver
        - Change drm_gem_shmem_{vmap,vunmap} signatures
        - Add gud_gem_create_object() to get cached memory mapping.
      ]
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      5bd26a36
    • Noralf Trønnes's avatar
      drm/uapi: Add USB connector type · a4e30fff
      Noralf Trønnes authored
      [ Upstream commit 757e2671
      
       ]
      
      Add a connector type for USB connected display panels.
      
      Some examples of what current userspace will name the connector:
      - Weston: "UNNAMED-%d"
      - Mutter: "Unknown20-%d"
      - X: "Unknown20-%d"
      
      v2:
      - Update drm_connector_enum_list
      - Add examples to commit message
      
      Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarNoralf Trønnes <noralf@tronnes.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210313112545.37527-2-noralf@tronnes.org
      a4e30fff
  2. Jul 20, 2021
  3. Jul 19, 2021
    • Phil Elwell's avatar
      ARM: dts: bcm2711: Tidy the HDMI I2C aliases · 55f43ec5
      Phil Elwell authored
      
      
      The bcm2711 vc3-kms-v3d overlay enables the I2C instances used for
      EDID data. Give these distinct I2C interface numbers (20 & 21) to
      clearly separate them from other regular I2C blocks (1, 3-6) and the
      mux on I2C0 (10+).
      
      The 2711 DTS tree no longer includes i2c2, so the explicit deletion can
      be removed.
      
      Signed-off-by: default avatarPhil Elwell <phil@raspberrypi.com>
      55f43ec5
  4. Jul 16, 2021
  5. Jul 15, 2021
    • Dom Cobley's avatar
    • Mateusz Kwiatkowski's avatar
      drm/vc4: Refactor mode checking logic · f6657869
      Mateusz Kwiatkowski authored
      
      
      Replace drm_encoder_helper_funcs::atomic_check with
      drm_connector_helper_funcs::atomic_check - the former is not called
      during drm_mode_obj_set_property_ioctl(). Set crtc_state->mode_changed
      if TV norm changes even without explicit mode change. This makes things
      like "xrandr --output Composite-1 --set mode PAL-M" work properly.
      
      Signed-off-by: default avatarMateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
      f6657869
    • Mateusz Kwiatkowski's avatar
      drm/vc4: Allow setting the TV norm via module parameter · 2d2e7e5e
      Mateusz Kwiatkowski authored
      
      
      Similar to the ch7006 and nouveau drivers, introduce a "tv_mode" module
      parameter that allow setting the TV norm by specifying vc4.tv_norm= on
      the kernel command line.
      
      If that is not specified, try inferring one of the most popular norms
      (PAL or NTSC) from the video mode specified on the command line. On
      Raspberry Pis, this causes the most common cases of the sdtv_mode
      setting in config.txt to be respected.
      
      Signed-off-by: default avatarMateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
      2d2e7e5e
    • Mateusz Kwiatkowski's avatar
      drm/vc4: Add support for more analog TV standards · 7da41d8a
      Mateusz Kwiatkowski authored
      
      
      Add support for the following composite output modes (all of them are
      somewhat more obscure than the previously defined ones):
      
      - NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to
        4.43361875 MHz (the PAL subcarrier frequency). Never used for
        broadcasting, but sometimes used as a hack to play NTSC content in PAL
        regions (e.g. on VCRs).
      - PAL_N - PAL with alternative chroma subcarrier frequency,
        3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay
        and Uruguay to fit 576i50 with colour in 6 MHz channel raster.
      - PAL60 - 480i60 signal with PAL-style color at normal European PAL
        frequency. Another non-standard, non-broadcast mode, used in similar
        contexts as NTSC_443. Some displays support one but not the other.
      - SECAM - French frequency-modulated analog color standard; also have
        been broadcast in Eastern Europe and various parts of Africa and Asia.
        Uses the same 576i50 timings as PAL.
      
      Also added some comments explaining color subcarrier frequency
      registers.
      
      Signed-off-by: default avatarMateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
      7da41d8a
    • Mateusz Kwiatkowski's avatar
      drm/vc4: Fix definition of PAL-M mode · 60213115
      Mateusz Kwiatkowski authored
      
      
      PAL-M is a Brazilian analog TV standard that uses a PAL-style chroma
      subcarrier at 3.575611[888111] MHz on top of 525-line (480i60) timings.
      This commit makes the driver actually use the proper VEC preset for this
      mode instead of just changing PAL subcarrier frequency.
      
      DRM mode constant names have also been changed, as they no longer
      correspond to the "NTSC" or "PAL" terms.
      
      Signed-off-by: default avatarMateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
      60213115
    • Mateusz Kwiatkowski's avatar
      drm/vc4: Refactor VEC TV mode setting · cb13145e
      Mateusz Kwiatkowski authored
      
      
      Change the mode_set function pointer logic to declarative config0,
      config1 and custom_freq fields, to make TV mode setting logic more
      concise and uniform.
      
      Additionally, remove the superfluous tv_mode field, which was redundant
      with the mode field in struct drm_tv_connector_state.
      
      Signed-off-by: default avatarMateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
      cb13145e
    • Mateusz Kwiatkowski's avatar
      drm/vc4: Fix timings for VEC modes · 16c6da0f
      Mateusz Kwiatkowski authored
      
      
      This commit fixes vertical timings of the VEC (composite output) modes
      to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R
      standards.
      
      Previous timings were actually defined as 502 and 601 lines, resulting
      in non-standard 62.69 Hz and 52 Hz signals being generated,
      respectively.
      
      Changes to vc4_crtc.c have also been made, to make the PixelValve
      vertical timings accurately correspond to the DRM modeline in interlaced
      modes. The resulting VERTA/VERTB register values have been verified
      against the reference values set by the Raspberry Pi firmware.
      
      Signed-off-by: default avatarMateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
      16c6da0f
  6. Jul 14, 2021