lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1485960530-22728-1-git-send-email-mihail.atanassov@arm.com>
Date:   Wed, 1 Feb 2017 14:48:49 +0000
From:   Mihail Atanassov <mihail.atanassov@....com>
To:     <dri-devel@...ts.freedesktop.org>
CC:     Liviu Dudau <liviu.dudau@....com>,
        Brian Starkey <brian.starkey@....com>,
        David Airlie <airlied@...ux.ie>,
        <linux-kernel@...r.kernel.org>,
        Mali DP Maintainers <malidp@...s.arm.com>, <nd@....com>
Subject: [PATCH v2 1/2] drm: mali-dp: add malidp_crtc_state struct

Add a custom CRTC state struct to enable storing driver-private per-CRTC
state. This patch only adds the base drm_crtc_state struct.

Signed-off-by: Mihail Atanassov <mihail.atanassov@....com>
Reviewed-by: Brian Starkey <brian.starkey@....com>
---
Link to v1: https://lkml.org/lkml/2017/2/1/203
Changes since v1:
 - Moved unused variable to patch 2/2, where it is used.

 drivers/gpu/drm/arm/malidp_crtc.c | 37 +++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/arm/malidp_drv.h  |  6 ++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/arm/malidp_crtc.c b/drivers/gpu/drm/arm/malidp_crtc.c
index 08e6a71..ebf57e6 100644
--- a/drivers/gpu/drm/arm/malidp_crtc.c
+++ b/drivers/gpu/drm/arm/malidp_crtc.c
@@ -160,6 +160,39 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
 	return 0;
 }
 
+static struct drm_crtc_state *malidp_crtc_duplicate_state(struct drm_crtc *crtc)
+{
+	struct malidp_crtc_state *state;
+
+	if (WARN_ON(!crtc->state))
+		return NULL;
+
+	state = kmalloc(sizeof(*state), GFP_KERNEL);
+	if (!state)
+		return NULL;
+
+	__drm_atomic_helper_crtc_duplicate_state(crtc, &state->base);
+
+	return &state->base;
+}
+
+static void malidp_crtc_reset(struct drm_crtc *crtc)
+{
+	struct malidp_crtc_state *cs = (crtc->state) ?
+				       to_malidp_crtc_state(crtc->state) : NULL;
+
+	if (crtc->state)
+		__drm_atomic_helper_crtc_destroy_state(crtc->state);
+
+	kfree(cs);
+	cs = kzalloc(sizeof(*cs), GFP_KERNEL);
+	if (!cs)
+		return;
+
+	crtc->state = &cs->base;
+	crtc->state->crtc = crtc;
+}
+
 static const struct drm_crtc_helper_funcs malidp_crtc_helper_funcs = {
 	.mode_fixup = malidp_crtc_mode_fixup,
 	.enable = malidp_crtc_enable,
@@ -171,8 +204,8 @@ static int malidp_crtc_atomic_check(struct drm_crtc *crtc,
 	.destroy = drm_crtc_cleanup,
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
-	.reset = drm_atomic_helper_crtc_reset,
-	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
+	.reset = malidp_crtc_reset,
+	.atomic_duplicate_state = malidp_crtc_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
 };
 
diff --git a/drivers/gpu/drm/arm/malidp_drv.h b/drivers/gpu/drm/arm/malidp_drv.h
index 9fc8a2e..c7a69ae 100644
--- a/drivers/gpu/drm/arm/malidp_drv.h
+++ b/drivers/gpu/drm/arm/malidp_drv.h
@@ -47,6 +47,12 @@ struct malidp_plane_state {
 #define to_malidp_plane(x) container_of(x, struct malidp_plane, base)
 #define to_malidp_plane_state(x) container_of(x, struct malidp_plane_state, base)
 
+struct malidp_crtc_state {
+	struct drm_crtc_state base;
+};
+
+#define to_malidp_crtc_state(x) container_of(x, struct malidp_crtc_state, base)
+
 int malidp_de_planes_init(struct drm_device *drm);
 void malidp_de_planes_destroy(struct drm_device *drm);
 int malidp_crtc_init(struct drm_device *drm);
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