Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2016 Noralf Trønnes
4 */
5
6/*
7 * Simple KMS helpers are deprected in favor of regular atomic helpers. Do not
8 * use the min new code.
9 */
10
11#ifndef __LINUX_DRM_SIMPLE_KMS_HELPER_H
12#define __LINUX_DRM_SIMPLE_KMS_HELPER_H
13
14#include <drm/drm_crtc.h>
15#include <drm/drm_encoder.h>
16#include <drm/drm_plane.h>
17
18struct drm_simple_display_pipe;
19
20struct drm_simple_display_pipe_funcs {
21 enum drm_mode_status (*mode_valid)(struct drm_simple_display_pipe *pipe,
22 const struct drm_display_mode *mode);
23 void (*enable)(struct drm_simple_display_pipe *pipe,
24 struct drm_crtc_state *crtc_state,
25 struct drm_plane_state *plane_state);
26 void (*disable)(struct drm_simple_display_pipe *pipe);
27 int (*check)(struct drm_simple_display_pipe *pipe,
28 struct drm_plane_state *plane_state,
29 struct drm_crtc_state *crtc_state);
30 void (*update)(struct drm_simple_display_pipe *pipe,
31 struct drm_plane_state *old_plane_state);
32 int (*prepare_fb)(struct drm_simple_display_pipe *pipe,
33 struct drm_plane_state *plane_state);
34 void (*cleanup_fb)(struct drm_simple_display_pipe *pipe,
35 struct drm_plane_state *plane_state);
36 int (*begin_fb_access)(struct drm_simple_display_pipe *pipe,
37 struct drm_plane_state *new_plane_state);
38 void (*end_fb_access)(struct drm_simple_display_pipe *pipe,
39 struct drm_plane_state *plane_state);
40 int (*enable_vblank)(struct drm_simple_display_pipe *pipe);
41 void (*disable_vblank)(struct drm_simple_display_pipe *pipe);
42 void (*reset_crtc)(struct drm_simple_display_pipe *pipe);
43 struct drm_crtc_state * (*duplicate_crtc_state)(struct drm_simple_display_pipe *pipe);
44 void (*destroy_crtc_state)(struct drm_simple_display_pipe *pipe,
45 struct drm_crtc_state *crtc_state);
46 void (*reset_plane)(struct drm_simple_display_pipe *pipe);
47 struct drm_plane_state * (*duplicate_plane_state)(struct drm_simple_display_pipe *pipe);
48 void (*destroy_plane_state)(struct drm_simple_display_pipe *pipe,
49 struct drm_plane_state *plane_state);
50};
51
52struct drm_simple_display_pipe {
53 struct drm_crtc crtc;
54 struct drm_plane plane;
55 struct drm_encoder encoder;
56 struct drm_connector *connector;
57
58 const struct drm_simple_display_pipe_funcs *funcs;
59};
60
61int drm_simple_display_pipe_attach_bridge(struct drm_simple_display_pipe *pipe,
62 struct drm_bridge *bridge);
63
64int drm_simple_display_pipe_init(struct drm_device *dev,
65 struct drm_simple_display_pipe *pipe,
66 const struct drm_simple_display_pipe_funcs *funcs,
67 const uint32_t *formats, unsigned int format_count,
68 const uint64_t *format_modifiers,
69 struct drm_connector *connector);
70
71int drm_simple_encoder_init(struct drm_device *dev,
72 struct drm_encoder *encoder,
73 int encoder_type);
74
75void *__drmm_simple_encoder_alloc(struct drm_device *dev, size_t size,
76 size_t offset, int encoder_type);
77
78#define drmm_simple_encoder_alloc(dev, type, member, encoder_type) \
79 ((type *)__drmm_simple_encoder_alloc(dev, sizeof(type), \
80 offsetof(type, member), \
81 encoder_type))
82
83#endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */