|
@@ -793,3 +793,47 @@ void drm_framebuffer_remove(struct drm_framebuffer *fb)
|
|
|
drm_framebuffer_unreference(fb);
|
|
|
}
|
|
|
EXPORT_SYMBOL(drm_framebuffer_remove);
|
|
|
+
|
|
|
+/**
|
|
|
+ * drm_framebuffer_plane_width - width of the plane given the first plane
|
|
|
+ * @width: width of the first plane
|
|
|
+ * @fb: the framebuffer
|
|
|
+ * @plane: plane index
|
|
|
+ *
|
|
|
+ * Returns:
|
|
|
+ * The width of @plane, given that the width of the first plane is @width.
|
|
|
+ */
|
|
|
+int drm_framebuffer_plane_width(int width,
|
|
|
+ const struct drm_framebuffer *fb, int plane)
|
|
|
+{
|
|
|
+ if (plane >= fb->format->num_planes)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (plane == 0)
|
|
|
+ return width;
|
|
|
+
|
|
|
+ return width / fb->format->hsub;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(drm_framebuffer_plane_width);
|
|
|
+
|
|
|
+/**
|
|
|
+ * drm_framebuffer_plane_height - height of the plane given the first plane
|
|
|
+ * @height: height of the first plane
|
|
|
+ * @fb: the framebuffer
|
|
|
+ * @plane: plane index
|
|
|
+ *
|
|
|
+ * Returns:
|
|
|
+ * The height of @plane, given that the height of the first plane is @height.
|
|
|
+ */
|
|
|
+int drm_framebuffer_plane_height(int height,
|
|
|
+ const struct drm_framebuffer *fb, int plane)
|
|
|
+{
|
|
|
+ if (plane >= fb->format->num_planes)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ if (plane == 0)
|
|
|
+ return height;
|
|
|
+
|
|
|
+ return height / fb->format->vsub;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(drm_framebuffer_plane_height);
|