mirror of
https://github.com/Fishwaldo/build.git
synced 2025-06-05 05:41:43 +00:00
disable temporarily some Mali or Lima patches
This commit is contained in:
parent
d4cab3024e
commit
e514907bd2
4 changed files with 699 additions and 0 deletions
|
@ -0,0 +1,72 @@
|
|||
From fa666ec858630bad5d3bf2952c96460302065102 Mon Sep 17 00:00:00 2001
|
||||
From: Icenowy Zheng <icenowy@aosc.io>
|
||||
Date: Sat, 6 May 2017 19:29:44 +0800
|
||||
Subject: [PATCH 002/146] arm64: allwinner: a64: add Mali device node
|
||||
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 41 +++++++++++++++++++
|
||||
1 file changed, 41 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index d3daf90a8715..0f69f3593975 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -157,6 +157,20 @@
|
||||
compatible = "linux,spdif-dit";
|
||||
};
|
||||
|
||||
+ reserved-memory {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ ranges;
|
||||
+
|
||||
+ cma: linux,cma {
|
||||
+ compatible = "shared-dma-pool";
|
||||
+ reusable;
|
||||
+ size = <0x4000000>;
|
||||
+ alignment = <0x2000>;
|
||||
+ linux,cma-default;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
timer {
|
||||
compatible = "arm,armv8-timer";
|
||||
interrupts = <GIC_PPI 13
|
||||
@@ -664,6 +678,33 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ mali: gpu@1c40000 {
|
||||
+ compatible = "allwinner,sun50i-a64-mali",
|
||||
+ "allwinner,sun7i-a20-mali", "arm,mali-400";
|
||||
+ reg = <0x01c40000 0x10000>;
|
||||
+ interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
|
||||
+ <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ interrupt-names = "gp",
|
||||
+ "gpmmu",
|
||||
+ "pp0",
|
||||
+ "ppmmu0",
|
||||
+ "pp1",
|
||||
+ "ppmmu1",
|
||||
+ "pmu";
|
||||
+ clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>;
|
||||
+ clock-names = "bus", "core";
|
||||
+ resets = <&ccu RST_BUS_GPU>;
|
||||
+ memory-region = <&cma>;
|
||||
+
|
||||
+ assigned-clocks = <&ccu CLK_GPU>;
|
||||
+ assigned-clock-rates = <384000000>;
|
||||
+ };
|
||||
+
|
||||
gic: interrupt-controller@1c81000 {
|
||||
compatible = "arm,gic-400";
|
||||
reg = <0x01c81000 0x1000>,
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -0,0 +1,481 @@
|
|||
From f31bbd84c9aab62a0aee72e540d9d8c9d998a958 Mon Sep 17 00:00:00 2001
|
||||
From: Qiang Yu <yuq825@gmail.com>
|
||||
Date: Mon, 14 May 2018 22:28:36 +0800
|
||||
Subject: [PATCH 054/146] drm/lima: add TTM subsystem functions
|
||||
|
||||
Signed-off-by: Qiang Yu <yuq825@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/lima/lima_ttm.c | 409 ++++++++++++++++++++++++++++++++
|
||||
drivers/gpu/drm/lima/lima_ttm.h | 44 ++++
|
||||
2 files changed, 453 insertions(+)
|
||||
create mode 100644 drivers/gpu/drm/lima/lima_ttm.c
|
||||
create mode 100644 drivers/gpu/drm/lima/lima_ttm.h
|
||||
|
||||
diff --git a/drivers/gpu/drm/lima/lima_ttm.c b/drivers/gpu/drm/lima/lima_ttm.c
|
||||
new file mode 100644
|
||||
index 000000000000..5325f3f48ae7
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/lima/lima_ttm.c
|
||||
@@ -0,0 +1,409 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2017-2018 Lima Project
|
||||
+ *
|
||||
+ * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 <linux/mm.h>
|
||||
+#include <drm/ttm/ttm_page_alloc.h>
|
||||
+
|
||||
+#include "lima_drv.h"
|
||||
+#include "lima_device.h"
|
||||
+#include "lima_object.h"
|
||||
+
|
||||
+
|
||||
+static int lima_ttm_mem_global_init(struct drm_global_reference *ref)
|
||||
+{
|
||||
+ return ttm_mem_global_init(ref->object);
|
||||
+}
|
||||
+
|
||||
+static void lima_ttm_mem_global_release(struct drm_global_reference *ref)
|
||||
+{
|
||||
+ ttm_mem_global_release(ref->object);
|
||||
+}
|
||||
+
|
||||
+static int lima_ttm_global_init(struct lima_device *dev)
|
||||
+{
|
||||
+ struct drm_global_reference *global_ref;
|
||||
+ int err;
|
||||
+
|
||||
+ dev->mman.mem_global_referenced = false;
|
||||
+ global_ref = &dev->mman.mem_global_ref;
|
||||
+ global_ref->global_type = DRM_GLOBAL_TTM_MEM;
|
||||
+ global_ref->size = sizeof(struct ttm_mem_global);
|
||||
+ global_ref->init = &lima_ttm_mem_global_init;
|
||||
+ global_ref->release = &lima_ttm_mem_global_release;
|
||||
+
|
||||
+ err = drm_global_item_ref(global_ref);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(dev->dev, "Failed setting up TTM memory accounting "
|
||||
+ "subsystem.\n");
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ dev->mman.bo_global_ref.mem_glob =
|
||||
+ dev->mman.mem_global_ref.object;
|
||||
+ global_ref = &dev->mman.bo_global_ref.ref;
|
||||
+ global_ref->global_type = DRM_GLOBAL_TTM_BO;
|
||||
+ global_ref->size = sizeof(struct ttm_bo_global);
|
||||
+ global_ref->init = &ttm_bo_global_init;
|
||||
+ global_ref->release = &ttm_bo_global_release;
|
||||
+ err = drm_global_item_ref(global_ref);
|
||||
+ if (err != 0) {
|
||||
+ dev_err(dev->dev, "Failed setting up TTM BO subsystem.\n");
|
||||
+ drm_global_item_unref(&dev->mman.mem_global_ref);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ dev->mman.mem_global_referenced = true;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void lima_ttm_global_fini(struct lima_device *dev)
|
||||
+{
|
||||
+ if (dev->mman.mem_global_referenced) {
|
||||
+ drm_global_item_unref(&dev->mman.bo_global_ref.ref);
|
||||
+ drm_global_item_unref(&dev->mman.mem_global_ref);
|
||||
+ dev->mman.mem_global_referenced = false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+struct lima_tt_mgr {
|
||||
+ spinlock_t lock;
|
||||
+ unsigned long available;
|
||||
+};
|
||||
+
|
||||
+static int lima_ttm_bo_man_init(struct ttm_mem_type_manager *man,
|
||||
+ unsigned long p_size)
|
||||
+{
|
||||
+ struct lima_tt_mgr *mgr;
|
||||
+
|
||||
+ mgr = kmalloc(sizeof(*mgr), GFP_KERNEL);
|
||||
+ if (!mgr)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ spin_lock_init(&mgr->lock);
|
||||
+ mgr->available = p_size;
|
||||
+ man->priv = mgr;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lima_ttm_bo_man_takedown(struct ttm_mem_type_manager *man)
|
||||
+{
|
||||
+ struct lima_tt_mgr *mgr = man->priv;
|
||||
+
|
||||
+ kfree(mgr);
|
||||
+ man->priv = NULL;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lima_ttm_bo_man_get_node(struct ttm_mem_type_manager *man,
|
||||
+ struct ttm_buffer_object *bo,
|
||||
+ const struct ttm_place *place,
|
||||
+ struct ttm_mem_reg *mem)
|
||||
+{
|
||||
+ struct lima_tt_mgr *mgr = man->priv;
|
||||
+
|
||||
+ /* don't exceed the mem limit */
|
||||
+ spin_lock(&mgr->lock);
|
||||
+ if (mgr->available < mem->num_pages) {
|
||||
+ spin_unlock(&mgr->lock);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ mgr->available -= mem->num_pages;
|
||||
+ spin_unlock(&mgr->lock);
|
||||
+
|
||||
+ /* just fake a non-null pointer to tell caller success */
|
||||
+ mem->mm_node = (void *)1;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void lima_ttm_bo_man_put_node(struct ttm_mem_type_manager *man,
|
||||
+ struct ttm_mem_reg *mem)
|
||||
+{
|
||||
+ struct lima_tt_mgr *mgr = man->priv;
|
||||
+
|
||||
+ spin_lock(&mgr->lock);
|
||||
+ mgr->available += mem->num_pages;
|
||||
+ spin_unlock(&mgr->lock);
|
||||
+
|
||||
+ mem->mm_node = NULL;
|
||||
+}
|
||||
+
|
||||
+static void lima_ttm_bo_man_debug(struct ttm_mem_type_manager *man,
|
||||
+ struct drm_printer *printer)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+static const struct ttm_mem_type_manager_func lima_bo_manager_func = {
|
||||
+ .init = lima_ttm_bo_man_init,
|
||||
+ .takedown = lima_ttm_bo_man_takedown,
|
||||
+ .get_node = lima_ttm_bo_man_get_node,
|
||||
+ .put_node = lima_ttm_bo_man_put_node,
|
||||
+ .debug = lima_ttm_bo_man_debug
|
||||
+};
|
||||
+
|
||||
+static int lima_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
|
||||
+ struct ttm_mem_type_manager *man)
|
||||
+{
|
||||
+ struct lima_device *dev = ttm_to_lima_dev(bdev);
|
||||
+
|
||||
+ switch (type) {
|
||||
+ case TTM_PL_SYSTEM:
|
||||
+ /* System memory */
|
||||
+ man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
|
||||
+ man->available_caching = TTM_PL_MASK_CACHING;
|
||||
+ man->default_caching = TTM_PL_FLAG_CACHED;
|
||||
+ break;
|
||||
+ case TTM_PL_TT:
|
||||
+ man->func = &lima_bo_manager_func;
|
||||
+ man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
|
||||
+ man->available_caching = TTM_PL_MASK_CACHING;
|
||||
+ man->default_caching = TTM_PL_FLAG_CACHED;
|
||||
+ break;
|
||||
+ default:
|
||||
+ dev_err(dev->dev, "Unsupported memory type %u\n",
|
||||
+ (unsigned int)type);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lima_ttm_backend_bind(struct ttm_tt *ttm,
|
||||
+ struct ttm_mem_reg *bo_mem)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int lima_ttm_backend_unbind(struct ttm_tt *ttm)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void lima_ttm_backend_destroy(struct ttm_tt *ttm)
|
||||
+{
|
||||
+ struct lima_ttm_tt *tt = (void *)ttm;
|
||||
+
|
||||
+ ttm_dma_tt_fini(&tt->ttm);
|
||||
+ kfree(tt);
|
||||
+}
|
||||
+
|
||||
+static struct ttm_backend_func lima_ttm_backend_func = {
|
||||
+ .bind = &lima_ttm_backend_bind,
|
||||
+ .unbind = &lima_ttm_backend_unbind,
|
||||
+ .destroy = &lima_ttm_backend_destroy,
|
||||
+};
|
||||
+
|
||||
+static struct ttm_tt *lima_ttm_tt_create(struct ttm_buffer_object *bo,
|
||||
+ uint32_t page_flags)
|
||||
+{
|
||||
+ struct lima_ttm_tt *tt;
|
||||
+
|
||||
+ tt = kzalloc(sizeof(struct lima_ttm_tt), GFP_KERNEL);
|
||||
+ if (tt == NULL)
|
||||
+ return NULL;
|
||||
+
|
||||
+ tt->ttm.ttm.func = &lima_ttm_backend_func;
|
||||
+
|
||||
+ if (ttm_sg_tt_init(&tt->ttm, bo, page_flags)) {
|
||||
+ kfree(tt);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ return &tt->ttm.ttm;
|
||||
+}
|
||||
+
|
||||
+static int lima_ttm_tt_populate(struct ttm_tt *ttm,
|
||||
+ struct ttm_operation_ctx *ctx)
|
||||
+{
|
||||
+ struct lima_device *dev = ttm_to_lima_dev(ttm->bdev);
|
||||
+ struct lima_ttm_tt *tt = (void *)ttm;
|
||||
+ bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
|
||||
+
|
||||
+ if (slave) {
|
||||
+ drm_prime_sg_to_page_addr_arrays(ttm->sg, ttm->pages,
|
||||
+ tt->ttm.dma_address,
|
||||
+ ttm->num_pages);
|
||||
+ ttm->state = tt_unbound;
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ return ttm_populate_and_map_pages(dev->dev, &tt->ttm, ctx);
|
||||
+}
|
||||
+
|
||||
+static void lima_ttm_tt_unpopulate(struct ttm_tt *ttm)
|
||||
+{
|
||||
+ struct lima_device *dev = ttm_to_lima_dev(ttm->bdev);
|
||||
+ struct lima_ttm_tt *tt = (void *)ttm;
|
||||
+ bool slave = !!(ttm->page_flags & TTM_PAGE_FLAG_SG);
|
||||
+
|
||||
+ if (slave)
|
||||
+ return;
|
||||
+
|
||||
+ ttm_unmap_and_unpopulate_pages(dev->dev, &tt->ttm);
|
||||
+}
|
||||
+
|
||||
+static int lima_invalidate_caches(struct ttm_bo_device *bdev,
|
||||
+ uint32_t flags)
|
||||
+{
|
||||
+ struct lima_device *dev = ttm_to_lima_dev(bdev);
|
||||
+
|
||||
+ dev_err(dev->dev, "%s not implemented\n", __FUNCTION__);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void lima_evict_flags(struct ttm_buffer_object *tbo,
|
||||
+ struct ttm_placement *placement)
|
||||
+{
|
||||
+ struct lima_bo *bo = ttm_to_lima_bo(tbo);
|
||||
+ struct lima_device *dev = to_lima_dev(bo->gem.dev);
|
||||
+
|
||||
+ dev_err(dev->dev, "%s not implemented\n", __FUNCTION__);
|
||||
+}
|
||||
+
|
||||
+static int lima_verify_access(struct ttm_buffer_object *tbo,
|
||||
+ struct file *filp)
|
||||
+{
|
||||
+ struct lima_bo *bo = ttm_to_lima_bo(tbo);
|
||||
+
|
||||
+ return drm_vma_node_verify_access(&bo->gem.vma_node,
|
||||
+ filp->private_data);
|
||||
+}
|
||||
+
|
||||
+static int lima_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
|
||||
+ struct ttm_mem_reg *mem)
|
||||
+{
|
||||
+ struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
|
||||
+
|
||||
+ mem->bus.addr = NULL;
|
||||
+ mem->bus.offset = 0;
|
||||
+ mem->bus.size = mem->num_pages << PAGE_SHIFT;
|
||||
+ mem->bus.base = 0;
|
||||
+ mem->bus.is_iomem = false;
|
||||
+
|
||||
+ if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ switch (mem->mem_type) {
|
||||
+ case TTM_PL_SYSTEM:
|
||||
+ case TTM_PL_TT:
|
||||
+ return 0;
|
||||
+ default:
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void lima_ttm_io_mem_free(struct ttm_bo_device *bdev,
|
||||
+ struct ttm_mem_reg *mem)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static void lima_bo_move_notify(struct ttm_buffer_object *tbo, bool evict,
|
||||
+ struct ttm_mem_reg *new_mem)
|
||||
+{
|
||||
+ struct lima_bo *bo = ttm_to_lima_bo(tbo);
|
||||
+ struct lima_device *dev = to_lima_dev(bo->gem.dev);
|
||||
+
|
||||
+ if (evict)
|
||||
+ dev_err(dev->dev, "%s not implemented\n", __FUNCTION__);
|
||||
+}
|
||||
+
|
||||
+static void lima_bo_swap_notify(struct ttm_buffer_object *tbo)
|
||||
+{
|
||||
+ struct lima_bo *bo = ttm_to_lima_bo(tbo);
|
||||
+ struct lima_device *dev = to_lima_dev(bo->gem.dev);
|
||||
+
|
||||
+ dev_err(dev->dev, "%s not implemented\n", __FUNCTION__);
|
||||
+}
|
||||
+
|
||||
+static struct ttm_bo_driver lima_bo_driver = {
|
||||
+ .ttm_tt_create = lima_ttm_tt_create,
|
||||
+ .ttm_tt_populate = lima_ttm_tt_populate,
|
||||
+ .ttm_tt_unpopulate = lima_ttm_tt_unpopulate,
|
||||
+ .invalidate_caches = lima_invalidate_caches,
|
||||
+ .init_mem_type = lima_init_mem_type,
|
||||
+ .eviction_valuable = ttm_bo_eviction_valuable,
|
||||
+ .evict_flags = lima_evict_flags,
|
||||
+ .verify_access = lima_verify_access,
|
||||
+ .io_mem_reserve = lima_ttm_io_mem_reserve,
|
||||
+ .io_mem_free = lima_ttm_io_mem_free,
|
||||
+ .move_notify = lima_bo_move_notify,
|
||||
+ .swap_notify = lima_bo_swap_notify,
|
||||
+};
|
||||
+
|
||||
+int lima_ttm_init(struct lima_device *dev)
|
||||
+{
|
||||
+ int err;
|
||||
+ bool need_dma32;
|
||||
+ u64 gtt_size;
|
||||
+
|
||||
+ err = lima_ttm_global_init(dev);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+#if defined(CONFIG_ARM) && !defined(CONFIG_ARM_LPAE)
|
||||
+ need_dma32 = false;
|
||||
+#else
|
||||
+ need_dma32 = true;
|
||||
+#endif
|
||||
+
|
||||
+ err = ttm_bo_device_init(&dev->mman.bdev,
|
||||
+ dev->mman.bo_global_ref.ref.object,
|
||||
+ &lima_bo_driver,
|
||||
+ dev->ddev->anon_inode->i_mapping,
|
||||
+ DRM_FILE_PAGE_OFFSET,
|
||||
+ need_dma32);
|
||||
+ if (err) {
|
||||
+ dev_err(dev->dev, "failed initializing buffer object "
|
||||
+ "driver(%d).\n", err);
|
||||
+ goto err_out0;
|
||||
+ }
|
||||
+
|
||||
+ if (lima_max_mem < 0) {
|
||||
+ struct sysinfo si;
|
||||
+ si_meminfo(&si);
|
||||
+ /* TODO: better to have lower 32 mem size */
|
||||
+ gtt_size = min(((u64)si.totalram * si.mem_unit * 3/4),
|
||||
+ 0x100000000ULL);
|
||||
+ }
|
||||
+ else
|
||||
+ gtt_size = (u64)lima_max_mem << 20;
|
||||
+
|
||||
+ err = ttm_bo_init_mm(&dev->mman.bdev, TTM_PL_TT, gtt_size >> PAGE_SHIFT);
|
||||
+ if (err) {
|
||||
+ dev_err(dev->dev, "Failed initializing GTT heap.\n");
|
||||
+ goto err_out1;
|
||||
+ }
|
||||
+ return 0;
|
||||
+
|
||||
+err_out1:
|
||||
+ ttm_bo_device_release(&dev->mman.bdev);
|
||||
+err_out0:
|
||||
+ lima_ttm_global_fini(dev);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+void lima_ttm_fini(struct lima_device *dev)
|
||||
+{
|
||||
+ ttm_bo_device_release(&dev->mman.bdev);
|
||||
+ lima_ttm_global_fini(dev);
|
||||
+ dev_info(dev->dev, "ttm finalized\n");
|
||||
+}
|
||||
diff --git a/drivers/gpu/drm/lima/lima_ttm.h b/drivers/gpu/drm/lima/lima_ttm.h
|
||||
new file mode 100644
|
||||
index 000000000000..1d36d06a47a3
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/lima/lima_ttm.h
|
||||
@@ -0,0 +1,44 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2017-2018 Lima Project
|
||||
+ *
|
||||
+ * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
|
||||
+ */
|
||||
+#ifndef __LIMA_TTM_H__
|
||||
+#define __LIMA_TTM_H__
|
||||
+
|
||||
+#include <drm/ttm/ttm_bo_driver.h>
|
||||
+
|
||||
+struct lima_mman {
|
||||
+ struct ttm_bo_global_ref bo_global_ref;
|
||||
+ struct drm_global_reference mem_global_ref;
|
||||
+ struct ttm_bo_device bdev;
|
||||
+ bool mem_global_referenced;
|
||||
+};
|
||||
+
|
||||
+struct lima_ttm_tt {
|
||||
+ struct ttm_dma_tt ttm;
|
||||
+};
|
||||
+
|
||||
+struct lima_device;
|
||||
+struct lima_bo;
|
||||
+
|
||||
+int lima_ttm_init(struct lima_device *dev);
|
||||
+void lima_ttm_fini(struct lima_device *dev);
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
From f7f324da0402ba4efe3656e68d573fb649fd60f5 Mon Sep 17 00:00:00 2001
|
||||
From: Lima Project Developers <dri-devel@lists.freedesktop.org>
|
||||
Date: Wed, 16 May 2018 11:17:06 +0800
|
||||
Subject: [PATCH 060/146] drm/lima: add makefile and kconfig
|
||||
|
||||
Signed-off-by: Qiang Yu <yuq825@gmail.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
Signed-off-by: Simon Shields <simon@lineageos.org>
|
||||
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
||||
---
|
||||
drivers/gpu/drm/Kconfig | 2 ++
|
||||
drivers/gpu/drm/Makefile | 1 +
|
||||
drivers/gpu/drm/lima/Kconfig | 9 +++++++++
|
||||
drivers/gpu/drm/lima/Makefile | 19 +++++++++++++++++++
|
||||
4 files changed, 31 insertions(+)
|
||||
create mode 100644 drivers/gpu/drm/lima/Kconfig
|
||||
create mode 100644 drivers/gpu/drm/lima/Makefile
|
||||
|
||||
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
|
||||
index cb88528e7b10..145c093c3dec 100644
|
||||
--- a/drivers/gpu/drm/Kconfig
|
||||
+++ b/drivers/gpu/drm/Kconfig
|
||||
@@ -315,6 +315,8 @@ source "drivers/gpu/drm/tve200/Kconfig"
|
||||
|
||||
source "drivers/gpu/drm/xen/Kconfig"
|
||||
|
||||
+source "drivers/gpu/drm/lima/Kconfig"
|
||||
+
|
||||
# Keep legacy drivers last
|
||||
|
||||
menuconfig DRM_LEGACY
|
||||
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
|
||||
index a6771cef85e2..302b4c8e7cf0 100644
|
||||
--- a/drivers/gpu/drm/Makefile
|
||||
+++ b/drivers/gpu/drm/Makefile
|
||||
@@ -107,3 +107,4 @@ obj-$(CONFIG_DRM_TINYDRM) += tinydrm/
|
||||
obj-$(CONFIG_DRM_PL111) += pl111/
|
||||
obj-$(CONFIG_DRM_TVE200) += tve200/
|
||||
obj-$(CONFIG_DRM_XEN) += xen/
|
||||
+obj-$(CONFIG_DRM_LIMA) += lima/
|
||||
diff --git a/drivers/gpu/drm/lima/Kconfig b/drivers/gpu/drm/lima/Kconfig
|
||||
new file mode 100644
|
||||
index 000000000000..4ce9ac2e8204
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/lima/Kconfig
|
||||
@@ -0,0 +1,9 @@
|
||||
+
|
||||
+config DRM_LIMA
|
||||
+ tristate "LIMA (DRM support for ARM Mali 400/450 GPU)"
|
||||
+ depends on DRM
|
||||
+ depends on ARCH_SUNXI || ARCH_ROCKCHIP || ARCH_EXYNOS || ARCH_MESON
|
||||
+ select DRM_SCHED
|
||||
+ select DRM_TTM
|
||||
+ help
|
||||
+ DRM driver for ARM Mali 400/450 GPUs.
|
||||
diff --git a/drivers/gpu/drm/lima/Makefile b/drivers/gpu/drm/lima/Makefile
|
||||
new file mode 100644
|
||||
index 000000000000..0a1d6605f164
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/lima/Makefile
|
||||
@@ -0,0 +1,19 @@
|
||||
+lima-y := \
|
||||
+ lima_drv.o \
|
||||
+ lima_device.o \
|
||||
+ lima_pmu.o \
|
||||
+ lima_l2_cache.o \
|
||||
+ lima_mmu.o \
|
||||
+ lima_gp.o \
|
||||
+ lima_pp.o \
|
||||
+ lima_gem.o \
|
||||
+ lima_vm.o \
|
||||
+ lima_sched.o \
|
||||
+ lima_ctx.o \
|
||||
+ lima_gem_prime.o \
|
||||
+ lima_dlbu.o \
|
||||
+ lima_bcast.o \
|
||||
+ lima_ttm.o \
|
||||
+ lima_object.o
|
||||
+
|
||||
+obj-$(CONFIG_DRM_LIMA) += lima.o
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
From fa09957c702e5aa41c09ca452bd7220c1e8a6985 Mon Sep 17 00:00:00 2001
|
||||
From: Qiang Yu <yuq825@gmail.com>
|
||||
Date: Sun, 15 Jul 2018 11:24:41 +0800
|
||||
Subject: [PATCH 076/146] drm/lima: remove depend on ARM arch
|
||||
|
||||
Mali GPU is used on x86-64 arch too:
|
||||
https://en.wikipedia.org/wiki/Rockchip#Tablet_processors_with_integrated_modem
|
||||
|
||||
Always use need_dma32 as it won't cause any trouble
|
||||
on 32bit arch.
|
||||
|
||||
Signed-off-by: Qiang Yu <yuq825@gmail.com>
|
||||
---
|
||||
drivers/gpu/drm/lima/Kconfig | 1 -
|
||||
drivers/gpu/drm/lima/lima_ttm.c | 9 +--------
|
||||
2 files changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/lima/Kconfig b/drivers/gpu/drm/lima/Kconfig
|
||||
index bb75bcb97ccb..89d63cca8a75 100644
|
||||
--- a/drivers/gpu/drm/lima/Kconfig
|
||||
+++ b/drivers/gpu/drm/lima/Kconfig
|
||||
@@ -4,7 +4,6 @@
|
||||
config DRM_LIMA
|
||||
tristate "LIMA (DRM support for ARM Mali 400/450 GPU)"
|
||||
depends on DRM
|
||||
- depends on ARM || ARM64 || COMPILE_TEST
|
||||
select DRM_SCHED
|
||||
select DRM_TTM
|
||||
help
|
||||
diff --git a/drivers/gpu/drm/lima/lima_ttm.c b/drivers/gpu/drm/lima/lima_ttm.c
|
||||
index a79ff0e86929..af46dd1edf43 100644
|
||||
--- a/drivers/gpu/drm/lima/lima_ttm.c
|
||||
+++ b/drivers/gpu/drm/lima/lima_ttm.c
|
||||
@@ -333,25 +333,18 @@ static struct ttm_bo_driver lima_bo_driver = {
|
||||
int lima_ttm_init(struct lima_device *dev)
|
||||
{
|
||||
int err;
|
||||
- bool need_dma32;
|
||||
u64 gtt_size;
|
||||
|
||||
err = lima_ttm_global_init(dev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
-#if defined(CONFIG_ARM) && !defined(CONFIG_ARM_LPAE)
|
||||
- need_dma32 = false;
|
||||
-#else
|
||||
- need_dma32 = true;
|
||||
-#endif
|
||||
-
|
||||
err = ttm_bo_device_init(&dev->mman.bdev,
|
||||
dev->mman.bo_global_ref.ref.object,
|
||||
&lima_bo_driver,
|
||||
dev->ddev->anon_inode->i_mapping,
|
||||
DRM_FILE_PAGE_OFFSET,
|
||||
- need_dma32);
|
||||
+ true);
|
||||
if (err) {
|
||||
dev_err(dev->dev, "failed initializing buffer object "
|
||||
"driver(%d).\n", err);
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
Add table
Reference in a new issue