mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/i915/color: Add framework to program CSC
Add framework to program CSC. It enables copying of matrix from UAPI to intel plane state. Also add helper functions which will eventually program values to hardware. Add a crtc state variable to track plane color change. v2: - Add crtc_state->plane_color_changed - Improve comments (Suraj) - s/intel_plane_*_color/intel_plane_color_* (Suraj) v3: - align parameters with open braces (Suraj) - Improve commit message (Suraj) v4: - Re-arrange variable declaration (Suraj) Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Signed-off-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Signed-off-by: Uma Shankar <uma.shankar@intel.com> Link: https://patch.msgid.link/20251203085211.3663374-6-uma.shankar@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
committed by
Jani Nikula
parent
ef10531681
commit
a78f1b6baf
@@ -49,6 +49,7 @@
|
||||
#include "i9xx_plane_regs.h"
|
||||
#include "intel_cdclk.h"
|
||||
#include "intel_cursor.h"
|
||||
#include "intel_colorop.h"
|
||||
#include "intel_display_rps.h"
|
||||
#include "intel_display_trace.h"
|
||||
#include "intel_display_types.h"
|
||||
@@ -336,6 +337,52 @@ intel_plane_copy_uapi_plane_damage(struct intel_plane_state *new_plane_state,
|
||||
*damage = drm_plane_state_src(&new_uapi_plane_state->uapi);
|
||||
}
|
||||
|
||||
static bool
|
||||
intel_plane_colorop_replace_blob(struct intel_plane_state *plane_state,
|
||||
struct intel_colorop *intel_colorop,
|
||||
struct drm_property_blob *blob)
|
||||
{
|
||||
if (intel_colorop->id == INTEL_PLANE_CB_CSC)
|
||||
return drm_property_replace_blob(&plane_state->hw.ctm, blob);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
intel_plane_color_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
|
||||
const struct intel_plane_state *from_plane_state,
|
||||
struct intel_crtc *crtc)
|
||||
{
|
||||
struct drm_colorop *iter_colorop, *colorop;
|
||||
struct drm_colorop_state *new_colorop_state;
|
||||
struct drm_atomic_state *state = plane_state->uapi.state;
|
||||
struct intel_colorop *intel_colorop;
|
||||
struct drm_property_blob *blob;
|
||||
struct intel_atomic_state *intel_atomic_state = to_intel_atomic_state(state);
|
||||
struct intel_crtc_state *new_crtc_state = intel_atomic_state ?
|
||||
intel_atomic_get_new_crtc_state(intel_atomic_state, crtc) : NULL;
|
||||
bool changed = false;
|
||||
int i = 0;
|
||||
|
||||
iter_colorop = plane_state->uapi.color_pipeline;
|
||||
|
||||
while (iter_colorop) {
|
||||
for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
|
||||
if (new_colorop_state->colorop == iter_colorop) {
|
||||
blob = new_colorop_state->bypass ? NULL : new_colorop_state->data;
|
||||
intel_colorop = to_intel_colorop(colorop);
|
||||
changed |= intel_plane_colorop_replace_blob(plane_state,
|
||||
intel_colorop,
|
||||
blob);
|
||||
}
|
||||
}
|
||||
iter_colorop = iter_colorop->next;
|
||||
}
|
||||
|
||||
if (new_crtc_state && changed)
|
||||
new_crtc_state->plane_color_changed = true;
|
||||
}
|
||||
|
||||
void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
|
||||
const struct intel_plane_state *from_plane_state,
|
||||
struct intel_crtc *crtc)
|
||||
@@ -364,6 +411,8 @@ void intel_plane_copy_uapi_to_hw_state(struct intel_plane_state *plane_state,
|
||||
|
||||
plane_state->uapi.src = drm_plane_state_src(&from_plane_state->uapi);
|
||||
plane_state->uapi.dst = drm_plane_state_dest(&from_plane_state->uapi);
|
||||
|
||||
intel_plane_color_copy_uapi_to_hw_state(plane_state, from_plane_state, crtc);
|
||||
}
|
||||
|
||||
void intel_plane_copy_hw_state(struct intel_plane_state *plane_state,
|
||||
|
||||
Reference in New Issue
Block a user