Re: [Intel-gfx] [PATCH v2 4/4] drm/i915/hdcp: Adjust timeout for read in DPMST Scenario

2023-08-27 Thread Murthy, Arun R
> -Original Message- > From: Kandpal, Suraj > Sent: Wednesday, August 23, 2023 11:28 AM > To: intel-gfx@lists.freedesktop.org > Cc: Nautiyal, Ankit K ; uma.sha...@intel.com; > Murthy, Arun R ; Kandpal, Suraj > > Subject: [PATCH v2 4/4] drm/i915/hdcp: Adjust timeout for read in DPMST >

[Intel-gfx] [PATCH v12 7/8] drm/i915/vdsc: Fill the intel_dsc_get_pps_config function

2023-08-27 Thread Suraj Kandpal
We have setup both the read and write functions so we can move ahead and fill in all the readout state from PPS register into the crtc_state so we can send it for comparision. --v2 -Shorten comment to just PPSX rather than having the whole "Readout PPSX register" [Jani] -Remove pps_temp

[Intel-gfx] [PATCH v12 8/8] drm/i915/display: Compare the readout dsc pps params

2023-08-27 Thread Suraj Kandpal
With the dsc config being readout and filled in crtc_state add macros and use them to compare current and previous PPS param in DSC. --v2 -Remove version check [Jani] -Remove dupe macro for dsc pipe compare and use the existing ones [Jani] Signed-off-by: Suraj Kandpal Reviewed-by: Ankit

[Intel-gfx] [PATCH v12 6/8] drm/i915/vdsc: Remove unused dsc registers

2023-08-27 Thread Suraj Kandpal
Now that we have macros that can fetch dsc register values based on pipe and pps parameters we can go ahead and remove all the unused register. Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal --- .../gpu/drm/i915/display/intel_vdsc_regs.h| 251 ++ 1 file changed,

[Intel-gfx] [PATCH v12 4/8] drm/i915/vdsc: Add function to read any PPS register

2023-08-27 Thread Suraj Kandpal
Add function to read any PPS register based on the intel_dsc_pps enum provided. Add a function which will call the new pps read function and place it in crtc state. Only PPS0 and PPS1 are readout the rest of the registers will be read in upcoming patches. --v2 -Changes in read function as PPS

[Intel-gfx] [PATCH v12 5/8] drm/i915/vdsc: Add function to write in PPS register

2023-08-27 Thread Suraj Kandpal
Now that we have a function that reads any PPS register based on intel_dsc_pps enum provided lets create a function that can write on any PPS. --v2 -Changes need as PPS enum was dropped -Remove duplicated code in intel_dsc_write_pps_reg [Jani] --v3 -Use dsc_split instead of num_vdsc_instances

[Intel-gfx] [PATCH v12 3/8] drm/i915/vdsc: Add func to get no. of vdsc instances per pipe

2023-08-27 Thread Suraj Kandpal
We have a function that gets us the total of the vdsc engines being used but not the no. of vdsc instances being used by each pipe. --v6 -Change function to static --v7 -Shorten name to intel_dsc_get_vdsc_per_pipe Signed-off-by: Suraj Kandpal Reviewed-by: Ankit Nautiyal ---

[Intel-gfx] [PATCH v12 2/8] drm/i915/vdsc: Add a check for dsc split cases

2023-08-27 Thread Suraj Kandpal
In intel_vdsc_get_config we only read the primary dsc engine register and not take into account if the other dsc engine is in use and if both registers have the same value or not this patche fixes that by adding a check. --v3 -Remove superfluos new line [Jani] -Fix register naming [Jani] --v5

[Intel-gfx] [PATCH v12 1/8] drm/i915/vdsc: Refactor dsc register field macro

2023-08-27 Thread Suraj Kandpal
This patch refactors dsc register related macros that prepares the values to be written in the register. The current bit shifting looks bad and going forward will not serve our purpose to readout dsc register field values the change was suggested by Jani Nikula. Cc: Jani Nikula Signed-off-by:

