.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ |
---|
3 | 4 | * 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 | 5 | */ |
---|
17 | 6 | |
---|
18 | | -#include <linux/seq_file.h> |
---|
| 7 | +#include <linux/dma-mapping.h> |
---|
19 | 8 | |
---|
20 | | -#include <drm/drm_crtc.h> |
---|
21 | | -#include <drm/drm_crtc_helper.h> |
---|
| 9 | +#include <drm/drm_modeset_helper.h> |
---|
| 10 | +#include <drm/drm_fourcc.h> |
---|
22 | 11 | #include <drm/drm_gem_framebuffer_helper.h> |
---|
23 | 12 | |
---|
24 | 13 | #include "omap_dmm_tiler.h" |
---|
.. | .. |
---|
66 | 55 | struct mutex lock; |
---|
67 | 56 | }; |
---|
68 | 57 | |
---|
| 58 | +static int omap_framebuffer_dirty(struct drm_framebuffer *fb, |
---|
| 59 | + struct drm_file *file_priv, |
---|
| 60 | + unsigned flags, unsigned color, |
---|
| 61 | + struct drm_clip_rect *clips, |
---|
| 62 | + unsigned num_clips) |
---|
| 63 | +{ |
---|
| 64 | + struct drm_crtc *crtc; |
---|
| 65 | + |
---|
| 66 | + drm_modeset_lock_all(fb->dev); |
---|
| 67 | + |
---|
| 68 | + drm_for_each_crtc(crtc, fb->dev) |
---|
| 69 | + omap_crtc_flush(crtc); |
---|
| 70 | + |
---|
| 71 | + drm_modeset_unlock_all(fb->dev); |
---|
| 72 | + |
---|
| 73 | + return 0; |
---|
| 74 | +} |
---|
| 75 | + |
---|
69 | 76 | static const struct drm_framebuffer_funcs omap_framebuffer_funcs = { |
---|
70 | 77 | .create_handle = drm_gem_fb_create_handle, |
---|
| 78 | + .dirty = omap_framebuffer_dirty, |
---|
71 | 79 | .destroy = drm_gem_fb_destroy, |
---|
72 | 80 | }; |
---|
73 | 81 | |
---|
.. | .. |
---|
87 | 95 | |
---|
88 | 96 | bool omap_framebuffer_supports_rotation(struct drm_framebuffer *fb) |
---|
89 | 97 | { |
---|
90 | | - return omap_gem_flags(fb->obj[0]) & OMAP_BO_TILED; |
---|
| 98 | + return omap_gem_flags(fb->obj[0]) & OMAP_BO_TILED_MASK; |
---|
91 | 99 | } |
---|
92 | 100 | |
---|
93 | 101 | /* Note: DRM rotates counter-clockwise, TILER & DSS rotates clockwise */ |
---|
.. | .. |
---|
127 | 135 | { |
---|
128 | 136 | struct omap_framebuffer *omap_fb = to_omap_framebuffer(fb); |
---|
129 | 137 | const struct drm_format_info *format = omap_fb->format; |
---|
130 | | - struct plane *plane = &omap_fb->planes[0]; |
---|
131 | 138 | u32 x, y, orient = 0; |
---|
132 | 139 | |
---|
133 | 140 | info->fourcc = fb->format->format; |
---|
.. | .. |
---|
146 | 153 | x = state->src_x >> 16; |
---|
147 | 154 | y = state->src_y >> 16; |
---|
148 | 155 | |
---|
149 | | - if (omap_gem_flags(fb->obj[0]) & OMAP_BO_TILED) { |
---|
| 156 | + if (omap_gem_flags(fb->obj[0]) & OMAP_BO_TILED_MASK) { |
---|
150 | 157 | u32 w = state->src_w >> 16; |
---|
151 | 158 | u32 h = state->src_h >> 16; |
---|
152 | 159 | |
---|
.. | .. |
---|
201 | 208 | info->screen_width /= format->cpp[0]; |
---|
202 | 209 | |
---|
203 | 210 | if (fb->format->format == DRM_FORMAT_NV12) { |
---|
204 | | - plane = &omap_fb->planes[1]; |
---|
205 | | - |
---|
206 | 211 | if (info->rotation_type == OMAP_DSS_ROT_TILER) { |
---|
207 | | - WARN_ON(!(omap_gem_flags(fb->obj[1]) & OMAP_BO_TILED)); |
---|
| 212 | + WARN_ON(!(omap_gem_flags(fb->obj[1]) & OMAP_BO_TILED_MASK)); |
---|
208 | 213 | omap_gem_rotated_dma_addr(fb->obj[1], orient, x/2, y/2, |
---|
209 | 214 | &info->p_uv_addr); |
---|
210 | 215 | } else { |
---|
.. | .. |
---|
298 | 303 | struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, |
---|
299 | 304 | struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd) |
---|
300 | 305 | { |
---|
301 | | - unsigned int num_planes = drm_format_num_planes(mode_cmd->pixel_format); |
---|
| 306 | + const struct drm_format_info *info = drm_get_format_info(dev, |
---|
| 307 | + mode_cmd); |
---|
| 308 | + unsigned int num_planes = info->num_planes; |
---|
302 | 309 | struct drm_gem_object *bos[4]; |
---|
303 | 310 | struct drm_framebuffer *fb; |
---|
304 | 311 | int i; |
---|
.. | .. |
---|
319 | 326 | |
---|
320 | 327 | error: |
---|
321 | 328 | while (--i >= 0) |
---|
322 | | - drm_gem_object_unreference_unlocked(bos[i]); |
---|
| 329 | + drm_gem_object_put(bos[i]); |
---|
323 | 330 | |
---|
324 | 331 | return fb; |
---|
325 | 332 | } |
---|
.. | .. |
---|
337 | 344 | dev, mode_cmd, mode_cmd->width, mode_cmd->height, |
---|
338 | 345 | (char *)&mode_cmd->pixel_format); |
---|
339 | 346 | |
---|
340 | | - format = drm_format_info(mode_cmd->pixel_format); |
---|
| 347 | + format = drm_get_format_info(dev, mode_cmd); |
---|
341 | 348 | |
---|
342 | 349 | for (i = 0; i < ARRAY_SIZE(formats); i++) { |
---|
343 | 350 | if (formats[i] == mode_cmd->pixel_format) |
---|