mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 20:16:16 +07:00
a4d46a8e26
TTM is an implementation detail of the VRAM helpers and therefore shouldn't be exposed to the callers. There's only one correct value for the BO device anyway, which is the one stored in the DRM device. So remove struct ttm_bo_device from the VRAM-helper interface and use the device's VRAM manager unconditionally. The GEM initializer function fails if the VRAM manager has not been initialized. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Acked-by: Sam Ravnborg <sam@ravnborg.org> Link: https://patchwork.freedesktop.org/patch/msgid/20200106125745.13797-8-tzimmermann@suse.de
61 lines
1.3 KiB
C
61 lines
1.3 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/* Hisilicon Hibmc SoC drm driver
|
|
*
|
|
* Based on the bochs drm driver.
|
|
*
|
|
* Copyright (c) 2016 Huawei Limited.
|
|
*
|
|
* Author:
|
|
* Rongrong Zou <zourongrong@huawei.com>
|
|
* Rongrong Zou <zourongrong@gmail.com>
|
|
* Jianhua Li <lijianhua@huawei.com>
|
|
*/
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <drm/drm_atomic_helper.h>
|
|
#include <drm/drm_gem.h>
|
|
#include <drm/drm_gem_framebuffer_helper.h>
|
|
#include <drm/drm_gem_vram_helper.h>
|
|
#include <drm/drm_print.h>
|
|
|
|
#include "hibmc_drm_drv.h"
|
|
|
|
int hibmc_mm_init(struct hibmc_drm_private *hibmc)
|
|
{
|
|
struct drm_vram_mm *vmm;
|
|
int ret;
|
|
struct drm_device *dev = hibmc->dev;
|
|
|
|
vmm = drm_vram_helper_alloc_mm(dev,
|
|
pci_resource_start(dev->pdev, 0),
|
|
hibmc->fb_size);
|
|
if (IS_ERR(vmm)) {
|
|
ret = PTR_ERR(vmm);
|
|
DRM_ERROR("Error initializing VRAM MM; %d\n", ret);
|
|
return ret;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void hibmc_mm_fini(struct hibmc_drm_private *hibmc)
|
|
{
|
|
if (!hibmc->dev->vram_mm)
|
|
return;
|
|
|
|
drm_vram_helper_release_mm(hibmc->dev);
|
|
}
|
|
|
|
int hibmc_dumb_create(struct drm_file *file, struct drm_device *dev,
|
|
struct drm_mode_create_dumb *args)
|
|
{
|
|
return drm_gem_vram_fill_create_dumb(file, dev, 0, 16, args);
|
|
}
|
|
|
|
const struct drm_mode_config_funcs hibmc_mode_funcs = {
|
|
.atomic_check = drm_atomic_helper_check,
|
|
.atomic_commit = drm_atomic_helper_commit,
|
|
.fb_create = drm_gem_fb_create,
|
|
};
|