Sprite plane gamma on/off property.
Subsystems (2)
cover Sprite plane gamma on/off property.
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(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 Add set_property stub for plane properties.
Hook up the set_property function pointer to a stub function. The function will be populated once actual plane properties are created.
--- drivers/gpu/drm/i915/intel_sprite.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/i915/intel_sprite.c +9 -0
@@ -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[] = {
Signature · 1 line
1.8.3.1
PATCH 2/2 Add gamma property to sprite planes.
In reply to Bob PaauweAdd 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)
--- 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(-)
drivers/gpu/drm/i915/i915_drv.h +5 -0
@@ -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))
drivers/gpu/drm/i915/intel_drv.h +6 -0
@@ -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
drivers/gpu/drm/i915/intel_sprite.c +22 -6
@@ -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; }
Signature · 1 line
1.8.3.1