[Intel-gfx] [PATCH v12 0/8] Add DSC PPS readout

2023-08-27 Thread Suraj Kandpal
Up until now we only verified one or two of the dsc pps params like bits_per_component and bits_per_pixel this patch series aim to readout almost all PPS param and get them compared. Along with that some work on making a common function to read and write PPS param regiters is also done. --v2

[Intel-gfx] [PATCH 5/6] drm/i915: Adjust seamless_m_n flag behaviour

2023-08-27 Thread Ville Syrjala
From: Ville Syrjälä Make the seamless_m_n flag more like the update_pipe fastset flag, ie. the flag will only be set if we need to do the seamless M/N update, and in all other cases the flag is cleared. Also rename the flag to update_m_n to make it more clear it's similar to update_pipe. I

[Intel-gfx] [PATCH 6/6] drm/i915: Optimize out redundant M/N updates

2023-08-27 Thread Ville Syrjala
From: Ville Syrjälä Don't perform a seamless M/N update if the values aren't actually changing. This avoids doing extra shenanigans during vblank evasion needlessly. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 4 +++- 1 file changed, 3 insertions(+), 1

[Intel-gfx] [PATCH 0/6] drm/i915: VRR and M/N stuff

2023-08-27 Thread Ville Syrjala
From: Ville Syrjälä Some prep work towards reconciling VRR and M/N. I think after these we coukd try VRR fastsets that alter the state of the VRR registers, assuming we toggle VRR off and on around the update. Cc: Manasi Navare Ville Syrjälä (6): drm/i915: Move psr unlock out from the pipe

[Intel-gfx] [PATCH 4/6] drm/i915: Enable VRR later during fastsets

2023-08-27 Thread Ville Syrjala
From: Ville Syrjälä In order to reconcile seamless M/N updates with VRR we'll need to defer the fastset VRR enable to happen after the seamless M/N update (which happens during the vblank evade critical section). So just push the VRR enable to be the last thing during the update. This will also

[Intel-gfx] [PATCH 3/6] drm/i915: Extract intel_crtc_vblank_evade_scanlines()

2023-08-27 Thread Ville Syrjala
From: Ville Syrjälä Pull the vblank evasion scanline calculations into their own helper to declutter intel_pipe_update_start() a bit. Cc: Manasi Navare Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_crtc.c | 53 +-- 1 file changed, 31 insertions(+),

[Intel-gfx] [PATCH 2/6] drm/i915: Change intel_pipe_update_{start, end}() calling convention

2023-08-27 Thread Ville Syrjala
From: Ville Syrjälä We'll need to also look at the old crtc state in intel_pipe_update_start() so change the calling convention to just plumb in the full atomic state instead. Cc: Manasi Navare Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_crtc.c| 18

[Intel-gfx] [PATCH 1/6] drm/i915: Move psr unlock out from the pipe update critical section

2023-08-27 Thread Ville Syrjala
From: Ville Syrjälä Do the PSR unlock after the vblank evade critcal section is fully over, not before. Cc: Manasi Navare Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_crtc.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git

Re: [Intel-gfx] [PATCH v2 3/4] drm/i915: Add new frontbuffer tracking interface to queue flush

2023-08-27 Thread Ville Syrjälä
On Thu, Jul 27, 2023 at 08:35:17AM +0300, Jouni Högander wrote: > We want to wait dma fences in dirtyfb ioctl. As we don't want to make > dirtyfb ioctl as blocking call we need to use > dma_fence_add_callback. Callback used for dma_fence_add_callback is > called from atomic context. Due to this we

Re: [Intel-gfx] [PATCH 6/9] drm/i915/dsc/mtl: Add support for fractional bpp

