XenevaOS
Loading...
Searching...
No Matches
drm_plane.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
20 * OF THIS SOFTWARE.
21 */
22
23#ifndef __DRM_PLANE_H__
24#define __DRM_PLANE_H__
25
26#include <linux/list.h>
27#include <linux/ctype.h>
28#include <linux/kmsg_dump.h>
29#include <drm/drm_mode_object.h>
30#include <drm/drm_color_mgmt.h>
31#include <drm/drm_rect.h>
33#include <drm/drm_util.h>
34
35struct drm_crtc;
37struct drm_printer;
39
44
272
273static inline struct drm_rect
274drm_plane_state_src(const struct drm_plane_state *state)
275{
276 struct drm_rect src = {
277 .x1 = state->src_x,
278 .y1 = state->src_y,
279 .x2 = state->src_x + state->src_w,
280 .y2 = state->src_y + state->src_h,
281 };
282 return src;
283}
284
285static inline struct drm_rect
286drm_plane_state_dest(const struct drm_plane_state *state)
287{
288 struct drm_rect dest = {
289 .x1 = state->crtc_x,
290 .y1 = state->crtc_y,
291 .x2 = state->crtc_x + state->crtc_w,
292 .y2 = state->crtc_y + state->crtc_h,
293 };
294 return dest;
295}
296
328 struct drm_crtc *crtc, struct drm_framebuffer *fb,
329 int crtc_x, int crtc_y,
330 unsigned int crtc_w, unsigned int crtc_h,
331 uint32_t src_x, uint32_t src_y,
332 uint32_t src_w, uint32_t src_h,
333 struct drm_modeset_acquire_ctx *ctx);
334
351 struct drm_modeset_acquire_ctx *ctx);
352
360 void (*destroy)(struct drm_plane *plane);
361
372 void (*reset)(struct drm_plane *plane);
373
389 struct drm_property *property, uint64_t val);
390
422 struct drm_plane_state *(*atomic_duplicate_state)(struct drm_plane *plane);
423
433 struct drm_plane_state *state);
434
478 struct drm_plane_state *state,
479 struct drm_property *property,
480 uint64_t val);
481
501 const struct drm_plane_state *state,
502 struct drm_property *property,
503 uint64_t *val);
518
529
540 const struct drm_plane_state *state);
541
559 uint64_t modifier);
575 u32 format, u64 modifier);
576
577};
578
630
631
823
824#define obj_to_plane(x) container_of(x, struct drm_plane, base)
825
827int drm_universal_plane_init(struct drm_device *dev,
830 const struct drm_plane_funcs *funcs,
832 unsigned int format_count,
834 enum drm_plane_type type,
835 const char *name, ...);
837
838__printf(10, 11)
839void *__drmm_universal_plane_alloc(struct drm_device *dev,
840 size_t size, size_t offset,
842 const struct drm_plane_funcs *funcs,
843 const uint32_t *formats,
844 unsigned int format_count,
846 enum drm_plane_type plane_type,
847 const char *name, ...);
848
875#define drmm_universal_plane_alloc(dev, type, member, possible_crtcs, funcs, formats, \
876 format_count, format_modifiers, plane_type, name, ...) \
877 ((type *)__drmm_universal_plane_alloc(dev, sizeof(type), \
878 offsetof(type, member), \
879 possible_crtcs, funcs, formats, \
880 format_count, format_modifiers, \
881 plane_type, name, ##__VA_ARGS__))
882
883__printf(10, 11)
884void *__drm_universal_plane_alloc(struct drm_device *dev,
885 size_t size, size_t offset,
887 const struct drm_plane_funcs *funcs,
888 const uint32_t *formats,
889 unsigned int format_count,
891 enum drm_plane_type plane_type,
892 const char *name, ...);
893
919#define drm_universal_plane_alloc(dev, type, member, possible_crtcs, funcs, formats, \
920 format_count, format_modifiers, plane_type, name, ...) \
921 ((type *)__drm_universal_plane_alloc(dev, sizeof(type), \
922 offsetof(type, member), \
923 possible_crtcs, funcs, formats, \
924 format_count, format_modifiers, \
925 plane_type, name, ##__VA_ARGS__))
926
934static inline unsigned int drm_plane_index(const struct drm_plane *plane)
935{
936 return plane->index;
937}
938
943static inline u32 drm_plane_mask(const struct drm_plane *plane)
944{
945 return 1 << drm_plane_index(plane);
946}
947
948struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx);
950
952 struct drm_property *property,
953 uint64_t value);
954
964static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
965 struct drm_file *file_priv,
966 uint32_t id)
967{
968 struct drm_mode_object *mo;
969 mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PLANE);
970 return mo ? obj_to_plane(mo) : NULL;
971}
972
981#define drm_for_each_plane_mask(plane, dev, plane_mask) \
982 list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \
983 for_each_if ((plane_mask) & drm_plane_mask(plane))
984
994#define drm_for_each_legacy_plane(plane, dev) \
995 list_for_each_entry(plane, &(dev)->mode_config.plane_list, head) \
996 for_each_if (plane->type == DRM_PLANE_TYPE_OVERLAY)
997
1005#define drm_for_each_plane(plane, dev) \
1006 list_for_each_entry(plane, &(dev)->mode_config.plane_list, head)
1007
1009 u32 format, u64 modifier);
1011 u32 format, u64 modifier);
1012
1014unsigned int
1016struct drm_mode_rect *
1018
1020 unsigned int supported_filters);
1022 const struct drm_plane_size_hint *hints,
1023 int num_hints);
1024
1026 const struct drm_prop_enum_list *pipelines,
1027 int num_pipelines);
1028#endif
#define bool
Definition stdbool.h:35
int int32_t
Definition acefiex.h:160
unsigned int uint32_t
Definition acefiex.h:163
COMPILER_DEPENDENT_UINT64 uint64_t
Definition acefiex.h:165
unsigned short int uint16_t
Definition acefiex.h:162
#define NULL
Definition actypes.h:561
#define __printf(fmt_idx, arg_idx)
Definition compiler.h:144
#define DRM_MODE_OBJECT_PLANE
Definition drm_mode.h:620
drm_color_encoding
Definition drm_color_mgmt.h:103
drm_color_range
Definition drm_color_mgmt.h:110
struct drm_crtc * crtc
Definition drm_crtc.h:1238
struct drm_mode_object * drm_mode_object_find(struct drm_device *dev, struct drm_file *file_priv, uint32_t id, uint32_t type)
struct drm_plane uint32_t possible_crtcs
Definition drm_plane.h:829
bool drm_plane_has_format(struct drm_plane *plane, u32 format, u64 modifier)
struct drm_plane uint32_t const struct drm_plane_funcs const uint32_t unsigned int const uint64_t * format_modifiers
Definition drm_plane.h:833
int drm_plane_create_color_pipeline_property(struct drm_plane *plane, const struct drm_prop_enum_list *pipelines, int num_pipelines)
struct drm_plane uint32_t const struct drm_plane_funcs const uint32_t unsigned int format_count
Definition drm_plane.h:832
struct drm_plane uint32_t const struct drm_plane_funcs const uint32_t unsigned int const uint64_t enum drm_plane_type type const char * name
Definition drm_plane.h:834
struct drm_mode_rect * drm_plane_get_damage_clips(const struct drm_plane_state *state)
struct drm_plane uint32_t const struct drm_plane_funcs const uint32_t unsigned int const uint64_t enum drm_plane_type type const char void drm_plane_cleanup(struct drm_plane *plane)
void drm_plane_force_disable(struct drm_plane *plane)
struct drm_plane uint32_t const struct drm_plane_funcs * funcs
Definition drm_plane.h:830
bool drm_any_plane_has_format(struct drm_device *dev, u32 format, u64 modifier)
struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx)
size_t size
Definition drm_plane.h:840
struct drm_plane * plane
Definition drm_plane.h:828
drm_plane_type
Definition drm_plane.h:601
@ DRM_PLANE_TYPE_OVERLAY
Definition drm_plane.h:608
@ DRM_PLANE_TYPE_PRIMARY
Definition drm_plane.h:617
@ DRM_PLANE_TYPE_CURSOR
Definition drm_plane.h:628
void drm_plane_enable_fb_damage_clips(struct drm_plane *plane)
unsigned int drm_plane_get_damage_clips_count(const struct drm_plane_state *state)
int drm_plane_create_scaling_filter_property(struct drm_plane *plane, unsigned int supported_filters)
int drm_mode_plane_set_obj_prop(struct drm_plane *plane, struct drm_property *property, uint64_t value)
#define obj_to_plane(x)
Definition drm_plane.h:824
size_t size_t offset
Definition drm_plane.h:840
int drm_plane_add_size_hints_property(struct drm_plane *plane, const struct drm_plane_size_hint *hints, int num_hints)
struct drm_plane uint32_t const struct drm_plane_funcs const uint32_t * formats
Definition drm_plane.h:831
drm_scaling_filter
Definition drm_plane.h:40
@ DRM_SCALING_FILTER_NEAREST_NEIGHBOR
Definition drm_plane.h:42
@ DRM_SCALING_FILTER_DEFAULT
Definition drm_plane.h:41
const struct device * dev
Definition drm_print.h:519
const char const char * format
Definition drm_print.h:516
uint64_t u64
Definition kernel.h:17
uint16_t u16
Definition kernel.h:15
uint32_t u32
Definition kernel.h:16
int const struct list_head const struct list_head struct list_head * head
Definition list_sort.h:13
Definition dma-fence.h:70
Definition drm_atomic.h:480
Definition drm_colorop.h:228
Definition drm_atomic.h:72
Definition drm_crtc.h:955
Definition drm_device.h:75
Definition drm_file.h:165
Definition drm_framebuffer.h:120
Definition drm_mode_object.h:55
Definition drm_mode.h:1520
Definition drm_modeset_lock.h:46
Definition drm_modeset_lock.h:85
Definition drm_mode_object.h:67
Definition drm_plane.h:300
void(* atomic_destroy_state)(struct drm_plane *plane, struct drm_plane_state *state)
Definition drm_plane.h:432
int(* set_property)(struct drm_plane *plane, struct drm_property *property, uint64_t val)
Definition drm_plane.h:388
void(* destroy)(struct drm_plane *plane)
Definition drm_plane.h:360
int(* disable_plane)(struct drm_plane *plane, struct drm_modeset_acquire_ctx *ctx)
Definition drm_plane.h:350
int(* late_register)(struct drm_plane *plane)
Definition drm_plane.h:517
int(* atomic_set_property)(struct drm_plane *plane, struct drm_plane_state *state, struct drm_property *property, uint64_t val)
Definition drm_plane.h:477
void(* early_unregister)(struct drm_plane *plane)
Definition drm_plane.h:528
int(* atomic_get_property)(struct drm_plane *plane, const struct drm_plane_state *state, struct drm_property *property, uint64_t *val)
Definition drm_plane.h:500
bool(* format_mod_supported_async)(struct drm_plane *plane, u32 format, u64 modifier)
Definition drm_plane.h:574
void(* reset)(struct drm_plane *plane)
Definition drm_plane.h:372
void(* atomic_print_state)(struct drm_printer *p, const struct drm_plane_state *state)
Definition drm_plane.h:539
bool(* format_mod_supported)(struct drm_plane *plane, uint32_t format, uint64_t modifier)
Definition drm_plane.h:558
int(* update_plane)(struct drm_plane *plane, struct drm_crtc *crtc, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h, struct drm_modeset_acquire_ctx *ctx)
Definition drm_plane.h:327
Definition drm_modeset_helper_vtables.h:1189
Definition drm_mode.h:991
Definition drm_plane.h:54
struct drm_property_blob * fb_damage_clips
Definition drm_plane.h:197
uint32_t src_h
Definition drm_plane.h:119
struct drm_crtc_commit * commit
Definition drm_plane.h:260
enum drm_scaling_filter scaling_filter
Definition drm_plane.h:244
uint32_t src_y
Definition drm_plane.h:116
bool ignore_damage_clips
Definition drm_plane.h:207
unsigned int normalized_zpos
Definition drm_plane.h:170
struct drm_rect src dst
Definition drm_plane.h:229
uint32_t crtc_h
Definition drm_plane.h:105
enum drm_color_encoding color_encoding
Definition drm_plane.h:177
struct drm_colorop * color_pipeline
Definition drm_plane.h:252
int32_t crtc_x
Definition drm_plane.h:94
uint32_t src_x
Definition drm_plane.h:111
bool visible
Definition drm_plane.h:237
unsigned int zpos
Definition drm_plane.h:161
enum drm_color_range color_range
Definition drm_plane.h:184
int32_t hotspot_y
Definition drm_plane.h:123
uint16_t pixel_blend_mode
Definition drm_plane.h:139
uint32_t src_w
Definition drm_plane.h:119
unsigned int rotation
Definition drm_plane.h:146
int32_t hotspot_x
Definition drm_plane.h:123
int32_t crtc_y
Definition drm_plane.h:101
uint32_t crtc_w
Definition drm_plane.h:105
struct drm_crtc * crtc
Definition drm_plane.h:64
u16 alpha
Definition drm_plane.h:131
bool color_mgmt_changed
Definition drm_plane.h:270
struct drm_plane * plane
Definition drm_plane.h:56
struct drm_atomic_commit * state
Definition drm_plane.h:263
struct drm_framebuffer * fb
Definition drm_plane.h:72
struct dma_fence * fence
Definition drm_plane.h:85
Definition drm_plane.h:641
struct drm_mode_object base
Definition drm_plane.h:669
struct drm_crtc * crtc
Definition drm_plane.h:698
unsigned int format_count
Definition drm_plane.h:679
struct drm_property * alpha_property
Definition drm_plane.h:755
enum drm_plane_type type
Definition drm_plane.h:724
const struct drm_plane_helper_funcs * helper_private
Definition drm_plane.h:733
unsigned int modifier_count
Definition drm_plane.h:689
struct drm_property * scaling_filter_property
Definition drm_plane.h:806
struct drm_property * color_pipeline_property
Definition drm_plane.h:800
bool format_default
Definition drm_plane.h:684
struct drm_property * hotspot_y_property
Definition drm_plane.h:816
struct drm_property * color_range_property
Definition drm_plane.h:792
uint32_t * format_types
Definition drm_plane.h:677
struct drm_framebuffer * old_fb
Definition drm_plane.h:715
struct drm_property * rotation_property
Definition drm_plane.h:767
unsigned index
Definition drm_plane.h:730
struct drm_property * hotspot_x_property
Definition drm_plane.h:811
struct drm_property * zpos_property
Definition drm_plane.h:761
struct drm_framebuffer * fb
Definition drm_plane.h:707
struct drm_device * dev
Definition drm_plane.h:643
struct kmsg_dumper kmsg_panic
Definition drm_plane.h:821
struct drm_property * blend_mode_property
Definition drm_plane.h:775
const struct drm_plane_funcs * funcs
Definition drm_plane.h:718
char * name
Definition drm_plane.h:655
uint32_t possible_crtcs
Definition drm_plane.h:675
struct drm_plane_state * state
Definition drm_plane.h:748
uint64_t * modifiers
Definition drm_plane.h:687
struct drm_object_properties properties
Definition drm_plane.h:721
struct drm_property * color_encoding_property
Definition drm_plane.h:784
Definition drm_print.h:181
Definition drm_property.h:225
Definition drm_property.h:216
Definition drm_property.h:80
Definition drm_rect.h:46
int x1
Definition drm_rect.h:47
Definition kmsg_dump.h:61
Definition list.h:11
Definition mutex.h:59
#define state(x)