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.c55
1 files changed, 46 insertions, 9 deletions
diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
index 6e74de833466..2f0d1ba285be 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.
*/
/**
@@ -428,7 +449,7 @@ int drm_plane_create_zpos_immutable_property(struct drm_plane *plane,
}
EXPORT_SYMBOL(drm_plane_create_zpos_immutable_property);
-static int drm_atomic_state_zpos_cmp(const void *a, const void *b)
+static int drm_atomic_commit_zpos_cmp(const void *a, const void *b)
{
const struct drm_plane_state *sa = *(struct drm_plane_state **)a;
const struct drm_plane_state *sb = *(struct drm_plane_state **)b;
@@ -442,7 +463,7 @@ static int drm_atomic_state_zpos_cmp(const void *a, const void *b)
static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
struct drm_crtc_state *crtc_state)
{
- struct drm_atomic_state *state = crtc_state->state;
+ struct drm_atomic_commit *state = crtc_state->state;
struct drm_device *dev = crtc->dev;
int total_planes = dev->mode_config.num_total_plane;
struct drm_plane_state **states;
@@ -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;
@@ -473,7 +494,7 @@ static int drm_atomic_helper_crtc_normalize_zpos(struct drm_crtc *crtc,
plane->base.id, plane->name, plane_state->zpos);
}
- sort(states, n, sizeof(*states), drm_atomic_state_zpos_cmp, NULL);
+ sort(states, n, sizeof(*states), drm_atomic_commit_zpos_cmp, NULL);
for (i = 0; i < n; i++) {
plane = states[i]->plane;
@@ -508,7 +529,7 @@ done:
* Zero for success or -errno
*/
int drm_atomic_normalize_zpos(struct drm_device *dev,
- struct drm_atomic_state *state)
+ struct drm_atomic_commit *state)
{
struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
@@ -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);