diff mbox

[Intel-gfx,v2,2/3] drm: Create a format/modifier blob

Message ID CAPj87rNPeLepHCN2dO72dNiq6a5t7aHX2Aw-8JJMTF5MOJbCfA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Stone May 23, 2017, 4:39 p.m. UTC
Hi Ben,

On 16 May 2017 at 22:31, Ben Widawsky <ben@bwidawsk.net> wrote:
> Updated blob layout (Rob, Daniel, Kristian, xerpi)

If you take the attached fixup, this is:
Reviewed-by: Daniel Stone <daniels@collabora.com>

The rest of the series looks fine to me, so you can take my Acked-by,
but I'm currently off work sick and am away next week, so please don't
block on me for merging.

Cheers,
Daniel
commit 250f3b2c2a824516b18fe21623ddc86ccf31eddb
Author: Daniel Stone <daniels@collabora.com>
Date:   Tue May 23 17:36:55 2017 +0100

    fixup! drm: Create a format/modifier blob
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
index f5b032b5f761..083231750583 100644
--- a/drivers/gpu/drm/drm_plane.c
+++ b/drivers/gpu/drm/drm_plane.c
@@ -77,18 +77,12 @@  modifiers_ptr(struct drm_format_modifier_blob *blob)
 static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane)
 {
 	const struct drm_mode_config *config = &dev->mode_config;
-	const uint64_t *temp_modifiers = plane->modifiers;
-	unsigned int format_modifier_count = 0;
 	struct drm_property_blob *blob = NULL;
 	struct drm_format_modifier *mod;
 	size_t blob_size = 0, formats_size, modifiers_size;
 	struct drm_format_modifier_blob *blob_data;
 	int i, j, ret = 0;
 
-	if (plane->modifiers)
-		while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID)
-			format_modifier_count++;
-
 	formats_size = sizeof(*plane->format_types) * plane->format_count;
 	if (WARN_ON(!formats_size)) {
 		/* 0 formats are never expected */
@@ -96,7 +90,7 @@  static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 	}
 
 	modifiers_size =
-		sizeof(struct drm_format_modifier) * format_modifier_count;
+		sizeof(struct drm_format_modifier) * plane->modifier_count;
 
 	blob_size = sizeof(struct drm_format_modifier_blob);
 	blob_size += ALIGN(formats_size, 8);
@@ -110,7 +104,7 @@  static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 	blob_data->version = FORMAT_BLOB_CURRENT;
 	blob_data->count_formats = plane->format_count;
 	blob_data->formats_offset = sizeof(struct drm_format_modifier_blob);
-	blob_data->count_modifiers = format_modifier_count;
+	blob_data->count_modifiers = plane->modifier_count;
 
 	/* Modifiers offset is a pointer to a struct with a 64 bit field so it
 	 * should be naturally aligned to 8B.
@@ -125,7 +119,7 @@  static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane
 		goto done;
 
 	mod = modifiers_ptr(blob_data);
-	for (i = 0; i < format_modifier_count; i++) {
+	for (i = 0; i < plane->modifier_count; i++) {
 		for (j = 0; j < plane->format_count; j++) {
 			if (plane->funcs->format_mod_supported(plane,
 							       plane->format_types[j],