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

drm/colorop: Introduce new drm_colorop mode object

This patches introduces a new drm_colorop mode object. This
object represents color transformations and can be used to
define color pipelines.

We also introduce the drm_colorop_state here, as well as
various helpers and state tracking bits.

Reviewed-by: Simon Ser <contact@emersion.fr>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Sebastian Wick <sebastian.wick@redhat.com>
Signed-off-by: Simon Ser <contact@emersion.fr>
Link: https://patch.msgid.link/20251115000237.3561250-5-alex.hung@amd.com

authored by

Harry Wentland and committed by
Simon Ser
cfc27680 bcaefdaa

+504
+1
drivers/gpu/drm/Makefile
··· 41 41 drm_bridge.o \ 42 42 drm_cache.o \ 43 43 drm_color_mgmt.o \ 44 + drm_colorop.o \ 44 45 drm_connector.o \ 45 46 drm_crtc.o \ 46 47 drm_displayid.o \
+69
drivers/gpu/drm/drm_atomic.c
··· 42 42 #include <drm/drm_mode.h> 43 43 #include <drm/drm_print.h> 44 44 #include <drm/drm_writeback.h> 45 + #include <drm/drm_colorop.h> 45 46 46 47 #include "drm_crtc_internal.h" 47 48 #include "drm_internal.h" ··· 108 107 kfree(state->connectors); 109 108 kfree(state->crtcs); 110 109 kfree(state->planes); 110 + kfree(state->colorops); 111 111 kfree(state->private_objs); 112 112 } 113 113 EXPORT_SYMBOL(drm_atomic_state_default_release); ··· 139 137 state->planes = kcalloc(dev->mode_config.num_total_plane, 140 138 sizeof(*state->planes), GFP_KERNEL); 141 139 if (!state->planes) 140 + goto fail; 141 + state->colorops = kcalloc(dev->mode_config.num_colorop, 142 + sizeof(*state->colorops), GFP_KERNEL); 143 + if (!state->colorops) 142 144 goto fail; 143 145 144 146 /* ··· 255 249 state->planes[i].state_to_destroy = NULL; 256 250 state->planes[i].old_state = NULL; 257 251 state->planes[i].new_state = NULL; 252 + } 253 + 254 + for (i = 0; i < config->num_colorop; i++) { 255 + struct drm_colorop *colorop = state->colorops[i].ptr; 256 + 257 + if (!colorop) 258 + continue; 259 + 260 + drm_colorop_atomic_destroy_state(colorop, 261 + state->colorops[i].state); 262 + state->colorops[i].ptr = NULL; 263 + state->colorops[i].state = NULL; 264 + state->colorops[i].old_state = NULL; 265 + state->colorops[i].new_state = NULL; 258 266 } 259 267 260 268 for (i = 0; i < state->num_private_objs; i++) { ··· 591 571 return plane_state; 592 572 } 593 573 EXPORT_SYMBOL(drm_atomic_get_plane_state); 574 + 575 + /** 576 + * drm_atomic_get_colorop_state - get colorop state 577 + * @state: global atomic state object 578 + * @colorop: colorop to get state object for 579 + * 580 + * This function returns the colorop state for the given colorop, allocating it 581 + * if needed. It will also grab the relevant plane lock to make sure that the 582 + * state is consistent. 583 + * 584 + * Returns: 585 + * 586 + * Either the allocated state or the error code encoded into the pointer. When 587 + * the error is EDEADLK then the w/w mutex code has detected a deadlock and the 588 + * entire atomic sequence must be restarted. All other errors are fatal. 589 + */ 590 + struct drm_colorop_state * 591 + drm_atomic_get_colorop_state(struct drm_atomic_state *state, 592 + struct drm_colorop *colorop) 593 + { 594 + int ret, index = drm_colorop_index(colorop); 595 + struct drm_colorop_state *colorop_state; 596 + 597 + WARN_ON(!state->acquire_ctx); 598 + 599 + colorop_state = drm_atomic_get_new_colorop_state(state, colorop); 600 + if (colorop_state) 601 + return colorop_state; 602 + 603 + ret = drm_modeset_lock(&colorop->plane->mutex, state->acquire_ctx); 604 + if (ret) 605 + return ERR_PTR(ret); 606 + 607 + colorop_state = drm_atomic_helper_colorop_duplicate_state(colorop); 608 + if (!colorop_state) 609 + return ERR_PTR(-ENOMEM); 610 + 611 + state->colorops[index].state = colorop_state; 612 + state->colorops[index].ptr = colorop; 613 + state->colorops[index].old_state = colorop->state; 614 + state->colorops[index].new_state = colorop_state; 615 + colorop_state->state = state; 616 + 617 + drm_dbg_atomic(colorop->dev, "Added [COLOROP:%d] %p state to %p\n", 618 + colorop->base.id, colorop_state, state); 619 + 620 + return colorop_state; 621 + } 622 + EXPORT_SYMBOL(drm_atomic_get_colorop_state); 594 623 595 624 static bool 596 625 plane_switching_crtc(const struct drm_plane_state *old_plane_state,
+12
drivers/gpu/drm/drm_atomic_helper.c
··· 3184 3184 struct drm_crtc_state *old_crtc_state, *new_crtc_state; 3185 3185 struct drm_plane *plane; 3186 3186 struct drm_plane_state *old_plane_state, *new_plane_state; 3187 + struct drm_colorop *colorop; 3188 + struct drm_colorop_state *old_colorop_state, *new_colorop_state; 3187 3189 struct drm_crtc_commit *commit; 3188 3190 struct drm_private_obj *obj; 3189 3191 struct drm_private_state *old_obj_state, *new_obj_state; ··· 3261 3259 3262 3260 new_crtc_state->commit->event = NULL; 3263 3261 } 3262 + } 3263 + 3264 + for_each_oldnew_colorop_in_state(state, colorop, old_colorop_state, new_colorop_state, i) { 3265 + WARN_ON(colorop->state != old_colorop_state); 3266 + 3267 + old_colorop_state->state = state; 3268 + new_colorop_state->state = NULL; 3269 + 3270 + state->colorops[i].state = old_colorop_state; 3271 + colorop->state = new_colorop_state; 3264 3272 } 3265 3273 3266 3274 drm_panic_lock(state->dev, flags);
+45
drivers/gpu/drm/drm_atomic_uapi.c
··· 35 35 #include <drm/drm_drv.h> 36 36 #include <drm/drm_writeback.h> 37 37 #include <drm/drm_vblank.h> 38 + #include <drm/drm_colorop.h> 38 39 39 40 #include <linux/export.h> 40 41 #include <linux/dma-fence.h> ··· 649 648 return 0; 650 649 } 651 650 651 + static int drm_atomic_colorop_set_property(struct drm_colorop *colorop, 652 + struct drm_colorop_state *state, 653 + struct drm_file *file_priv, 654 + struct drm_property *property, 655 + uint64_t val) 656 + { 657 + drm_dbg_atomic(colorop->dev, 658 + "[COLOROP:%d] unknown property [PROP:%d:%s]]\n", 659 + colorop->base.id, property->base.id, property->name); 660 + return -EINVAL; 661 + } 662 + 663 + static int 664 + drm_atomic_colorop_get_property(struct drm_colorop *colorop, 665 + const struct drm_colorop_state *state, 666 + struct drm_property *property, uint64_t *val) 667 + { 668 + return -EINVAL; 669 + } 670 + 652 671 static int drm_atomic_set_writeback_fb_for_connector( 653 672 struct drm_connector_state *conn_state, 654 673 struct drm_framebuffer *fb) ··· 935 914 plane->state, property, val); 936 915 break; 937 916 } 917 + case DRM_MODE_OBJECT_COLOROP: { 918 + struct drm_colorop *colorop = obj_to_colorop(obj); 919 + 920 + if (colorop->plane) 921 + WARN_ON(!drm_modeset_is_locked(&colorop->plane->mutex)); 922 + 923 + ret = drm_atomic_colorop_get_property(colorop, colorop->state, property, val); 924 + break; 925 + } 938 926 default: 939 927 drm_dbg_atomic(dev, "[OBJECT:%d] has no properties\n", obj->id); 940 928 ret = -EINVAL; ··· 1141 1111 ret = drm_atomic_plane_set_property(plane, 1142 1112 plane_state, file_priv, 1143 1113 prop, prop_value); 1114 + 1115 + break; 1116 + } 1117 + case DRM_MODE_OBJECT_COLOROP: { 1118 + struct drm_colorop *colorop = obj_to_colorop(obj); 1119 + struct drm_colorop_state *colorop_state; 1120 + 1121 + colorop_state = drm_atomic_get_colorop_state(state, colorop); 1122 + if (IS_ERR(colorop_state)) { 1123 + ret = PTR_ERR(colorop_state); 1124 + break; 1125 + } 1126 + 1127 + ret = drm_atomic_colorop_set_property(colorop, colorop_state, 1128 + file_priv, prop, prop_value); 1144 1129 break; 1145 1130 } 1146 1131 default:
+103
drivers/gpu/drm/drm_colorop.c
··· 1 + // SPDX-License-Identifier: MIT 2 + /* 3 + * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. 4 + * 5 + * Permission is hereby granted, free of charge, to any person obtaining a 6 + * copy of this software and associated documentation files (the "Software"), 7 + * to deal in the Software without restriction, including without limitation 8 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 + * and/or sell copies of the Software, and to permit persons to whom the 10 + * Software is furnished to do so, subject to the following conditions: 11 + * 12 + * The above copyright notice and this permission notice shall be included in 13 + * all copies or substantial portions of the Software. 14 + * 15 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 + * OTHER DEALINGS IN THE SOFTWARE. 22 + * 23 + * Authors: AMD 24 + * 25 + */ 26 + 27 + #include <drm/drm_colorop.h> 28 + #include <drm/drm_print.h> 29 + #include <drm/drm_drv.h> 30 + #include <drm/drm_plane.h> 31 + 32 + #include "drm_crtc_internal.h" 33 + 34 + static void __drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colorop, 35 + struct drm_colorop_state *state) 36 + { 37 + memcpy(state, colorop->state, sizeof(*state)); 38 + } 39 + 40 + struct drm_colorop_state * 41 + drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colorop) 42 + { 43 + struct drm_colorop_state *state; 44 + 45 + if (WARN_ON(!colorop->state)) 46 + return NULL; 47 + 48 + state = kmalloc(sizeof(*state), GFP_KERNEL); 49 + if (state) 50 + __drm_atomic_helper_colorop_duplicate_state(colorop, state); 51 + 52 + return state; 53 + } 54 + 55 + void drm_colorop_atomic_destroy_state(struct drm_colorop *colorop, 56 + struct drm_colorop_state *state) 57 + { 58 + kfree(state); 59 + } 60 + 61 + /** 62 + * __drm_colorop_state_reset - resets colorop state to default values 63 + * @colorop_state: atomic colorop state, must not be NULL 64 + * @colorop: colorop object, must not be NULL 65 + * 66 + * Initializes the newly allocated @colorop_state with default 67 + * values. This is useful for drivers that subclass the CRTC state. 68 + */ 69 + static void __drm_colorop_state_reset(struct drm_colorop_state *colorop_state, 70 + struct drm_colorop *colorop) 71 + { 72 + colorop_state->colorop = colorop; 73 + } 74 + 75 + /** 76 + * __drm_colorop_reset - reset state on colorop 77 + * @colorop: drm colorop 78 + * @colorop_state: colorop state to assign 79 + * 80 + * Initializes the newly allocated @colorop_state and assigns it to 81 + * the &drm_crtc->state pointer of @colorop, usually required when 82 + * initializing the drivers or when called from the &drm_colorop_funcs.reset 83 + * hook. 84 + * 85 + * This is useful for drivers that subclass the colorop state. 86 + */ 87 + static void __drm_colorop_reset(struct drm_colorop *colorop, 88 + struct drm_colorop_state *colorop_state) 89 + { 90 + if (colorop_state) 91 + __drm_colorop_state_reset(colorop_state, colorop); 92 + 93 + colorop->state = colorop_state; 94 + } 95 + 96 + void drm_colorop_reset(struct drm_colorop *colorop) 97 + { 98 + kfree(colorop->state); 99 + colorop->state = kzalloc(sizeof(*colorop->state), GFP_KERNEL); 100 + 101 + if (colorop->state) 102 + __drm_colorop_reset(colorop, colorop->state); 103 + }
+7
drivers/gpu/drm/drm_mode_config.c
··· 30 30 #include <drm/drm_managed.h> 31 31 #include <drm/drm_mode_config.h> 32 32 #include <drm/drm_print.h> 33 + #include <drm/drm_colorop.h> 33 34 #include <linux/dma-resv.h> 34 35 35 36 #include "drm_crtc_internal.h" ··· 193 192 void drm_mode_config_reset(struct drm_device *dev) 194 193 { 195 194 struct drm_crtc *crtc; 195 + struct drm_colorop *colorop; 196 196 struct drm_plane *plane; 197 197 struct drm_encoder *encoder; 198 198 struct drm_connector *connector; 199 199 struct drm_connector_list_iter conn_iter; 200 + 201 + drm_for_each_colorop(colorop, dev) 202 + drm_colorop_reset(colorop); 200 203 201 204 drm_for_each_plane(plane, dev) 202 205 if (plane->funcs->reset) ··· 442 437 INIT_LIST_HEAD(&dev->mode_config.property_list); 443 438 INIT_LIST_HEAD(&dev->mode_config.property_blob_list); 444 439 INIT_LIST_HEAD(&dev->mode_config.plane_list); 440 + INIT_LIST_HEAD(&dev->mode_config.colorop_list); 445 441 INIT_LIST_HEAD(&dev->mode_config.privobj_list); 446 442 idr_init_base(&dev->mode_config.object_idr, 1); 447 443 idr_init_base(&dev->mode_config.tile_idr, 1); ··· 464 458 dev->mode_config.num_crtc = 0; 465 459 dev->mode_config.num_encoder = 0; 466 460 dev->mode_config.num_total_plane = 0; 461 + dev->mode_config.num_colorop = 0; 467 462 468 463 if (IS_ENABLED(CONFIG_LOCKDEP)) { 469 464 struct drm_modeset_acquire_ctx modeset_ctx;
+70
include/drm/drm_atomic.h
··· 30 30 31 31 #include <drm/drm_crtc.h> 32 32 #include <drm/drm_util.h> 33 + #include <drm/drm_colorop.h> 33 34 34 35 /** 35 36 * struct drm_crtc_commit - track modeset commits on a CRTC ··· 156 155 * used by the free code to remove the second reference if commit fails. 157 156 */ 158 157 bool abort_completion; 158 + }; 159 + 160 + struct __drm_colorops_state { 161 + struct drm_colorop *ptr; 162 + struct drm_colorop_state *state, *old_state, *new_state; 159 163 }; 160 164 161 165 struct __drm_planes_state { ··· 538 532 bool checked : 1; 539 533 540 534 /** 535 + * @colorops: 536 + * 537 + * Pointer to array of @drm_colorop and @drm_colorop_state part of this 538 + * update. 539 + */ 540 + struct __drm_colorops_state *colorops; 541 + 542 + /** 541 543 * @planes: 542 544 * 543 545 * Pointer to array of @drm_plane and @drm_plane_state part of this ··· 686 672 struct drm_plane_state * __must_check 687 673 drm_atomic_get_plane_state(struct drm_atomic_state *state, 688 674 struct drm_plane *plane); 675 + struct drm_colorop_state * 676 + drm_atomic_get_colorop_state(struct drm_atomic_state *state, 677 + struct drm_colorop *colorop); 689 678 struct drm_connector_state * __must_check 690 679 drm_atomic_get_connector_state(struct drm_atomic_state *state, 691 680 struct drm_connector *connector); ··· 783 766 struct drm_plane *plane) 784 767 { 785 768 return state->planes[drm_plane_index(plane)].new_state; 769 + } 770 + 771 + /** 772 + * drm_atomic_get_old_colorop_state - get colorop state, if it exists 773 + * @state: global atomic state object 774 + * @colorop: colorop to grab 775 + * 776 + * This function returns the old colorop state for the given colorop, or 777 + * NULL if the colorop is not part of the global atomic state. 778 + */ 779 + static inline struct drm_colorop_state * 780 + drm_atomic_get_old_colorop_state(struct drm_atomic_state *state, 781 + struct drm_colorop *colorop) 782 + { 783 + return state->colorops[drm_colorop_index(colorop)].old_state; 784 + } 785 + 786 + /** 787 + * drm_atomic_get_new_colorop_state - get colorop state, if it exists 788 + * @state: global atomic state object 789 + * @colorop: colorop to grab 790 + * 791 + * This function returns the new colorop state for the given colorop, or 792 + * NULL if the colorop is not part of the global atomic state. 793 + */ 794 + static inline struct drm_colorop_state * 795 + drm_atomic_get_new_colorop_state(struct drm_atomic_state *state, 796 + struct drm_colorop *colorop) 797 + { 798 + return state->colorops[drm_colorop_index(colorop)].new_state; 786 799 } 787 800 788 801 /** ··· 1044 997 (void)(crtc) /* Only to avoid unused-but-set-variable warning */, \ 1045 998 (new_crtc_state) = (__state)->crtcs[__i].new_state, \ 1046 999 (void)(new_crtc_state) /* Only to avoid unused-but-set-variable warning */, 1)) 1000 + 1001 + /** 1002 + * for_each_oldnew_colorop_in_state - iterate over all colorops in an atomic update 1003 + * @__state: &struct drm_atomic_state pointer 1004 + * @colorop: &struct drm_colorop iteration cursor 1005 + * @old_colorop_state: &struct drm_colorop_state iteration cursor for the old state 1006 + * @new_colorop_state: &struct drm_colorop_state iteration cursor for the new state 1007 + * @__i: int iteration cursor, for macro-internal use 1008 + * 1009 + * This iterates over all colorops in an atomic update, tracking both old and 1010 + * new state. This is useful in places where the state delta needs to be 1011 + * considered, for example in atomic check functions. 1012 + */ 1013 + #define for_each_oldnew_colorop_in_state(__state, colorop, old_colorop_state, \ 1014 + new_colorop_state, __i) \ 1015 + for ((__i) = 0; \ 1016 + (__i) < (__state)->dev->mode_config.num_colorop; \ 1017 + (__i)++) \ 1018 + for_each_if ((__state)->colorops[__i].ptr && \ 1019 + ((colorop) = (__state)->colorops[__i].ptr, \ 1020 + (void)(colorop) /* Only to avoid unused-but-set-variable warning */, \ 1021 + (old_colorop_state) = (__state)->colorops[__i].old_state,\ 1022 + (new_colorop_state) = (__state)->colorops[__i].new_state, 1)) 1047 1023 1048 1024 /** 1049 1025 * for_each_oldnew_plane_in_state - iterate over all planes in an atomic update
+1
include/drm/drm_atomic_uapi.h
··· 37 37 struct drm_connector_state; 38 38 struct dma_fence; 39 39 struct drm_framebuffer; 40 + struct drm_colorop; 40 41 41 42 int __must_check 42 43 drm_atomic_set_mode_for_crtc(struct drm_crtc_state *state,
+169
include/drm/drm_colorop.h
··· 1 + /* SPDX-License-Identifier: MIT */ 2 + /* 3 + * Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved. 4 + * 5 + * Permission is hereby granted, free of charge, to any person obtaining a 6 + * copy of this software and associated documentation files (the "Software"), 7 + * to deal in the Software without restriction, including without limitation 8 + * the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 + * and/or sell copies of the Software, and to permit persons to whom the 10 + * Software is furnished to do so, subject to the following conditions: 11 + * 12 + * The above copyright notice and this permission notice shall be included in 13 + * all copies or substantial portions of the Software. 14 + * 15 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 19 + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20 + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21 + * OTHER DEALINGS IN THE SOFTWARE. 22 + * 23 + * Authors: AMD 24 + * 25 + */ 26 + 27 + #ifndef __DRM_COLOROP_H__ 28 + #define __DRM_COLOROP_H__ 29 + 30 + #include <drm/drm_mode_object.h> 31 + #include <drm/drm_mode.h> 32 + #include <drm/drm_property.h> 33 + 34 + /** 35 + * struct drm_colorop_state - mutable colorop state 36 + */ 37 + struct drm_colorop_state { 38 + /** @colorop: backpointer to the colorop */ 39 + struct drm_colorop *colorop; 40 + 41 + /* 42 + * Color properties 43 + * 44 + * The following fields are not always valid, their usage depends 45 + * on the colorop type. See their associated comment for more 46 + * information. 47 + */ 48 + 49 + /** @state: backpointer to global drm_atomic_state */ 50 + struct drm_atomic_state *state; 51 + }; 52 + 53 + /** 54 + * struct drm_colorop - DRM color operation control structure 55 + * 56 + * A colorop represents one color operation. They can be chained via 57 + * the 'next' pointer to build a color pipeline. 58 + * 59 + * Since colorops cannot stand-alone and are used to describe colorop 60 + * operations on a plane they don't have their own locking mechanism but 61 + * are locked and programmed along with their associated &drm_plane. 62 + * 63 + */ 64 + struct drm_colorop { 65 + /** @dev: parent DRM device */ 66 + struct drm_device *dev; 67 + 68 + /** 69 + * @head: 70 + * 71 + * List of all colorops on @dev, linked from &drm_mode_config.colorop_list. 72 + * Invariant over the lifetime of @dev and therefore does not need 73 + * locking. 74 + */ 75 + struct list_head head; 76 + 77 + /** 78 + * @index: Position inside the mode_config.list, can be used as an array 79 + * index. It is invariant over the lifetime of the colorop. 80 + */ 81 + unsigned int index; 82 + 83 + /** @base: base mode object */ 84 + struct drm_mode_object base; 85 + 86 + /** 87 + * @plane: 88 + * 89 + * The plane on which the colorop sits. A drm_colorop is always unique 90 + * to a plane. 91 + */ 92 + struct drm_plane *plane; 93 + 94 + /** 95 + * @state: 96 + * 97 + * Current atomic state for this colorop. 98 + * 99 + * This is protected by @mutex. Note that nonblocking atomic commits 100 + * access the current colorop state without taking locks. 101 + */ 102 + struct drm_colorop_state *state; 103 + 104 + /* 105 + * Color properties 106 + * 107 + * The following fields are not always valid, their usage depends 108 + * on the colorop type. See their associated comment for more 109 + * information. 110 + */ 111 + 112 + /** @properties: property tracking for this colorop */ 113 + struct drm_object_properties properties; 114 + 115 + }; 116 + 117 + #define obj_to_colorop(x) container_of(x, struct drm_colorop, base) 118 + 119 + /** 120 + * drm_colorop_find - look up a Colorop object from its ID 121 + * @dev: DRM device 122 + * @file_priv: drm file to check for lease against. 123 + * @id: &drm_mode_object ID 124 + * 125 + * This can be used to look up a Colorop from its userspace ID. Only used by 126 + * drivers for legacy IOCTLs and interface, nowadays extensions to the KMS 127 + * userspace interface should be done using &drm_property. 128 + */ 129 + static inline struct drm_colorop *drm_colorop_find(struct drm_device *dev, 130 + struct drm_file *file_priv, 131 + uint32_t id) 132 + { 133 + struct drm_mode_object *mo; 134 + 135 + mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_COLOROP); 136 + return mo ? obj_to_colorop(mo) : NULL; 137 + } 138 + 139 + struct drm_colorop_state * 140 + drm_atomic_helper_colorop_duplicate_state(struct drm_colorop *colorop); 141 + 142 + void drm_colorop_atomic_destroy_state(struct drm_colorop *colorop, 143 + struct drm_colorop_state *state); 144 + 145 + /** 146 + * drm_colorop_reset - reset colorop atomic state 147 + * @colorop: drm colorop 148 + * 149 + * Resets the atomic state for @colorop by freeing the state pointer (which might 150 + * be NULL, e.g. at driver load time) and allocating a new empty state object. 151 + */ 152 + void drm_colorop_reset(struct drm_colorop *colorop); 153 + 154 + /** 155 + * drm_colorop_index - find the index of a registered colorop 156 + * @colorop: colorop to find index for 157 + * 158 + * Given a registered colorop, return the index of that colorop within a DRM 159 + * device's list of colorops. 160 + */ 161 + static inline unsigned int drm_colorop_index(const struct drm_colorop *colorop) 162 + { 163 + return colorop->index; 164 + } 165 + 166 + #define drm_for_each_colorop(colorop, dev) \ 167 + list_for_each_entry(colorop, &(dev)->mode_config.colorop_list, head) 168 + 169 + #endif /* __DRM_COLOROP_H__ */
+18
include/drm/drm_mode_config.h
··· 501 501 struct raw_spinlock panic_lock; 502 502 503 503 /** 504 + * @num_colorop: 505 + * 506 + * Number of colorop objects on this device. 507 + * This is invariant over the lifetime of a device and hence doesn't 508 + * need any locks. 509 + */ 510 + int num_colorop; 511 + 512 + /** 513 + * @colorop_list: 514 + * 515 + * List of colorop objects linked with &drm_colorop.head. This is 516 + * invariant over the lifetime of a device and hence doesn't need any 517 + * locks. 518 + */ 519 + struct list_head colorop_list; 520 + 521 + /** 504 522 * @num_crtc: 505 523 * 506 524 * Number of CRTCs on this device linked with &drm_crtc.head. This is invariant over the lifetime
+8
include/drm/drm_plane.h
··· 244 244 enum drm_scaling_filter scaling_filter; 245 245 246 246 /** 247 + * @color_pipeline: 248 + * 249 + * The first colorop of the active color pipeline, or NULL, if no 250 + * color pipeline is active. 251 + */ 252 + struct drm_colorop *color_pipeline; 253 + 254 + /** 247 255 * @commit: Tracks the pending commit to prevent use-after-free conditions, 248 256 * and for async plane updates. 249 257 *
+1
include/uapi/drm/drm_mode.h
··· 629 629 #define DRM_MODE_OBJECT_FB 0xfbfbfbfb 630 630 #define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb 631 631 #define DRM_MODE_OBJECT_PLANE 0xeeeeeeee 632 + #define DRM_MODE_OBJECT_COLOROP 0xfafafafa 632 633 #define DRM_MODE_OBJECT_ANY 0 633 634 634 635 struct drm_mode_obj_get_properties {