hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/drivers/gpu/drm/zte/zx_plane.c
....@@ -1,20 +1,16 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright 2016 Linaro Ltd.
34 * Copyright 2016 ZTE Corporation.
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as
7
- * published by the Free Software Foundation.
8
- *
95 */
106
117 #include <drm/drm_atomic.h>
128 #include <drm/drm_atomic_helper.h>
139 #include <drm/drm_fb_cma_helper.h>
10
+#include <drm/drm_fourcc.h>
1411 #include <drm/drm_gem_cma_helper.h>
1512 #include <drm/drm_modeset_helper_vtables.h>
1613 #include <drm/drm_plane_helper.h>
17
-#include <drm/drmP.h>
1814
1915 #include "zx_common_regs.h"
2016 #include "zx_drm_drv.h"
....@@ -58,7 +54,7 @@
5854 int min_scale = FRAC_16_16(1, 8);
5955 int max_scale = FRAC_16_16(8, 1);
6056
61
- if (!crtc || !fb)
57
+ if (!crtc || WARN_ON(!fb))
6258 return 0;
6359
6460 crtc_state = drm_atomic_get_existing_crtc_state(plane_state->state,
....@@ -199,7 +195,6 @@
199195 u32 dst_x, dst_y, dst_w, dst_h;
200196 uint32_t format;
201197 int fmt;
202
- int num_planes;
203198 int i;
204199
205200 if (!fb)
....@@ -218,13 +213,12 @@
218213 dst_h = drm_rect_height(dst);
219214
220215 /* Set up data address registers for Y, Cb and Cr planes */
221
- num_planes = drm_format_num_planes(format);
222216 paddr_reg = layer + VL_Y;
223
- for (i = 0; i < num_planes; i++) {
217
+ for (i = 0; i < fb->format->num_planes; i++) {
224218 cma_obj = drm_fb_cma_get_gem_obj(fb, i);
225219 paddr = cma_obj->paddr + fb->offsets[i];
226220 paddr += src_y * fb->pitches[i];
227
- paddr += src_x * drm_format_plane_cpp(format, i);
221
+ paddr += src_x * fb->format->cpp[i];
228222 zx_writel(paddr_reg, paddr);
229223 paddr_reg += 4;
230224 }
....@@ -287,7 +281,7 @@
287281 struct drm_crtc *crtc = plane_state->crtc;
288282 struct drm_crtc_state *crtc_state;
289283
290
- if (!crtc || !fb)
284
+ if (!crtc || WARN_ON(!fb))
291285 return 0;
292286
293287 crtc_state = drm_atomic_get_existing_crtc_state(plane_state->state,
....@@ -446,7 +440,6 @@
446440
447441 static void zx_plane_destroy(struct drm_plane *plane)
448442 {
449
- drm_plane_helper_disable(plane, NULL);
450443 drm_plane_cleanup(plane);
451444 }
452445