hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c
....@@ -1,21 +1,12 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
34 * Copyright (C) 2013 Red Hat
45 * 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/>.
176 */
187
8
+#include <drm/drm_fourcc.h>
9
+#include <drm/drm_util.h>
1910
2011 #include "mdp5_kms.h"
2112 #include "mdp5_smp.h"
....@@ -88,7 +79,7 @@
8879
8980 avail = cnt - bitmap_weight(state->state, cnt);
9081 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",
9283 nblks, avail);
9384 return -ENOSPC;
9485 }
....@@ -126,14 +117,14 @@
126117 const struct mdp_format *format,
127118 u32 width, bool hdecim)
128119 {
120
+ const struct drm_format_info *info = drm_format_info(format->base.pixel_format);
129121 struct mdp5_kms *mdp5_kms = get_kms(smp);
130122 int rev = mdp5_cfg_get_hw_rev(mdp5_kms->cfg);
131123 int i, hsub, nplanes, nlines;
132
- u32 fmt = format->base.pixel_format;
133124 uint32_t blkcfg = 0;
134125
135
- nplanes = drm_format_num_planes(fmt);
136
- hsub = drm_format_horz_chroma_subsampling(fmt);
126
+ nplanes = info->num_planes;
127
+ hsub = info->hsub;
137128
138129 /* different if BWC (compressed framebuffer?) enabled: */
139130 nlines = 2;
....@@ -143,7 +134,6 @@
143134 * them together, writes to SMP using a single client.
144135 */
145136 if ((rev > 0) && (format->chroma_sample > CHROMA_FULL)) {
146
- fmt = DRM_FORMAT_NV24;
147137 nplanes = 2;
148138
149139 /* if decimation is enabled, HW decimates less on the
....@@ -156,7 +146,7 @@
156146 for (i = 0; i < nplanes; i++) {
157147 int n, fetch_stride, cpp;
158148
159
- cpp = drm_format_plane_cpp(fmt, i);
149
+ cpp = info->cpp[i];
160150 fetch_stride = width * cpp / (i ? hsub : 1);
161151
162152 n = DIV_ROUND_UP(fetch_stride * nlines, smp->blk_size);
....@@ -188,7 +178,7 @@
188178 DBG("%s[%d]: request %d SMP blocks", pipe2name(pipe), i, n);
189179 ret = smp_request_block(smp, state, cid, n);
190180 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",
192182 n, ret);
193183 return ret;
194184 }