summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2023-03-10drm/format-helper: Make conversion_buf_size() support sub-byte pixel fmtsJavier Martinez Canillas1-2/+5
There are DRM fourcc formats that have pixels smaller than a byte, but the conversion_buf_size() function assumes that pixels are a multiple of bytes and use the struct drm_format_info .cpp field to calculate the dst_pitch. Instead, calculate it by using the bits per pixel (bpp) and divide it by 8 to account for formats that have sub-byte pixels. Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Arthur Grillo <arthurgrillo@riseup.net> Reviewed-by: Maíra Canal <mcanal@igalia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230307215039.346863-1-javierm@redhat.com
2023-03-09drm/tests: helpers: Drop empty platform remove functionUwe Kleine-König1-6/+0
A remove callback just returning 0 is equivalent to no remove callback at all. So drop the useless function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Maíra Canal <mcanal@igalia.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230224221417.1712368-1-u.kleine-koenig@pengutronix.de
2023-03-09drm/ttm: Don't print error message if eviction was interruptedThomas Hellström1-1/+2
Avoid printing an error message if eviction was interrupted by, for example, the user pressing CTRL-C. That may happen if eviction is waiting for something, like for example a free batch-buffer. Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230307144621.10748-6-thomas.hellstrom@linux.intel.com
2023-03-09drm/ttm: Unexport ttm_global_swapout()Thomas Hellström1-1/+0
Unexport ttm_global_swapout() since it is not used outside of TTM. Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230307144621.10748-5-thomas.hellstrom@linux.intel.com
2023-03-09drm/rockchip: vop2: add polarity flags to RGB outputGerald Loacker1-0/+2
Use h/v-sync and pixel clock polarity flags for RGB output. For all other outputs this is already implemented. Signed-off-by: Gerald Loacker <gerald.loacker@wolfvision.net> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230302123949.957998-1-gerald.loacker@wolfvision.net
2023-03-09drm/rockchip: vop2: use struct_size() in vop2_bindJacob Keller1-1/+1
Use the overflow-protected struct_size() helper macro to compute the allocation size of the vop2 data structure. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Cc: Sandy Huang <hjc@rock-chips.com> Cc: Heiko Stübner <heiko@sntech.de> Cc: David Airlie <airlied@gmail.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230223013533.1707706-1-jacob.e.keller@intel.com
2023-03-09drm/rockchip: dw_hdmi: discard modes with unachievable pixelclocksSascha Hauer1-0/+7
The Rockchip PLL drivers are currently table based and support only the most common pixelclocks. Discard all modes we cannot achieve at all. Normally the desired pixelclocks have an exact match in the PLL driver, nevertheless allow for a 0.1% error just in case. Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com> Tested-by: Michael Riesch <michael.riesch@wolfvision.net> Tested-by: Dan Johansen <strit@manjaro.org> Link: https://lore.kernel.org/r/20230118132213.2911418-4-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230216102447.582905-5-s.hauer@pengutronix.de
2023-03-09drm/rockchip: dw_hdmi: Add support for 4k@30 resolutionSascha Hauer1-0/+8
This adds the PLL/phy settings to support higher resolutions like 4k@30. The values were taken from the Rockchip downstream Kernel. Tested-by: Michael Riesch <michael.riesch@wolfvision.net> Link: https://lore.kernel.org/r/20220926080435.259617-3-s.hauer@pengutronix.de Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com> Tested-by: Dan Johansen <strit@manjaro.org> Link: https://lore.kernel.org/r/20230118132213.2911418-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230216102447.582905-4-s.hauer@pengutronix.de
2023-03-09drm/rockchip: dw_hdmi: relax mode_valid hookSascha Hauer1-7/+19
The driver checks if the pixel clock of the given mode matches an entry in the mpll config table. At least for the Synopsys phy the frequencies in the mpll table are meant as a frequency range up to which the entry works, not as a frequency that must match the pixel clock. Return MODE_OK when the pixelclock is smaller than one of the mpll frequencies to allow for more display resolutions. Limit this behaviour to the Synopsys phy at the moment and keep the current behaviour of forcing exact pixelclock rates for the other phys until it has been sorted out how and if the vendor specific phys work with non standard clock rates. Tested-by: Michael Riesch <michael.riesch@wolfvision.net> Link: https://lore.kernel.org/r/20220926080435.259617-2-s.hauer@pengutronix.de Tested-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com> Tested-by: Dan Johansen <strit@manjaro.org> Link: https://lore.kernel.org/r/20230118132213.2911418-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230216102447.582905-3-s.hauer@pengutronix.de
2023-03-09drm/rockchip: vop: limit maximum resolution to hardware capabilitiesSascha Hauer4-5/+36
The different VOP variants support different maximum resolutions. Reject resolutions that are not supported by a specific variant. This hasn't been a problem in the upstream driver so far as 1920x1080 has been the maximum resolution supported by the HDMI driver and that resolution is supported by all VOP variants. Now with higher resolutions supported in the HDMI driver we have to limit the resolutions to the ones supported by the VOP. The actual maximum resolutions are taken from the Rockchip downstream Kernel. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> [dropped the vdisplay > height check after talking to Sascha, as according to the vendor code "Actually vop hardware has no output height limit" (from vendor commit "drm/rockchip: vop: get rid of max_output.height check") and the height-check broke the px30-minievb display] Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230216102447.582905-2-s.hauer@pengutronix.de
2023-03-08gpu/drm/panel: Add Sony TD4353 JDI panel driverKonrad Dybcio3-0/+340
Add support for the Sony TD4353 JDI 2160x1080 display panel used in some Sony Xperia XZ2 and XZ2 Compact smartphones. Due to the specifics of smartphone manufacturing, it is impossible to retrieve a better name for this panel. This revision adds support for the default 60 Hz configuration, however there could possibly be some room for expansion, as the display panels used on Sony devices have historically been capable of >2x refresh rate overclocking. Signed-off-by: Konrad Dybcio <konrad.dybcio@somainline.org> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230119163201.580858-2-konrad.dybcio@linaro.org
2023-03-08drm: panel: Add orientation support for st7701Maya Matuszczyk1-0/+19
Note that this patch is 'heavily inspired' by orientation support in driver for Elida KD35T133 panel Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230213153816.213526-4-maccraft123mc@gmail.com
2023-03-08drm: panel: Add Elida KD50T048A to Sitronix ST7701 driverMaya Matuszczyk1-0/+125
Add KD50T048A MIPI-DSI panel, which is based on ST7701 chip. Not sure what else to add to this commit message. Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230213153816.213526-3-maccraft123mc@gmail.com
2023-03-07drm/rockchip: dsi: Remove the unused function dsi_read()Jiapeng Chong1-5/+0
The function dsi_read is defined in the dw-mipi-dsi-rockchip.c file, but not called elsewhere, so remove this unused function. drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c:362:19: warning: unused function 'dsi_read'. Reported-by: Abaci Robot <abaci@linux.alibaba.com> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3984 Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Heiko Stuebner <heiko@sntech.de> Link: https://patchwork.freedesktop.org/patch/msgid/20230208023429.73696-1-jiapeng.chong@linux.alibaba.com
2023-03-07drm/nouveau/hwmon: Use sysfs_emit in show function callsbacksDeepak R Varma1-5/+5
According to Documentation/filesystems/sysfs.rst, the show() callback function of kobject attributes should strictly use sysfs_emit() instead of sprintf() family functions. So, make this change. Issue identified using the coccinelle device_attr_show.cocci script. Signed-off-by: Deepak R Varma <drv@mailo.com> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/Y/+pDaHOgG1x8Py2@ubun2204.myguest.virtualbox.org
2023-03-06drm/virtio: Fix handling CONFIG_DRM_VIRTIO_GPU_KMS optionDmitry Osipenko1-8/+10
VirtIO-GPU got a new config option for disabling KMS. There were two problems left unnoticed during review when the new option was added: 1. The IS_ENABLED(CONFIG_DRM_VIRTIO_GPU_KMS) check in the code was inverted, hence KMS was disabled when it should be enabled and vice versa. 2. The disabled KMS crashed kernel with a NULL dereference in drm_kms_helper_hotplug_event(), which shall not be invoked with a disabled KMS. Fix the inverted config option check in the code and skip handling the VIRTIO_GPU_EVENT_DISPLAY sent by host when KMS is disabled in guest to fix the crash. Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Fixes: 72122c69d717 ("drm/virtio: Add option to disable KMS support") Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230306163916.1595961-1-dmitry.osipenko@collabora.com
2023-03-06drm/meson/meson_venc: Relax the supported mode checksCarlo Caione1-2/+2
Relax a bit the supported modes list by including also 480x1920 and 400x1280. This was actually tested on real hardware and it works correctly. Signed-off-by: Carlo Caione <ccaione@baylibre.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230210-relax_dmt_limits-v2-1-318913f08121@baylibre.com
2023-03-05drm: remove outdated doc TODO for subconnector propertySimon Ser1-1/+0
This is already documented under "standard connector properties". Signed-off-by: Simon Ser <contact@emersion.fr> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Noralf Trønnes <noralf@tronnes.org> Cc: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com> Acked-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20230227122522.117580-1-contact@emersion.fr
2023-03-05drm: document connector margin propertiesSimon Ser1-4/+14
Add docs for "{left,right,top,bottom} margin" properties. v2: - Mention the purpose: mitigate underscan on TVs - Move out of analog TV section into standard props (Pekka) - Mention HDMI AVI InfoFrames (Pekka, Ville) Signed-off-by: Simon Ser <contact@emersion.fr> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Noralf Trønnes <noralf@tronnes.org> Cc: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Acked-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230228123156.175973-1-contact@emersion.fr
2023-03-03drm/virtio: Add option to disable KMS supportRob Clark4-9/+35
Add a build option to disable modesetting support. This is useful in cases where the guest only needs to use the GPU in a headless mode, or (such as in the CrOS usage) window surfaces are proxied to a host compositor. As the modesetting ioctls are a big surface area for potential security bugs to be found (it's happened in the past, we should assume it will again in the future), it makes sense to have a build option to disable those ioctls in cases where they serve no legitimate purpose. v2: Use more if (IS_ENABLED(...)) v3: Also permit the host to advertise no scanouts v4: Spiff out commit msg v5: Make num_scanouts==0 and DRM_VIRTIO_GPU_KMS=n behave the same v6: Drop conditionally building virtgpu_display.c and early-out of it's init/fini fxns instead Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230302233506.3146290-1-robdclark@gmail.com
2023-03-03dma-buf: Include missing parentheses to documentationMaíra Canal1-1/+1
The missing parentheses prevents the function to be rendered as a link in the documentation. So, add the missing parentheses to the function on the documentation. Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230223121909.149980-1-mcanal@igalia.com
2023-03-02drm/bridge: tc358762: Set pre_enable_prev_firstDouglas Anderson1-0/+1
Set the "pre_enable_prev_first" as provided by commit 4fb912e5e190 ("drm/bridge: Introduce pre_enable_prev_first to alter bridge init order"). This should allow us to revert commit ec7981e6c614 ("drm/msm/dsi: don't powerup at modeset time for parade-ps8640") and commit 7d8e9a90509f ("drm/msm/dsi: move DSI host powerup to modeset time"). Cc: Dave Stevenson <dave.stevenson@raspberrypi.com> Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Cc: Abhinav Kumar <quic_abhinavk@quicinc.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230131141756.RFT.v2.1.I723a3761d57ea60c5dd754c144aed6c3b2ea6f5a@changeid
2023-03-01drm/radeon: Use the drm suballocation manager implementation.Maarten Lankhorst6-356/+57
Use the generic suballocation helper for radeon. v3: - Select the suballoc helper in Kconfig (Thomas). Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Co-developed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Alex Deucher <alexdeucher@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230224095152.30134-4-thomas.hellstrom@linux.intel.com
2023-03-01drm/amd: Convert amdgpu to use suballocation helper.Maarten Lankhorst6-337/+45
Now that we have a generic suballocation helper, Use it in amdgpu. For lines that get moved or changed, also fix up pre-existing style issues. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Co-developed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230224095152.30134-3-thomas.hellstrom@linux.intel.com
2023-03-01drm/suballoc: Extract amdgpu_sa.c as generic suballocation helperMaarten Lankhorst3-0/+464
Suballocating a buffer object is something that is not driver-specific and useful for many drivers. Use a slightly modified version of amdgpu_sa.c v2: - Style cleanups. - Added / Modified documentation. - Use u64 for the sizes and offset. The code dates back to 2012 and using unsigned int will probably soon come back to bite us. We can consider size_t as well for better 32-bit efficiency. - Add and document gfp, intr and align arguments to drm_suballoc_new(). - Use drm_printer for debug output. v3: - Remove stale author info (Christian König) v4: - Avoid 64-bit integer divisions (kernel test robot <lkp@intel.com>) - Use size_t rather than u64 for the managed range. (Thomas) Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Co-developed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Alex Deucher <alexdeucher@gmail.com> Acked-by: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230224095152.30134-2-thomas.hellstrom@linux.intel.com
2023-03-01drm/edid: Fix csync detailed mode parsingVille Syrjälä1-8/+21
Remove the bogus csync check and replace it with something that: - triggers for all forms of csync, not just the basic analog variant - actually populates the mode csync flags so that drivers can decide what to do with the mode Originally the code tried to outright reject csync, but that apparently broke some bogus LCD monitor that claimed to have a detailed mode that uses analog csync, despite also claiming the monitor only support separate sync: https://bugzilla.redhat.com/show_bug.cgi?id=540024 Potentially that monitor should just be quirked or something. Anyways, what we are dealing with now is some kind of funny i915 JSL machine with eDP where the panel claims to support a sensible 60Hz separate sync mode, and a 50Hz mode with bipolar analog csync. The 50Hz mode does not work so we want to not use it. Easiest way is to just correctly flag it as csync and the driver will reject it. TODO: or should we just reject any form of csync (or at least the analog variants) for digital display interfaces? v2: Grab digital csync polarity from hsync polarity bit (Jani) Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8146 Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230228213610.26283-1-ville.syrjala@linux.intel.com
2023-03-01drm/ast: Rename to_ast_private() to to_ast_device()Thomas Zimmermann7-46/+46
The helper to_ast_private() now upcasts to struct ast_device. Rename it accordingly. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230221155745.27484-5-tzimmermann@suse.de
2023-03-01drm/ast: Rename struct ast_private to struct ast_deviceThomas Zimmermann9-150/+150
The data structure struct ast_private represents an AST device. Its name comes from the time when it was allocated and stored separately in struct drm_device.dev_private. The DRM device is now embedded, so rename struct ast_private to struct ast_device. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230221155745.27484-4-tzimmermann@suse.de
2023-03-01drm/ast: Rework definition of I/O read and write helpersThomas Zimmermann1-34/+14
Ast defines a number of I/O helpers for accessing hardware. Only 4 of the many generated functions are actually used. Replace the respective generator macros with those 4 functions. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230221155745.27484-3-tzimmermann@suse.de
2023-03-01drm/ast: Remove little-endianism from I/O helpersThomas Zimmermann1-1/+3
Replace one call to ast_io_write16() with two calls to ast_io_write8() in ast_set_index_reg(). The combined 16-bit-wide write of an index register and the corresponding data register only works on little- endian systems. Write both registers independent from each other. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230221155745.27484-2-tzimmermann@suse.de
2023-02-28drm/vc4: replace obj lookup steps with drm_gem_objects_lookupMaíra Canal1-41/+2
As vc4_cl_lookup_bos() performs the same steps as drm_gem_objects_lookup(), replace the open-coded implementation in vc4 to simply use the DRM function. Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: André Almeida <andrealmeid@igalia.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230202111943.111757-3-mcanal@igalia.com
2023-02-28drm/vc4: replace drm_gem_dma_object for drm_gem_object in vc4_exec_infoMaíra Canal3-23/+20
The array of BOs that are lookup at the start of exec doesn't need to be instantiated as drm_gem_dma_object, as it doesn't benefit from its attributes. So, simplify the code by replacing the array of drm_gem_dma_object for an array of drm_gem_object in the struct vc4_exec_info. Suggested-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: André Almeida <andrealmeid@igalia.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230202111943.111757-2-mcanal@igalia.com
2023-02-28Revert "drm/shmem-helper: Switch to reservation lock"Thomas Zimmermann5-90/+135
This reverts commit 67b7836d4458790f1261e31fe0ce3250989784f0. The locking appears incomplete. A caller of SHMEM helper's pin function never acquires the dma-buf reservation lock. So we get WARNING: CPU: 3 PID: 967 at drivers/gpu/drm/drm_gem_shmem_helper.c:243 drm_gem_shmem_pin+0x42/0x90 [drm_shmem_helper] Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230228152612.19971-1-tzimmermann@suse.de
2023-02-28drm/connector: print max_requested_bpc in state debugfsHarry Wentland1-0/+1
This is useful to understand the bpc defaults and support of a driver. Signed-off-by: Harry Wentland <harry.wentland@amd.com> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Sebastian Wick <sebastian.wick@redhat.com> Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar <uma.shankar@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Joshua Ashton <joshua@froggi.es> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Reviewed-By: Joshua Ashton <joshua@froggi.es> Link: https://patchwork.freedesktop.org/patch/msgid/20230113162428.33874-3-harry.wentland@amd.com
2023-02-28drm/display: Don't block HDR_OUTPUT_METADATA on unknown EOTFHarry Wentland1-4/+2
The EDID of an HDR display defines EOTFs that are supported by the display and can be set in the HDR metadata infoframe. Userspace is expected to read the EDID and set an appropriate HDR_OUTPUT_METADATA. In drm_parse_hdr_metadata_block the kernel reads the supported EOTFs from the EDID and stores them in the drm_connector->hdr_sink_metadata. While doing so it also filters the EOTFs to the EOTFs the kernel knows about. When an HDR_OUTPUT_METADATA is set it then checks to make sure the EOTF is a supported EOTF. In cases where the kernel doesn't know about a new EOTF this check will fail, even if the EDID advertises support. Since it is expected that userspace reads the EDID to understand what the display supports it doesn't make sense for DRM to block an HDR_OUTPUT_METADATA if it contains an EOTF the kernel doesn't understand. This comes with the added benefit of future-proofing metadata support. If the spec defines a new EOTF there is no need to update DRM and an compositor can immediately make use of it. Bug: https://gitlab.freedesktop.org/wayland/weston/-/issues/609 v2: Distinguish EOTFs defind in kernel and ones defined in EDID in the commit description (Pekka) v3: Rebase; drm_hdmi_infoframe_set_hdr_metadata moved to drm_hdmi_helper.c Signed-off-by: Harry Wentland <harry.wentland@amd.com> Cc: Pekka Paalanen <ppaalanen@gmail.com> Cc: Sebastian Wick <sebastian.wick@redhat.com> Cc: Vitaly.Prosyak@amd.com Cc: Uma Shankar <uma.shankar@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Joshua Ashton <joshua@froggi.es> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: dri-devel@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Reviewed-By: Joshua Ashton <joshua@froggi.es> Link: https://patchwork.freedesktop.org/patch/msgid/20230113162428.33874-2-harry.wentland@amd.com
2023-02-27drm/probe-helper: Cancel previous job before starting new oneDom Cobley1-2/+3
Currently we schedule a call to output_poll_execute from drm_kms_helper_poll_enable for 10s in future. Later we try to replace that in drm_helper_probe_single_connector_modes with a 0s schedule with delayed_event set. But as there is already a job in the queue this fails, and the immediate job we wanted with delayed_event set doesn't occur until 10s later. And that call acts as if connector state has changed, reprobing modes. This has a side effect of waking up a display that has been blanked. Make sure we cancel the old job before submitting the immediate one. Fixes: 162b6a57ac50 ("drm/probe-helper: don't lose hotplug event") Acked-by: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Dom Cobley <popcornmix@gmail.com> [Maxime: Switched to mod_delayed_work] Signed-off-by: Maxime Ripard <maxime@cerno.tech> Link: https://patchwork.freedesktop.org/patch/msgid/20230127154052.452524-1-maxime@cerno.tech
2023-02-27drm/shmem-helper: Switch to reservation lockDmitry Osipenko5-135/+90
Replace all drm-shmem locks with a GEM reservation lock. This makes locks consistent with dma-buf locking convention where importers are responsible for holding reservation lock for all operations performed over dma-bufs, preventing deadlock between dma-buf importers and exporters. Suggested-by: Daniel Vetter <daniel@ffwll.ch> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://lore.kernel.org/all/20230108210445.3948344-8-dmitry.osipenko@collabora.com/
2023-02-27drm/shmem-helper: Don't use vmap_use_count for dma-bufsDmitry Osipenko1-14/+15
DMA-buf core has its own refcounting of vmaps, use it instead of drm-shmem counting. This change prepares drm-shmem for addition of memory shrinker support where drm-shmem will use a single dma-buf reservation lock for all operations performed over dma-bufs. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://lore.kernel.org/all/20230108210445.3948344-7-dmitry.osipenko@collabora.com/
2023-02-27drm/shmem-helper: Switch to use drm_* debug helpersDmitry Osipenko1-16/+22
Ease debugging of a multi-GPU system by using drm_WARN_*() and drm_dbg_kms() helpers that print out DRM device name corresponding to shmem GEM. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://lore.kernel.org/all/20230108210445.3948344-6-dmitry.osipenko@collabora.com/
2023-02-27drm/gem: Add evict() callback to drm_gem_object_funcsDmitry Osipenko1-0/+18
Add new common evict() callback to drm_gem_object_funcs and corresponding drm_gem_object_evict() helper. This is a first step on a way to providing common GEM-shrinker API for DRM drivers. Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de> Suggested-by: Thomas Zimmermann <tzimmermann@suse.de> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://lore.kernel.org/all/20230108210445.3948344-4-dmitry.osipenko@collabora.com/
2023-02-27drm/virtio: use strscpy() to instead of strncpy()Xu Panda1-2/+1
The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/202212070913161959936@zte.com.cn
2023-02-27drm/edid: parse Tiled Display Topology Data Block for DisplayID 2.0Jani Nikula1-1/+10
Currently we only parse the Tiled Display Topology Data Block for DisplayID structure version 1.2, but not 2.0. The contents seem to be the same for both, so expand the parsing to structure version 2.0. Note that DisplayID spec version is not the same as DisplayID structure version; DisplayID 1.3 uses structure version 1.2, and DisplayID 2.0-2.1 use structure version 2.0. Lovely. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230217104627.1360015-1-jani.nikula@intel.com
2023-02-27drm/edid: update non-desktop use also from DisplayIDJani Nikula1-0/+25
Use the DisplayID 2.0 primary use case information to deduce whether this is a head-mounted display, and should not be used for desktop. Cc: Iaroslav Boliukin <iam@lach.pw> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> # HTC VIVE Pro 2 Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/de75b2edddd7d30216e4dd5699a064dc737688f5.1676580180.git.jani.nikula@intel.com
2023-02-27drm/displayid: provide access to DisplayID version and primary use caseJani Nikula1-0/+30
The DisplayID structure version and primary use case are stored in the DisplayID Base Section. We should be checking them in a number of places when parsing the DisplayID blocks. Currently, we completely ignore the primary use case, and just look at the block tags without cross-checking against structure version. Store the version and primary use case in the DisplayID iterator, and provide accessors to them. In general, the information is needed when iterating the blocks, and this is a convenient place to both store and retrieve the information during parsing. Promote using accessors rather than users poking at the iterator directly. Cc: Iaroslav Boliukin <iam@lach.pw> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/ad8a35c109f97ffe115e6b18e4a132b592f11089.1676580180.git.jani.nikula@intel.com
2023-02-27drm/displayid: return struct displayid_header from validate_displayid()Jani Nikula1-9/+8
Avoid figuring out the header pointer multiple times. Cc: Iaroslav Boliukin <iam@lach.pw> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/e840c744d165608a41db5a5e2bd4b0205783c697.1676580180.git.jani.nikula@intel.com
2023-02-27drm/displayid: add displayid_get_header() and check bounds betterJani Nikula1-1/+16
Add a helper to get a pointer to struct displayid_header. To be pedantic, add buffer overflow checks to not touch the base if that itself would overflow. Cc: Iaroslav Boliukin <iam@lach.pw> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/4a03b3a5132642d3cdb6d4c2641422955a917292.1676580180.git.jani.nikula@intel.com
2023-02-24drm/v3d: Use drm_sched_job_add_syncobj_dependency()Maíra Canal1-18/+8
As v3d_job_add_deps() performs the same steps as drm_sched_job_add_syncobj_dependency(), replace the open-coded implementation in v3d in order to simply use the DRM function. Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230209124447.467867-6-mcanal@igalia.com
2023-02-24drm/panfrost: Use drm_sched_job_add_syncobj_dependency()Maíra Canal1-9/+2
As panfrost_copy_in_sync() performs the same steps as drm_sched_job_add_syncobj_dependency(), replace the open-coded implementation in Panfrost in order to simply use the DRM function. Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Signed-off-by: Maíra Canal <mcanal@igalia.com> Reviewed-by: Steven Price <steven.price@arm.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230209124447.467867-5-mcanal@igalia.com
2023-02-24drm/sched: Create wrapper to add a syncobj dependency to jobMaíra Canal1-0/+29
In order to add a syncobj's fence as a dependency to a job, it is necessary to call drm_syncobj_find_fence() to find the fence and then add the dependency with drm_sched_job_add_dependency(). So, wrap these steps in one single function, drm_sched_job_add_syncobj_dependency(). Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Luben Tuikov <luben.tuikov@amd.com> Signed-off-by: Maíra Canal <mcanal@igalia.com> Signed-off-by: Maíra Canal <mairacanal@riseup.net> Link: https://patchwork.freedesktop.org/patch/msgid/20230209124447.467867-2-mcanal@igalia.com
2023-02-23drm/radeon: handle NULL bo->resource in move callbackMatthew Auld1-1/+2
The ttm bo now initially has NULL bo->resource, and leaves the driver the handle that. However it looks like we forgot to handle that for radeon. It looks like this will just null-ptr-deref in radeon_bo_move(), if bo->resource is NULL. Fix this by calling move_null(). Fixes: 180253782038 ("drm/ttm: stop allocating dummy resources during BO creation") Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Christian König <christian.koenig@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230208145319.397235-4-matthew.auld@intel.com Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com>