[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.13' - drivers/gpu/drm
Kevin Brace
kevinbrace at kemper.freedesktop.org
Tue Aug 29 01:22:15 UTC 2017
drivers/gpu/drm/openchrome/ttm_gem.c | 2
drivers/gpu/drm/openchrome/via_crtc.c | 2
drivers/gpu/drm/openchrome/via_drv.c | 8 +--
drivers/gpu/drm/openchrome/via_drv.h | 12 +++-
drivers/gpu/drm/openchrome/via_fb.c | 2
drivers/gpu/drm/openchrome/via_fence.c | 2
drivers/gpu/drm/openchrome/via_h1_cmdbuf.c | 2
drivers/gpu/drm/openchrome/via_ioc32.c | 2
drivers/gpu/drm/openchrome/via_sgdma.c | 6 --
drivers/gpu/drm/openchrome/via_ttm.c | 70 +++++++++++++++--------------
10 files changed, 58 insertions(+), 50 deletions(-)
New commits:
commit 837da7f954655b65f3d04acc4c41571c9d104c9f
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Aug 28 18:20:40 2017 -0700
Added via_ttm struct
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/ttm_gem.c b/drivers/gpu/drm/openchrome/ttm_gem.c
index d4179dd16f57..0ce52146909c 100644
--- a/drivers/gpu/drm/openchrome/ttm_gem.c
+++ b/drivers/gpu/drm/openchrome/ttm_gem.c
@@ -75,7 +75,7 @@ int ttm_mmap(struct file *filp, struct vm_area_struct *vma)
if (!dev_priv)
return -EINVAL;
- return ttm_bo_mmap(filp, vma, &dev_priv->bdev);
+ return ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev);
}
struct drm_gem_object *
diff --git a/drivers/gpu/drm/openchrome/via_crtc.c b/drivers/gpu/drm/openchrome/via_crtc.c
index 08157c9b721a..eea4ca4ff51f 100644
--- a/drivers/gpu/drm/openchrome/via_crtc.c
+++ b/drivers/gpu/drm/openchrome/via_crtc.c
@@ -1971,7 +1971,7 @@ via_crtc_init(struct drm_device *dev, int index)
|| dev->pdev->device == PCI_DEVICE_ID_VIA_KM400)
cursor_size = 32 * 32 * 4;
- if (via_ttm_allocate_kernel_buffer(&dev_priv->bdev, cursor_size, 16,
+ if (via_ttm_allocate_kernel_buffer(&dev_priv->ttm.bdev, cursor_size, 16,
TTM_PL_FLAG_VRAM, &iga->cursor_kmap))
DRM_ERROR("failed to create cursor\n");
}
diff --git a/drivers/gpu/drm/openchrome/via_drv.c b/drivers/gpu/drm/openchrome/via_drv.c
index 40515729687b..2a4dd3f74941 100644
--- a/drivers/gpu/drm/openchrome/via_drv.c
+++ b/drivers/gpu/drm/openchrome/via_drv.c
@@ -91,7 +91,7 @@ via_detect_agp(struct drm_device *dev)
goto out_err0;
}
- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_TT, agp_info.aperture_size >> PAGE_SHIFT);
+ ret = ttm_bo_init_mm(&dev_priv->ttm.bdev, TTM_PL_TT, agp_info.aperture_size >> PAGE_SHIFT);
if (!ret) {
DRM_INFO("Detected %lu MB of AGP Aperture at "
"physical address 0x%08lx.\n",
@@ -199,7 +199,7 @@ static int via_dumb_create(struct drm_file *filp, struct drm_device *dev,
args->pitch = round_up(args->width * (args->bpp >> 3), 16);
args->size = args->pitch * args->height;
- obj = ttm_gem_create(dev, &dev_priv->bdev, args->size,
+ obj = ttm_gem_create(dev, &dev_priv->ttm.bdev, args->size,
ttm_bo_type_device, TTM_PL_FLAG_VRAM,
16, PAGE_SIZE, false);
if (IS_ERR(obj))
@@ -357,7 +357,7 @@ via_driver_load(struct drm_device *dev, unsigned long chipset)
#endif
if (pci_is_pcie(dev->pdev)) {
/* Allocate GART. */
- ret = via_ttm_allocate_kernel_buffer(&dev_priv->bdev, SGDMA_MEMORY,
+ ret = via_ttm_allocate_kernel_buffer(&dev_priv->ttm.bdev, SGDMA_MEMORY,
16, TTM_PL_FLAG_VRAM,
&dev_priv->gart);
if (likely(!ret)) {
@@ -369,7 +369,7 @@ via_driver_load(struct drm_device *dev, unsigned long chipset)
}
/* Allocate VQ. (Virtual Queue) */
- ret = via_ttm_allocate_kernel_buffer(&dev_priv->bdev, VQ_MEMORY, 16,
+ ret = via_ttm_allocate_kernel_buffer(&dev_priv->ttm.bdev, VQ_MEMORY, 16,
TTM_PL_FLAG_VRAM, &dev_priv->vq);
if (likely(!ret)) {
DRM_INFO("Allocated %u KB of VQ (Virtual Queue) memory.\n", VQ_MEMORY >> 10);
diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index b39a14d7688b..02d664df1683 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -105,6 +105,12 @@ struct via_state {
struct vga_regset seq_regs[256];
};
+struct via_ttm {
+ struct drm_global_reference mem_global_ref;
+ struct ttm_bo_global_ref bo_global_ref;
+ struct ttm_bo_device bdev;
+};
+
struct ttm_heap {
struct ttm_buffer_object bo;
struct ttm_place busy_placements[TTM_NUM_MEM_TYPES];
@@ -136,10 +142,10 @@ enum via_engine {
};
struct via_device {
- struct drm_global_reference mem_global_ref;
- struct ttm_bo_global_ref bo_global_ref;
- struct ttm_bo_device bdev;
struct drm_device *dev;
+
+ struct via_ttm ttm;
+
int revision;
struct ttm_bo_kmap_obj dmabuf;
diff --git a/drivers/gpu/drm/openchrome/via_fb.c b/drivers/gpu/drm/openchrome/via_fb.c
index ff4944a09582..18e709441e6b 100644
--- a/drivers/gpu/drm/openchrome/via_fb.c
+++ b/drivers/gpu/drm/openchrome/via_fb.c
@@ -1073,7 +1073,7 @@ via_fb_probe(struct drm_fb_helper *helper,
size = mode_cmd.pitches[0] * mode_cmd.height;
size = ALIGN(size, PAGE_SIZE);
- gem_obj = ttm_gem_create(dev, &dev_priv->bdev, size,
+ gem_obj = ttm_gem_create(dev, &dev_priv->ttm.bdev, size,
ttm_bo_type_kernel, TTM_PL_FLAG_VRAM,
1, PAGE_SIZE, false);
if (unlikely(IS_ERR(gem_obj))) {
diff --git a/drivers/gpu/drm/openchrome/via_fence.c b/drivers/gpu/drm/openchrome/via_fence.c
index de91ae4d3217..e466a38d0bf4 100644
--- a/drivers/gpu/drm/openchrome/via_fence.c
+++ b/drivers/gpu/drm/openchrome/via_fence.c
@@ -202,7 +202,7 @@ via_fence_pool_init(struct drm_device *dev, char *name, int domain,
return ERR_PTR(-ENOMEM);
/* allocate fence sync bo */
- ret = via_ttm_allocate_kernel_buffer(&dev_priv->bdev, PAGE_SIZE, 16,
+ ret = via_ttm_allocate_kernel_buffer(&dev_priv->ttm.bdev, PAGE_SIZE, 16,
domain, &pool->fence_sync);
if (unlikely(ret)) {
DRM_ERROR("allocate fence sync bo error.\n");
diff --git a/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c b/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c
index 0713785b3968..d21fdd24112b 100644
--- a/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c
+++ b/drivers/gpu/drm/openchrome/via_h1_cmdbuf.c
@@ -159,7 +159,7 @@ static int via_initialize(struct drm_device *dev,
return ret;
}
- ret = via_bo_create(&dev_priv->bdev, &bo, init->size,
+ ret = via_bo_create(&dev_priv->ttm.bdev, &bo, init->size,
ttm_bo_type_kernel, TTM_PL_FLAG_TT,
VIA_MM_ALIGN_SIZE, PAGE_SIZE,
false, NULL, NULL);
diff --git a/drivers/gpu/drm/openchrome/via_ioc32.c b/drivers/gpu/drm/openchrome/via_ioc32.c
index d0ffda66c8e9..5e175750f208 100644
--- a/drivers/gpu/drm/openchrome/via_ioc32.c
+++ b/drivers/gpu/drm/openchrome/via_ioc32.c
@@ -66,7 +66,7 @@ via_gem_alloc(struct drm_device *dev, void *data,
struct drm_gem_object *obj;
int ret = -ENOMEM;
- obj = ttm_gem_create(dev, &dev_priv->bdev, args->size,
+ obj = ttm_gem_create(dev, &dev_priv->ttm.bdev, args->size,
ttm_bo_type_device, args->domains,
args->alignment, PAGE_SIZE, false);
if (obj != NULL) {
diff --git a/drivers/gpu/drm/openchrome/via_sgdma.c b/drivers/gpu/drm/openchrome/via_sgdma.c
index e0401096435a..83ed1349db11 100644
--- a/drivers/gpu/drm/openchrome/via_sgdma.c
+++ b/drivers/gpu/drm/openchrome/via_sgdma.c
@@ -29,9 +29,8 @@ static int
via_pcie_sgdma_bind(struct ttm_tt *ttm, struct ttm_mem_reg *mem)
{
struct sgdma_tt *dma_tt = (struct sgdma_tt *) ttm;
- struct ttm_bo_device *bdev = dma_tt->sgdma.ttm.bdev;
struct via_device *dev_priv =
- container_of(bdev, struct via_device, bdev);
+ container_of(ttm->bdev, struct via_device, ttm.bdev);
int i;
/* Disable gart table HW protect */
@@ -56,9 +55,8 @@ static int
via_pcie_sgdma_unbind(struct ttm_tt *ttm)
{
struct sgdma_tt *dma_tt = (struct sgdma_tt *) ttm;
- struct ttm_bo_device *bdev = dma_tt->sgdma.ttm.bdev;
struct via_device *dev_priv =
- container_of(bdev, struct via_device, bdev);
+ container_of(ttm->bdev, struct via_device, ttm.bdev);
int i;
if (ttm->state != tt_bound)
diff --git a/drivers/gpu/drm/openchrome/via_ttm.c b/drivers/gpu/drm/openchrome/via_ttm.c
index 12714409a4dc..1fa06b45d76c 100644
--- a/drivers/gpu/drm/openchrome/via_ttm.c
+++ b/drivers/gpu/drm/openchrome/via_ttm.c
@@ -48,7 +48,7 @@ via_ttm_global_init(struct via_device *dev_priv)
struct drm_global_reference *bo_ref;
int rc;
- global_ref = &dev_priv->mem_global_ref;
+ global_ref = &dev_priv->ttm.mem_global_ref;
global_ref->global_type = DRM_GLOBAL_TTM_MEM;
global_ref->size = sizeof(struct ttm_mem_global);
global_ref->init = &via_ttm_mem_global_init;
@@ -61,8 +61,8 @@ via_ttm_global_init(struct via_device *dev_priv)
return rc;
}
- dev_priv->bo_global_ref.mem_glob = dev_priv->mem_global_ref.object;
- bo_ref = &dev_priv->bo_global_ref.ref;
+ dev_priv->ttm.bo_global_ref.mem_glob = dev_priv->ttm.mem_global_ref.object;
+ bo_ref = &dev_priv->ttm.bo_global_ref.ref;
bo_ref->global_type = DRM_GLOBAL_TTM_BO;
bo_ref->size = sizeof(struct ttm_bo_global);
bo_ref->init = &ttm_bo_global_init;
@@ -109,15 +109,20 @@ static struct ttm_tt *
via_ttm_tt_create(struct ttm_bo_device *bdev, unsigned long size,
uint32_t page_flags, struct page *dummy_read_page)
{
-#if IS_ENABLED(CONFIG_AGP)
- struct via_device *dev_priv =
- container_of(bdev, struct via_device, bdev);
+ struct via_device *dev_priv = container_of(bdev,
+ struct via_device, ttm.bdev);
- if (pci_find_capability(dev_priv->dev->pdev, PCI_CAP_ID_AGP))
- return ttm_agp_tt_create(bdev, dev_priv->dev->agp->bridge,
- size, page_flags, dummy_read_page);
+#if IS_ENABLED(CONFIG_AGP)
+ if (pci_find_capability(dev_priv->dev->pdev, PCI_CAP_ID_AGP)) {
+ return ttm_agp_tt_create(bdev,
+ dev_priv->dev->agp->bridge,
+ size, page_flags, dummy_read_page);
+ }
#endif
- return via_sgdma_backend_init(bdev, size, page_flags, dummy_read_page);
+
+ return via_sgdma_backend_init(bdev, size, page_flags,
+ dummy_read_page);
+
}
static int
@@ -125,9 +130,8 @@ via_ttm_tt_populate(struct ttm_tt *ttm)
{
struct sgdma_tt *dma_tt = (struct sgdma_tt *) ttm;
struct ttm_dma_tt *sgdma = &dma_tt->sgdma;
- struct ttm_bo_device *bdev = ttm->bdev;
- struct via_device *dev_priv =
- container_of(bdev, struct via_device, bdev);
+ struct via_device *dev_priv = container_of(ttm->bdev,
+ struct via_device, ttm.bdev);
struct drm_device *dev = dev_priv->dev;
unsigned int i;
int ret = 0;
@@ -171,9 +175,8 @@ via_ttm_tt_unpopulate(struct ttm_tt *ttm)
{
struct sgdma_tt *dma_tt = (struct sgdma_tt *) ttm;
struct ttm_dma_tt *sgdma = &dma_tt->sgdma;
- struct ttm_bo_device *bdev = ttm->bdev;
- struct via_device *dev_priv =
- container_of(bdev, struct via_device, bdev);
+ struct via_device *dev_priv = container_of(ttm->bdev,
+ struct via_device, ttm.bdev);
struct drm_device *dev = dev_priv->dev;
unsigned int i;
@@ -215,8 +218,8 @@ via_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
struct ttm_mem_type_manager *man)
{
#if IS_ENABLED(CONFIG_AGP)
- struct via_device *dev_priv =
- container_of(bdev, struct via_device, bdev);
+ struct via_device *dev_priv = container_of(bdev,
+ struct via_device, ttm.bdev);
struct drm_device *dev = dev_priv->dev;
#endif
@@ -331,8 +334,8 @@ static int
via_move_blit(struct ttm_buffer_object *bo, bool evict, bool no_wait_gpu,
struct ttm_mem_reg *new_mem, struct ttm_mem_reg *old_mem)
{
- struct via_device *dev_priv =
- container_of(bo->bdev, struct via_device, bdev);
+ struct via_device *dev_priv = container_of(bo->bdev,
+ struct via_device, ttm.bdev);
enum dma_data_direction direction = DMA_TO_DEVICE;
unsigned long old_start, new_start, dev_addr = 0;
struct drm_via_sg_info *vsg;
@@ -498,8 +501,9 @@ exit:
static int
via_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
{
- struct via_device *dev_priv =
- container_of(bdev, struct via_device, bdev);
+ struct via_device *dev_priv = container_of(bdev,
+ struct via_device, ttm.bdev);
+
struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
struct drm_device *dev = dev_priv->dev;
@@ -582,10 +586,10 @@ int via_mm_init(struct via_device *dev_priv)
goto exit;
}
- dev_priv->bdev.dev_mapping = dev->anon_inode->i_mapping;
+ dev_priv->ttm.bdev.dev_mapping = dev->anon_inode->i_mapping;
- ret = ttm_bo_device_init(&dev_priv->bdev,
- dev_priv->bo_global_ref.ref.object,
+ ret = ttm_bo_device_init(&dev_priv->ttm.bdev,
+ dev_priv->ttm.bo_global_ref.ref.object,
&via_bo_driver,
dev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
@@ -595,7 +599,7 @@ int via_mm_init(struct via_device *dev_priv)
goto exit;
}
- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM, dev_priv->vram_size >> PAGE_SHIFT);
+ ret = ttm_bo_init_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM, dev_priv->vram_size >> PAGE_SHIFT);
if (ret) {
DRM_ERROR("Failed to map video RAM: %d\n", ret);
goto exit;
@@ -609,13 +613,13 @@ int via_mm_init(struct via_device *dev_priv)
start = (unsigned long long) pci_resource_start(dev->pdev, 1);
len = pci_resource_len(dev->pdev, 1);
- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_PRIV, len >> PAGE_SHIFT);
+ ret = ttm_bo_init_mm(&dev_priv->ttm.bdev, TTM_PL_PRIV, len >> PAGE_SHIFT);
if (ret) {
DRM_ERROR("Failed to map MMIO: %d\n", ret);
goto exit;
}
- ret = via_bo_create(&dev_priv->bdev, &bo, VIA_MMIO_REGSIZE, ttm_bo_type_kernel,
+ ret = via_bo_create(&dev_priv->ttm.bdev, &bo, VIA_MMIO_REGSIZE, ttm_bo_type_kernel,
TTM_PL_FLAG_PRIV, 1, PAGE_SIZE, false, NULL, NULL);
if (ret) {
DRM_ERROR("Failed to create a buffer object for MMIO: %d\n", ret);
@@ -625,7 +629,7 @@ int via_mm_init(struct via_device *dev_priv)
ret = via_bo_pin(bo, &dev_priv->mmio);
if (ret) {
DRM_ERROR("Failed to map a buffer object for MMIO: %d\n", ret);
- ttm_bo_clean_mm(&dev_priv->bdev, TTM_PL_PRIV);
+ ttm_bo_clean_mm(&dev_priv->ttm.bdev, TTM_PL_PRIV);
goto exit;
}
@@ -642,11 +646,11 @@ void via_mm_fini(struct drm_device *dev)
DRM_DEBUG("Entered via_mm_fini.\n");
- ttm_bo_device_release(&dev_priv->bdev);
+ ttm_bo_device_release(&dev_priv->ttm.bdev);
- via_ttm_global_release(&dev_priv->mem_global_ref,
- &dev_priv->bo_global_ref,
- &dev_priv->bdev);
+ via_ttm_global_release(&dev_priv->ttm.mem_global_ref,
+ &dev_priv->ttm.bo_global_ref,
+ &dev_priv->ttm.bdev);
/* mtrr delete the vram */
if (dev_priv->vram_mtrr >= 0) {
More information about the Openchrome-devel
mailing list