|
49 | 49 | #include "i9xx_plane_regs.h" |
50 | 50 | #include "intel_cdclk.h" |
51 | 51 | #include "intel_cursor.h" |
| 52 | +#include "intel_colorop.h" |
52 | 53 | #include "intel_display_rps.h" |
53 | 54 | #include "intel_display_trace.h" |
54 | 55 | #include "intel_display_types.h" |
@@ -336,6 +337,52 @@ intel_plane_copy_uapi_plane_damage(struct intel_plane_state *new_plane_state, |
336 | 337 | *damage = drm_plane_state_src(&new_uapi_plane_state->uapi); |
337 | 338 | } |
338 | 339 |
|
| 340 | +static bool |
| 341 | +intel_plane_colorop_replace_blob(struct intel_plane_state *plane_state, |
| 342 | + struct intel_colorop *intel_colorop, |
| 343 | + struct drm_property_blob *blob) |
| 344 | +{ |
| 345 | + if (intel_colorop->id == INTEL_PLANE_CB_CSC) |
| 346 | + return drm_property_replace_blob(&plane_state->hw.ctm, blob); |
| 347 | + |
| 348 | + return false; |
| 349 | +} |
| 350 | + |
| 351 | +static void |
| 352 | +intel_plane_color_copy_uapi_to_hw_state(struct intel_plane_state *plane_state, |
| 353 | + const struct intel_plane_state *from_plane_state, |
| 354 | + struct intel_crtc *crtc) |
| 355 | +{ |
| 356 | + struct drm_colorop *iter_colorop, *colorop; |
| 357 | + struct drm_colorop_state *new_colorop_state; |
| 358 | + struct drm_atomic_state *state = plane_state->uapi.state; |
| 359 | + struct intel_colorop *intel_colorop; |
| 360 | + struct drm_property_blob *blob; |
| 361 | + struct intel_atomic_state *intel_atomic_state = to_intel_atomic_state(state); |
| 362 | + struct intel_crtc_state *new_crtc_state = intel_atomic_state ? |
| 363 | + intel_atomic_get_new_crtc_state(intel_atomic_state, crtc) : NULL; |
| 364 | + bool changed = false; |
| 365 | + int i = 0; |
| 366 | + |
| 367 | + iter_colorop = plane_state->uapi.color_pipeline; |
| 368 | + |
| 369 | + while (iter_colorop) { |
| 370 | + for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) { |
| 371 | + if (new_colorop_state->colorop == iter_colorop) { |
| 372 | + blob = new_colorop_state->bypass ? NULL : new_colorop_state->data; |
| 373 | + intel_colorop = to_intel_colorop(colorop); |
| 374 | + changed |= intel_plane_colorop_replace_blob(plane_state, |
| 375 | + intel_colorop, |
| 376 | + blob); |
| 377 | + } |
| 378 | + } |
| 379 | + iter_colorop = iter_colorop->next; |
| 380 | + } |
| 381 | + |
| 382 | + if (new_crtc_state && changed) |
| 383 | + new_crtc_state->plane_color_changed = true; |
| 384 | +} |
| 385 | + |
339 | 386 | void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state, |
340 | 387 | const struct intel_plane_state *from_plane_state, |
341 | 388 | struct intel_crtc *crtc) |
@@ -364,6 +411,8 @@ void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state, |
364 | 411 |
|
365 | 412 | plane_state->uapi.src = drm_plane_state_src(&from_plane_state->uapi); |
366 | 413 | plane_state->uapi.dst = drm_plane_state_dest(&from_plane_state->uapi); |
| 414 | + |
| 415 | + intel_plane_color_copy_uapi_to_hw_state(plane_state, from_plane_state, crtc); |
367 | 416 | } |
368 | 417 |
|
369 | 418 | void intel_plane_copy_hw_state(struct intel_plane_state *plane_state, |
|
0 commit comments