All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Sprite plane gamma on/off property.
@ 2014-02-27 16:38 Bob Paauwe
  2014-02-27 16:38 ` [PATCH 1/2] Add set_property stub for plane properties Bob Paauwe
  2014-02-27 16:38 ` [PATCH 2/2] Add gamma property to sprite planes Bob Paauwe
  0 siblings, 2 replies; 3+ messages in thread
From: Bob Paauwe @ 2014-02-27 16:38 UTC (permalink / raw)
  To: intel-gfx

Add the infrastructure to support plane properties in the intel_plane
structure. Then use that infrastructure to add a property that controls
wether gamma correction is applied to a plane.

The default value is to enable gamma correction on the planes to match the
previous behavior.

Bob Paauwe (2):
  Add set_property stub for plane properties.
  Add gamma property to sprite planes.

 drivers/gpu/drm/i915/i915_drv.h     |  5 +++++
 drivers/gpu/drm/i915/intel_drv.h    |  6 ++++++
 drivers/gpu/drm/i915/intel_sprite.c | 37 +++++++++++++++++++++++++++++++------
 3 files changed, 42 insertions(+), 6 deletions(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] Add set_property stub for plane properties.
  2014-02-27 16:38 [PATCH 0/2] Sprite plane gamma on/off property Bob Paauwe
@ 2014-02-27 16:38 ` Bob Paauwe
  2014-02-27 16:38 ` [PATCH 2/2] Add gamma property to sprite planes Bob Paauwe
  1 sibling, 0 replies; 3+ messages in thread
From: Bob Paauwe @ 2014-02-27 16:38 UTC (permalink / raw)
  To: intel-gfx

Hook up the set_property function pointer to a stub function. The function
will be populated once actual plane properties are created.

Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
---
 drivers/gpu/drm/i915/intel_sprite.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index 336ae6c..f9f81dd 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -949,6 +949,14 @@ static void intel_destroy_plane(struct drm_plane *plane)
 	kfree(intel_plane);
 }
 
