Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2011 Texas Instruments Incorporated - https://www.ti.com/
0004  * Author: Rob Clark <rob@ti.com>
0005  */
0006 
0007 #ifndef __OMAPDRM_DRV_H__
0008 #define __OMAPDRM_DRV_H__
0009 
0010 #include <linux/module.h>
0011 #include <linux/types.h>
0012 #include <linux/workqueue.h>
0013 
0014 #include "dss/omapdss.h"
0015 #include "dss/dss.h"
0016 
0017 #include <drm/drm_atomic.h>
0018 #include <drm/drm_gem.h>
0019 #include <drm/omap_drm.h>
0020 
0021 #include "omap_crtc.h"
0022 #include "omap_encoder.h"
0023 #include "omap_fb.h"
0024 #include "omap_fbdev.h"
0025 #include "omap_gem.h"
0026 #include "omap_irq.h"
0027 #include "omap_plane.h"
0028 #include "omap_overlay.h"
0029 
0030 #define DBG(fmt, ...) DRM_DEBUG_DRIVER(fmt"\n", ##__VA_ARGS__)
0031 #define VERB(fmt, ...) if (0) DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__) /* verbose debug */
0032 
0033 #define MODULE_NAME     "omapdrm"
0034 
0035 struct omap_drm_usergart;
0036 
0037 struct omap_drm_pipeline {
0038     struct drm_crtc *crtc;
0039     struct drm_encoder *encoder;
0040     struct drm_connector *connector;
0041     struct omap_dss_device *output;
0042     unsigned int alias_id;
0043 };
0044 
0045 /*
0046  * Global private object state for tracking resources that are shared across
0047  * multiple kms objects (planes/crtcs/etc).
0048  */
0049 #define to_omap_global_state(x) container_of(x, struct omap_global_state, base)
0050 
0051 struct omap_global_state {
0052     struct drm_private_state base;
0053 
0054     /* global atomic state of assignment between overlays and planes */
0055     struct drm_plane *hwoverlay_to_plane[8];
0056 };
0057 
0058 struct omap_drm_private {
0059     struct drm_device *ddev;
0060     struct device *dev;
0061     u32 omaprev;
0062 
0063     struct dss_device *dss;
0064     struct dispc_device *dispc;
0065 
0066     bool irq_enabled;
0067 
0068     unsigned int num_pipes;
0069     struct omap_drm_pipeline pipes[8];
0070     struct omap_drm_pipeline *channels[8];
0071 
0072     unsigned int num_planes;
0073     struct drm_plane *planes[8];
0074 
0075     unsigned int num_ovls;
0076     struct omap_hw_overlay *overlays[8];
0077 
0078     struct drm_private_obj glob_obj;
0079 
0080     struct drm_fb_helper *fbdev;
0081 
0082     struct workqueue_struct *wq;
0083 
0084     /* lock for obj_list below */
0085     struct mutex list_lock;
0086 
0087     /* list of GEM objects: */
0088     struct list_head obj_list;
0089 
0090     struct omap_drm_usergart *usergart;
0091     bool has_dmm;
0092 
0093     /* properties: */
0094     struct drm_property *zorder_prop;
0095 
0096     /* irq handling: */
0097     spinlock_t wait_lock;       /* protects the wait_list */
0098     struct list_head wait_list; /* list of omap_irq_wait */
0099     u32 irq_mask;           /* enabled irqs in addition to wait_list */
0100 
0101     /* memory bandwidth limit if it is needed on the platform */
0102     unsigned int max_bandwidth;
0103 };
0104 
0105 
0106 void omap_debugfs_init(struct drm_minor *minor);
0107 
0108 struct omap_global_state * __must_check omap_get_global_state(struct drm_atomic_state *s);
0109 
0110 struct omap_global_state *omap_get_existing_global_state(struct omap_drm_private *priv);
0111 
0112 #endif /* __OMAPDRM_DRV_H__ */