build/patch/kernel/sunxi-next-old/30-sun4i-drm-add-GEM-allocator.patch
Igor Pečovnik 1a12994e79
Moving sunxi-next to 4.17.y (#1049)
* [Early WIP] Update sunxi-next to kernel 4.17
* Switch Allwinner 32 and 64bit to U-boot 2018.05
* Adjust patched for 4.17.y / sunxi-next
- adjust both configurations
- removing FAT support from u-boot (breaks if you try to save)

Tested those boards:
Cubietruck: wlan fails http://ix.io/1fYS USB OK, HDMI yes
Bananapi R40: http://ix.io/1fZm USB OK, HDMI yes
Lime A64: USB no, HDMI no, wireless buggy, eMMC yes
Orangepi prime H5: OK http://ix.io/1fZJ DVFS no
Orangepi2e: DVFS OK, HDMI OK, net OK, wifi OK, eMMC ok,  http://ix.io/1fZT

* Kernel config update, enabling HDMI on CT+
* Trying to fix A64 HDMI but failed. Fixed M64 ethernet instead
* Update orangepioneplus.wip
* Update orangepioneplus.wip
* Fix H6 build process
* Add regulator bits for Orangepizero+, thanks to @5kft
* add H5 support for optional 1.3v regulator and 1.3GHz operation
This patch adds two optional overlays that can be used to:

1) enable the 1.1v/1.3v regulator on boards that provide the necessary compatible H/W support
2) modify the default CPU clock operating table to add new 1.2GHz and 1.3GHz clocks

Note that the generated regulator overlay will only support boards whose 1.1v/1.3v regulator
is controlled by GPIO PL6.
* updates for the NanoPi NEO Plus2
This change introduces a patch that provides two changes for the NanoPi NEO Plus2:
* Configure the "cpu0" to use the "vdd_cpux" regulator; this enables the ability to use higher CPU clocks
* Correct the configurations of the on-board power and status LEDs
* Adjust nightly building and few boards config cleanup
2018-07-17 15:53:30 +02:00

99 lines
2.9 KiB
Diff

From 98b373a7c4b0b634979ff646d8aa40ea0ab96c1a Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime.ripard@free-electrons.com>
Date: Mon, 7 Dec 2015 09:47:34 +0100
Subject: [PATCH] drm/sun4i: Add GEM allocator
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/gpu/drm/sun4i/sun4i_drv.c | 27 +++++++++++++++++++++++++++
include/uapi/drm/sun4i_drm.h | 29 +++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 include/uapi/drm/sun4i_drm.h
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index a45a627283a14..52991511ccd48 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -21,6 +21,8 @@
#include <drm/drm_fb_helper.h>
#include <drm/drm_of.h>
+#include <uapi/drm/sun4i_drm.h>
+
#include "sun4i_drv.h"
#include "sun4i_framebuffer.h"
#include "sun4i_tcon.h"
@@ -34,6 +36,27 @@ static void sun4i_drv_lastclose(struct drm_device *dev)
DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops);
+static int sun4i_gem_create_ioctl(struct drm_device *drm, void *data,
+ struct drm_file *file_priv)
+{
+ struct drm_sun4i_gem_create *args = data;
+ struct drm_gem_cma_object *cma_obj;
+ size_t size;
+
+ /* The Mali requires a 64 bytes alignment */
+ size = ALIGN(args->size, 64);
+
+ cma_obj = drm_gem_cma_create_with_handle(file_priv, drm, size,
+ &args->handle);
+
+ return PTR_ERR_OR_ZERO(cma_obj);
+}
+
+static const struct drm_ioctl_desc sun4i_drv_ioctls[] = {
+ DRM_IOCTL_DEF_DRV(SUN4I_GEM_CREATE, sun4i_gem_create_ioctl,
+ DRM_UNLOCKED | DRM_AUTH),
+};
+
static struct drm_driver sun4i_drv_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC,
@@ -46,6 +69,10 @@ static struct drm_driver sun4i_drv_driver = {
.major = 1,
.minor = 0,
+ /* Custom ioctls */
+ .ioctls = sun4i_drv_ioctls,
+ .num_ioctls = ARRAY_SIZE(sun4i_drv_ioctls),
+
/* GEM Operations */
.dumb_create = drm_gem_cma_dumb_create,
.dumb_destroy = drm_gem_dumb_destroy,
diff --git a/include/uapi/drm/sun4i_drm.h b/include/uapi/drm/sun4i_drm.h
new file mode 100644
index 0000000000000..67b9dd4ee594b
--- /dev/null
+++ b/include/uapi/drm/sun4i_drm.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2015 Free Electrons
+ * Copyright (C) 2015 NextThing Co
+ *
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#ifndef _UAPI_SUN4I_DRM_H_
+#define _UAPI_SUN4I_DRM_H_
+
+#include <drm/drm.h>
+
+struct drm_sun4i_gem_create {
+ __u64 size;
+ __u32 flags;
+ __u32 handle;
+};
+
+#define DRM_SUN4I_GEM_CREATE 0x00
+
+#define DRM_IOCTL_SUN4I_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_SUN4I_GEM_CREATE, \
+ struct drm_sun4i_gem_create)
+
+#endif