Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/plane: modify create_in_formats to acommodate async

create_in_formats creates the list of supported format/modifiers for
synchronous flips, modify the same function so as to take the
format_mod_supported as argument and create list of format/modifier for
async as well.

v5: create_in_formats can return -ve value in failure case, correct the
if condition to check the creation of blob <Chaitanya>
Dont add the modifier for which none of the formats is not supported.
v6: Remove the code for masking the unsupported modifiers as UMD can
leave with it. (Naveen/Chaitanya)
v7: Retain the unsupported modifiers, userspace should have no
impact, return pointer to blob instead of blob_id(Ville)

Signed-off-by: Arun R Murthy <arun.r.murthy@intel.com>
Acked-by: Xaver Hugl <xaver.hugl@kde.org>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Tested-by: Naveen Kumar <naveen1.kumar@intel.com>
Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://lore.kernel.org/r/20250407-asyn-v13-2-b93ef83076c5@intel.com

authored by

Arun R Murthy and committed by
Suraj Kandpal
0d6dcd74 9cd5cc9d

+31 -13
+31 -13
drivers/gpu/drm/drm_plane.c
··· 193 193 return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset); 194 194 } 195 195 196 - static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane) 196 + static struct drm_property_blob *create_in_format_blob(struct drm_device *dev, 197 + struct drm_plane *plane, 198 + bool (*format_mod_supported) 199 + (struct drm_plane *plane, 200 + u32 format, 201 + u64 modifier)) 197 202 { 198 - const struct drm_mode_config *config = &dev->mode_config; 199 203 struct drm_property_blob *blob; 200 204 struct drm_format_modifier *mod; 201 205 size_t blob_size, formats_size, modifiers_size; ··· 225 221 226 222 blob = drm_property_create_blob(dev, blob_size, NULL); 227 223 if (IS_ERR(blob)) 228 - return -1; 224 + return NULL; 229 225 230 226 blob_data = blob->data; 231 227 blob_data->version = FORMAT_BLOB_CURRENT; ··· 241 237 mod = modifiers_ptr(blob_data); 242 238 for (i = 0; i < plane->modifier_count; i++) { 243 239 for (j = 0; j < plane->format_count; j++) { 244 - if (!plane->funcs->format_mod_supported || 245 - plane->funcs->format_mod_supported(plane, 246 - plane->format_types[j], 247 - plane->modifiers[i])) { 240 + if (!format_mod_supported || 241 + format_mod_supported(plane, 242 + plane->format_types[j], 243 + plane->modifiers[i])) { 248 244 mod->formats |= 1ULL << j; 249 245 } 250 246 } ··· 255 251 mod++; 256 252 } 257 253 258 - drm_object_attach_property(&plane->base, config->modifiers_property, 259 - blob->base.id); 260 - 261 - return 0; 254 + return blob; 262 255 } 263 256 264 257 /** ··· 367 366 const char *name, va_list ap) 368 367 { 369 368 struct drm_mode_config *config = &dev->mode_config; 369 + struct drm_property_blob *blob; 370 370 static const uint64_t default_modifiers[] = { 371 371 DRM_FORMAT_MOD_LINEAR, 372 372 }; ··· 479 477 drm_plane_create_hotspot_properties(plane); 480 478 } 481 479 482 - if (format_modifier_count) 483 - create_in_format_blob(dev, plane); 480 + if (format_modifier_count) { 481 + blob = create_in_format_blob(dev, plane, 482 + plane->funcs->format_mod_supported); 483 + if (!IS_ERR(blob)) 484 + drm_object_attach_property(&plane->base, 485 + config->modifiers_property, 486 + blob->base.id); 487 + } 488 + 489 + if (plane->funcs->format_mod_supported_async) { 490 + blob = create_in_format_blob(dev, plane, 491 + plane->funcs->format_mod_supported_async); 492 + if (!IS_ERR(blob)) 493 + drm_object_attach_property(&plane->base, 494 + config->async_modifiers_property, 495 + blob->base.id); 496 + } 497 + 484 498 485 499 return 0; 486 500 }