summaryrefslogtreecommitdiffstats
path: root/drivers
AgeCommit message (Collapse)Author
2020-07-13drm/lima: Expose job_hang_limit module parameterAndrey Lebedev
Some pp or gp jobs can be successfully repeated even after they time outs. Introduce lima module parameter to specify number of times a job can hang before being dropped. Signed-off-by: Andrey Lebedev <andrey@lebedev.lt> Signed-off-by: Qiang Yu <yuq825@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200619075900.3030696-1-andrey.lebedev@gmail.com
2020-07-12drm/vkms: change the max cursor width/heightMelissa Wen
This change expands the coverage for the IGT kms_cursor_crc test, where the size varies between 64 and 512 for a square cursor. With this, in addition to the cursor 64x64, this patch enables the test of cursors with sizes: 128x128, 256x256, and 512x512. Signed-off-by: Melissa Wen <melissa.srw@gmail.com> Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200710160313.xjoz6ereyma5vkc3@smtp.gmail.com
2020-07-12drm: panel: simple: Fix bpc for LG LB070WV8 panelLaurent Pinchart
The LG LB070WV8 panel incorrectly reports a 16 bits per component value, while the panel uses 8 bits per component. Fix it. Fixes: dd0150026901 ("drm/panel: simple: Add support for LG LB070WV8 800x480 7" panel") Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200711225317.28476-1-laurent.pinchart+renesas@ideasonboard.com
2020-07-11drm/panel: auo,b116xw03: fix flash backlight when power onJitao Shi
Delay the backlight on to make sure the video stable. Signed-off-by: Jitao Shi <jitao.shi@mediatek.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200705094514.34526-1-jitao.shi@mediatek.com
2020-07-10drm: fb-helper: Convert logging to drm_* functions.Suraj Upadhyay
Change logging information from dev_info() to drm_info(). Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/0d37c7a614eb0885f0f0bed18e48a4d26b345a8e.1594136880.git.usuraj35@gmail.com
2020-07-10drm: mipi-dsi: Convert logging to drm_* functions.Suraj Upadhyay
Convert logging errors from dev_err() to drm_err(). Signed-off-by: Suraj Upadhyay <usuraj35@gmail.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/feeec2816debcf4105ac22af1661fd2d491d02b9.1594136880.git.usuraj35@gmail.com
2020-07-10drm/bridge: Replace HTTP links with HTTPS onesAlexander A. Klimov
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200708121604.14292-1-grandmaster@al2klimov.de
2020-07-10drm/bridge: dw-hdmi: Always add the bridge in the global bridge listLiu Ying
It doesn't hurt to add the bridge in the global bridge list also for platform specific dw-hdmi drivers which are based on the component framework. This can be achieved by moving the drm_bridge_add() function call from dw_hdmi_probe() to __dw_hdmi_probe(). A counterpart movement for drm_bridge_remove() is also needed then. Moreover, since drm_bridge_add() initializes &bridge->hpd_mutex, this may help those platform specific dw-hdmi drivers(based on the component framework) avoid accessing the uninitialized mutex in drm_bridge_hpd_notify() which is called in dw_hdmi_irq(). Putting drm_bridge_add() in __dw_hdmi_probe() just before it returns successfully should bring no logic change for platforms based on the DRM bridge API, which is a good choice from safety point of view. Also, __dw_hdmi_probe() is renamed to dw_hdmi_probe() since dw_hdmi_probe() does nothing else but calling __dw_hdmi_probe(). Similar renaming applies to the __dw_hdmi_remove()/dw_hdmi_remove() pair. Fixes: ec971aaa6775 ("drm: bridge: dw-hdmi: Make connector creation optional") Cc: Andrzej Hajda <a.hajda@samsung.com> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Jernej Skrabec <jernej.skrabec@siol.net> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Boris Brezillon <boris.brezillon@collabora.com> Cc: Jerome Brunet <jbrunet@baylibre.com> Cc: Cheng-Yi Chiang <cychiang@chromium.org> Cc: Dariusz Marcinkiewicz <darekm@google.com> Cc: Archit Taneja <architt@codeaurora.org> Cc: Jose Abreu <joabreu@synopsys.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: dri-devel@lists.freedesktop.org Cc: NXP Linux Team <linux-imx@nxp.com> Signed-off-by: Liu Ying <victor.liu@nxp.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/1594260156-8316-2-git-send-email-victor.liu@nxp.com
2020-07-10drm/bridge: dw-hdmi: Don't cleanup i2c adapter and ddc ptr in ↵Liu Ying
__dw_hdmi_probe() bailout path It's unnecessary to cleanup the i2c adapter and the ddc pointer in the bailout path of __dw_hdmi_probe(), since the adapter is not added and the ddc pointer is not set. Fixes: a23d6265f033 ("drm: bridge: dw-hdmi: Extract PHY interrupt setup to a function") Cc: Andrzej Hajda <a.hajda@samsung.com> Cc: Neil Armstrong <narmstrong@baylibre.com> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com> Cc: Jonas Karlman <jonas@kwiboo.se> Cc: Jernej Skrabec <jernej.skrabec@siol.net> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Boris Brezillon <boris.brezillon@collabora.com> Cc: Jerome Brunet <jbrunet@baylibre.com> Cc: Cheng-Yi Chiang <cychiang@chromium.org> Cc: Dariusz Marcinkiewicz <darekm@google.com> Cc: Archit Taneja <architt@codeaurora.org> Cc: Jose Abreu <joabreu@synopsys.com> Cc: dri-devel@lists.freedesktop.org Cc: NXP Linux Team <linux-imx@nxp.com> Signed-off-by: Liu Ying <victor.liu@nxp.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/1594260156-8316-1-git-send-email-victor.liu@nxp.com
2020-07-10drm/panel: Replace HTTP links with HTTPS onesAlexander A. Klimov
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If neither `\bgnu\.org/license`, nor `\bmozilla\.org/MPL\b`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200709184755.24798-1-grandmaster@al2klimov.de
2020-07-10fbdev: sm712fb: set error code in probeEvgeny Novikov
If smtcfb_pci_probe() does not detect a valid chip it cleans up everything and returns 0. This can result in various bad things later. The patch sets the error code on the corresponding path. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com> Cc: Teddy Wang <teddy.wang@siliconmotion.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200706155328.8396-1-novikov@ispras.ru
2020-07-10fbdev: da8xx-fb: go to proper label on error handling paths in probeEvgeny Novikov
fb_probe() can successfully allocate a new frame buffer, but then fail to perform some operations with regulator. In these cases fb_probe() goes to label err_pm_runtime_disable where the frame buffer is not released. The patch makes fb_probe() to go to label err_release_fb on corresponding error handling paths. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Cc: Sekhar Nori <nsekhar@ti.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200702160540.24546-1-novikov@ispras.ru
2020-07-10video: fbdev: vt8623fb: Constify static vga_regsetsRikard Falkeborn
These are not modified so make them const to allow the compiler to put them in read-only memory. Before: text data bss dec hex filename 25509 7928 64 33501 82dd drivers/video/fbdev/vt8623fb.o After: text data bss dec hex filename 26533 6904 64 33501 82dd drivers/video/fbdev/vt8623fb.o Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200701210248.64893-1-rikard.falkeborn@gmail.com
2020-07-10omapfb: dss: Fix max fclk divider for omap36xxAdam Ford
The drm/omap driver was fixed to correct an issue where using a divider of 32 breaks the DSS despite the TRM stating 32 is a valid number. Through experimentation, it appears that 31 works, and it is consistent with the value used by the drm/omap driver. This patch fixes the divider for fbdev driver instead of the drm. Fixes: f76ee892a99e ("omapfb: copy omapdss & displays for omapfb") Cc: <stable@vger.kernel.org> #4.5+ Signed-off-by: Adam Ford <aford173@gmail.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Dave Airlie <airlied@gmail.com> Cc: Rob Clark <robdclark@gmail.com> [b.zolnierkie: mark patch as applicable to stable 4.5+ (was 4.9+)] Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200630182636.439015-1-aford173@gmail.com
2020-07-10omapfb: fix multiple reference count leaks due to pm_runtime_get_syncAditya Pakki
On calling pm_runtime_get_sync() the reference count of the device is incremented. In case of failure, decrement the reference count before returning the error. Signed-off-by: Aditya Pakki <pakki001@umn.edu> Cc: kjlu@umn.edu Cc: wu000273@umn.edu Cc: Allison Randal <allison@lohutok.net> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Enrico Weigelt <info@metux.net> cc: "Andrew F. Davis" <afd@ti.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Alexios Zavras <alexios.zavras@intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: YueHaibing <yuehaibing@huawei.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200614030528.128064-1-pakki001@umn.edu
2020-07-10video: fbdev: neofb: fix memory leak in neo_scan_monitor()Evgeny Novikov
neofb_probe() calls neo_scan_monitor() that can successfully allocate a memory for info->monspecs.modedb and proceed to case 0x03. There it does not free the memory and returns -1. neofb_probe() goes to label err_scan_monitor, thus, it does not free this memory through calling fb_destroy_modedb() as well. We can not go to label err_init_hw since neo_scan_monitor() can fail during memory allocation. So, the patch frees the memory directly for case 0x03. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Cc: Jani Nikula <jani.nikula@intel.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200630195451.18675-1-novikov@ispras.ru
2020-07-10video: fbdev: savage: fix memory leak on error handling path in probeEvgeny Novikov
savagefb_probe() calls savage_init_fb_info() that can successfully allocate memory for info->pixmap.addr but then fail when fb_alloc_cmap() fails. savagefb_probe() goes to label failed_init and does not free allocated memory. It is not valid to go to label failed_mmio since savage_init_fb_info() can fail during memory allocation as well. So, the patch free allocated memory on the error handling path in savage_init_fb_info() itself. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Cc: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200619162136.9010-1-novikov@ispras.ru
2020-07-10fbcon: Use array3_size() helper in scr_memcpyw()Gustavo A. R. Silva
Use array3_size() helper instead of the open-coded version in scr_memcpyw() and scr_memsetw(). These sorts of multiplication factors need to be wrapped in array3_size(). This issue was found with the help of Coccinelle and, audited and fixed manually. Addresses-KSPP-ID: https://github.com/KSPP/linux/issues/83 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200615231542.GA20470@embeddedor
2020-07-10video: fbdev: amifb: add FIXMEs about {put,get}_user() failuresBartlomiej Zolnierkiewicz
Since we lack the hardware (or proper emulator setup) for testing needed changes add FIXMEs to document the issues (so at least they are not forgotten). Cc: Al Viro <viro@zeniv.linux.org.uk> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/380c0494-ed02-b2be-65b0-d385627fb894@samsung.com
2020-07-10video: fbdev: amifb: add FIXME about dead APUS supportBartlomiej Zolnierkiewicz
On 5/14/20 10:21 PM, Geert Uytterhoeven wrote: > These #ifdefs are relics from APUS (Amiga Power-Up System), which > added a PPC board. APUS support was killed off a long time ago, > when arch/ppc/ was still king, but these #ifdefs were missed, because > they didn't test for CONFIG_APUS. Add FIXME about using the C code variants (APUS ones) in the future. Reported-by: Al Viro <viro@zeniv.linux.org.uk> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Link: https://patchwork.freedesktop.org/patch/msgid/767d36ff-22ec-8136-7ebc-1d9d0d3ac98d@samsung.com
2020-07-09drm/edid: Clean up some curly bracesVille Syrjälä
Drop some pointless curly braces, and add some across the else when the if has them too. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200527130310.27099-3-ville.syrjala@linux.intel.com Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2020-07-09drm/edid: Iterate through all DispID ext blocksVille Syrjälä
Apparently there are EDIDs in the wild with multiple DispID extension blocks. Iterate through them all. In one particular case the tile information is specicied in the second DispID ext block, and since the current parser only looks at the first DispID ext block we don't notice that we're dealing with a tiled display. While at it change a few functions to return void since we have no use for the errno. References: https://gitlab.freedesktop.org/drm/intel/-/issues/27 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200527130310.27099-2-ville.syrjala@linux.intel.com Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2020-07-09drm/edid: Allow looking for ext blocks starting from a specified indexVille Syrjälä
Apparently EDIDs with multiple DispID ext blocks is a thing, so prepare for iterating through multiple ext blocks of the same type by passing the starting ext block index to drm_find_edid_extension(). Well also have drm_find_edid_extension() update the index to point to the next ext block on success. Thus we should be able to call drm_find_edid_extension() in loop. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200527130310.27099-1-ville.syrjala@linux.intel.com Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
2020-07-09drm/dp: Include the AUX CH name in the debug messagesVille Syrjälä
To make it easier to figure out what caused a particular debug message let's print out aux->name. v2: Convert drm_dp_send_real_edid_checksum() too Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200514184040.20700-1-ville.syrjala@linux.intel.com Acked-by: Sam Ravnborg <sam@ravnborg.org>
2020-07-08drm/vgem: Replace opencoded version of drm_gem_dumb_map_offset()Chris Wilson
drm_gem_dumb_map_offset() now exists and does everything vgem_gem_dump_map does and *ought* to do. In particular, vgem_gem_dumb_map() was trying to reject mmapping an imported dmabuf by checking the existence of obj->filp. Unfortunately, we always allocated an obj->filp, even if unused for an imported dmabuf. Instead, the drm_gem_dumb_map_offset(), since commit 90378e589192 ("drm/gem: drm_gem_dumb_map_offset(): reject dma-buf"), uses the obj->import_attach to reject such invalid mmaps. This prevents vgem from allowing userspace mmapping the dumb handle and attempting to incorrectly fault in remote pages belonging to another device, where there may not even be a struct page. v2: Use the default drm_gem_dumb_map_offset() callback Fixes: af33a9190d02 ("drm/vgem: Enable dmabuf import interfaces") Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: <stable@vger.kernel.org> # v4.13+ Link: https://patchwork.freedesktop.org/patch/msgid/20200708154911.21236-1-chris@chris-wilson.co.uk
2020-07-08drm/stm: repair runtime power managementMarek Vasut
Add missing pm_runtime_get_sync() into ltdc_crtc_atomic_enable() to match pm_runtime_put_sync() in ltdc_crtc_atomic_disable(), otherwise the LTDC might suspend via runtime PM, disable clock, and then fail to resume later on. The test which triggers it is roughly -- run qt5 application which uses eglfs platform and etnaviv, stop the application, sleep for 15 minutes, run the application again. This leads to a timeout waiting for vsync, because the LTDC has suspended, but did not resume. Fixes: 35ab6cfbf211 ("drm/stm: support runtime power management") Signed-off-by: Marek Vasut <marex@denx.de> Cc: Yannick Fertré <yannick.fertre@st.com> Cc: Philippe Cornu <philippe.cornu@st.com> Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org> Cc: Vincent Abriou <vincent.abriou@st.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> To: dri-devel@lists.freedesktop.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Acked-by: Philippe Cornu <philippe.cornu@st.com> Tested-by: Yannick Fertre <yannick.fertre@st.com> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200229221649.90813-1-marex@denx.de
2020-07-08drm/stm: ltdc: remove call of pm-runtime functionsYannick Fertre
It is not necessary to suspend or stop the ltdc clocks to modify the pixel clock. Signed-off-by: Yannick Fertre <yannick.fertre@st.com> Acked-by: Philippe Cornu <philippe.cornu@st.com> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200701120402.6444-1-yannick.fertre@st.com
2020-07-07drm/meson: overlay: fix build failureNeil Armstrong
The recent GCC compiler is very picky with the VD_H_START() and AFBC_DEC_PIXEL_BGN_H() macros, triggering a runtime assert error as: In function 'meson_overlay_setup_scaler_params', inlined from 'meson_overlay_atomic_update' at drivers/gpu/drm/meson/meson_overlay.c:542:2: ./include/linux/compiler.h:392:38: error: call to '__compiletime_assert_341' declared with attribute error: FIELD_PREP: value too large for the field drivers/gpu/drm/meson/meson_overlay.c:413:4: note: in expansion of macro 'AFBC_DEC_PIXEL_BGN_H' 413 | AFBC_DEC_PIXEL_BGN_H(hd_start_lines - afbc_left) | | ^~~~~~~~~~~~~~~~~~~~ ./include/linux/compiler.h:392:38: error: call to '__compiletime_assert_401' declared with attribute error: FIELD_PREP: value too large for the field It's not expected to overflow these fields, but the compiler did find a case where it overflows. We can safely ignore this, so mask the value with the field width. Fixes: e860785d57306 ("drm/meson: overlay: setup overlay for Amlogic FBC") Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> [narmstrong: moved to (value) to avoid precedence issues] Link: https://patchwork.freedesktop.org/patch/msgid/20200707135009.32474-1-narmstrong@baylibre.com
2020-07-07drm/ast: Initialize mode setting in ast_mode_config_init()Thomas Zimmermann
There's modesetting init code in ast_main.c. Move it to ast_mode.c and merge it with the modesetting init code in ast_mode_init(). The result is ast_mode_config_init(), which initalizes the whole modesetting. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-15-tzimmermann@suse.de
2020-07-07drm/ast: Use managed mode-config initThomas Zimmermann
Using drmm_mode_config_init() sets up managed release of modesetting resources. The existing modesetting's finalizer is empty, so remove it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-14-tzimmermann@suse.de
2020-07-07drm/ast: Replace struct ast_crtc with struct drm_crtcThomas Zimmermann
Struct ast_crtc has been cleaned up and it's now a wrapper around the DRM CRTC structure struct drm_crtc. This patch converts the driver to struct drm_crtc and removes struct ast_crtc. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-13-tzimmermann@suse.de
2020-07-07drm/ast: Init cursors before creating modesetting structuresThomas Zimmermann
The cursor helpers reserve buffer objects in VRAM and update their content. So although tied to modesetting, cursor helpers are more of a memory manager. The modesetting's cursor plane requires this functionality, so initialize cursors before modesetting. While at it, also add an error check for ast_cursor_init(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-12-tzimmermann@suse.de
2020-07-07drm/ast: Managed cursor releaseThomas Zimmermann
Register a release function to finalize cursors. The _fini() function gets un-exported from the source file. The function ast_mode_fini() is now empty and will be removed by a later patch. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-11-tzimmermann@suse.de
2020-07-07drm/ast: Keep cursor HW BOs mappedThomas Zimmermann
Updating the image in a cursor's HW BO requires a mapping of the BO's buffer in the kernel's address space. Cursor image updates can happen frequently and create CPU overhead. As cursor HW BOs are small and never move, they are now map exactly once during the initialization and the mapping is used throughout the driver's lifetime. This change also removes a possible source of failures from ast_cursor_show(). As the helper does not establish mappings, it cannot fail. As a result, the cursor plane's atomic-update helper does not call any failable interfaces. All failures are detected before trying to update the cursor plane. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-10-tzimmermann@suse.de
2020-07-07drm/ast: Add helper to hide cursorThomas Zimmermann
As the inverse to ast_cursor_show(), ast_cursor_hide() disables the HW cursor. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-9-tzimmermann@suse.de
2020-07-07drm/ast: Don't enable HW cursors twice during atomic updateThomas Zimmermann
The ast_cursor_show() helper enables the cursor to be displayed. No need to repeat that operation in the plane's atomic-update function. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-8-tzimmermann@suse.de
2020-07-07drm/ast: Replace ast_cursor_move() with ast_cursor_show()Thomas Zimmermann
Having a cursor move function is misleading, as it actually enables the cursor's image for displaying. So rename it to ast_cursor_show(). It's semantics is to show a cursor at the specified location on the screen. The displayed cursor is always the image in the cursor front BO. This change also simplifies struct ast_crtc to being a mere wrapper around around struct drm_crtc. It will be removed by a later patch. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-7-tzimmermann@suse.de
2020-07-07drm/ast: Move cursor pageflip into helperThomas Zimmermann
The new helper ast_cursor_page_flip() switches the cursor's front and back BOs. This simplifies the cursor plane's update helper. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-6-tzimmermann@suse.de
2020-07-07drm/ast: Update cursor image and checksum from same functionThomas Zimmermann
Cursor image and checksum go hand in hand. Update both in the same place. The helper cannot fail, so remove the return type. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-5-tzimmermann@suse.de
2020-07-07drm/ast: Move cursor fb pinning and mapping into helperThomas Zimmermann
The new helper ast_cursor_blit() updates a cursor's backbuffer HW BO from a framebuffer structure. The cursor plane's prepare_fb() function now uses the new interface. Pinning and mapping of BOs is done automatically by the helper. This includes the source BO, which was not pinned by the original code in prepare_fb(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-4-tzimmermann@suse.de
2020-07-07drm/ast: Pass struct ast_private instance to cursor init/fini functionsThomas Zimmermann
Removes some typecasting. v2: * use to_ast_private() instead of struct drm_device.dev_private Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-3-tzimmermann@suse.de
2020-07-07drm/ast: Move cursor functions to ast_cursor.cThomas Zimmermann
The cursor manipulation functions are unrelated to modesetting. Move them into their own file. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200702115029.5281-2-tzimmermann@suse.de
2020-07-07drm/vc4: crtc: Remove the feed_txp testsMaxime Ripard
Now that the code in vc4_crtc accessing registers is only meant for the pixelvalve, it doesn't make sense anymore to test whether we're accessing the TXP or not and we can safely remove those checks. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/c044daba470fcb1cb57e3d34d88f75325b2ebbab.1591882579.git-series.maxime@cerno.tech
2020-07-07drm/vc4: txp: Turn the TXP into a CRTC of its ownMaxime Ripard
The TXP so far has been leveraging the PixelValve infrastructure in the driver, that was really two things: the interaction with DRM's CRTC concept, the setup of the underlying pixelvalve and the setup of the shared HVS, the pixelvalve part being irrelevant to the TXP since it accesses the HVS directly. Now that we have a clear separation between the three parts, we can represent the TXP as a CRTC of its own, leveraging the common CRTC and HVS code, but leaving aside the pixelvalve setup. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20f387f881b57f3474fa42d94cfd8bc1b7b80595.1591882579.git-series.maxime@cerno.tech
2020-07-07drm/vc4: crtc: Move the txp_armed function to the TXPMaxime Ripard
The TXP driver is the only place where we need to set the txp_armed flag, so let's move the function in the TXP driver. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/12b383e7b8462e281b00c0a21b2b50f13691bead.1591882579.git-series.maxime@cerno.tech
2020-07-07drm/vc4: crtc: Move the CRTC initialisation to a separate functionMaxime Ripard
The upcoming patches to turn the TXP into a full-blown CRTC will have the same CRTC initialisation code, so let's move it into a separate, public, function so that we can reuse it later on. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/3a3026c0e7408895d154d8dea454cf6d1c459715.1591882579.git-series.maxime@cerno.tech
2020-07-07drm/vc4: crtc: Only access the PixelValve registers if we have toMaxime Ripard
The CRTC hooks are called both for the TXP and the pixelvalve, yet some will read / write the registers as if the device was a pixelvalve, which won't really work. Let's make sure we only access those registers if we are running on a PixelValve. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/b55e31869304c748920c261eba87b3275dbeb297.1591882579.git-series.maxime@cerno.tech
2020-07-07drm/vc4: crtc: Split CRTC data in twoMaxime Ripard
The vc4_crtc_data structure is currently storing data related to both the general CRTC information needed by the rest of the vc4 driver (like HVS output and available FIFOs) and some related to the pixelvalve attached to that CRTC. Let's split this into two structures so that we can reuse the CRTC part into the TXP later on. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/8eb317c91ac208d7f926d76ad421002fa0364c47.1591882579.git-series.maxime@cerno.tech
2020-07-07drm/vc4: crtc: Make state functions publicMaxime Ripard
We'll need the CRTC state related functions to be exported so that we can reuse them for the TXP. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/658f40aa01d7a45cbf6feebfc3dc6549f100d110.1591882579.git-series.maxime@cerno.tech
2020-07-07drm/vc4: crtc: Move HVS setup code to the HVS driverMaxime Ripard
The CRTC in vc4 is backed by two devices, the HVS that does the composition and the PixelValve that does the timing generation. The writeback is kind of a special case since it doesn't have an associated pixelvalve but goes straight from the HVS to the TXP. Therefore, it makes sense to move out the HVS setup code into helpers so that we can also reuse them from the TXP driver. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/96443394e81429ee38f070cfe231701b07e56d69.1591882579.git-series.maxime@cerno.tech