video: adf: add buffer padding quirk

Quirks specify common behaviors that vary slightly among devices, and
which ADF must account for.

The buffer padding quirk captures the way different devices fetch the
last scanline in a buffer: some devices fetch an entire line (including
padding to the pitch) while others only fetch up to the visible width.
ADF's buffer size validation now takes this quirk into account.

Change-Id: I828b13316e27621d8a9efd9d5fffa6ce12a525ff
Signed-off-by: Greg Hackmann <ghackmann@google.com>
diff --git a/include/video/adf.h b/include/video/adf.h
index 2b742ab..34f10e5 100644
--- a/include/video/adf.h
+++ b/include/video/adf.h
@@ -193,10 +193,26 @@
 };
 
 /**
+ * struct adf_device_quirks - common display device quirks
+ *
+ * @buffer_padding: whether the last scanline of a buffer extends to the
+ * 	buffer's pitch (@ADF_BUFFER_PADDED_TO_PITCH) or just to the visible
+ * 	width (@ADF_BUFFER_UNPADDED)
+ */
+struct adf_device_quirks {
+	/* optional, defaults to ADF_BUFFER_PADDED_TO_PITCH */
+	enum {
+		ADF_BUFFER_PADDED_TO_PITCH = 0,
+		ADF_BUFFER_UNPADDED = 1,
+	} buffer_padding;
+};
+
+/**
  * struct adf_device_ops - display device implementation ops
  *
  * @owner: device's module
  * @base: common operations (see &struct adf_obj_ops)
+ * @quirks: device's quirks (see &struct adf_device_quirks)
  *
  * @attach: attach overlay engine @eng to interface @intf.  Return 0 on success
  *	or error code (<0) on failure.
@@ -228,6 +244,8 @@
 	/* required */
 	struct module *owner;
 	const struct adf_obj_ops base;
+	/* optional */
+	const struct adf_device_quirks quirks;
 
 	/* optional */
 	int (*attach)(struct adf_device *dev, struct adf_overlay_engine *eng,