forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/arm/malidp_mw.c
....@@ -5,13 +5,14 @@
55 *
66 * ARM Mali DP Writeback connector implementation
77 */
8
+
89 #include <drm/drm_atomic.h>
910 #include <drm/drm_atomic_helper.h>
1011 #include <drm/drm_crtc.h>
11
-#include <drm/drm_crtc_helper.h>
1212 #include <drm/drm_fb_cma_helper.h>
13
+#include <drm/drm_fourcc.h>
1314 #include <drm/drm_gem_cma_helper.h>
14
-#include <drm/drmP.h>
15
+#include <drm/drm_probe_helper.h>
1516 #include <drm/drm_writeback.h>
1617
1718 #include "malidp_drv.h"
....@@ -130,7 +131,7 @@
130131 struct drm_framebuffer *fb;
131132 int i, n_planes;
132133
133
- if (!conn_state->writeback_job || !conn_state->writeback_job->fb)
134
+ if (!conn_state->writeback_job)
134135 return 0;
135136
136137 fb = conn_state->writeback_job->fb;
....@@ -141,9 +142,14 @@
141142 return -EINVAL;
142143 }
143144
145
+ if (fb->modifier) {
146
+ DRM_DEBUG_KMS("Writeback framebuffer does not support modifiers\n");
147
+ return -EINVAL;
148
+ }
149
+
144150 mw_state->format =
145151 malidp_hw_get_format_id(&malidp->dev->hw->map, SE_MEMWRITE,
146
- fb->format->format);
152
+ fb->format->format, !!fb->modifier);
147153 if (mw_state->format == MALIDP_INVALID_FORMAT_ID) {
148154 struct drm_format_name_buf format_name;
149155
....@@ -153,7 +159,7 @@
153159 return -EINVAL;
154160 }
155161
156
- n_planes = drm_format_num_planes(fb->format->format);
162
+ n_planes = fb->format->num_planes;
157163 for (i = 0; i < n_planes; i++) {
158164 struct drm_gem_cma_object *obj = drm_fb_cma_get_gem_obj(fb, i);
159165 /* memory write buffers are never rotated */
....@@ -242,7 +248,7 @@
242248
243249 mw_state = to_mw_state(conn_state);
244250
245
- if (conn_state->writeback_job && conn_state->writeback_job->fb) {
251
+ if (conn_state->writeback_job) {
246252 struct drm_framebuffer *fb = conn_state->writeback_job->fb;
247253
248254 DRM_DEV_DEBUG_DRIVER(drm->dev,
....@@ -252,8 +258,7 @@
252258 &mw_state->addrs[0],
253259 mw_state->format);
254260
255
- drm_writeback_queue_job(mw_conn, conn_state->writeback_job);
256
- conn_state->writeback_job = NULL;
261
+ drm_writeback_queue_job(mw_conn, conn_state);
257262 hwdev->hw->enable_memwrite(hwdev, mw_state->addrs,
258263 mw_state->pitches, mw_state->n_planes,
259264 fb->width, fb->height, mw_state->format,