Loading...
1/*
2 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 * Author: Rob Clark <rob@ti.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __OMAPDRM_DRV_H__
19#define __OMAPDRM_DRV_H__
20
21#include <linux/module.h>
22#include <linux/types.h>
23#include <linux/workqueue.h>
24
25#include <drm/drmP.h>
26#include <drm/drm_crtc_helper.h>
27#include <drm/drm_gem.h>
28#include <drm/omap_drm.h>
29
30#include "dss/omapdss.h"
31
32#include "omap_connector.h"
33#include "omap_crtc.h"
34#include "omap_encoder.h"
35#include "omap_fb.h"
36#include "omap_fbdev.h"
37#include "omap_gem.h"
38#include "omap_irq.h"
39#include "omap_plane.h"
40
41#define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)
42#define VERB(fmt, ...) if (0) DRM_DEBUG(fmt, ##__VA_ARGS__) /* verbose debug */
43
44#define MODULE_NAME "omapdrm"
45
46struct omap_drm_usergart;
47
48struct omap_drm_private {
49 struct drm_device *ddev;
50 struct device *dev;
51 u32 omaprev;
52
53 struct dss_device *dss;
54 struct dispc_device *dispc;
55 const struct dispc_ops *dispc_ops;
56
57 unsigned int num_crtcs;
58 struct drm_crtc *crtcs[8];
59
60 unsigned int num_planes;
61 struct drm_plane *planes[8];
62
63 unsigned int num_encoders;
64 struct drm_encoder *encoders[8];
65
66 unsigned int num_connectors;
67 struct drm_connector *connectors[8];
68
69 struct drm_fb_helper *fbdev;
70
71 struct workqueue_struct *wq;
72
73 /* lock for obj_list below */
74 spinlock_t list_lock;
75
76 /* list of GEM objects: */
77 struct list_head obj_list;
78
79 struct omap_drm_usergart *usergart;
80 bool has_dmm;
81
82 /* properties: */
83 struct drm_property *zorder_prop;
84
85 /* irq handling: */
86 spinlock_t wait_lock; /* protects the wait_list */
87 struct list_head wait_list; /* list of omap_irq_wait */
88 u32 irq_mask; /* enabled irqs in addition to wait_list */
89
90 /* memory bandwidth limit if it is needed on the platform */
91 unsigned int max_bandwidth;
92};
93
94
95int omap_debugfs_init(struct drm_minor *minor);
96
97#endif /* __OMAPDRM_DRV_H__ */
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
4 * Author: Rob Clark <rob@ti.com>
5 */
6
7#ifndef __OMAPDRM_DRV_H__
8#define __OMAPDRM_DRV_H__
9
10#include <linux/module.h>
11#include <linux/types.h>
12#include <linux/workqueue.h>
13
14#include "dss/omapdss.h"
15#include "dss/dss.h"
16
17#include <drm/drm_atomic.h>
18#include <drm/drm_gem.h>
19#include <drm/omap_drm.h>
20
21#include "omap_crtc.h"
22#include "omap_encoder.h"
23#include "omap_fb.h"
24#include "omap_gem.h"
25#include "omap_irq.h"
26#include "omap_plane.h"
27#include "omap_overlay.h"
28
29#define DBG(fmt, ...) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
30#define VERB(fmt, ...) if (0) DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) /* verbose debug */
31
32#define MODULE_NAME "omapdrm"
33
34struct omap_drm_usergart;
35
36struct omap_drm_pipeline {
37 struct drm_crtc *crtc;
38 struct drm_encoder *encoder;
39 struct drm_connector *connector;
40 struct omap_dss_device *output;
41 unsigned int alias_id;
42};
43
44/*
45 * Global private object state for tracking resources that are shared across
46 * multiple kms objects (planes/crtcs/etc).
47 */
48#define to_omap_global_state(x) container_of(x, struct omap_global_state, base)
49
50struct omap_global_state {
51 struct drm_private_state base;
52
53 /* global atomic state of assignment between overlays and planes */
54 struct drm_plane *hwoverlay_to_plane[8];
55};
56
57struct omap_drm_private {
58 struct drm_device *ddev;
59 struct device *dev;
60 u32 omaprev;
61
62 struct dss_device *dss;
63 struct dispc_device *dispc;
64
65 bool irq_enabled;
66
67 unsigned int num_pipes;
68 struct omap_drm_pipeline pipes[8];
69 struct omap_drm_pipeline *channels[8];
70
71 unsigned int num_planes;
72 struct drm_plane *planes[8];
73
74 unsigned int num_ovls;
75 struct omap_hw_overlay *overlays[8];
76
77 struct drm_private_obj glob_obj;
78
79 struct workqueue_struct *wq;
80
81 /* lock for obj_list below */
82 struct mutex list_lock;
83
84 /* list of GEM objects: */
85 struct list_head obj_list;
86
87 struct omap_drm_usergart *usergart;
88 bool has_dmm;
89
90 /* properties: */
91 struct drm_property *zorder_prop;
92
93 /* irq handling: */
94 spinlock_t wait_lock; /* protects the wait_list */
95 struct list_head wait_list; /* list of omap_irq_wait */
96 u32 irq_mask; /* enabled irqs in addition to wait_list */
97
98 /* memory bandwidth limit if it is needed on the platform */
99 unsigned int max_bandwidth;
100};
101
102
103void omap_debugfs_init(struct drm_minor *minor);
104
105struct omap_global_state * __must_check omap_get_global_state(struct drm_atomic_state *s);
106
107struct omap_global_state *omap_get_existing_global_state(struct omap_drm_private *priv);
108
109#endif /* __OMAPDRM_DRV_H__ */