2023-08-27 Thread Kandpal, Suraj
> Subject: RE: [Intel-gfx] [PATCH 6/9] drm/i915/dsc/mtl: Add support for > fractional > bpp > > > Subject: [Intel-gfx] [PATCH 6/9] drm/i915/dsc/mtl: Add support for > > fractional bpp > > > > From: Vandita Kulkarni > > > > Consider the fractional bpp while reading the qp values. > > > > v2: Use

[Intel-gfx] ✓ Fi.CI.IGT: success for Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3)

2023-08-27 Thread Patchwork
== Series Details == Series: Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3) URL : https://patchwork.freedesktop.org/series/114671/ State : success == Summary == CI Bug Log - changes from CI_DRM_13569_full -> Patchwork_114671v3_full

[Intel-gfx] ✓ Fi.CI.BAT: success for Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3)

2023-08-27 Thread Patchwork
== Series Details == Series: Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3) URL : https://patchwork.freedesktop.org/series/114671/ State : success == Summary == CI Bug Log - changes from CI_DRM_13569 -> Patchwork_114671v3

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3)

2023-08-27 Thread Patchwork
== Series Details == Series: Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3) URL : https://patchwork.freedesktop.org/series/114671/ State : warning == Summary == Error: dim sparse failed /home/kbuild2/linux/maintainer-tools/dim: line 50: /home/kbuild2/.dimrc: No

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3)

2023-08-27 Thread Patchwork
== Series Details == Series: Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers (rev3) URL : https://patchwork.freedesktop.org/series/114671/ State : warning == Summary == Error: dim checkpatch failed /home/kbuild2/linux/maintainer-tools/dim: line 50: /home/kbuild2/.dimrc: No

[Intel-gfx] [PATCH v15 15/23] drm/shmem-helper: Switch drm_gem_shmem_vmap/vunmap to use pin/unpin

2023-08-27 Thread Dmitry Osipenko
The vmapped pages shall be pinned in memory and previously get/put_pages() were implicitly hard-pinning/unpinning the pages. This will no longer be the case with addition of memory shrinker because pages_use_count > 0 won't determine anymore whether pages are hard-pinned (they will be

[Intel-gfx] [PATCH v15 21/23] drm/virtio: Attach shmem BOs dynamically

2023-08-27 Thread Dmitry Osipenko
Prepare for addition of memory shrinker support by attaching shmem pages to host dynamically on first use. The attachment vq command wasn't fenced and there was no vq kick made in the BO creation code path, hence the the attachment already was happening dynamically, but implicitly. Making

[Intel-gfx] [PATCH v15 22/23] drm/virtio: Support memory shrinking

2023-08-27 Thread Dmitry Osipenko
Support generic drm-shmem memory shrinker and add new madvise IOCTL to the VirtIO-GPU driver. BO cache manager of Mesa driver will mark BOs as "don't need" using the new IOCTL to let shrinker purge the marked BOs on OOM, the shrinker will also evict unpurgeable shmem BOs from memory if guest

[Intel-gfx] [PATCH v15 18/23] drm/shmem-helper: Add memory shrinker

2023-08-27 Thread Dmitry Osipenko
Introduce common drm-shmem shrinker for DRM drivers. To start using drm-shmem shrinker drivers should do the following: 1. Implement evict() callback of GEM object where driver should check whether object is purgeable or evictable using drm-shmem helpers and perform the shrinking action

[Intel-gfx] [PATCH v15 23/23] drm/panfrost: Switch to generic memory shrinker

2023-08-27 Thread Dmitry Osipenko
Replace Panfrost's custom memory shrinker with a common drm-shmem memory shrinker. Tested-by: Steven Price # Firefly-RK3288 Reviewed-by: Steven Price Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/panfrost/Makefile | 1 - drivers/gpu/drm/panfrost/panfrost_device.h| 4 -

[Intel-gfx] [PATCH v15 14/23] drm/shmem-helper: Add and use lockless drm_gem_shmem_get_pages()