+static int intel_set_property(struct drm_plane *plane,
+				struct drm_property *property,
+				uint64_t value)
+{
+	return 0;
+}
+
+
 int intel_sprite_set_colorkey(struct drm_device *dev, void *data,
 			      struct drm_file *file_priv)
 {
@@ -1037,6 +1045,7 @@ static const struct drm_plane_funcs intel_plane_funcs = {
 	.update_plane = intel_update_plane,
 	.disable_plane = intel_disable_plane,
 	.destroy = intel_destroy_plane,
+	.set_property = intel_set_property,
 };
 
 static uint32_t ilk_plane_formats[] = {
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Add gamma property to sprite planes.
  2014-02-27 16:38 [PATCH 0/2] Sprite plane gamma on/off property Bob Paauwe
  2014-02-27 16:38 ` [PATCH 1/2] Add set_property stub for plane properties Bob Paauwe
@ 2014-02-27 16:38 ` Bob Paauwe
  1 sibling, 0 replies; 3+ messages in thread
From: Bob Paauwe @ 2014-02-27 16:38 UTC (permalink / raw)
  To: intel-gfx

Add a gamma property to sprite planes that enables/disables the
gamma ramp on sprite planes. By default the gamma ramp is enabled to
match the prior behavior.

v2: Rename property variable from "gamma" to "gamma_property" for clarity
    Change property type from range to enum (Matt)
    Add enum definitions for sprite gamma enable/disable
v3: Rename property name to "Sprite Gamma Enabled" (Matt)

Signed-off-by: Bob Paauwe <bob.j.paauwe@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h     |  5 +++++
 drivers/gpu/drm/i915/intel_drv.h    |  6 ++++++
 drivers/gpu/drm/i915/intel_sprite.c | 28 ++++++++++++++++++++++------
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8c64831..69934be 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2671,6 +2671,11 @@ void vlv_force_wake_put(struct drm_i915_private *dev_priv, int fw_engine);
 #define INTEL_BROADCAST_RGB_FULL 1
 #define INTEL_BROADCAST_RGB_LIMITED 2
 
+/* Sprite plane "Sprite Gamma" property */
+#define INTEL_GAMMA_DISABLED 0
+#define INTEL_GAMMA_ENABLED 1
+
+
 static inline uint32_t i915_vgacntrl_reg(struct drm_device *dev)
 {
 	if (HAS_PCH_SPLIT(dev))
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a4ffc02..7d72c49 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -406,6 +406,12 @@ struct intel_plane {
 	uint32_t src_x, src_y;
 	uint32_t src_w, src_h;
 
+	struct {
+		struct drm_property *gamma_property;
+	} properties;
+
+	bool gamma;
+
 	/* Since we need to change the watermarks before/after
 	 * enabling/disabling the planes, we need to store the parameters here
 	 * as the other pieces of the struct may not reflect the values we want
diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
index f9f81dd..d2173da 100644
--- a/drivers/gpu/drm/i915/intel_sprite.c
+++ b/drivers/gpu/drm/i915/intel_sprite.c
@@ -37,6 +37,7 @@
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 
+
 static void
 vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
 		 struct drm_framebuffer *fb,
@@ -106,9 +107,8 @@ vlv_update_plane(struct drm_plane *dplane, struct drm_crtc *crtc,
 
 	/*
 	 * Enable gamma to match primary/cursor plane behaviour.
-	 * FIXME should be user controllable via propertiesa.
 	 */
-	sprctl |= SP_GAMMA_ENABLE;
+	sprctl |= (intel_plane->gamma) ? SP_GAMMA_ENABLE : 0;
 
 	if (obj->tiling_mode != I915_TILING_NONE)
 		sprctl |= SP_TILED;
@@ -264,9 +264,8 @@ ivb_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	/*
 	 * Enable gamma to match primary/cursor plane behaviour.
-	 * FIXME should be user controllable via propertiesa.
 	 */
-	sprctl |= SPRITE_GAMMA_ENABLE;
+	sprctl |= (intel_plane->gamma) ? SPRITE_GAMMA_ENABLE : 0;
 
 	if (obj->tiling_mode != I915_TILING_NONE)
 		sprctl |= SPRITE_TILED;
@@ -448,9 +447,8 @@ ilk_update_plane(struct drm_plane *plane, struct drm_crtc *crtc,
 
 	/*
 	 * Enable gamma to match primary/cursor plane behaviour.
-	 * FIXME should be user controllable via propertiesa.
 	 */
-	dvscntr |= DVS_GAMMA_ENABLE;
+	dvscntr |= (intel_plane->gamma) ? DVS_GAMMA_ENABLE : 0;
 
 	if (obj->tiling_mode != I915_TILING_NONE)
 		dvscntr |= DVS_TILED;
@@ -953,6 +951,11 @@ static int intel_set_property(struct drm_plane *plane,
 				struct drm_property *property,
 				uint64_t value)
 {
+	struct intel_plane *intel_plane = to_intel_plane(plane);
+
+	if (property == intel_plane->properties.gamma_property)
+		intel_plane->gamma = (bool)value;
+
 	return 0;
 }
 
@@ -1079,6 +1082,11 @@ static uint32_t vlv_plane_formats[] = {
 	DRM_FORMAT_VYUY,
 };
 
+static const struct drm_prop_enum_list intel_gamma_enum_list[] = {
+	{ INTEL_GAMMA_DISABLED, "Off" },
+	{ INTEL_GAMMA_ENABLED, "On" }
+};
+
 int
 intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 {
@@ -1158,5 +1166,13 @@ intel_plane_init(struct drm_device *dev, enum pipe pipe, int plane)
 	if (ret)
 		kfree(intel_plane);
 
+	/* Initialize the plane properties */
+	intel_plane->properties.gamma_property =
+		drm_property_create_enum(dev, 0, "Sprite Gamma Enabled",
+		intel_gamma_enum_list, ARRAY_SIZE(intel_gamma_enum_list));
+	intel_plane->gamma = true;
+	drm_object_attach_property(&intel_plane->base.base,
+		intel_plane->properties.gamma_property, intel_plane->gamma);
+
 	return ret;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-27 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-27 16:38 [PATCH 0/2] Sprite plane gamma on/off property Bob Paauwe
2014-02-27 16:38 ` [PATCH 1/2] Add set_property stub for plane properties Bob Paauwe
2014-02-27 16:38 ` [PATCH 2/2] Add gamma property to sprite planes Bob Paauwe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.