Skip to content

Commit

Permalink
Fix details mask tiling issues
Browse files Browse the repository at this point in the history
If rawprepare or demosaic run in tiled mode they can't write the details mask, that would require a rewrite
of those modules with a special tiled process implementation.

As we set the piece->pipe->want_detail_mask while committing params and that comes *after* the mask writing
modules we must check via _piece_may_tile() if we must a) fallback to cpu code or b) process CPU code but at
least leave a note.
Used a flag for that check instead of string compare.
  • Loading branch information
jenshannoschwalm authored and TurboGit committed Jan 21, 2025
1 parent 489cddf commit 430e3d6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/develop/imageop.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ typedef enum dt_iop_flags_t
IOP_FLAGS_GUIDES_SPECIAL_DRAW = 1 << 14, // handle the grid drawing directly
IOP_FLAGS_GUIDES_WIDGET = 1 << 15, // require the guides widget
IOP_FLAGS_CROP_EXPOSER = 1 << 16, // offers crop exposing
IOP_FLAGS_EXPAND_ROI_IN = 1 << 17 // we might have to take special care about roi expansion
IOP_FLAGS_EXPAND_ROI_IN = 1 << 17, // we might have to take special care about roi expansion
IOP_FLAGS_WRITE_DETAILS = 1 << 18
} dt_iop_flags_t;

/** status of a module*/
Expand Down
14 changes: 11 additions & 3 deletions src/develop/pixelpipe_hb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,13 @@ static gboolean _request_color_pick(dt_dev_pixelpipe_t *pipe,
&& module->request_color_pick != DT_REQUEST_COLORPICK_OFF;
}

// Is it worth to use a dt_iop_flags_t for this ?
static inline gboolean _piece_may_tile(const dt_dev_pixelpipe_iop_t *piece)
{
return piece->process_tiling_ready
&& !(piece->pipe->want_detail_mask && piece->module->flags() & IOP_FLAGS_WRITE_DETAILS);
}

static void _collect_histogram_on_CPU(dt_dev_pixelpipe_t *pipe,
dt_develop_t *dev,
float *input,
Expand Down Expand Up @@ -1185,7 +1192,7 @@ static gboolean _pixelpipe_process_on_CPU(dt_dev_pixelpipe_t *pipe,
roi_in->width, roi_in->height, in_bpp,
TRUE, dt_dev_pixelpipe_type_to_str(piece->pipe->type));

if(!fitting && piece->process_tiling_ready)
if(!fitting && _piece_may_tile(piece))
{
dt_print_pipe(DT_DEBUG_PIPE,
"process tiles",
Expand Down Expand Up @@ -1214,7 +1221,8 @@ static gboolean _pixelpipe_process_on_CPU(dt_dev_pixelpipe_t *pipe,

// this code section is for simplistic benchmarking via --bench-module
if((piece->pipe->type & (DT_DEV_PIXELPIPE_FULL | DT_DEV_PIXELPIPE_EXPORT))
&& darktable.bench_module)
&& darktable.bench_module
&& fitting)
{
if(dt_str_commasubstring(darktable.bench_module, module->op))
{
Expand Down Expand Up @@ -1712,7 +1720,7 @@ static gboolean _dev_pixelpipe_process_rec(dt_dev_pixelpipe_t *pipe,

if(possible_cl && !fits_on_device)
{
if(!piece->process_tiling_ready)
if(!_piece_may_tile(piece))
possible_cl = FALSE;

const float advantage = darktable.opencl->dev[pipe->devid].advantage;
Expand Down
2 changes: 1 addition & 1 deletion src/iop/demosaic.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ int default_group()

int flags()
{
return IOP_FLAGS_ALLOW_TILING | IOP_FLAGS_ONE_INSTANCE | IOP_FLAGS_FENCE;
return IOP_FLAGS_ALLOW_TILING | IOP_FLAGS_ONE_INSTANCE | IOP_FLAGS_FENCE | IOP_FLAGS_WRITE_DETAILS;
}

dt_iop_colorspace_type_t default_colorspace(dt_iop_module_t *self,
Expand Down
2 changes: 1 addition & 1 deletion src/iop/rawprepare.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int operation_tags()
int flags()
{
return IOP_FLAGS_ALLOW_TILING | IOP_FLAGS_TILING_FULL_ROI | IOP_FLAGS_ONE_INSTANCE
| IOP_FLAGS_UNSAFE_COPY;
| IOP_FLAGS_UNSAFE_COPY | IOP_FLAGS_WRITE_DETAILS;
}

int default_group()
Expand Down

0 comments on commit 430e3d6

Please sign in to comment.