2023-08-27 Thread Dmitry Osipenko
Add lockless drm_gem_shmem_get_pages() helper that skips taking reservation lock if pages_use_count is non-zero, leveraging from atomicity of the kref counter. Make drm_gem_shmem_mmap() to utilize the new helper. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko ---

[Intel-gfx] [PATCH v15 19/23] drm/shmem-helper: Export drm_gem_shmem_get_pages_sgt_locked()

2023-08-27 Thread Dmitry Osipenko
Export drm_gem_shmem_get_pages_sgt_locked() that will be used by virtio-gpu shrinker during GEM swap-in operation done under the held reservation lock. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 ++- include/drm/drm_gem_shmem_helper.h | 1 + 2 files

[Intel-gfx] [PATCH v15 17/23] drm/shmem-helper: Add and use drm_gem_shmem_resv_assert_held() helper

2023-08-27 Thread Dmitry Osipenko
In a preparation of adding drm-shmem memory shrinker, move all reservation locking lockdep checks to use new drm_gem_shmem_resv_assert_held() that will resolve spurious lockdep warning about wrong locking order vs fs_reclam code paths during freeing of shmem GEM, where lockdep isn't aware that

[Intel-gfx] [PATCH v15 20/23] drm/virtio: Pin display framebuffer BO

2023-08-27 Thread Dmitry Osipenko
Prepare to addition of memory shrinker support by pinning display framebuffer BO pages in memory while they are in use by display on host. Shrinker is free to relocate framebuffer BO pages if it doesn't know that pages are in use, thus pin the pages to disallow shrinker to move them. Acked-by:

[Intel-gfx] [PATCH v15 08/23] drm/shmem-helper: Refactor locked/unlocked functions

2023-08-27 Thread Dmitry Osipenko
Add locked and remove unlocked postfixes from drm-shmem function names, making names consistent with the drm/gem core code. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c| 64 +-- drivers/gpu/drm/lima/lima_gem.c

[Intel-gfx] [PATCH v15 09/23] drm/shmem-helper: Remove obsoleted is_iomem test

2023-08-27 Thread Dmitry Osipenko
Everything that uses the mapped buffer should by agnostic to is_iomem. The only reason for the is_iomem test is that we're setting shmem->vaddr to the returned map->vaddr. Now that the shmem->vaddr code is gone, remove the obsoleted is_iomem test to clean up the code. Suggested-by: Thomas

[Intel-gfx] [PATCH v15 16/23] drm/shmem-helper: Use kref for vmap_use_count

2023-08-27 Thread Dmitry Osipenko
Use kref helper for vmap_use_count to make refcounting consistent with pages_use_count and pages_pin_count that use kref. This will allow to optimize unlocked vmappings by skipping reservation locking if refcnt > 1. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko ---

[Intel-gfx] [PATCH v15 12/23] drm/shmem-helper: Add and use pages_pin_count

