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]
Date:   Thu, 16 Dec 2021 18:01:39 +0100
From:   José Expósito <jose.exposito89@...il.com>
To:     rodrigosiqueiramelo@...il.com
Cc:     melissa.srw@...il.com, hamohammed.sa@...il.com, daniel@...ll.ch,
        airlied@...ux.ie, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org, cphealy@...il.com,
        contact@...rsion.fr,
        José Expósito <jose.exposito89@...il.com>
Subject: [PATCH v2 1/2] drm/vkms: add function to get plane formats

Move the logic to get the plane formats depending on the plane type to
its own function.
Refactor, no functional changes.

Signed-off-by: José Expósito <jose.exposito89@...il.com>
---
 drivers/gpu/drm/vkms/vkms_plane.c | 37 ++++++++++++++++---------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_plane.c b/drivers/gpu/drm/vkms/vkms_plane.c
index 32409e15244b..76a06dd92ac1 100644
--- a/drivers/gpu/drm/vkms/vkms_plane.c
+++ b/drivers/gpu/drm/vkms/vkms_plane.c
@@ -83,6 +83,23 @@ static void vkms_plane_reset(struct drm_plane *plane)
 	__drm_gem_reset_shadow_plane(plane, &vkms_state->base);
 }
 
+static void vkms_formats_for_plane_type(enum drm_plane_type type,
+					const u32 **formats, int *nformats)
+{
+	switch (type) {
+	case DRM_PLANE_TYPE_CURSOR:
+	case DRM_PLANE_TYPE_OVERLAY:
+		*formats = vkms_plane_formats;
+		*nformats = ARRAY_SIZE(vkms_plane_formats);
+		break;
+	case DRM_PLANE_TYPE_PRIMARY:
+	default:
+		*formats = vkms_formats;
+		*nformats = ARRAY_SIZE(vkms_formats);
+		break;
+	}
+}
+
 static const struct drm_plane_funcs vkms_plane_funcs = {
 	.update_plane		= drm_atomic_helper_update_plane,
 	.disable_plane		= drm_atomic_helper_disable_plane,
@@ -167,24 +184,8 @@ struct vkms_plane *vkms_plane_init(struct vkms_device *vkmsdev,
 	const u32 *formats;
 	int nformats;
 
-	switch (type) {
-	case DRM_PLANE_TYPE_PRIMARY:
-		formats = vkms_formats;
-		nformats = ARRAY_SIZE(vkms_formats);
-		funcs = &vkms_primary_helper_funcs;
-		break;
-	case DRM_PLANE_TYPE_CURSOR:
-	case DRM_PLANE_TYPE_OVERLAY:
-		formats = vkms_plane_formats;
-		nformats = ARRAY_SIZE(vkms_plane_formats);
-		funcs = &vkms_primary_helper_funcs;
-		break;
-	default:
-		formats = vkms_formats;
-		nformats = ARRAY_SIZE(vkms_formats);
-		funcs = &vkms_primary_helper_funcs;
-		break;
-	}
+	funcs = &vkms_primary_helper_funcs;
+	vkms_formats_for_plane_type(type, &formats, &nformats);
 
 	plane = drmm_universal_plane_alloc(dev, struct vkms_plane, base, 1 << index,
 					   &vkms_plane_funcs,
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