]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: atomisp: gate ref and tnr frame config behind ISP enable flags
authorJose A. Perez de Azpillaga <azpijr@gmail.com>
Sun, 5 Apr 2026 09:30:43 +0000 (11:30 +0200)
committerSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 20 May 2026 08:29:31 +0000 (11:29 +0300)
The FIXME comment noted that delay_frames can be NULL for certain
pipeline configurations, without knowing why. The reason is that when a
binary does not enable ref_frame, delay frame allocation is
intentionally skipped to save memory, leaving the pointers NULL by
design.

The ISP feature flags in binary->info->sp.enable accurately reflect
which features are active for a given binary. Using enable.ref_frame and
enable.tnr as the predicate for their respective configuration steps
ensures the configuration path stays in sync with what was actually
built into the pipeline

Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
drivers/staging/media/atomisp/pci/sh_css_sp.c

index 6da151e7a873280ca8b7ddbe5cf826690cfed154..abdffff41ae2e6026243daefa63fab46493468e2 100644 (file)
@@ -775,9 +775,13 @@ static int configure_isp_from_args(const struct sh_css_sp_pipeline *pipeline,
        ret = ia_css_fpn_configure(binary,  &binary->in_frame_info);
        if (ret)
                return ret;
-       ret = ia_css_crop_configure(binary, ia_css_frame_get_info(args->delay_frames[0]));
-       if (ret)
-               return ret;
+
+       if (binary->info->sp.enable.ref_frame) {
+               ret = ia_css_crop_configure(binary, ia_css_frame_get_info(args->delay_frames[0]));
+               if (ret)
+                       return ret;
+       }
+
        ret = ia_css_qplane_configure(pipeline, binary, &binary->in_frame_info);
        if (ret)
                return ret;
@@ -807,22 +811,18 @@ static int configure_isp_from_args(const struct sh_css_sp_pipeline *pipeline,
        if (ret)
                return ret;
 
-       /*
-        * FIXME: args->delay_frames can be NULL here
-        *
-        * Somehow, the driver at the Intel Atom Yocto tree doesn't seem to
-        * suffer from the same issue.
-        *
-        * Anyway, the function below should now handle a NULL delay_frames
-        * without crashing, but the pipeline should likely be built without
-        * adding it at the first place (or there are a hidden bug somewhere)
-        */
-       ret = ia_css_ref_configure(binary, args->delay_frames, pipeline->dvs_frame_delay);
-       if (ret)
-               return ret;
-       ret = ia_css_tnr_configure(binary, args->tnr_frames);
-       if (ret)
-               return ret;
+       if (binary->info->sp.enable.ref_frame) {
+               ret = ia_css_ref_configure(binary, args->delay_frames, pipeline->dvs_frame_delay);
+               if (ret)
+                       return ret;
+       }
+
+       if (binary->info->sp.enable.tnr) {
+               ret = ia_css_tnr_configure(binary, args->tnr_frames);
+               if (ret)
+                       return ret;
+       }
+
        return ia_css_bayer_io_config(binary, args);
 }