Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
0002 /**************************************************************************
0003  *
0004  * Copyright (c) 2018 VMware, Inc., Palo Alto, CA., USA
0005  * All Rights Reserved.
0006  *
0007  * Permission is hereby granted, free of charge, to any person obtaining a
0008  * copy of this software and associated documentation files (the
0009  * "Software"), to deal in the Software without restriction, including
0010  * without limitation the rights to use, copy, modify, merge, publish,
0011  * distribute, sub license, and/or sell copies of the Software, and to
0012  * permit persons to whom the Software is furnished to do so, subject to
0013  * the following conditions:
0014  *
0015  * The above copyright notice and this permission notice (including the
0016  * next paragraph) shall be included in all copies or substantial portions
0017  * of the Software.
0018  *
0019  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0020  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0021  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
0022  * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
0023  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
0024  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
0025  * USE OR OTHER DEALINGS IN THE SOFTWARE.
0026  *
0027  * Authors:
0028  * Deepak Rawat <drawat@vmware.com>
0029  *
0030  **************************************************************************/
0031 
0032 #ifndef DRM_DAMAGE_HELPER_H_
0033 #define DRM_DAMAGE_HELPER_H_
0034 
0035 #include <drm/drm_atomic_helper.h>
0036 
0037 /**
0038  * drm_atomic_for_each_plane_damage - Iterator macro for plane damage.
0039  * @iter: The iterator to advance.
0040  * @rect: Return a rectangle in fb coordinate clipped to plane src.
0041  *
0042  * Note that if the first call to iterator macro return false then no need to do
0043  * plane update. Iterator will return full plane src when damage is not passed
0044  * by user-space.
0045  */
0046 #define drm_atomic_for_each_plane_damage(iter, rect) \
0047     while (drm_atomic_helper_damage_iter_next(iter, rect))
0048 
0049 /**
0050  * struct drm_atomic_helper_damage_iter - Closure structure for damage iterator.
0051  *
0052  * This structure tracks state needed to walk the list of plane damage clips.
0053  */
0054 struct drm_atomic_helper_damage_iter {
0055     /* private: Plane src in whole number. */
0056     struct drm_rect plane_src;
0057     /* private: Rectangles in plane damage blob. */
0058     const struct drm_rect *clips;
0059     /* private: Number of rectangles in plane damage blob. */
0060     uint32_t num_clips;
0061     /* private: Current clip iterator is advancing on. */
0062     uint32_t curr_clip;
0063     /* private: Whether need full plane update. */
0064     bool full_update;
0065 };
0066 
0067 void drm_atomic_helper_check_plane_damage(struct drm_atomic_state *state,
0068                       struct drm_plane_state *plane_state);
0069 int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb,
0070                   struct drm_file *file_priv, unsigned int flags,
0071                   unsigned int color, struct drm_clip_rect *clips,
0072                   unsigned int num_clips);
0073 void
0074 drm_atomic_helper_damage_iter_init(struct drm_atomic_helper_damage_iter *iter,
0075                    const struct drm_plane_state *old_state,
0076                    const struct drm_plane_state *new_state);
0077 bool
0078 drm_atomic_helper_damage_iter_next(struct drm_atomic_helper_damage_iter *iter,
0079                    struct drm_rect *rect);
0080 bool drm_atomic_helper_damage_merged(const struct drm_plane_state *old_state,
0081                      struct drm_plane_state *state,
0082                      struct drm_rect *rect);
0083 
0084 #endif