.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2014, The Linux Foundation. All rights reserved. |
---|
3 | 4 | * Copyright (C) 2013 Red Hat |
---|
4 | 5 | * Author: Rob Clark <robdclark@gmail.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify it |
---|
7 | | - * under the terms of the GNU General Public License version 2 as published by |
---|
8 | | - * the Free Software Foundation. |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
---|
11 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
12 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
13 | | - * more details. |
---|
14 | | - * |
---|
15 | | - * You should have received a copy of the GNU General Public License along with |
---|
16 | | - * this program. If not, see <http://www.gnu.org/licenses/>. |
---|
17 | 6 | */ |
---|
18 | 7 | |
---|
| 8 | +#include <drm/drm_fourcc.h> |
---|
| 9 | +#include <drm/drm_util.h> |
---|
19 | 10 | |
---|
20 | 11 | #include "mdp5_kms.h" |
---|
21 | 12 | #include "mdp5_smp.h" |
---|
.. | .. |
---|
88 | 79 | |
---|
89 | 80 | avail = cnt - bitmap_weight(state->state, cnt); |
---|
90 | 81 | if (nblks > avail) { |
---|
91 | | - dev_err(smp->dev->dev, "out of blks (req=%d > avail=%d)\n", |
---|
| 82 | + DRM_DEV_ERROR(smp->dev->dev, "out of blks (req=%d > avail=%d)\n", |
---|
92 | 83 | nblks, avail); |
---|
93 | 84 | return -ENOSPC; |
---|
94 | 85 | } |
---|
.. | .. |
---|
126 | 117 | const struct mdp_format *format, |
---|
127 | 118 | u32 width, bool hdecim) |
---|
128 | 119 | { |
---|
| 120 | + const struct drm_format_info *info = drm_format_info(format->base.pixel_format); |
---|
129 | 121 | struct mdp5_kms *mdp5_kms = get_kms(smp); |
---|
130 | 122 | int rev = mdp5_cfg_get_hw_rev(mdp5_kms->cfg); |
---|
131 | 123 | int i, hsub, nplanes, nlines; |
---|
132 | | - u32 fmt = format->base.pixel_format; |
---|
133 | 124 | uint32_t blkcfg = 0; |
---|
134 | 125 | |
---|
135 | | - nplanes = drm_format_num_planes(fmt); |
---|
136 | | - hsub = drm_format_horz_chroma_subsampling(fmt); |
---|
| 126 | + nplanes = info->num_planes; |
---|
| 127 | + hsub = info->hsub; |
---|
137 | 128 | |
---|
138 | 129 | /* different if BWC (compressed framebuffer?) enabled: */ |
---|
139 | 130 | nlines = 2; |
---|
.. | .. |
---|
143 | 134 | * them together, writes to SMP using a single client. |
---|
144 | 135 | */ |
---|
145 | 136 | if ((rev > 0) && (format->chroma_sample > CHROMA_FULL)) { |
---|
146 | | - fmt = DRM_FORMAT_NV24; |
---|
147 | 137 | nplanes = 2; |
---|
148 | 138 | |
---|
149 | 139 | /* if decimation is enabled, HW decimates less on the |
---|
.. | .. |
---|
156 | 146 | for (i = 0; i < nplanes; i++) { |
---|
157 | 147 | int n, fetch_stride, cpp; |
---|
158 | 148 | |
---|
159 | | - cpp = drm_format_plane_cpp(fmt, i); |
---|
| 149 | + cpp = info->cpp[i]; |
---|
160 | 150 | fetch_stride = width * cpp / (i ? hsub : 1); |
---|
161 | 151 | |
---|
162 | 152 | n = DIV_ROUND_UP(fetch_stride * nlines, smp->blk_size); |
---|
.. | .. |
---|
188 | 178 | DBG("%s[%d]: request %d SMP blocks", pipe2name(pipe), i, n); |
---|
189 | 179 | ret = smp_request_block(smp, state, cid, n); |
---|
190 | 180 | if (ret) { |
---|
191 | | - dev_err(dev->dev, "Cannot allocate %d SMP blocks: %d\n", |
---|
| 181 | + DRM_DEV_ERROR(dev->dev, "Cannot allocate %d SMP blocks: %d\n", |
---|
192 | 182 | n, ret); |
---|
193 | 183 | return ret; |
---|
194 | 184 | } |
---|