drm_hwcomposer: filter out empty or invalid rects.

We can safely ignore zero-area rects because they do not affect the outcome
of the separate_rects() function. Furthermore the line sweep algorithm would
break when two identical START or END events are added to the same set.

Additionally any rect with |left| greater than |right| or |top| greater than
|bottom| is invalid and shall be ignored.

Added test cases with empty and invalid rects. This case would have crashed (or
failed the assert in a debug build) without this fix.

BUG=chrome-os-partner:47103
TEST=verify no crash with Photos app

Change-Id: I80950ef376390a14a892c58b563eb3c0f79db71c
1 file changed