Ok, I need to confess. This is not a question about your code :). I'm working on a similar project using an ESP-32 connected via HDMI (SCL, SDA, Ground) to my Samsung CF791 UW monitor. I can send the VCP 0x60 to switch to either HDMI-1 or HDMI-2. However, switching from an HDMI input to DisplayPort does not work.
I plugged a ilnux computer into the same HDMI input that I'm using and was able to use DDCUtil to switch the input from HDMI to Displayport. I captured the i2c bytes and I'm sending the same sequence.
I'm wondering if you've encountered odd behavior like this? Is it perhaps a voltage thing? I'm using ESP-32 with 4.5k pull up resistors and 3.3v.