2 * Copyright 1992-2015 Michal Meloun
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #include <dev/gpio/gpiobusvar.h>
34 struct drm_gem_object gem_obj;
35 /* mapped memory buffer */
40 vm_object_t cdev_pager;
44 struct drm_plane drm_plane;
45 int index; /* Window index */
49 struct drm_framebuffer drm_fb;
50 struct drm_fb_helper fb_helper;
51 struct tegra_bo **planes; /* Attached planes */
54 /* Surface and display geometry */
55 bool block_linear; /* Surface_kind */
56 uint32_t block_height;
57 int rotation; /* In degrees */
58 bool flip_x; /* Inverted X-axis */
59 bool flip_y; /* Inverted Y-axis */
63 struct drm_crtc drm_crtc;
66 vm_paddr_t cursor_pbase; /* Cursor buffer */
67 vm_offset_t cursor_vbase;
70 struct tegra_drm_encoder {
73 void *panel; /* XXX For LVDS panel */
79 struct drm_encoder encoder;
80 struct drm_connector connector;
81 int (*setup_clock)(struct tegra_drm_encoder *output,
82 clk_t clk, uint64_t pclk);
86 struct drm_device drm_dev;
87 struct tegra_fb *fb; /* Prime framebuffer */
91 /* tegra_drm_subr.c */
92 int tegra_drm_encoder_attach(struct tegra_drm_encoder *output, phandle_t node);
93 int tegra_drm_encoder_init(struct tegra_drm_encoder *output,
94 struct tegra_drm *drm);
95 int tegra_drm_encoder_exit(struct tegra_drm_encoder *output,
96 struct tegra_drm *drm);
97 enum drm_connector_status tegra_drm_connector_detect(
98 struct drm_connector *connector, bool force);
99 int tegra_drm_connector_get_modes(struct drm_connector *connector);
100 struct drm_encoder *tegra_drm_connector_best_encoder(
101 struct drm_connector *connector);
104 void tegra_dc_cancel_page_flip(struct drm_crtc *drm_crtc,
105 struct drm_file *file);
106 void tegra_dc_enable_vblank(struct drm_crtc *drm_crtc);
107 void tegra_dc_disable_vblank(struct drm_crtc *drm_crtc);
108 int tegra_dc_get_pipe(struct drm_crtc *drm_crtc);
111 struct fb_info *tegra_drm_fb_getinfo(struct drm_device *drm);
112 struct tegra_bo *tegra_fb_get_plane(struct tegra_fb *fb, int idx);
113 int tegra_drm_fb_create(struct drm_device *drm, struct drm_file *file,
114 struct drm_mode_fb_cmd2 *cmd, struct drm_framebuffer **fb_res);
115 int tegra_drm_fb_init(struct drm_device *drm);
116 void tegra_drm_fb_destroy(struct drm_device *drm);
121 int tegra_bo_create(struct drm_device *drm, size_t size,
122 struct tegra_bo **res_bo);
123 void tegra_bo_driver_register(struct drm_driver *drm_drv);
125 #endif /* _TEGRA_DRM_H_ */