2023-08-27 Thread Dmitry Osipenko
Add separate pages_pin_count for tracking of whether drm-shmem pages are moveable or not. With the addition of memory shrinker support to drm-shmem, the pages_use_count will no longer determine whether pages are hard-pinned in memory, but whether pages exit and are soft-pinned (and could be

[Intel-gfx] [PATCH v15 04/23] drm/gem: Add _locked postfix to functions that have unlocked counterpart

2023-08-27 Thread Dmitry Osipenko
Add _locked postfix to drm_gem functions that have unlocked counterpart functions to make GEM functions naming more consistent and intuitive in regards to the locking requirements. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem.c | 6 +++---

[Intel-gfx] [PATCH v15 06/23] drm/virtio: Replace drm_gem_shmem_free() with drm_gem_object_put()

2023-08-27 Thread Dmitry Osipenko
Prepare virtio_gpu_object_create() to addition of memory shrinker support by replacing open-coded drm_gem_shmem_free() with drm_gem_object_put() that decrements GEM refcount to 0, which becomes important for drm-shmem because it will start to use GEM's refcount during the shmem's BO freeing time

[Intel-gfx] [PATCH v15 13/23] drm/shmem-helper: Use kref for pages_use_count

2023-08-27 Thread Dmitry Osipenko
Use atomic kref helper for pages_use_count to optimize pin/unpin functions by skipping reservation locking while GEM's pin refcount > 1. Suggested-by: Boris Brezillon Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 48 ++---

[Intel-gfx] [PATCH v15 11/23] dma-resv: Add kref_put_dma_resv()

2023-08-27 Thread Dmitry Osipenko
Add simple kref_put_dma_resv() helper that wraps around kref_put_ww_mutex() for drivers that needs to lock dma-resv on kref_put(). It's not possible to easily add this helper to kref.h because of the headers inclusion dependency, hence add it to dma-resv.h. Signed-off-by: Dmitry Osipenko ---

[Intel-gfx] [PATCH v15 05/23] drm/v3d: Replace open-coded drm_gem_shmem_free() with drm_gem_object_put()

2023-08-27 Thread Dmitry Osipenko
The drm_gem_shmem_free() doesn't put GEM's kref to zero, which becomes important with addition of the shrinker support to drm-shmem that will use kref=0 in order to prevent taking lock during special GEM-freeing time in order to avoid spurious lockdep warning about locking ordering vs fs_reclaim

[Intel-gfx] [PATCH v15 10/23] locking/refcount, kref: Add kref_put_ww_mutex()

2023-08-27 Thread Dmitry Osipenko
Introduce kref_put_ww_mutex() helper that will handle the wait-wound mutex auto-locking on kref_put(). This helper is wanted by DRM drivers that extensively use dma-reservation locking which in turns uses ww-mutex. Signed-off-by: Dmitry Osipenko --- include/linux/kref.h | 12

[Intel-gfx] [PATCH v15 07/23] drm/shmem-helper: Make all exported symbols GPL

2023-08-27 Thread Dmitry Osipenko
Make all drm-shmem exported symbols GPL to make them consistent with the rest of drm-shmem symbols. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/drm_gem_shmem_helper.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git

[Intel-gfx] [PATCH v15 03/23] drm/gem: Change locked/unlocked postfix of drm_gem_v/unmap() function names

2023-08-27 Thread Dmitry Osipenko
Make drm/gem API function names consistent by having locked function use the _locked postfix in the name, while the unlocked variants don't use the _unlocked postfix. Rename drm_gem_v/unmap() function names to make them consistent with the rest of the API functions. Suggested-by: Boris Brezillon

[Intel-gfx] [PATCH v15 01/23] drm/shmem-helper: Fix UAF in error path when freeing SGT of imported GEM

2023-08-27 Thread Dmitry Osipenko
Freeing drm-shmem GEM right after creating it using drm_gem_shmem_prime_import_sg_table() frees SGT of the imported dma-buf and then dma-buf frees this SGT second time. The v3d_prime_import_sg_table() is example of a error code path where dma-buf's SGT is freed by drm-shmem and then it's freed

[Intel-gfx] [PATCH v15 02/23] drm/shmem-helper: Use flag for tracking page count bumped by get_pages_sgt()

2023-08-27 Thread Dmitry Osipenko
Use separate flag for tracking page count bumped by shmem->sgt to avoid imbalanced page counter during of drm_gem_shmem_free() time. It's fragile to assume that populated shmem->pages at a freeing time means that the count was bumped by drm_gem_shmem_get_pages_sgt(), using a flag removes the

[Intel-gfx] [PATCH v15 00/23] Add generic memory shrinker to VirtIO-GPU and Panfrost DRM drivers

2023-08-27 Thread Dmitry Osipenko
This series: 1. Adds common drm-shmem memory shrinker 2. Enables shrinker for VirtIO-GPU driver 3. Switches Panfrost driver to the common shrinker Changelog: v15:- Moved drm-shmem reference counters to use kref that allows to optimize unlocked functions, like was suggested by Boris