aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tiny (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-08-08drm/simpledrm: Use offset-adjusted shadow-plane mappingThomas Zimmermann1-2/+2
For framebuffers with non-zero offset fields, shadow-plane helpers provide a pointer to the first byte of the contained data. Use it in simpledrm. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210803125928.27780-9-tzimmermann@suse.de
2021-08-08drm/gm12u320: Use offset-adjusted shadow-plane mappingsThomas Zimmermann1-2/+2
For framebuffers with non-zero offset fields, shadow-plane helpers provide a pointer to the first byte of the contained data. Use it in gm12u320. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210803125928.27780-8-tzimmermann@suse.de
2021-08-08drm/cirrus: Use offset-adjusted shadow-plane mappingsThomas Zimmermann1-2/+2
For framebuffers with non-zero offset fields, shadow-plane helpers provide a pointer to the first byte of the contained data. Use it in cirrus. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210803125928.27780-7-tzimmermann@suse.de
2021-07-23drm/st7586: Use framebuffer dma-buf helpersThomas Zimmermann1-12/+6
Replace dma_buf_begin_cpu_access() with drm_gem_fb_begin_cpu_access(); same for _end_cpu_access(). Remove some boiler-plate code. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: David Lechner <david@lechnology.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210716140801.1215-8-tzimmermann@suse.de
2021-07-23drm/repaper: Use framebuffer dma-buf helpersThomas Zimmermann1-14/+4
Replace dma_buf_begin_cpu_access() with drm_gem_fb_begin_cpu_access(); same for _end_cpu_access(). Remove some boiler-plate code. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210716140801.1215-7-tzimmermann@suse.de
2021-07-23drm/gm12u320: Use framebuffer dma-buf helpersThomas Zimmermann1-14/+5
Replace dma_buf_begin_cpu_access() with drm_gem_fb_begin_cpu_access(); same for _end_cpu_access(). Remove some boiler-plate code. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210716140801.1215-6-tzimmermann@suse.de
2021-07-21drivers/firmware: consolidate EFI framebuffer setup for all archesJavier Martinez Canillas1-2/+2
The register_gop_device() function registers an "efi-framebuffer" platform device to match against the efifb driver, to have an early framebuffer for EFI platforms. But there is already support to do exactly the same by the Generic System Framebuffers (sysfb) driver. This used to be only for X86 but it has been moved to drivers/firmware and could be reused by other architectures. Also, besides supporting registering an "efi-framebuffer", this driver can register a "simple-framebuffer" allowing to use the siple{fb,drm} drivers on non-X86 EFI platforms. For example, on aarch64 these drivers can only be used with DT and doesn't have code to register a "simple-frambuffer" platform device when booting with EFI. For these reasons, let's remove the register_gop_device() duplicated code and instead move the platform specific logic that's there to sysfb driver. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Acked-by: Borislav Petkov <bp@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210625131359.1804394-1-javierm@redhat.com
2021-07-20drm/bochs: Fix missing pci_disable_device() on error in bochs_pci_probe()Yang Yingliang1-1/+1
Replace pci_enable_device() with pcim_enable_device(), pci_disable_device() will be called in release automatically. v3: reformat commit message update for move to tiny/ v2: use pcim_enable_device() Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reported-by: Hulk Robot <hulkci@huawei.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210715132845.2415619-1-yangyingliang@huawei.com
2021-07-05drm/bochs: Use managed initialization for GEM VRAM helpersThomas Zimmermann1-38/+5
Convert to managed GEM VRAM initialization and switch bochs to full autocleanup. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210702075434.27677-3-tzimmermann@suse.de
2021-07-05drm/bochs: Move to tiny/Thomas Zimmermann3-0/+780
The bochs driver is only ~600 lines of code. Putting it into tiny/ cleans up the DRM directory slightly. Some style problems were fixed and unneeded include statements were removed. No functional changes. v2: * make bochs_mode_funcs static (Daniel, kernel test robot) * rebase onto aperture API changes Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20210702075434.27677-2-tzimmermann@suse.de
2021-07-01drm/aperture: Pass DRM driver structure instead of driver nameThomas Zimmermann1-1/+1
Print the name of the DRM driver when taking over fbdev devices. Makes the output to dmesg more consistent. Note that the driver name is only used for printing a string to the kernel log. No UAPI is affected by this change. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Nirmoy Das <nirmoy.das@amd.com> Acked-by: Chen-Yu Tsai <wens@csie.org> # sun4i Acked-by: Neil Armstrong <narmstrong@baylibre.com> # meson Link: https://patchwork.freedesktop.org/patch/msgid/20210629135833.22679-1-tzimmermann@suse.de
2021-06-24drm/tiny: drm_gem_simple_display_pipe_prepare_fb is the defaultDaniel Vetter8-8/+0
Goes through all the drivers and deletes the default hook since it's the default now. Acked-by: David Lechner <david@lechnology.com> Acked-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Joel Stanley <joel@jms.id.au> Cc: Andrew Jeffery <andrew@aj.id.au> Cc: "Noralf Trønnes" <noralf@tronnes.org> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Emma Anholt <emma@anholt.net> Cc: David Lechner <david@lechnology.com> Cc: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Maxime Ripard <mripard@kernel.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: linux-aspeed@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org Cc: xen-devel@lists.xenproject.org Link: https://patchwork.freedesktop.org/patch/msgid/20210622165511.3169559-14-daniel.vetter@ffwll.ch
2021-05-27drm/simpledrm: Use %p4cc to print 4CC formatThomas Zimmermann1-4/+2
Replace use of struct drm_format_name_buf with %p4cc for printing 4CC formats. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210516121315.30321-3-tzimmermann@suse.de
2021-05-15drm: simpledrm: fix a potential NULL dereferenceDan Carpenter1-2/+7
The drm_format_info() function returns NULL if the format is unsupported, but the simplefb_get_validated_format() is expected to return error pointers. If we propagate the NULL return then it will lead to a NULL dereference in the callers. Swap the NULL and trade it in for an ERR_PTR(-EINVAL). Fixes: 11e8f5fd223b ("drm: Add simpledrm driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/YJ+aC47XX58ICXax@mwanda
2021-05-13drm: simpledrm: Fix use after free issuesColin Ian King1-0/+2
There are two occurrances where objects are being free'd via a put call and yet they are being referenced after this. Fix these by adding in the missing continue statement so that the put on the end of the loop is skipped over. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Addresses-Coverity: ("Use after free") Fixes: 11e8f5fd223b ("drm: Add simpledrm driver") Link: https://patchwork.freedesktop.org/patch/msgid/20210512203051.299026-1-colin.king@canonical.com
2021-05-13drm: simpledrm: print resource info using '%pr'Randy Dunlap1-2/+2
struct resource start and end fields are not always long long, so using %llx to print them can cause build warnings (below). Fix these by using the special "%pr" for printing struct resource info. ../drivers/gpu/drm/tiny/simpledrm.c: In function ‘simpledrm_device_init_mm’: ../include/drm/drm_print.h:412:32: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘resource_size_t {aka unsigned int}’ [-Wformat=] ../drivers/gpu/drm/tiny/simpledrm.c:533:54: note: format string is defined here drm_err(dev, "could not acquire memory range [0x%llx:0x%llx]: error %d\n", ~~~^ %x ../include/drm/drm_print.h:412:32: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘resource_size_t {aka unsigned int}’ [-Wformat=] ../drivers/gpu/drm/tiny/simpledrm.c:533:61: note: format string is defined here drm_err(dev, "could not acquire memory range [0x%llx:0x%llx]: error %d\n", ~~~^ %x Fixes: 4aae79f77e3a ("drm/simpledrm: Acquire memory aperture for framebuffer") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: dri-devel@lists.freedesktop.org Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210512233459.19534-1-rdunlap@infradead.org
2021-05-01drm/simpledrm: Acquire memory aperture for framebufferThomas Zimmermann1-1/+24
We register the simplekms device with the DRM platform helpers. A native driver for the graphics hardware will kick-out the simpledrm driver before taking over the device. The original generic platform device from the simple-framebuffer boot code will be unregistered. The native driver will use whatever native hardware device it received. v4: * convert to drm_aperture_acquire_from_firmware() v3: * use platform_device_unregister() and handle detachment like hot-unplug event (Daniel) v2: * adapt to aperture changes * use drm_dev_unplug() and drm_dev_enter/exit() * don't split error string Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Maxime Ripard <maxime@cerno.tech> Tested-by: nerdopolis <bluescreen_avenger@verizon.net> Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-10-tzimmermann@suse.de
2021-05-01drm: Add simpledrm driverThomas Zimmermann3-0/+890
The simpledrm driver is a DRM driver for simple-framebuffer framebuffers as provided by the kernel's boot code. This driver enables basic graphical output on many different graphics devices that are provided by the platform (e.g., EFI, VESA, embedded framebuffers). With the kernel's simple-framebuffer infrastructure, the kernel receives a pre-configured framebuffer from the system (i.e., firmware, boot loader). It creates a platform device to which simpledrm attaches. The system's framebuffer consists of a memory range, size and format. Based on these values, simpledrm creates a DRM devices. No actual modesetting is possible. A firmware framebuffer might also be specified via device-tree files. If no device platform data is given, try the DT device node. Make sure required hardware clocks and regulators are enabled while the firmware framebuffer is in use. The basic code has been taken from the simplefb driver and adapted to DRM. Clocks are released automatically via devres helpers. The drivers displays a console on simpledrm's framebuffer. The default framebuffer format is being used. v4: * disable simplefb if simpledrm has been selected (Maxime) v3: * add disable function that clears screen to black (Daniel) * set shadow buffering only for fbdev emulation * set platform-driver data during device creation v2: * rename driver to simpledrm * add dri-devel to MAINTAINERS entry * put native format first in primary-plane format list (Daniel) * inline simplekms_device_cleanup() (Daniel) * use helpers for shadow-buffered planes * fix whitespace errors * add Device Tree match table * clean-up parser wrappers * use strscpy() Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> # fbdev support Acked-by: Maxime Ripard <maxime@cerno.tech> Tested-by: nerdopolis <bluescreen_avenger@verizon.net> Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-5-tzimmermann@suse.de Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-6-tzimmermann@suse.de Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-7-tzimmermann@suse.de Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-8-tzimmermann@suse.de Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-9-tzimmermann@suse.de
2021-05-01drm/format-helper: Pass destination pitch to drm_fb_memcpy_dstclip()Thomas Zimmermann1-1/+1
The memcpy's destination buffer might have a different pitch than the source. Support different pitches as function argument. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Maxime Ripard <maxime@cerno.tech> Tested-by: nerdopolis <bluescreen_avenger@verizon.net> Link: https://patchwork.freedesktop.org/patch/msgid/20210430105840.30515-2-tzimmermann@suse.de
2021-04-27drm/hx8357d: Avoid spamming logs if probe is deferredAndy Shevchenko1-4/+2
The GPIO request can fail and probe may be deferred. Thus, the error message may be printed again and again. Avoid this by replacing DRM_DEV_ERROR() by dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-7-andriy.shevchenko@linux.intel.com
2021-04-27drm/ili9225: Avoid spamming logs if probe is deferredAndy Shevchenko1-8/+4
The GPIO request can fail and probe may be deferred. Thus, the error message may be printed again and again. Avoid this by replacing DRM_DEV_ERROR() by dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-6-andriy.shevchenko@linux.intel.com
2021-04-27drm/ili9341: Avoid spamming logs if probe is deferredAndy Shevchenko1-8/+4
The GPIO request can fail and probe may be deferred. Thus, the error message may be printed again and again. Avoid this by replacing DRM_DEV_ERROR() by dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-5-andriy.shevchenko@linux.intel.com
2021-04-27drm/ili9486: Avoid spamming logs if probe is deferredAndy Shevchenko1-8/+4
The GPIO request can fail and probe may be deferred. Thus, the error message may be printed again and again. Avoid this by replacing DRM_DEV_ERROR() by dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-4-andriy.shevchenko@linux.intel.com
2021-04-27drm/mi0283qt: Avoid spamming logs if probe is deferredAndy Shevchenko1-8/+4
The GPIO request can fail and probe may be deferred. Thus, the error message may be printed again and again. Avoid this by replacing DRM_DEV_ERROR() by dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-3-andriy.shevchenko@linux.intel.com
2021-04-27drm/st7586: Avoid spamming logs if probe is deferredAndy Shevchenko1-8/+4
The GPIO request can fail and probe may be deferred. Thus, the error message may be printed again and again. Avoid this by replacing DRM_DEV_ERROR() by dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-2-andriy.shevchenko@linux.intel.com
2021-04-27drm/st7735r: Avoid spamming logs if probe is deferredAndy Shevchenko1-8/+4
The GPIO request can fail and probe may be deferred. Thus, the error message may be printed again and again. Avoid this by replacing DRM_DEV_ERROR() by dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210421163157.50949-1-andriy.shevchenko@linux.intel.com
2021-04-14drm/aperture: Convert drivers to aperture interfacesThomas Zimmermann1-1/+2
Mass-convert all drivers from FB helpers to aperture interfaces. No functional changes besides checking for returned errno codes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210412131043.5787-3-tzimmermann@suse.de
2021-03-16Merge tag 'drm-misc-next-2021-03-03' of git://anongit.freedesktop.org/drm/drm-misc into drm-nextDave Airlie13-56/+491
drm-misc-next for 5.13: UAPI Changes: Cross-subsystem Changes: Core Changes: - %p4cc printk format modifier - atomic: introduce drm_crtc_commit_wait, rework atomic plane state helpers to take the drm_commit_state structure - dma-buf: heaps rework to return a struct dma_buf - simple-kms: Add plate state helpers - ttm: debugfs support, removal of sysfs Driver Changes: - Convert drivers to shadow plane helpers - arc: Move to drm/tiny - ast: cursor plane reworks - gma500: Remove TTM and medfield support - mxsfb: imx8mm support - panfrost: MMU IRQ handling rework - qxl: rework to better handle resources deallocation, locking - sun4i: Add alpha properties for UI and VI layers - vc4: RPi4 CEC support - vmwgfx: doc cleanup Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20210303100600.dgnkadonzuvfnu22@gilmour
2021-03-11drm: Use USB controller's DMA mask when importing dmabufsThomas Zimmermann1-8/+36
USB devices cannot perform DMA and hence have no dma_mask set in their device structure. Therefore importing dmabuf into a USB-based driver fails, which breaks joining and mirroring of display in X11. For USB devices, pick the associated USB controller as attachment device. This allows the DRM import helpers to perform the DMA setup. If the DMA controller does not support DMA transfers, we're out of luck and cannot import. Our current USB-based DRM drivers don't use DMA, so the actual DMA device is not important. Tested by joining/mirroring displays of udl and radeon under Gnome/X11. v8: * release dmadev if device initialization fails (Noralf) * fix commit description (Noralf) v7: * fix use-before-init bug in gm12u320 (Dan) v6: * implement workaround in DRM drivers and hold reference to DMA device while USB device is in use * remove dev_is_usb() (Greg) * collapse USB helper into usb_intf_get_dma_device() (Alan) * integrate Daniel's TODO statement (Daniel) * fix typos (Greg) v5: * provide a helper for USB interfaces (Alan) * add FIXME item to documentation and TODO list (Daniel) v4: * implement workaround with USB helper functions (Greg) * use struct usb_device->bus->sysdev as DMA device (Takashi) v3: * drop gem_create_object * use DMA mask of USB controller, if any (Daniel, Christian, Noralf) v2: * move fix to importer side (Christian, Daniel) * update SHMEM and CMA helpers for new PRIME callbacks Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Fixes: 6eb0233ec2d0 ("usb: don't inherity DMA properties for USB devices") Tested-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Noralf Trønnes <noralf@tronnes.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: <stable@vger.kernel.org> # v5.10+ Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210303133229.3288-1-tzimmermann@suse.de Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
2021-02-25drm/arc: Move to drm/tinyDaniel Vetter3-0/+445
Because it is. v2: Delete now unused crtc funcs (0day) Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Alexey Brodkin <abrodkin@synopsys.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210112084358.2771527-15-daniel.vetter@ffwll.ch
2021-02-23drm/gem: Move drm_gem_fb_prepare_fb() to GEM atomic helpersThomas Zimmermann8-15/+16
The function drm_gem_fb_prepare_fb() is a helper for atomic modesetting, but currently located next to framebuffer helpers. Move it to GEM atomic helpers, rename it slightly and adopt the drivers. Same for the rsp simple-pipe helper. Compile-tested with x86-64, aarch64 and arm. The patch is fairly large, but there are no functional changes. v3: * remove out-comented line in drm_gem_framebuffer_helper.h (Maxime) v2: * rename to drm_gem_plane_helper_prepare_fb() (Daniel) * add tutorial-style documentation Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Maxime Ripard <mripard@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210222141756.7864-1-tzimmermann@suse.de
2021-02-08drm/gm12u320: Move vmap out of commit tailThomas Zimmermann1-15/+13
Vmap operations may acquire the dmabuf reservation lock, which is not allowed within atomic commit-tail functions. Therefore move vmap and vunmap from the damage handler into prepare_fb and cleanup_fb callbacks. The mapping is provided as GEM shadow-buffered plane. The functions in the commit tail use the pre-established mapping for damage handling. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210208115538.6430-7-tzimmermann@suse.de
2021-02-08drm/cirrus: Move vmap out of commit tailThomas Zimmermann1-26/+17
Vmap operations may acquire the dmabuf reservation lock, which is not allowed within atomic commit-tail functions. Therefore move vmap and vunmap from the damage handler into prepare_fb and cleanup_fb callbacks. The mapping is provided as GEM shadow-buffered plane. The functions in the commit tail use the pre-established mapping for damage handling. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Tested-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20210208115538.6430-6-tzimmermann@suse.de
2021-01-06drm/cirrus: Remove references to struct drm_device.pdevThomas Zimmermann1-1/+0
Using struct drm_device.pdev is deprecated. Convert cirrus to struct drm_device.dev. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Cc: Gerd Hoffmann <kraxel@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201201103542.2182-6-tzimmermann@suse.de
2020-11-09drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backendsThomas Zimmermann2-8/+12
This patch replaces the vmap/vunmap's use of raw pointers in GEM object functions with instances of struct dma_buf_map. GEM backends are converted as well. For most of them, this simply changes the returned type. TTM-based drivers now return information about the location of the memory, either system or I/O memory. GEM VRAM helpers and qxl now use ttm_bo_vmap() et al. Amdgpu, nouveau and radeon use drm_gem_ttm_vmap() et al instead of implementing their own vmap callbacks. v7: * init QXL cursor to mapped BO buffer (kernel test robot) v5: * update vkms after switch to shmem v4: * use ttm_bo_vmap(), drm_gem_ttm_vmap(), et al. (Daniel, Christian) * fix a trailing { in drm_gem_vmap() * remove several empty functions instead of converting them (Daniel) * comment uses of raw pointers with a TODO (Daniel) * TODO list: convert more helpers to use struct dma_buf_map Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Christian König <christian.koenig@amd.com> Tested-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20201103093015.1063-7-tzimmermann@suse.de
2020-11-09drm/tiny/gm12u320: Retrieve USB device from struct drm_device.devThomas Zimmermann1-28/+28
Drop the driver's udev field in favor of struct drm_device.dev. No functional changes made. v3: * upcast dev with gm12u320_to_usb_device() v2: * upcast dev with drm_dev_get_usb_device() Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/20201103113456.3066-2-tzimmermann@suse.de
2020-11-06drm/<drivers>: Constify struct drm_driverDaniel Vetter10-10/+10
Only the following drivers aren't converted: - amdgpu, because of the driver_feature mangling due to virt support. Subsequent patch will address this. - nouveau, because DRIVER_ATOMIC uapi is still not the default on the platforms where it's supported (i.e. again driver_feature mangling) - vc4, again because of driver_feature mangling - qxl, because the ioctl table is somewhere else and moving that is maybe a bit too much, hence the num_ioctls assignment prevents a const driver structure. - arcpgu, because that is stuck behind a pending tiny-fication series from me. - legacy drivers, because legacy requires non-const drm_driver. Note that for armada I also went ahead and made the ioctl array const. Only cc'ing the driver people who've not been converted (everyone else is way too much). v2: Fix one misplaced const static, should be static const (0day) v3: - Improve commit message (Sam) Acked-by: Sam Ravnborg <sam@ravnborg.org> Cc: kernel test robot <lkp@intel.com> Acked-by: Maxime Ripard <mripard@kernel.org> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Dave Airlie <airlied@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: virtualization@lists.linux-foundation.org Cc: Harry Wentland <harry.wentland@amd.com> Cc: Leo Li <sunpeng.li@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Christian König <christian.koenig@amd.com> Cc: Eric Anholt <eric@anholt.net> Cc: Maxime Ripard <mripard@kernel.org> Cc: Ben Skeggs <bskeggs@redhat.com> Cc: nouveau@lists.freedesktop.org Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201104100425.1922351-5-daniel.vetter@ffwll.ch
2020-06-24drm/mipi-dbi: Remove ->enabledDaniel Vetter2-17/+6
The atomic helpers try really hard to not lose track of things, duplicating enabled tracking in the driver is at best confusing. Double-enabling or disabling is a bug in atomic helpers. In the fb_dirty function we can just assume that the fb always exists, simple display pipe helpers guarantee that the crtc is only enabled together with the output, so we always have a primary plane around. Now in the update function we need to be a notch more careful, since that can also get called when the crtc is off. And we don't want to upload frames when that's the case, so filter that out too. Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: David Lechner <david@lechnology.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: 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> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: David Lechner <david@lechnology.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200612160056.2082681-7-daniel.vetter@ffwll.ch
2020-06-24drm/tiny/repaper: Drop edp->enabledDaniel Vetter1-10/+3
Same patch as the mipi-dbi one, atomic tracks this for us already, we just have to check the right thing. Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: "Noralf Trønnes" <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200612160056.2082681-8-daniel.vetter@ffwll.ch
2020-06-10drm/cma-helper: Rework DRM_GEM_CMA_VMAP_DRIVER_OPS macroThomas Zimmermann8-8/+8
Rename the macro to DRM_GEM_CMA_DRIVER_OPS_VMAP to align naming with SHMEM helpers and drm_gem_cma_prime_import_sg_table_vmap(). An variant of the macro is provided for drivers that override the default .dumb_create callback. Adapt drivers to the changes. v3: * rename macro to signal implicit vmap on imported buffers v2: * provide DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200605073247.4057-3-tzimmermann@suse.de
2020-04-28drm/cirrus: Move to drm/tinyDaniel Vetter3-0/+680
Because it is. Huge congrats to everyone who made this kind of refactoring happen! Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: virtualization@lists.linux-foundation.org Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-38-daniel.vetter@ffwll.ch
2020-04-28drm/gm12u320: Don't use drm_device->dev_privateDaniel Vetter1-5/+6
Upcasting using a container_of macro is more typesafe, faster and easier for the compiler to optimize. Acked-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Hans de Goede <hdegoede@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-23-daniel.vetter@ffwll.ch
2020-04-28drm/gm12u320: Use devm_drm_dev_allocDaniel Vetter1-9/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Hans de Goede <hdegoede@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-22-daniel.vetter@ffwll.ch
2020-04-28drm/hx8357d: Use devm_drm_dev_allocDaniel Vetter1-9/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: Eric Anholt <eric@anholt.net> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-21-daniel.vetter@ffwll.ch
2020-04-28drm/ili9225: Use devm_drm_dev_allocDaniel Vetter1-9/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: David Lechner <david@lechnology.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: David Lechner <david@lechnology.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-20-daniel.vetter@ffwll.ch
2020-04-28drm/ili9341: Use devm_drm_dev_allocDaniel Vetter1-9/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: David Lechner <david@lechnology.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: "Noralf Trønnes" <noralf@tronnes.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Eric Anholt <eric@anholt.net> Cc: David Lechner <david@lechnology.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-19-daniel.vetter@ffwll.ch
2020-04-28drm/ili9486: Use devm_drm_dev_allocDaniel Vetter1-9/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-18-daniel.vetter@ffwll.ch
2020-04-28drm/mi0283qt: Use devm_drm_dev_allocDaniel Vetter1-9/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: "Noralf Trønnes" <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-17-daniel.vetter@ffwll.ch
2020-04-28drm/repaper: Use devm_drm_dev_allocDaniel Vetter1-10/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: "Noralf Trønnes" <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-16-daniel.vetter@ffwll.ch
2020-04-28drm/st7586: Use devm_drm_dev_allocDaniel Vetter1-9/+4
Already using devm_drm_dev_init, so very simple replacment. Acked-by: David Lechner <david@lechnology.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> Cc: David Lechner <david@lechnology.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200415074034.175360-15-daniel.vetter@ffwll.ch