[Intel-gfx] [PATCH v8 00/25] Color Management for DRM framework
Shashank Sharma
shashank.sharma at intel.com
Thu Dec 3 03:36:36 PST 2015
This patch set adds Color Manager implementation in DRM layer. Color Manager
is an extension in DRM framework to support color correction/enhancement.
Various Hardware platforms can support several color correction capabilities.
Color Manager provides abstraction of these capabilities and allows a user
space UI agent to correct/enhance the display using the DRM property interface.
How is this going to work?
==========================
1. This patch series adds a few new properties in DRM framework. These properties are:
a. color_capabilities property (type blob)
b. Color Transformation Matrix property for corrections like CSC (called CTM, type blob)
c. Palette correction properties for corrections like gamma fixup (called palette_correction, type blob)
2. Also, this patch series adds few structures to indicate specifications of a property like size, no_of_samples for correction etc.
3. These properties are present in mode_config.
4. When the platform's display driver loads, it fills up the values of color_capabilities property using the standard structures (added in step 2).
For example, Intel's I915 driver adds following color correction capabilities:
a. gamma correction capability as palette correction property, with 257 correction coefficients and a max/min value
b. csc correction capability as CTM correction property, with 3x3 transformation matrix values and max/min values
5. Now when userspace comes up, it queries the platform's color capabilities by doing a get_property() on color_capabilities DRM property
6. Reading the blob, the userspace understands the color capabilities of the platform.
For example, userspace will understand it can support:
a. palette_correction with 257 coefficients
b. CSC correction with 3x3 = 9 values
7. To set color correction values, userspace:
a. creates a blob using the create_blob_ioctl in standard palette_correction structure format, with the correction values
b. calls the set_property_ioctl with the blob_id as value for the property
8. Driver refers to the blob, gets the correction values and applies the correction in HW.
9. To get currently applied color correction values, userspace:
a. calls a get_property_ioctl on that color property
b. gets the blob_id for the currently applied correction from DRM infrastructure
c. gets the blob using get_blob_ioctl and hence the currently applied values
That's all! :)
About the patch series:
=======================
The patch series first adds the color management support in DRM layer.
Then it adds the color management framework in I915 layer.
After that, it implements platform specific core color correction functios.
Intel color manager registers color correction with DRM color manager in this way:
- CSC transformation is registered as CTM DRM property
- Gamma correction is registered as palette_after_ctm DRM property
- Degamma correction is registered as palette_before_ctm DRM property
Our thanks to all the reviewers who have given valuable comments in terms of design
and implementation to our previous sets of patches. Special mention of thanks should
go to Matt Roper for all his inputs/suggestions in implementation of this module,
using DRM atomic CRTC commit path.
V2: Worked on review comments from Matt, Jim, Thierry, Rob.
V3: Worked on review comments from Matt, Jim, Rob:
- Jim, Rob:
========
Re-arranged the whole patch series in the sequence of features, currently:
First 5 patches add color management support in DRM layer
Next 7 patches add Intel color management framework in I915 driver
Next 5 patches add color correction for CHV (gamma, degamma and CSC)
Next 2 patches enable color management, by attaching the properties to CRTC(Matt)
Next 4 patches add color correction for BDW (gamma, degamma)
- Matt:
=====
Patch 3: Added refernce/unreference for blob
Patch 7: return -EINVAL and added debug message
Patch 8: check for valid blob, from create blob
moved call to intel_crtc_attach_color_prop in the end of full implementation (CHV)
Patch 9: DRM_ERROR->DRM_DEBUG for NULL blob case
Patch 13: Added static for internal functions
Patch 20-24: renamed gen9_* functions to bdw_*
Added new variables in device_info structure num_samples_after_ctm and num_samples_before_ctm
Added new function in patch 8 to load capabilities based on device_info across all platforms
V4: Worked on review comments from Daniel, Matt, Rob, Jim
- Rob, Jim:
=========
Patch 15, 22: Prepare CSC coeff properly(chv, bdw).
Patch 13, 20: Gamma max should be (1<<24) -1(chv, bdw).
- Daniel, Matt:
=============
Patch 2: Create separate properties to query color capabilities, not a single blob.
Patch 4, 5, 10: Add set/get property interface in DRM layer, not in I915 layer.
V5: Addressed review comments from Emil, Rob.
-Emil:
======
Patch 3: Fixed changes from patch 2, which were merged in patch 3
Patch 4: Added static for drm_atomic_crtc_set_blob
Patch 13: Removed unnecessary initialization for various functions
Patch 14: Removed unnecessary initialization for variables
Checked for overflow for length
Dropped variable ret, using direct returns instead
Patch 15: Fixed type of return value of function chv_prepare_csc_coeff
Fixed the type of variable csc_s3_12_format
Changed the looping approach to write csc coefficients
Patch 16: Fixed typo in intel_drv.h (intel_color_manager.c)
Patch 19: Made bdw_write_12_bit_gamma_precision function static
Fixed alignment problems with debug message
Patch 21: Fixed indentation of debug message
Patch 22: Removed change which belonged to another patch
Made function bdw_set_csc static
-Rob:
======
Patch 19: Clipped -> Clamped
SET_BITS in 10bit gamma was taking red_fraction variable for all channels, fixed that.
Added check for MAX values in 12_bit_gamma function
Added new function for 8_bit_gamma mode (legacy) with MAX value checks
Patch 20: Fixed commit message (BDW degamma values was mentioned as 65 in it).
Patch 21: Removed unused length variable
Moved mode variable closer to a place where its being used
Removed cast for correction_values
DeGamma -> degamma
V6: Addressed review comments from Emil, Daniel, Rob and Jim
-Emil:
======
Patch 10: Put definition and prototype in the same patch for function
intel_attach_color_properties_to_crtc
Patch 19: Removed extra line before every case() of switch()
Patch 13: Replace if..else in function chv_set_degamma with switch case to maintain consistency
Patch 21: Replace if..else in function bdw_set_degamma with switch case to maintain consistency
-Daniel/Rob:
=============
Removed num_samples from overall palette implementation, use blob_size/sizeof(struct drm_r32g32b32)
-Jim:
=====
Patch 13: Replace if..else in function chv_set_degamma with switch case
Patch 21: Replace if..else in function bdw_set_degamma with switch case
V7: Worked on Gary's suggestion to optimize the commit calls, applying color correction only
when there is a change in color property status (not every commit). Added patch 24 and 25 in
series, for the same.
V8:
-Daniel:
=======
Patch 1,2,4,8: Fixed make htmldoc warnings, for missing description of new variables
added in drm_crtc_state and mode_config.
-Rebase:
=======
Changed few variables from u32->i915_reg_t to align with changes
in I915_READ and I915_WRITE.
Shashank Sharma (25):
drm: Create Color Management DRM properties
drm: Create Color Management query properties
drm: Add color correction blobs in CRTC state
drm: Add set property support for color manager
drm: Add get property support for color manager
drm: Add drm structures for palette color property
drm: Add structure for CTM color property
drm: Add color correction state flag
drm/i915: Add set property interface for CRTC
drm/i915: Create color management files
drm/i915: Register color correction capabilities
drm/i915: CHV: Load gamma color correction values
drm/i915: CHV: Load degamma color correction values
drm/i915: CHV: Pipe level Gamma correction
drm/i915: CHV: Pipe level degamma correction
drm/i915: CHV: Pipe level CSC correction
drm/i915: Commit color correction to CRTC
drm/i915: Attach color properties to CRTC
drm/i915: BDW: Load gamma correction values
drm/i915: BDW: Pipe level Gamma correction
drm/i915: BDW: Load degamma correction values
drm/i915: BDW: Pipe level degamma correction
drm/i915: BDW: Pipe level CSC correction
drm/i915: disable plane gamma
drm/i915: Commit color correction only when needed
drivers/gpu/drm/drm_atomic.c | 67 ++-
drivers/gpu/drm/drm_atomic_helper.c | 9 +
drivers/gpu/drm/drm_crtc.c | 32 ++
drivers/gpu/drm/i915/Makefile | 3 +-
drivers/gpu/drm/i915/i915_drv.c | 17 +
drivers/gpu/drm/i915/i915_drv.h | 2 +
drivers/gpu/drm/i915/i915_reg.h | 58 +-
drivers/gpu/drm/i915/intel_color_manager.c | 863 +++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_color_manager.h | 111 ++++
drivers/gpu/drm/i915/intel_display.c | 6 +-
drivers/gpu/drm/i915/intel_drv.h | 5 +
drivers/gpu/drm/i915/intel_sprite.c | 7 +-
include/drm/drm_crtc.h | 24 +
include/uapi/drm/drm.h | 30 +
14 files changed, 1225 insertions(+), 9 deletions(-)
create mode 100644 drivers/gpu/drm/i915/intel_color_manager.c
create mode 100644 drivers/gpu/drm/i915/intel_color_manager.h
--
1.9.1
More information about the Intel-gfx
mailing list