Ok, makes sense to move it to a new thread and collect everything at one position!
I am a bit tight on time and haven't received the board yet (hoped it would arrive today ...) but my first step approach was simply to use one independent input capture interrupt per motor for the step-pin and attach a short (as short as possible) interrupt, like demonstrated here:
Due to the design of the input capture interrupts on the stm32f4 platform and the already defined gpios it has to be on two independent IRQ lines (means both step pins should not have the same port count number PXN, where N should be different)
Also I have not read the reference manual and the existing code thoroughly enough to say if it is a problem to use lines which are in use for the encoder interface.
In the long run something like DMA to get the position might be more efficient, but using interrupts is probably the quickest and easiest way to get started.
Given the clock speed of the processor and a reasonable step frequency (0.5MHz would be really fast actually, usual 3D printer boards are not going that high even with high microstepping) I don't think there are any issues with doing it with interrupts.
Also the interrupt would be really simple if we can just alter the internal motor position variable (maybe with a variable prescaler) after polling the dir pin.
I think this should be only a handful of cycles and no issue on the performance should be expected.
Not sure whether overrun may be an issue here
This for sure only works in position mode and I have no idea if there is excessive jitter with this (also dependent on the frequency the control loop is working with) but it could be worth a try. A more sophisticated approach could try to estimate the current velocity to smooth the movements especially on low speeds.