summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_blend.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_blend.c')
-rw-r--r--drivers/gpu/drm/drm_blend.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 6e74de833466..1f3af27d2418 100644
--- a/drivers/gpu/drm/drm_blend.c
+++ b/drivers/gpu/drm/drm_blend.c
@@ -75,6 +75,12 @@
* the currently visible vertical area of the &drm_crtc.
* FB_ID:
* Mode object ID of the &drm_framebuffer this plane should scan out.
+ *
+ * When a KMS client is performing front-buffer rendering, it should set
+ * FB_ID to the same front-buffer FB on each atomic commit. This implies
+ * to the driver that it needs to re-read the same FB again. Otherwise
+ * drivers which do not employ continuously repeated scanout cycles might
+ * not update the screen.
* CRTC_ID:
* Mode object ID of the &drm_crtc this plane should be connected to.
*
@@ -185,10 +191,6 @@
* plane does not expose the "alpha" property, then this is
* assumed to be 1.0
*
- * Note that all the property extensions described here apply either to the
- * plane or the CRTC (e.g. for the background color, which currently is not
- * exposed and assumed to be black).
- *
* SCALING_FILTER:
* Indicates scaling filter to be used for plane scaler
*
@@ -201,6 +203,25 @@
*
* Drivers can set up this property for a plane by calling
* drm_plane_create_scaling_filter_property
+ *
+ * The property extensions described above all apply to the plane. Drivers
+ * may also expose the following crtc property extension:
+ *
+ * BACKGROUND_COLOR:
+ * Background color is set up with drm_crtc_attach_background_color_property(),
+ * and expects a 64-bit ARGB value following DRM_FORMAT_ARGB16161616, as
+ * generated by the DRM_ARGB64_PREP*() helpers. It controls the color of a
+ * full-screen layer that exists below all planes. This color will be used
+ * for pixels not covered by any plane and may also be blended with plane
+ * contents as allowed by a plane's alpha values.
+ * The background color defaults to black, and is assumed to be black for
+ * drivers that do not expose this property. Although background color
+ * isn't a plane, it is assumed that the color provided here undergoes the
+ * CRTC degamma/CSC/gamma transformations applied after the planes blending.
+ * Note that the color value includes an alpha channel, hence non-opaque
+ * background color values are allowed, but since physically transparent
+ * monitors do not (yet) exists, the final alpha value may not reach the
+ * video sink or it may simply ignore it.
*/
/**
@@ -453,7 +474,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
drm_dbg_atomic(dev, "[CRTC:%d:%s] calculating normalized zpos values\n",
crtc->base.id, crtc->name);
- states = kmalloc_array(total_planes, sizeof(*states), GFP_KERNEL);
+ states = kmalloc_objs(*states, total_planes);
if (!states)
return -ENOMEM;
@@ -615,3 +636,19 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane,
return 0;
}
EXPORT_SYMBOL(drm_plane_create_blend_mode_property);
+
+/**
+ * drm_crtc_attach_background_color_property - attach background color property
+ * @crtc: drm crtc
+ *
+ * Attaches the background color property to @crtc. The property defaults to
+ * solid black and will accept 64-bit ARGB values in the format generated by
+ * DRM_ARGB64_PREP*() helpers.
+ */
+void drm_crtc_attach_background_color_property(struct drm_crtc *crtc)
+{
+ drm_object_attach_property(&crtc->base,
+ crtc->dev->mode_config.background_color_property,
+ DRM_ARGB64_PREP(0xffff, 0, 0, 0));
+}
+EXPORT_SYMBOL(drm_crtc_attach_background_color_property);