mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

non-drm: rust: - make ETIMEDOUT available - add size constants up to SZ_2G - add DMA coherent allocation bindings mtd: - driver for Intel GPU non-volatile storage i2c - designware quirk for Intel xe core: - atomic helpers: tune enable/disable sequences - add task info to wedge API - refactor EDID quirks - connector: move HDR sink to drm_display_info - fourcc: half-float and 32-bit float formats - mode_config: pass format info to simplify dma-buf: - heaps: Give CMA heap a stable name ci: - add device tree validation and kunit displayport: - change AUX DPCD access probe address - add quirk for DPCD probe - add panel replay definitions - backlight control helpers fbdev: - make CONFIG_FIRMWARE_EDID available on all arches fence: - fix UAF issues format-helper: - improve tests gpusvm: - introduce devmem only flag for allocation - add timeslicing support to GPU SVM ttm: - improve eviction sched: - tracing improvements - kunit improvements - memory leak fixes - reset handling improvements color mgmt: - add hardware gamma LUT handling helpers bridge: - add destroy hook - switch to reference counted drm_bridge allocations - tc358767: convert to devm_drm_bridge_alloc - improve CEC handling panel: - switch to reference counter drm_panel allocations - fwnode panel lookup - Huiling hl055fhv028c support - Raspberry Pi 7" 720x1280 support - edp: KDC KD116N3730A05, N160JCE-ELL CMN, N116BCJ-EAK - simple: AUO P238HAN01 - st7701: Winstar wf40eswaa6mnn0 - visionox: rm69299-shift - Renesas R61307, Renesas R69328 support - DJN HX83112B hdmi: - add CEC handling - YUV420 output support xe: - WildCat Lake support - Enable PanthorLake by default - mark BMG as SRIOV capable - update firmware recommendations - Expose media OA units - aux-bux support for non-volatile memory - MTD intel-dg driver for non-volatile memory - Expose fan control and voltage regulator in sysfs - restructure migration for multi-device - Restore GuC submit UAF fix - make GEM shrinker drm managed - SRIOV VF Post-migration recovery of GGTT nodes - W/A additions/reworks - Prefetch support for svm ranges - Don't allocate managed BO for each policy change - HWMON fixes for BMG - Create LRC BO without VM - PCI ID updates - make SLPC debugfs files optional - rework eviction rejection of bound external BOs - consolidate PAT programming logic for pre/post Xe2 - init changes for flicker-free boot - Enable GuC Dynamic Inhibit Context switch i915: - drm_panic support for i915/xe - initial flip queue off by default for LNL/PNL - Wildcat Lake Display support - Support for DSC fractional link bpp - Support for simultaneous Panel Replay and Adaptive sync - Support for PTL+ double buffer LUT - initial PIPEDMC event handling - drm_panel_follower support - DPLL interface renames - allocate struct intel_display dynamically - flip queue preperation - abstract DRAM detection better - avoid GuC scheduling stalls - remove DG1 force probe requirement - fix MEI interrupt handler on RT kernels - use backlight control helpers for eDP - more shared display code refactoring amdgpu: - add userq slot to INFO ioctl - SR-IOV hibernation support - Suspend improvements - Backlight improvements - Use scaling for non-native eDP modes - cleaner shader updates for GC 9.x - Remove fence slab - SDMA fw checks for userq support - RAS updates - DMCUB updates - DP tunneling fixes - Display idle D3 support - Per queue reset improvements - initial smartmux support amdkfd: - enable KFD on loongarch - mtype fix for ext coherent system memory radeon: - CS validation additional GL extensions - drop console lock during suspend/resume - bump driver version msm: - VM BIND support - CI: infrastructure updates - UBWC single source of truth - decouple GPU and KMS support - DP: rework I/O accessors - DPU: SM8750 support - DSI: SM8750 support - GPU: X1-45 support and speedbin support for X1-85 - MDSS: SM8750 support nova: - register! macro improvements - DMA object abstraction - VBIOS parser + fwsec lookup - sysmem flush page support - falcon: generic falcon boot code and HAL - FWSEC-FRTS: fb setup and load/execute ivpu: - Add Wildcat Lake support - Add turbo flag ast: - improve hardware generations implementation imx: - IMX8qxq Display Controller support lima: - Rockchip RK3528 GPU support nouveau: - fence handling cleanup panfrost: - MT8370 support - bo labeling - 64-bit register access qaic: - add RAS support rockchip: - convert inno_hdmi to a bridge rz-du: - add RZ/V2H(P) support - MIPI-DSI DCS support sitronix: - ST7567 support sun4i: - add H616 support tidss: - add TI AM62L support - AM65x OLDI bridge support bochs: - drm panic support vkms: - YUV and R* format support - use faux device vmwgfx: - fence improvements hyperv: - move out of simple - add drm_panic support -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEEKbZHaGwW9KfbeusDHTzWXnEhr4FAmiJM/0ACgkQDHTzWXnE hr6MpA/+JJKGdSdrE95QkaMcOZh/3e3areGXZ0V/RrrJXdB4/DoAfQSHhF0H7m7y MhBGVLGNMXq7KHrz28p1MjLHrE1mwmvJ6hZ4J076ed4u9naoCD0m6k5w5wiue+KL HyPR54ADxN0BYmgV0l/B0wj42KsHyTO4x4hdqPJu02V9Dtmx6FCh2ujkOF3p9nbK GMwWDttl4KEKljD0IvQ9YIYJ66crYGx/XmZi7JoWRrS104K/h1u8qZuXBp5jVKTy OZRAVyLdmJqdTOLH7l599MBBcEd/bNV37/LVwF4T5iFunEKOAiyN0QY0OR+IeRVh ZfOv2/gp4UNyIfyahQ7LKLgEilNPGHoPitvDJPvBZxW2UjwXVNvA1QfdK5DAlVRS D5NoFRjlFFCz8/c2hQwlKJ9o7eVgH3/pK0mwR7SPGQTuqzLFCrAfCuzUvg/gV++6 JFqmGKMHeCoxO2o4GMrwjFttStP41usxtV/D+grcbPteNO9UyKJS4C38n4eamJXM a9Sy9APuAb6F0w5+yMItEF7TQifgmhIbm5AZHlxE1KoDQV6TdiIf1Gou5LeDGoL6 OACbXHJPL52tUnfCRpbfI4tE/IVyYsfL01JnvZ5cZZWItXfcIz76ykJri+E0G60g yRl/zkimHKO4B0l/HSzal5xROXr+3VzeWehEiz/ot1VriP5OesA= =n9MO -----END PGP SIGNATURE----- Merge tag 'drm-next-2025-07-30' of https://gitlab.freedesktop.org/drm/kernel Pull drm updates from Dave Airlie: "Highlights: - Intel xe enable Panthor Lake, started adding WildCat Lake - amdgpu has a bunch of reset improvments along with the usual IP updates - msm got VM_BIND support which is important for vulkan sparse memory - more drm_panic users - gpusvm common code to handle a bunch of core SVM work outside drivers. Detail summary: Changes outside drm subdirectory: - 'shrink_shmem_memory()' for better shmem/hibernate interaction - Rust support infrastructure: - make ETIMEDOUT available - add size constants up to SZ_2G - add DMA coherent allocation bindings - mtd driver for Intel GPU non-volatile storage - i2c designware quirk for Intel xe core: - atomic helpers: tune enable/disable sequences - add task info to wedge API - refactor EDID quirks - connector: move HDR sink to drm_display_info - fourcc: half-float and 32-bit float formats - mode_config: pass format info to simplify dma-buf: - heaps: Give CMA heap a stable name ci: - add device tree validation and kunit displayport: - change AUX DPCD access probe address - add quirk for DPCD probe - add panel replay definitions - backlight control helpers fbdev: - make CONFIG_FIRMWARE_EDID available on all arches fence: - fix UAF issues format-helper: - improve tests gpusvm: - introduce devmem only flag for allocation - add timeslicing support to GPU SVM ttm: - improve eviction sched: - tracing improvements - kunit improvements - memory leak fixes - reset handling improvements color mgmt: - add hardware gamma LUT handling helpers bridge: - add destroy hook - switch to reference counted drm_bridge allocations - tc358767: convert to devm_drm_bridge_alloc - improve CEC handling panel: - switch to reference counter drm_panel allocations - fwnode panel lookup - Huiling hl055fhv028c support - Raspberry Pi 7" 720x1280 support - edp: KDC KD116N3730A05, N160JCE-ELL CMN, N116BCJ-EAK - simple: AUO P238HAN01 - st7701: Winstar wf40eswaa6mnn0 - visionox: rm69299-shift - Renesas R61307, Renesas R69328 support - DJN HX83112B hdmi: - add CEC handling - YUV420 output support xe: - WildCat Lake support - Enable PanthorLake by default - mark BMG as SRIOV capable - update firmware recommendations - Expose media OA units - aux-bux support for non-volatile memory - MTD intel-dg driver for non-volatile memory - Expose fan control and voltage regulator in sysfs - restructure migration for multi-device - Restore GuC submit UAF fix - make GEM shrinker drm managed - SRIOV VF Post-migration recovery of GGTT nodes - W/A additions/reworks - Prefetch support for svm ranges - Don't allocate managed BO for each policy change - HWMON fixes for BMG - Create LRC BO without VM - PCI ID updates - make SLPC debugfs files optional - rework eviction rejection of bound external BOs - consolidate PAT programming logic for pre/post Xe2 - init changes for flicker-free boot - Enable GuC Dynamic Inhibit Context switch i915: - drm_panic support for i915/xe - initial flip queue off by default for LNL/PNL - Wildcat Lake Display support - Support for DSC fractional link bpp - Support for simultaneous Panel Replay and Adaptive sync - Support for PTL+ double buffer LUT - initial PIPEDMC event handling - drm_panel_follower support - DPLL interface renames - allocate struct intel_display dynamically - flip queue preperation - abstract DRAM detection better - avoid GuC scheduling stalls - remove DG1 force probe requirement - fix MEI interrupt handler on RT kernels - use backlight control helpers for eDP - more shared display code refactoring amdgpu: - add userq slot to INFO ioctl - SR-IOV hibernation support - Suspend improvements - Backlight improvements - Use scaling for non-native eDP modes - cleaner shader updates for GC 9.x - Remove fence slab - SDMA fw checks for userq support - RAS updates - DMCUB updates - DP tunneling fixes - Display idle D3 support - Per queue reset improvements - initial smartmux support amdkfd: - enable KFD on loongarch - mtype fix for ext coherent system memory radeon: - CS validation additional GL extensions - drop console lock during suspend/resume - bump driver version msm: - VM BIND support - CI: infrastructure updates - UBWC single source of truth - decouple GPU and KMS support - DP: rework I/O accessors - DPU: SM8750 support - DSI: SM8750 support - GPU: X1-45 support and speedbin support for X1-85 - MDSS: SM8750 support nova: - register! macro improvements - DMA object abstraction - VBIOS parser + fwsec lookup - sysmem flush page support - falcon: generic falcon boot code and HAL - FWSEC-FRTS: fb setup and load/execute ivpu: - Add Wildcat Lake support - Add turbo flag ast: - improve hardware generations implementation imx: - IMX8qxq Display Controller support lima: - Rockchip RK3528 GPU support nouveau: - fence handling cleanup panfrost: - MT8370 support - bo labeling - 64-bit register access qaic: - add RAS support rockchip: - convert inno_hdmi to a bridge rz-du: - add RZ/V2H(P) support - MIPI-DSI DCS support sitronix: - ST7567 support sun4i: - add H616 support tidss: - add TI AM62L support - AM65x OLDI bridge support bochs: - drm panic support vkms: - YUV and R* format support - use faux device vmwgfx: - fence improvements hyperv: - move out of simple - add drm_panic support" * tag 'drm-next-2025-07-30' of https://gitlab.freedesktop.org/drm/kernel: (1479 commits) drm/tidss: oldi: convert to devm_drm_bridge_alloc() API drm/tidss: encoder: convert to devm_drm_bridge_alloc() drm/amdgpu: move reset support type checks into the caller drm/amdgpu/sdma7: re-emit unprocessed state on ring reset drm/amdgpu/sdma6: re-emit unprocessed state on ring reset drm/amdgpu/sdma5.2: re-emit unprocessed state on ring reset drm/amdgpu/sdma5: re-emit unprocessed state on ring reset drm/amdgpu/gfx12: re-emit unprocessed state on ring reset drm/amdgpu/gfx11: re-emit unprocessed state on ring reset drm/amdgpu/gfx10: re-emit unprocessed state on ring reset drm/amdgpu/gfx9.4.3: re-emit unprocessed state on kcq reset drm/amdgpu/gfx9: re-emit unprocessed state on kcq reset drm/amdgpu: Add WARN_ON to the resource clear function drm/amd/pm: Use cached metrics data on SMUv13.0.6 drm/amd/pm: Use cached data for min/max clocks gpu: nova-core: fix bounds check in PmuLookupTableEntry::new drm/amdgpu: Replace HQD terminology with slots naming drm/amdgpu: Add user queue instance count in HW IP info drm/amd/amdgpu: Add helper functions for isp buffers drm/amd/amdgpu: Initialize swnode for ISP MFD device ...
350 lines
8.6 KiB
C
350 lines
8.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0 OR MIT */
|
|
/*
|
|
* Copyright (c) 2021-2024 Broadcom. All Rights Reserved. The term
|
|
* “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person
|
|
* obtaining a copy of this software and associated documentation
|
|
* files (the "Software"), to deal in the Software without
|
|
* restriction, including without limitation the rights to use, copy,
|
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
* of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be
|
|
* included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*
|
|
*/
|
|
|
|
#include "vmwgfx_bo.h"
|
|
#include "vmwgfx_drv.h"
|
|
|
|
#include "drm/drm_prime.h"
|
|
#include "drm/drm_gem_ttm_helper.h"
|
|
|
|
#include <linux/debugfs.h>
|
|
|
|
static void vmw_gem_object_free(struct drm_gem_object *gobj)
|
|
{
|
|
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(gobj);
|
|
if (bo)
|
|
ttm_bo_put(bo);
|
|
}
|
|
|
|
static int vmw_gem_object_open(struct drm_gem_object *obj,
|
|
struct drm_file *file_priv)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static void vmw_gem_object_close(struct drm_gem_object *obj,
|
|
struct drm_file *file_priv)
|
|
{
|
|
}
|
|
|
|
static int vmw_gem_object_pin(struct drm_gem_object *obj)
|
|
{
|
|
struct vmw_bo *vbo = to_vmw_bo(obj);
|
|
|
|
vmw_bo_pin_reserved(vbo, true);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void vmw_gem_object_unpin(struct drm_gem_object *obj)
|
|
{
|
|
struct vmw_bo *vbo = to_vmw_bo(obj);
|
|
|
|
vmw_bo_pin_reserved(vbo, false);
|
|
}
|
|
|
|
static struct sg_table *vmw_gem_object_get_sg_table(struct drm_gem_object *obj)
|
|
{
|
|
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(obj);
|
|
struct vmw_ttm_tt *vmw_tt =
|
|
container_of(bo->ttm, struct vmw_ttm_tt, dma_ttm);
|
|
|
|
if (vmw_tt->vsgt.sgt)
|
|
return vmw_tt->vsgt.sgt;
|
|
|
|
return drm_prime_pages_to_sg(obj->dev, vmw_tt->dma_ttm.pages, vmw_tt->dma_ttm.num_pages);
|
|
}
|
|
|
|
static int vmw_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
|
|
{
|
|
struct ttm_buffer_object *bo = drm_gem_ttm_of_gem(obj);
|
|
int ret;
|
|
|
|
if (drm_gem_is_imported(obj)) {
|
|
ret = dma_buf_vmap(obj->import_attach->dmabuf, map);
|
|
if (!ret) {
|
|
if (drm_WARN_ON(obj->dev, map->is_iomem)) {
|
|
dma_buf_vunmap(obj->import_attach->dmabuf, map);
|
|
return -EIO;
|
|
}
|
|
}
|
|
} else {
|
|
ret = ttm_bo_vmap(bo, map);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
static void vmw_gem_vunmap(struct drm_gem_object *obj, struct iosys_map *map)
|
|
{
|
|
if (drm_gem_is_imported(obj))
|
|
dma_buf_vunmap(obj->import_attach->dmabuf, map);
|
|
else
|
|
drm_gem_ttm_vunmap(obj, map);
|
|
}
|
|
|
|
static int vmw_gem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
|
|
{
|
|
int ret;
|
|
|
|
if (drm_gem_is_imported(obj)) {
|
|
/*
|
|
* Reset both vm_ops and vm_private_data, so we don't end up with
|
|
* vm_ops pointing to our implementation if the dma-buf backend
|
|
* doesn't set those fields.
|
|
*/
|
|
vma->vm_private_data = NULL;
|
|
vma->vm_ops = NULL;
|
|
|
|
ret = dma_buf_mmap(obj->dma_buf, vma, 0);
|
|
|
|
/* Drop the reference drm_gem_mmap_obj() acquired.*/
|
|
if (!ret)
|
|
drm_gem_object_put(obj);
|
|
|
|
return ret;
|
|
}
|
|
|
|
return drm_gem_ttm_mmap(obj, vma);
|
|
}
|
|
|
|
static const struct vm_operations_struct vmw_vm_ops = {
|
|
.pfn_mkwrite = vmw_bo_vm_mkwrite,
|
|
.page_mkwrite = vmw_bo_vm_mkwrite,
|
|
.fault = vmw_bo_vm_fault,
|
|
.open = ttm_bo_vm_open,
|
|
.close = ttm_bo_vm_close,
|
|
};
|
|
|
|
const struct drm_gem_object_funcs vmw_gem_object_funcs = {
|
|
.free = vmw_gem_object_free,
|
|
.open = vmw_gem_object_open,
|
|
.close = vmw_gem_object_close,
|
|
.print_info = drm_gem_ttm_print_info,
|
|
.pin = vmw_gem_object_pin,
|
|
.unpin = vmw_gem_object_unpin,
|
|
.get_sg_table = vmw_gem_object_get_sg_table,
|
|
.vmap = vmw_gem_vmap,
|
|
.vunmap = vmw_gem_vunmap,
|
|
.mmap = vmw_gem_mmap,
|
|
.vm_ops = &vmw_vm_ops,
|
|
};
|
|
|
|
int vmw_gem_object_create_with_handle(struct vmw_private *dev_priv,
|
|
struct drm_file *filp,
|
|
uint32_t size,
|
|
uint32_t *handle,
|
|
struct vmw_bo **p_vbo)
|
|
{
|
|
int ret;
|
|
struct vmw_bo_params params = {
|
|
.domain = (dev_priv->has_mob) ? VMW_BO_DOMAIN_SYS : VMW_BO_DOMAIN_VRAM,
|
|
.busy_domain = VMW_BO_DOMAIN_SYS,
|
|
.bo_type = ttm_bo_type_device,
|
|
.size = size,
|
|
.pin = false
|
|
};
|
|
|
|
ret = vmw_bo_create(dev_priv, ¶ms, p_vbo);
|
|
if (ret != 0)
|
|
goto out_no_bo;
|
|
|
|
ret = drm_gem_handle_create(filp, &(*p_vbo)->tbo.base, handle);
|
|
out_no_bo:
|
|
return ret;
|
|
}
|
|
|
|
struct drm_gem_object *vmw_prime_import_sg_table(struct drm_device *dev,
|
|
struct dma_buf_attachment *attach,
|
|
struct sg_table *table)
|
|
{
|
|
int ret;
|
|
struct vmw_private *dev_priv = vmw_priv(dev);
|
|
struct drm_gem_object *gem = NULL;
|
|
struct vmw_bo *vbo;
|
|
struct vmw_bo_params params = {
|
|
.domain = (dev_priv->has_mob) ? VMW_BO_DOMAIN_SYS : VMW_BO_DOMAIN_VRAM,
|
|
.busy_domain = VMW_BO_DOMAIN_SYS,
|
|
.bo_type = ttm_bo_type_sg,
|
|
.size = attach->dmabuf->size,
|
|
.pin = false,
|
|
.keep_resv = true,
|
|
.resv = attach->dmabuf->resv,
|
|
.sg = table,
|
|
|
|
};
|
|
|
|
dma_resv_lock(params.resv, NULL);
|
|
|
|
ret = vmw_bo_create(dev_priv, ¶ms, &vbo);
|
|
if (ret != 0)
|
|
goto out_no_bo;
|
|
|
|
vbo->tbo.base.funcs = &vmw_gem_object_funcs;
|
|
|
|
gem = &vbo->tbo.base;
|
|
out_no_bo:
|
|
dma_resv_unlock(params.resv);
|
|
return gem;
|
|
}
|
|
|
|
int vmw_gem_object_create_ioctl(struct drm_device *dev, void *data,
|
|
struct drm_file *filp)
|
|
{
|
|
struct vmw_private *dev_priv = vmw_priv(dev);
|
|
union drm_vmw_alloc_dmabuf_arg *arg =
|
|
(union drm_vmw_alloc_dmabuf_arg *)data;
|
|
struct drm_vmw_alloc_dmabuf_req *req = &arg->req;
|
|
struct drm_vmw_dmabuf_rep *rep = &arg->rep;
|
|
struct vmw_bo *vbo;
|
|
uint32_t handle;
|
|
int ret;
|
|
|
|
ret = vmw_gem_object_create_with_handle(dev_priv, filp,
|
|
req->size, &handle, &vbo);
|
|
if (ret)
|
|
goto out_no_bo;
|
|
|
|
rep->handle = handle;
|
|
rep->map_handle = drm_vma_node_offset_addr(&vbo->tbo.base.vma_node);
|
|
rep->cur_gmr_id = handle;
|
|
rep->cur_gmr_offset = 0;
|
|
/* drop reference from allocate - handle holds it now */
|
|
drm_gem_object_put(&vbo->tbo.base);
|
|
out_no_bo:
|
|
return ret;
|
|
}
|
|
|
|
#if defined(CONFIG_DEBUG_FS)
|
|
|
|
static void vmw_bo_print_info(int id, struct vmw_bo *bo, struct seq_file *m)
|
|
{
|
|
const char *placement;
|
|
const char *type;
|
|
|
|
switch (bo->tbo.resource->mem_type) {
|
|
case TTM_PL_SYSTEM:
|
|
placement = " CPU";
|
|
break;
|
|
case VMW_PL_GMR:
|
|
placement = " GMR";
|
|
break;
|
|
case VMW_PL_MOB:
|
|
placement = " MOB";
|
|
break;
|
|
case VMW_PL_SYSTEM:
|
|
placement = "VCPU";
|
|
break;
|
|
case TTM_PL_VRAM:
|
|
placement = "VRAM";
|
|
break;
|
|
default:
|
|
placement = "None";
|
|
break;
|
|
}
|
|
|
|
switch (bo->tbo.type) {
|
|
case ttm_bo_type_device:
|
|
type = "device";
|
|
break;
|
|
case ttm_bo_type_kernel:
|
|
type = "kernel";
|
|
break;
|
|
case ttm_bo_type_sg:
|
|
type = "sg ";
|
|
break;
|
|
default:
|
|
type = "none ";
|
|
break;
|
|
}
|
|
|
|
seq_printf(m, "\t\t0x%08x: %12zu bytes %s, type = %s",
|
|
id, bo->tbo.base.size, placement, type);
|
|
seq_printf(m, ", priority = %u, pin_count = %u, GEM refs = %d",
|
|
bo->tbo.priority,
|
|
bo->tbo.pin_count,
|
|
kref_read(&bo->tbo.base.refcount));
|
|
seq_puts(m, "\n");
|
|
}
|
|
|
|
static int vmw_debugfs_gem_info_show(struct seq_file *m, void *unused)
|
|
{
|
|
struct vmw_private *vdev = (struct vmw_private *)m->private;
|
|
struct drm_device *dev = &vdev->drm;
|
|
struct drm_file *file;
|
|
int r;
|
|
|
|
r = mutex_lock_interruptible(&dev->filelist_mutex);
|
|
if (r)
|
|
return r;
|
|
|
|
list_for_each_entry(file, &dev->filelist, lhead) {
|
|
struct task_struct *task;
|
|
struct drm_gem_object *gobj;
|
|
struct pid *pid;
|
|
int id;
|
|
|
|
/*
|
|
* Although we have a valid reference on file->pid, that does
|
|
* not guarantee that the task_struct who called get_pid() is
|
|
* still alive (e.g. get_pid(current) => fork() => exit()).
|
|
* Therefore, we need to protect this ->comm access using RCU.
|
|
*/
|
|
rcu_read_lock();
|
|
pid = rcu_dereference(file->pid);
|
|
task = pid_task(pid, PIDTYPE_TGID);
|
|
seq_printf(m, "pid %8d command %s:\n", pid_nr(pid),
|
|
task ? task->comm : "<unknown>");
|
|
rcu_read_unlock();
|
|
|
|
spin_lock(&file->table_lock);
|
|
idr_for_each_entry(&file->object_idr, gobj, id) {
|
|
struct vmw_bo *bo = to_vmw_bo(gobj);
|
|
|
|
vmw_bo_print_info(id, bo, m);
|
|
}
|
|
spin_unlock(&file->table_lock);
|
|
}
|
|
|
|
mutex_unlock(&dev->filelist_mutex);
|
|
return 0;
|
|
}
|
|
|
|
DEFINE_SHOW_ATTRIBUTE(vmw_debugfs_gem_info);
|
|
|
|
#endif
|
|
|
|
void vmw_debugfs_gem_init(struct vmw_private *vdev)
|
|
{
|
|
#if defined(CONFIG_DEBUG_FS)
|
|
struct drm_minor *minor = vdev->drm.primary;
|
|
struct dentry *root = minor->debugfs_root;
|
|
|
|
debugfs_create_file("vmwgfx_gem_info", 0444, root, vdev,
|
|
&vmw_debugfs_gem_info_fops);
|
|
#endif
|
|
}
|