| .. | .. |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * ARM Mali DP Writeback connector implementation |
|---|
| 7 | 7 | */ |
|---|
| 8 | + |
|---|
| 8 | 9 | #include <drm/drm_atomic.h> |
|---|
| 9 | 10 | #include <drm/drm_atomic_helper.h> |
|---|
| 10 | 11 | #include <drm/drm_crtc.h> |
|---|
| 11 | | -#include <drm/drm_crtc_helper.h> |
|---|
| 12 | 12 | #include <drm/drm_fb_cma_helper.h> |
|---|
| 13 | +#include <drm/drm_fourcc.h> |
|---|
| 13 | 14 | #include <drm/drm_gem_cma_helper.h> |
|---|
| 14 | | -#include <drm/drmP.h> |
|---|
| 15 | +#include <drm/drm_probe_helper.h> |
|---|
| 15 | 16 | #include <drm/drm_writeback.h> |
|---|
| 16 | 17 | |
|---|
| 17 | 18 | #include "malidp_drv.h" |
|---|
| .. | .. |
|---|
| 130 | 131 | struct drm_framebuffer *fb; |
|---|
| 131 | 132 | int i, n_planes; |
|---|
| 132 | 133 | |
|---|
| 133 | | - if (!conn_state->writeback_job || !conn_state->writeback_job->fb) |
|---|
| 134 | + if (!conn_state->writeback_job) |
|---|
| 134 | 135 | return 0; |
|---|
| 135 | 136 | |
|---|
| 136 | 137 | fb = conn_state->writeback_job->fb; |
|---|
| .. | .. |
|---|
| 141 | 142 | return -EINVAL; |
|---|
| 142 | 143 | } |
|---|
| 143 | 144 | |
|---|
| 145 | + if (fb->modifier) { |
|---|
| 146 | + DRM_DEBUG_KMS("Writeback framebuffer does not support modifiers\n"); |
|---|
| 147 | + return -EINVAL; |
|---|
| 148 | + } |
|---|
| 149 | + |
|---|
| 144 | 150 | mw_state->format = |
|---|
| 145 | 151 | malidp_hw_get_format_id(&malidp->dev->hw->map, SE_MEMWRITE, |
|---|
| 146 | | - fb->format->format); |
|---|
| 152 | + fb->format->format, !!fb->modifier); |
|---|
| 147 | 153 | if (mw_state->format == MALIDP_INVALID_FORMAT_ID) { |
|---|
| 148 | 154 | struct drm_format_name_buf format_name; |
|---|
| 149 | 155 | |
|---|
| .. | .. |
|---|
| 153 | 159 | return -EINVAL; |
|---|
| 154 | 160 | } |
|---|
| 155 | 161 | |
|---|
| 156 | | - n_planes = drm_format_num_planes(fb->format->format); |
|---|
| 162 | + n_planes = fb->format->num_planes; |
|---|
| 157 | 163 | for (i = 0; i < n_planes; i++) { |
|---|
| 158 | 164 | struct drm_gem_cma_object *obj = drm_fb_cma_get_gem_obj(fb, i); |
|---|
| 159 | 165 | /* memory write buffers are never rotated */ |
|---|
| .. | .. |
|---|
| 242 | 248 | |
|---|
| 243 | 249 | mw_state = to_mw_state(conn_state); |
|---|
| 244 | 250 | |
|---|
| 245 | | - if (conn_state->writeback_job && conn_state->writeback_job->fb) { |
|---|
| 251 | + if (conn_state->writeback_job) { |
|---|
| 246 | 252 | struct drm_framebuffer *fb = conn_state->writeback_job->fb; |
|---|
| 247 | 253 | |
|---|
| 248 | 254 | DRM_DEV_DEBUG_DRIVER(drm->dev, |
|---|
| .. | .. |
|---|
| 252 | 258 | &mw_state->addrs[0], |
|---|
| 253 | 259 | mw_state->format); |
|---|
| 254 | 260 | |
|---|
| 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); |
|---|
| 257 | 262 | hwdev->hw->enable_memwrite(hwdev, mw_state->addrs, |
|---|
| 258 | 263 | mw_state->pitches, mw_state->n_planes, |
|---|
| 259 | 264 | fb->width, fb->height, mw_state->format, |
|---|