[PATCH v12 72/86] media: ipu6: Get watermark configuration directly from ipdata

Sakari Ailus
2026-04-09T20:15:13Z

Instead of passing watermark configuration data around, get it directly
from IPU variant specific static data structure.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 12 ++++--------
drivers/media/pci/intel/ipu6/ipu6-isys-video.h | 2 --
2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
index 0da9070aeb42..1165d5bc693b 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c
@@ -759,8 +759,6 @@ void ipu6_isys_configure_stream_watermark(struct ipu6_isys_video *av,

av->watermark.width = ipu6_isys_get_frame_width(av);
av->watermark.height = ipu6_isys_get_frame_height(av);
- av->watermark.sram_gran_shift = isys->pdata->ipdata->sram_gran_shift;
- av->watermark.sram_gran_size = isys->pdata->ipdata->sram_gran_size;

ret = v4l2_g_ctrl(esd->ctrl_handler, &hb);
if (!ret && hb.value >= 0)
@@ -799,17 +797,15 @@ static void calculate_stream_datarate(struct ipu6_isys_video *av)
ipu6_isys_get_isys_format(ipu6_isys_get_format(av), 0);
u32 pages_per_line, pb_bytes_per_line, pixels_per_line, bytes_per_line;
u64 line_time_ns, stream_data_rate;
- u16 shift, size;
-
- shift = watermark->sram_gran_shift;
- size = watermark->sram_gran_size;

pixels_per_line = watermark->width + watermark->hblank;
line_time_ns = div_u64(pixels_per_line * NSEC_PER_SEC,
watermark->pixel_rate);
bytes_per_line = watermark->width * pfmt->bpp / 8;
- pages_per_line = DIV_ROUND_UP(bytes_per_line, size);
- pb_bytes_per_line = pages_per_line << shift;
+ pages_per_line = DIV_ROUND_UP(bytes_per_line,
+ av->isys->pdata->ipdata->sram_gran_size);
+ pb_bytes_per_line =
+ pages_per_line << av->isys->pdata->ipdata->sram_gran_shift;
stream_data_rate = div64_u64(pb_bytes_per_line * 1000, line_time_ns);

watermark->stream_data_rate = stream_data_rate;
diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-video.h b/drivers/media/pci/intel/ipu6/ipu6-isys-video.h
index d07c16e79877..80b9d0d001b1 100644
--- a/drivers/media/pci/intel/ipu6/ipu6-isys-video.h
+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-video.h
@@ -72,8 +72,6 @@ struct video_stream_watermark {
u32 frame_rate;
u64 pixel_rate;
u64 stream_data_rate;
- u16 sram_gran_shift;
- u16 sram_gran_size;
struct list_head stream_node;
};

--
2.47.3