Patch "drm: add drm_gem_object_is_shared_for_memory_stats() helper" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm: add drm_gem_object_is_shared_for_memory_stats() helper

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-add-drm_gem_object_is_shared_for_memory_stats-he.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 20d98716f2ddccaf0c08ef3edeb921836b32d8d9
Author: Alex Deucher <alexander.deucher@xxxxxxx>
Date:   Mon Feb 12 16:04:24 2024 -0500

    drm: add drm_gem_object_is_shared_for_memory_stats() helper
    
    [ Upstream commit b31f5eba32ae8cc28e7cfa5a55ec8670d8c718e2 ]
    
    Add a helper so that drm drivers can consistently report
    shared status via the fdinfo shared memory stats interface.
    
    In addition to handle count, show buffers as shared if they
    are shared via dma-buf as well (e.g., shared with v4l or some
    other subsystem).
    
    v2: switch to inline function
    
    Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@xxxxxxx/
    Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx> (v1)
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Reviewed-by: Christian König <christian.keonig@xxxxxxx>
    Signed-off-by: Christian König <christian.koenig@xxxxxxx>
    Stable-dep-of: a6ff969fe9cb ("drm/amdgpu: fix visible VRAM handling during faults")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
index bc9f6aa2f3fec..7c2ec139c464a 100644
--- a/include/drm/drm_gem.h
+++ b/include/drm/drm_gem.h
@@ -544,6 +544,19 @@ unsigned long drm_gem_lru_scan(struct drm_gem_lru *lru,
 
 int drm_gem_evict(struct drm_gem_object *obj);
 
+/**
+ * drm_gem_object_is_shared_for_memory_stats - helper for shared memory stats
+ *
+ * This helper should only be used for fdinfo shared memory stats to determine
+ * if a GEM object is shared.
+ *
+ * @obj: obj in question
+ */
+static inline bool drm_gem_object_is_shared_for_memory_stats(struct drm_gem_object *obj)
+{
+	return (obj->handle_count > 1) || obj->dma_buf;
+}
+
 #ifdef CONFIG_LOCKDEP
 /**
  * drm_gem_gpuva_set_lock() - Set the lock protecting accesses to the gpuva list.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux