I was unable to write tests for this; it seems it doesn't consistently work on Windows. However, Rayman 3 seems to rely on it; it maps the same buffer twice immediately after creation, with DISCARD flags on both maps, and expects the same address to be returned.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53752
-- v2: d3d8: Filter out redundant buffer discards.