AC dimming with STM32 timers
You can put a timer (A) in single shot triggered from an external pin.
This external pin is your zero crossing detector.

You also may need a timer (B) to measure the frequency.

Software still needs to calculate the duty cycle percentage based on the frequency. And set timer A reload to the measured value in timer B.

However, you could use a DMA operation triggered by timer A to copy the capture time of B to the reload register of A. But, you're calculating with those numbers anyway. 



Having an ISR called at 50Hz isn't a problem when it doesn't take a lot of time to process it.