Color Management for DRM
Subsystems (3)
cover Color Management for DRM
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.
Shashank Sharma (22):
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 to set/get a CTM color property 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
drivers/gpu/drm/drm_atomic.c | 61 ++- drivers/gpu/drm/drm_atomic_helper.c | 12 + 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 | 825 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 111 ++++ drivers/gpu/drm/i915/intel_display.c | 4 + drivers/gpu/drm/i915/intel_drv.h | 5 + include/drm/drm_crtc.h | 14 + include/uapi/drm/drm.h | 36 ++ 13 files changed, 1175 insertions(+), 5 deletions(-) create mode 100644 drivers/gpu/drm/i915/intel_color_manager.c create mode 100644 drivers/gpu/drm/i915/intel_color_manager.h
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/22 drm: Create Color Management DRM properties
Color Management is an extension to DRM framework. It allows abstraction of hardware color correction and enhancement capabilities by virtue of DRM properties.
There are two major types of color correction supported by DRM color manager:
- CTM: color transformation matrix, properties where a correction matrix is used for color correction.
- Palette correction: Where direct LUT values are sent to be applied on a color palette.
This patch initializes color management framework by:
1. Introducing new pointers in DRM mode_config structure to carry CTM and Palette color correction properties.
2. Creating these DRM properties in DRM standard properties creation sequence.
--- drivers/gpu/drm/drm_crtc.c | 19 +++++++++++++++++++ include/drm/drm_crtc.h | 5 +++++ 2 files changed, 24 insertions(+)
drivers/gpu/drm/drm_crtc.c +19 -0
@@ -1472,6 +1472,25 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)return -ENOMEM ; dev->mode_config.prop_mode_id = prop; +/* Color Management properties */ + prop =drm_property_create (dev, +DRM_MODE_PROP_BLOB ,"PALETTE_AFTER_CTM" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.cm_palette_after_ctm_property = prop; + + prop =drm_property_create (dev, +DRM_MODE_PROP_BLOB ,"PALETTE_BEFORE_CTM" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.cm_palette_before_ctm_property = prop; + + prop =drm_property_create (dev, +DRM_MODE_PROP_BLOB ,"CTM" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.cm_ctm_property = prop; +return 0 ; }
include/drm/drm_crtc.h +5 -0
@@ -1146,6 +1146,11 @@ struct drm_mode_config {struct drm_property *suggested_x_property;struct drm_property *suggested_y_property; +/* Color Management Properties */ +struct drm_property *cm_palette_before_ctm_property; +struct drm_property *cm_palette_after_ctm_property; +struct drm_property *cm_ctm_property; +/* dumb ioctl parameters */ uint32_t preferred_depth, prefer_shadow;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botRe: [PATCH 01/22] drm: Create Color Management DRM properties
reproduce: make htmldocs
Hi Shashank,
[auto build test WARNING on next-20151009 -- if it's inappropriate base, please ignore]
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' include/drm/drm_crtc.h:310: warning: No description found for parameter 'mode_blob' include/drm/drm_crtc.h:742: warning: No description found for parameter 'tile_blob_ptr' include/drm/drm_crtc.h:781: warning: No description found for parameter 'rotation' include/drm/drm_crtc.h:877: warning: No description found for parameter 'mutex' include/drm/drm_crtc.h:877: warning: No description found for parameter 'helper_private' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tile_idr' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'delayed_event' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'edid_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'dpms_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'path_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tile_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'plane_type_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'rotation_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_src_x' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_src_y' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_src_w' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_src_h' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_crtc_x' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_crtc_y' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_crtc_w' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_crtc_h' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_fb_id' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_crtc_id' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_active' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'prop_mode_id' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'dvi_i_subconnector_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'dvi_i_select_subconnector_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_subconnector_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_select_subconnector_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_mode_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_left_margin_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_right_margin_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_top_margin_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_bottom_margin_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_brightness_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_contrast_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_flicker_reduction_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_overscan_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_saturation_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'tv_hue_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'scaling_mode_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'aspect_ratio_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'dirty_info_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'suggested_x_property' include/drm/drm_crtc.h:1167: warning: No description found for parameter 'suggested_y_property'
>> include/drm/drm_crtc.h:1167: warning: No description found for parameter 'cm_palette_before_ctm_property' >> include/drm/drm_crtc.h:1167: warning: No description found for parameter 'cm_palette_after_ctm_property' >> include/drm/drm_crtc.h:1167: warning: No description found for parameter 'cm_ctm_property'
include/drm/drm_crtc.h:1167: warning: No description found for parameter 'allow_fb_modifiers' include/drm/drm_fb_helper.h:148: warning: No description found for parameter 'connector_info' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_nack_count' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_defer_count' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' include/drm/drm_dp_mst_helper.h:97: warning: No description found for parameter 'cached_edid' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'max_dpcd_transaction_bytes' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'sink_count' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'avail_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_pbn' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'qlock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_downq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_upq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_down_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_up_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'proposed_vcpis' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payloads' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'vcpi_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_waitq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_list' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_work' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' drivers/gpu/drm/drm_irq.c:173: warning: No description found for parameter 'flags' include/drm/drmP.h:164: warning: No description found for parameter 'fmt'
include/drm/drmP.h:180: warning: No description found for parameter 'fmt'
include/drm/drmP.h:198: warning: No description found for parameter 'fmt'
include/drm/drmP.h:238: warning: No description found for parameter 'dev'
include/drm/drmP.h:238: warning: No description found for parameter 'data'
include/drm/drmP.h:238: warning: No description found for parameter 'file_priv'
include/drm/drmP.h:271: warning: No description found for parameter 'ioctl'
include/drm/drmP.h:271: warning: No description found for parameter '_func'
include/drm/drmP.h:271: warning: No description found for parameter '_flags'
include/drm/drmP.h:344: warning: cannot understand function prototype: 'struct drm_lock_data ' include/drm/drmP.h:397: warning: cannot understand function prototype: 'struct drm_driver ' include/drm/drmP.h:647: warning: cannot understand function prototype: 'struct drm_info_list ' include/drm/drmP.h:657: warning: cannot understand function prototype: 'struct drm_info_node ' include/drm/drmP.h:667: warning: cannot understand function prototype: 'struct drm_minor ' include/drm/drmP.h:715: warning: cannot understand function prototype: 'struct drm_device ' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'args' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1194: warning: No description found for parameter 'rps' drivers/gpu/drm/i915/i915_gem.c:1400: warning: No description found for parameter 'req' drivers/gpu/drm/i915/i915_gem.c:1435: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:1435: warning: No description found for parameter 'readonly' drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'size' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'tiling_mode' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'fenced' drivers/gpu/drm/i915/i915_gem.c:1954: warning: Excess function parameter 'obj' description in 'i915_gem_get_gtt_alignment' drivers/gpu/drm/i915/i915_gem.c:2816: warning: No description found for parameter 'ring' drivers/gpu/drm/i915/i915_gem.c:2945: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:2995: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:2995: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:2995: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:2995: warning: Excess function parameter 'DRM_IOCTL_ARGS' description in 'i915_gem_wait_ioctl' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'vm' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'ggtt_view' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'alignment' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'flags' drivers/gpu/drm/i915/i915_gem.c:3599: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:3599: warning: No description found for parameter 'write' drivers/gpu/drm/i915/i915_gem.c:3891: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:3891: warning: No description found for parameter 'write' drivers/gpu/drm/i915/intel_lrc.c:871: warning: No description found for parameter 'params' drivers/gpu/drm/i915/intel_lrc.c:871: warning: Excess function parameter 'dev' description in 'intel_execlists_submission'
vim +/cm_palette_before_ctm_property +1167 include/drm/drm_crtc.h
9302c2fa Shashank Sharma 2015-10-10 1151 /* Color Management Properties */ 9302c2fa Shashank Sharma 2015-10-10 1152 struct drm_property *cm_palette_before_ctm_property; 9302c2fa Shashank Sharma 2015-10-10 1153 struct drm_property *cm_palette_after_ctm_property; 9302c2fa Shashank Sharma 2015-10-10 1154 struct drm_property *cm_ctm_property; 9302c2fa Shashank Sharma 2015-10-10 1155 019d96cb Dave Airlie 2011-09-29 1156 /* dumb ioctl parameters */ 019d96cb Dave Airlie 2011-09-29 1157 uint32_t preferred_depth, prefer_shadow; 62f2104f Keith Packard 2013-07-22 1158 62f2104f Keith Packard 2013-07-22 1159 /* whether async page flip is supported or not */ 62f2104f Keith Packard 2013-07-22 1160 bool async_page_flip; 8716ed4e Alex Deucher 2014-02-12 1161 e3eb3250 Rob Clark 2015-02-05 1162 /* whether the driver supports fb modifiers */ e3eb3250 Rob Clark 2015-02-05 1163 bool allow_fb_modifiers; e3eb3250 Rob Clark 2015-02-05 1164 8716ed4e Alex Deucher 2014-02-12 1165 /* cursor size */ 8716ed4e Alex Deucher 2014-02-12 1166 uint32_t cursor_width, cursor_height; f453ba04 Dave Airlie 2008-11-07 @1167 }; f453ba04 Dave Airlie 2008-11-07 1168 dd275956 Rob Clark 2014-11-25 1169 /** dd275956 Rob Clark 2014-11-25 1170 * drm_for_each_plane_mask - iterate over planes specified by bitmask dd275956 Rob Clark 2014-11-25 1171 * @plane: the loop cursor dd275956 Rob Clark 2014-11-25 1172 * @dev: the DRM device dd275956 Rob Clark 2014-11-25 1173 * @plane_mask: bitmask of plane indices dd275956 Rob Clark 2014-11-25 1174 * dd275956 Rob Clark 2014-11-25 1175 * Iterate over all planes specified by bitmask.
:::::: The code at line 1167 was first introduced by commit :::::: f453ba0460742ad027ae0c4c7d61e62817b3e7ef DRM: add mode setting support
:::::: TO: Dave Airlie <[email protected]>
:::::: CC: Dave Airlie <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/22 drm: Create Color Management query properties
In reply to Shashank SharmaDRM color management is written to extract the color correction capabilities of various platforms, and every platform can showcase its capabilities using the query properties.
Different hardwares can have different no of coefficients for palette correction. Also the correction can be applied after/before color transformation (CTM) unit in the display pipeline.
This patch adds two new read-only properties,
- cm_coeff_before_ctm_property: A platform driver should use this property to show supported no_of_coefficients for palette correction, which gets applied before ctm correction.
- cm_coeff_after_ctm_property: A platform driver should use this property to show supported no_of_coefficients for palette correction, which gets applied after ctm correction.
--- drivers/gpu/drm/drm_crtc.c | 13 +++++++++++++ include/drm/drm_crtc.h | 4 ++++ 2 files changed, 17 insertions(+)
drivers/gpu/drm/drm_crtc.c +13 -0
@@ -1491,6 +1491,19 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)return -ENOMEM ; dev->mode_config.cm_ctm_property = prop; +/* DRM properties to query color capabilities */ + prop =drm_property_create (dev,DRM_MODE_PROP_IMMUTABLE , +"COEFFICIENTS_BEFORE_CTM" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.cm_coeff_before_ctm_property = prop; + + prop =drm_property_create (dev,DRM_MODE_PROP_IMMUTABLE , +"COEFFICIENTS_AFTER_CTM" ,0 ); +if (!prop) +return -ENOMEM ; + dev->mode_config.cm_coeff_after_ctm_property = prop; +return 0 ; }
include/drm/drm_crtc.h +4 -0
@@ -1151,6 +1151,10 @@ struct drm_mode_config {struct drm_property *cm_palette_after_ctm_property;struct drm_property *cm_ctm_property; +/* Coor management capabilities query */ +struct drm_property *cm_coeff_before_ctm_property; +struct drm_property *cm_coeff_after_ctm_property; +/* dumb ioctl parameters */ uint32_t preferred_depth, prefer_shadow;
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
kbuild test robot
build botRe: [Intel-gfx] [PATCH 02/22] drm: Create Color Management query properties
reproduce: make htmldocs
Hi Shashank,
[auto build test WARNING on next-20151009 -- if it's inappropriate base, please ignore]
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' include/drm/drm_crtc.h:310: warning: No description found for parameter 'mode_blob' include/drm/drm_crtc.h:742: warning: No description found for parameter 'tile_blob_ptr' include/drm/drm_crtc.h:781: warning: No description found for parameter 'rotation' include/drm/drm_crtc.h:877: warning: No description found for parameter 'mutex' include/drm/drm_crtc.h:877: warning: No description found for parameter 'helper_private' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tile_idr' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'delayed_event' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'edid_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'dpms_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'path_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tile_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'plane_type_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'rotation_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_src_x' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_src_y' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_src_w' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_src_h' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_crtc_x' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_crtc_y' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_crtc_w' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_crtc_h' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_fb_id' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_crtc_id' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_active' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'prop_mode_id' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'dvi_i_subconnector_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'dvi_i_select_subconnector_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_subconnector_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_select_subconnector_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_mode_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_left_margin_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_right_margin_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_top_margin_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_bottom_margin_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_brightness_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_contrast_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_flicker_reduction_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_overscan_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_saturation_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'tv_hue_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'scaling_mode_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'aspect_ratio_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'dirty_info_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'suggested_x_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'suggested_y_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'cm_palette_before_ctm_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'cm_palette_after_ctm_property' include/drm/drm_crtc.h:1171: warning: No description found for parameter 'cm_ctm_property'
>> include/drm/drm_crtc.h:1171: warning: No description found for parameter 'cm_coeff_before_ctm_property' >> include/drm/drm_crtc.h:1171: warning: No description found for parameter 'cm_coeff_after_ctm_property'
include/drm/drm_crtc.h:1171: warning: No description found for parameter 'allow_fb_modifiers' include/drm/drm_fb_helper.h:148: warning: No description found for parameter 'connector_info' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_nack_count' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_defer_count' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' include/drm/drm_dp_mst_helper.h:97: warning: No description found for parameter 'cached_edid' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'max_dpcd_transaction_bytes' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'sink_count' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'avail_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_pbn' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'qlock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_downq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_upq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_down_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_up_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'proposed_vcpis' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payloads' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'vcpi_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_waitq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_list' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_work' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' drivers/gpu/drm/drm_irq.c:173: warning: No description found for parameter 'flags' include/drm/drmP.h:164: warning: No description found for parameter 'fmt'
include/drm/drmP.h:180: warning: No description found for parameter 'fmt'
include/drm/drmP.h:198: warning: No description found for parameter 'fmt'
include/drm/drmP.h:238: warning: No description found for parameter 'dev'
include/drm/drmP.h:238: warning: No description found for parameter 'data'
include/drm/drmP.h:238: warning: No description found for parameter 'file_priv'
include/drm/drmP.h:271: warning: No description found for parameter 'ioctl'
include/drm/drmP.h:271: warning: No description found for parameter '_func'
include/drm/drmP.h:271: warning: No description found for parameter '_flags'
include/drm/drmP.h:344: warning: cannot understand function prototype: 'struct drm_lock_data ' include/drm/drmP.h:397: warning: cannot understand function prototype: 'struct drm_driver ' include/drm/drmP.h:647: warning: cannot understand function prototype: 'struct drm_info_list ' include/drm/drmP.h:657: warning: cannot understand function prototype: 'struct drm_info_node ' include/drm/drmP.h:667: warning: cannot understand function prototype: 'struct drm_minor ' include/drm/drmP.h:715: warning: cannot understand function prototype: 'struct drm_device ' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:421: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:686: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'args' drivers/gpu/drm/i915/i915_gem.c:767: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1029: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1194: warning: No description found for parameter 'rps' drivers/gpu/drm/i915/i915_gem.c:1400: warning: No description found for parameter 'req' drivers/gpu/drm/i915/i915_gem.c:1435: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:1435: warning: No description found for parameter 'readonly' drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1558: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1621: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:1666: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'size' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'tiling_mode' drivers/gpu/drm/i915/i915_gem.c:1954: warning: No description found for parameter 'fenced' drivers/gpu/drm/i915/i915_gem.c:1954: warning: Excess function parameter 'obj' description in 'i915_gem_get_gtt_alignment' drivers/gpu/drm/i915/i915_gem.c:2816: warning: No description found for parameter 'ring' drivers/gpu/drm/i915/i915_gem.c:2945: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:2995: warning: No description found for parameter 'dev' drivers/gpu/drm/i915/i915_gem.c:2995: warning: No description found for parameter 'data' drivers/gpu/drm/i915/i915_gem.c:2995: warning: No description found for parameter 'file' drivers/gpu/drm/i915/i915_gem.c:2995: warning: Excess function parameter 'DRM_IOCTL_ARGS' description in 'i915_gem_wait_ioctl' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'vm' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'ggtt_view' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'alignment' drivers/gpu/drm/i915/i915_gem.c:3364: warning: No description found for parameter 'flags' drivers/gpu/drm/i915/i915_gem.c:3599: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:3599: warning: No description found for parameter 'write' drivers/gpu/drm/i915/i915_gem.c:3891: warning: No description found for parameter 'obj' drivers/gpu/drm/i915/i915_gem.c:3891: warning: No description found for parameter 'write' drivers/gpu/drm/i915/intel_lrc.c:871: warning: No description found for parameter 'params' drivers/gpu/drm/i915/intel_lrc.c:871: warning: Excess function parameter 'dev' description in 'intel_execlists_submission'
vim +/cm_coeff_before_ctm_property +1171 include/drm/drm_crtc.h
9302c2fa Shashank Sharma 2015-10-10 1155 e508eb9a Shashank Sharma 2015-10-10 1156 /* Coor management capabilities query */ e508eb9a Shashank Sharma 2015-10-10 1157 struct drm_property *cm_coeff_before_ctm_property; e508eb9a Shashank Sharma 2015-10-10 1158 struct drm_property *cm_coeff_after_ctm_property; e508eb9a Shashank Sharma 2015-10-10 1159 019d96cb Dave Airlie 2011-09-29 1160 /* dumb ioctl parameters */ 019d96cb Dave Airlie 2011-09-29 1161 uint32_t preferred_depth, prefer_shadow; 62f2104f Keith Packard 2013-07-22 1162 62f2104f Keith Packard 2013-07-22 1163 /* whether async page flip is supported or not */ 62f2104f Keith Packard 2013-07-22 1164 bool async_page_flip; 8716ed4e Alex Deucher 2014-02-12 1165 e3eb3250 Rob Clark 2015-02-05 1166 /* whether the driver supports fb modifiers */ e3eb3250 Rob Clark 2015-02-05 1167 bool allow_fb_modifiers; e3eb3250 Rob Clark 2015-02-05 1168 8716ed4e Alex Deucher 2014-02-12 1169 /* cursor size */ 8716ed4e Alex Deucher 2014-02-12 1170 uint32_t cursor_width, cursor_height; f453ba04 Dave Airlie 2008-11-07 @1171 }; f453ba04 Dave Airlie 2008-11-07 1172 dd275956 Rob Clark 2014-11-25 1173 /** dd275956 Rob Clark 2014-11-25 1174 * drm_for_each_plane_mask - iterate over planes specified by bitmask dd275956 Rob Clark 2014-11-25 1175 * @plane: the loop cursor dd275956 Rob Clark 2014-11-25 1176 * @dev: the DRM device dd275956 Rob Clark 2014-11-25 1177 * @plane_mask: bitmask of plane indices dd275956 Rob Clark 2014-11-25 1178 * dd275956 Rob Clark 2014-11-25 1179 * Iterate over all planes specified by bitmask.
:::::: The code at line 1171 was first introduced by commit :::::: f453ba0460742ad027ae0c4c7d61e62817b3e7ef DRM: add mode setting support
:::::: TO: Dave Airlie <[email protected]>
:::::: CC: Dave Airlie <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/22 drm: Add color correction blobs in CRTC state
In reply to Shashank SharmaThis patch adds new variables in CRTC state, to hold respective color correction blobs. These blobs will be required during the atomic commit for writing the color correction values in correction registers.
--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++++++++ include/drm/drm_crtc.h | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +12 -0
@@ -2193,6 +2193,12 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,if (state->mode_blob)drm_property_reference_blob (state->mode_blob); +if (state->ctm_blob) +drm_property_reference_blob (state->ctm_blob); +if (state->palette_after_ctm_blob) +drm_property_reference_blob (state->palette_after_ctm_blob); +if (state->palette_before_ctm_blob) +drm_property_reference_blob (state->palette_before_ctm_blob); state->mode_changed = false; state->active_changed = false; state->planes_changed = false;
@@ -2238,6 +2244,12 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, {if (state->mode_blob)drm_property_unreference_blob (state->mode_blob); +if (state->ctm_blob) +drm_property_unreference_blob (state->ctm_blob); +if (state->palette_after_ctm_blob) +drm_property_unreference_blob (state->palette_after_ctm_blob); +if (state->palette_before_ctm_blob) +drm_property_unreference_blob (state->palette_before_ctm_blob); }EXPORT_SYMBOL (__drm_atomic_helper_crtc_destroy_state);
include/drm/drm_crtc.h +6 -1
@@ -302,6 +302,11 @@ struct drm_crtc_state {/* blob property to expose current mode to atomic userspace */ struct drm_property_blob *mode_blob; +/* blob properties to hold the color properties' blobs */ +struct drm_property_blob *palette_before_ctm_blob; +struct drm_property_blob *palette_after_ctm_blob; +struct drm_property_blob *ctm_blob; +struct drm_pending_vblank_event *event;struct drm_atomic_state *state;
@@ -1151,7 +1156,7 @@ struct drm_mode_config {struct drm_property *cm_palette_after_ctm_property;struct drm_property *cm_ctm_property; -/* Coor management capabilities query */ +/* Color management capabilities query */ struct drm_property *cm_coeff_before_ctm_property;struct drm_property *cm_coeff_after_ctm_property;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botRe: [PATCH 03/22] drm: Add color correction blobs in CRTC state
reproduce: make htmldocs
Hi Shashank,
[auto build test WARNING on next-20151009 -- if it's inappropriate base, please ignore]
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' include/drm/drm_crtc.h:315: warning: No description found for parameter 'mode_blob'
>> include/drm/drm_crtc.h:315: warning: No description found for parameter 'palette_before_ctm_blob' >> include/drm/drm_crtc.h:315: warning: No description found for parameter 'palette_after_ctm_blob' >> include/drm/drm_crtc.h:315: warning: No description found for parameter 'ctm_blob'
include/drm/drm_crtc.h:747: warning: No description found for parameter 'tile_blob_ptr' include/drm/drm_crtc.h:786: warning: No description found for parameter 'rotation' include/drm/drm_crtc.h:882: warning: No description found for parameter 'mutex' include/drm/drm_crtc.h:882: warning: No description found for parameter 'helper_private' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tile_idr' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'delayed_event' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'edid_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dpms_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'path_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tile_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'plane_type_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'rotation_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_x' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_y' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_w' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_h' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_x' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_y' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_w' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_h' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_fb_id' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_id' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_active' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_mode_id' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dvi_i_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dvi_i_select_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_select_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_mode_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_left_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_right_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_top_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_bottom_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_brightness_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_contrast_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_flicker_reduction_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_overscan_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_saturation_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_hue_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'scaling_mode_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'aspect_ratio_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dirty_info_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'suggested_x_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'suggested_y_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_palette_before_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_palette_after_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_coeff_before_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_coeff_after_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'allow_fb_modifiers' include/drm/drm_fb_helper.h:148: warning: No description found for parameter 'connector_info' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_nack_count' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_defer_count' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' include/drm/drm_dp_mst_helper.h:97: warning: No description found for parameter 'cached_edid' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'max_dpcd_transaction_bytes' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'sink_count' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'avail_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_pbn' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'qlock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_downq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_upq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_down_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_up_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'proposed_vcpis' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payloads' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'vcpi_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_waitq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_list' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_work' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' drivers/gpu/drm/drm_irq.c:173: warning: No description found for parameter 'flags' include/drm/drmP.h:164: warning: No description found for parameter 'fmt' include/drm/drmP.h:180: warning: No description found for parameter 'fmt' include/drm/drmP.h:198: warning: No description found for parameter 'fmt' include/drm/drmP.h:238: warning: No description found for parameter 'dev' include/drm/drmP.h:238: warning: No description found for parameter 'data' include/drm/drmP.h:238: warning: No description found for parameter 'file_priv' include/drm/drmP.h:271: warning: No description found for parameter 'ioctl' include/drm/drmP.h:271: warning: No description found for parameter '_func' include/drm/drmP.h:271: warning: No description found for parameter '_flags' include/drm/drmP.h:344: warning: cannot understand function prototype: 'struct drm_lock_data ' include/drm/drmP.h:397: warning: cannot understand function prototype: 'struct drm_driver ' include/drm/drmP.h:647: warning: cannot understand function prototype: 'struct drm_info_list ' include/drm/drmP.h:657: warning: cannot understand function prototype: 'struct drm_info_node ' include/drm/drmP.h:667: warning: cannot understand function prototype: 'struct drm_minor ' include/drm/drmP.h:715: warning: cannot understand function prototype: 'struct drm_device ' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged'
vim +/palette_before_ctm_blob +315 include/drm/drm_crtc.h
2f324b42 Daniel Vetter 2014-10-29 299 /* adjusted_mode: for use by helpers and drivers */ 2f324b42 Daniel Vetter 2014-10-29 300 struct drm_display_mode adjusted_mode; 2f324b42 Daniel Vetter 2014-10-29 301 144ecb97 Daniel Vetter 2014-10-27 302 struct drm_display_mode mode; 144ecb97 Daniel Vetter 2014-10-27 303 99cf4a29 Daniel Stone 2015-05-25 304 /* blob property to expose current mode to atomic userspace */ 99cf4a29 Daniel Stone 2015-05-25 305 struct drm_property_blob *mode_blob; 99cf4a29 Daniel Stone 2015-05-25 306 076c6f91 Shashank Sharma 2015-10-10 307 /* blob properties to hold the color properties' blobs */ 076c6f91 Shashank Sharma 2015-10-10 308 struct drm_property_blob *palette_before_ctm_blob; 076c6f91 Shashank Sharma 2015-10-10 309 struct drm_property_blob *palette_after_ctm_blob; 076c6f91 Shashank Sharma 2015-10-10 310 struct drm_property_blob *ctm_blob; 076c6f91 Shashank Sharma 2015-10-10 311 144ecb97 Daniel Vetter 2014-10-27 312 struct drm_pending_vblank_event *event; 144ecb97 Daniel Vetter 2014-10-27 313 144ecb97 Daniel Vetter 2014-10-27 314 struct drm_atomic_state *state; 144ecb97 Daniel Vetter 2014-10-27 @315 }; f453ba04 Dave Airlie 2008-11-07 316 f453ba04 Dave Airlie 2008-11-07 317 /** 3bf0401c Daniel Vetter 2014-10-27 318 * struct drm_crtc_funcs - control CRTCs for a given device f453ba04 Dave Airlie 2008-11-07 319 * @save: save CRTC state 3b02ab88 Laurent Pinchart 2012-05-17 320 * @restore: restore CRTC state 715f59cc Christopher Harvey 2013-04-05 321 * @reset: reset CRTC after state has been invalidated (e.g. resume) 3b02ab88 Laurent Pinchart 2012-05-17 322 * @cursor_set: setup the cursor 2c0c33d4 Daniel Vetter 2014-10-27 323 * @cursor_set2: setup the cursor with hotspot, superseeds @cursor_set if set
:::::: The code at line 315 was first introduced by commit
:::::: 144ecb97cd57d2a61cc455730a3337e413499cae drm: Add atomic driver interface definitions for objects
:::::: TO: Daniel Vetter <[email protected]>
:::::: CC: Daniel Vetter <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/22] drm: Add color correction blobs in CRTC state
In reply to Shashank SharmaHi Shashank,
Quoted 58 lines · Shashank Sharma
This patch adds new variables in CRTC state, to hold respective color correction blobs. These blobs will be required during the atomic commit for writing the color correction values in correction registers.
Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++++++++ include/drm/drm_crtc.h | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic_helper.c +12
-0@@ -2193,6 +2193,12 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,if (state->mode_blob)drm_property_reference_blob (state->mode_blob); +if (state->ctm_blob) +drm_property_reference_blob (state->ctm_blob); +if (state->palette_after_ctm_blob) +drm_property_reference_blob (state->palette_after_ctm_blob); +if (state->palette_before_ctm_blob) +drm_property_reference_blob (state->palette_before_ctm_blob); state->mode_changed = false; state->active_changed = false; state->planes_changed = false;@@ -2238,6 +2244,12 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, {if (state->mode_blob)drm_property_unreference_blob (state->mode_blob); +if (state->ctm_blob) +drm_property_unreference_blob (state->ctm_blob); +if (state->palette_after_ctm_blob) +drm_property_unreference_blob (state->palette_after_ctm_blob); +if (state->palette_before_ctm_blob) +drm_property_unreference_blob (state->palette_before_ctm_blob); }EXPORT_SYMBOL (__drm_atomic_helper_crtc_destroy_state);include/drm/drm_crtc.h +5
-0@@ -302,6 +302,11 @@ struct drm_crtc_state {/* blob property to expose current mode to atomic userspace */ struct drm_property_blob *mode_blob; +/* blob properties to hold the color properties' blobs */ +struct drm_property_blob *palette_before_ctm_blob; +struct drm_property_blob *palette_after_ctm_blob; +struct drm_property_blob *ctm_blob; +struct drm_pending_vblank_event *event;struct drm_atomic_state *state;
include/drm/drm_crtc.h struct drm_mode_config { · line 1159
Quoted 5 lines
include/drm/drm_crtc.h +1
-1@@ -1151,7 +1156,7 @@ struct drm_mode_config {struct drm_property *cm_palette_after_ctm_property;struct drm_property *cm_ctm_property; -/* Coor management capabilities query */ +/* Color management capabilities query */
This should be part of the previous patch.
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 03/22] drm: Add color correction blobs in CRTC state
Thanks for the review comments, Emil.
Regards
Shashank
Quoted 59 lines · Emil Velikov
Hi Shashank,
Quoted 56 lines · Shashank Sharma
This patch adds new variables in CRTC state, to hold respective color correction blobs. These blobs will be required during the atomic commit for writing the color correction values in correction registers.
Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++++++++ include/drm/drm_crtc.h | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_atomic_helper.c +12
-0@@ -2193,6 +2193,12 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc,if (state->mode_blob)drm_property_reference_blob (state->mode_blob); +if (state->ctm_blob) +drm_property_reference_blob (state->ctm_blob); +if (state->palette_after_ctm_blob) +drm_property_reference_blob (state->palette_after_ctm_blob); +if (state->palette_before_ctm_blob) +drm_property_reference_blob (state->palette_before_ctm_blob); state->mode_changed = false; state->active_changed = false; state->planes_changed = false;@@ -2238,6 +2244,12 @@ void __drm_atomic_helper_crtc_destroy_state(struct drm_crtc *crtc, {if (state->mode_blob)drm_property_unreference_blob (state->mode_blob); +if (state->ctm_blob) +drm_property_unreference_blob (state->ctm_blob); +if (state->palette_after_ctm_blob) +drm_property_unreference_blob (state->palette_after_ctm_blob); +if (state->palette_before_ctm_blob) +drm_property_unreference_blob (state->palette_before_ctm_blob); }EXPORT_SYMBOL (__drm_atomic_helper_crtc_destroy_state);include/drm/drm_crtc.h +5
-0@@ -302,6 +302,11 @@ struct drm_crtc_state {/* blob property to expose current mode to atomic userspace */ struct drm_property_blob *mode_blob; +/* blob properties to hold the color properties' blobs */ +struct drm_property_blob *palette_before_ctm_blob; +struct drm_property_blob *palette_after_ctm_blob; +struct drm_property_blob *ctm_blob; +struct drm_pending_vblank_event *event;
Quoted 9 lines
include/drm/drm_crtc.h struct drm_mode_config { · line 1159
Quoted 7 lines
include/drm/drm_crtc.h +1
-1struct drm_atomic_state *state;@@ -1151,7 +1156,7 @@ struct drm_mode_config {struct drm_property *cm_palette_after_ctm_property;struct drm_property *cm_ctm_property; -/* Coor management capabilities query */ +/* Color management capabilities query */ This should be part of the previous patch.
Agree, will do it.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/22 drm: Add set property support for color manager
In reply to Shashank SharmaAs per DRM color manager design, if a userspace wants to set a correction blob, it prepares it and sends the blob_id to kernel via set_property call. DRM framework takes this blob_id, gets the blob, and saves it in the CRTC state, so that, during the atomic_commit, the color correction values from the blob can referred and applied on display controller registers.
This patch adds this set_property support for color correction blobs in drm framework.
--- drivers/gpu/drm/drm_atomic.c | 53 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_atomic.c +51 -2
@@ -390,6 +390,38 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,EXPORT_SYMBOL (drm_atomic_set_mode_prop_for_crtc);/** +* drm_atomic_crtc_set_blob - find and set a blob +* @state_blob: reference pointer to the color blob in the crtc_state +* @blob_id: blob_id coming from set_property() call +* +* Set a color correction blob (originating from a set blob property) on the +* desired CRTC state. This function will take reference of the blob property +* in the CRTC state, finds the blob based on blob_id (which comes from +* set_property call) and set the blob at the proper place. +* +* RETURNS: +* Zero on success, error code on failure. +*/ +int drm_atomic_crtc_set_blob (struct drm_device *dev, +struct drm_property_blob **state_blob,uint32_t blob_id) +{ +struct drm_property_blob *blob; + + blob =drm_property_lookup_blob (dev, blob_id); +if (!blob) { +DRM_DEBUG_KMS ("Invalid Blob ID\n" ); +return -EINVAL ; + } + +if (*state_blob) +drm_property_unreference_blob (*state_blob); + +/* Attach the blob to be committed in state */ + *state_blob = blob; +return 0 ; +} + +/** * drm_atomic_crtc_set_property - set property on CRTC * @crtc: the drm CRTC to set a property on * @state: the state object to update with the new property value
@@ -422,8 +454,25 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc,if (mode)drm_property_unreference_blob (mode);return ret; - } -else if (crtc->funcs->atomic_set_property) + }else if (property == config->cm_palette_after_ctm_property) { + ret =drm_atomic_crtc_set_blob (dev, + &state->palette_after_ctm_blob, val); +if (ret) +DRM_ERROR ("Failed to load blob palette_after_ctm\n" ); +return ret; + }else if (property == config->cm_palette_before_ctm_property) { + ret =drm_atomic_crtc_set_blob (dev, + &state->palette_before_ctm_blob, val); +if (ret) +DRM_ERROR ("Failed to load blob palette_before_ctm\n" ); +return ret; + }else if (property == config->cm_ctm_property) { + ret =drm_atomic_crtc_set_blob (dev, + &state->ctm_blob, val); +if (ret) +DRM_ERROR ("Failed to load blob ctm\n" ); +return ret; + }else if (crtc->funcs->atomic_set_property)return crtc->funcs->atomic_set_property (crtc, state, property, val);else return -EINVAL ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
kbuild test robot
build botRe: [PATCH 04/22] drm: Add set property support for color manager
reproduce: make htmldocs
Hi Shashank,
[auto build test WARNING on next-20151009 -- if it's inappropriate base, please ignore]
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt'
>> drivers/gpu/drm/drm_atomic.c:407: warning: No description found for parameter 'dev'
include/drm/drm_crtc.h:315: warning: No description found for parameter 'mode_blob' include/drm/drm_crtc.h:315: warning: No description found for parameter 'palette_before_ctm_blob' include/drm/drm_crtc.h:315: warning: No description found for parameter 'palette_after_ctm_blob' include/drm/drm_crtc.h:315: warning: No description found for parameter 'ctm_blob' include/drm/drm_crtc.h:747: warning: No description found for parameter 'tile_blob_ptr' include/drm/drm_crtc.h:786: warning: No description found for parameter 'rotation' include/drm/drm_crtc.h:882: warning: No description found for parameter 'mutex' include/drm/drm_crtc.h:882: warning: No description found for parameter 'helper_private' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tile_idr' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'delayed_event' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'edid_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dpms_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'path_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tile_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'plane_type_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'rotation_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_x' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_y' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_w' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_src_h' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_x' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_y' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_w' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_h' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_fb_id' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_crtc_id' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_active' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'prop_mode_id' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dvi_i_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dvi_i_select_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_select_subconnector_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_mode_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_left_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_right_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_top_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_bottom_margin_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_brightness_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_contrast_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_flicker_reduction_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_overscan_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_saturation_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'tv_hue_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'scaling_mode_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'aspect_ratio_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'dirty_info_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'suggested_x_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'suggested_y_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_palette_before_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_palette_after_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_coeff_before_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'cm_coeff_after_ctm_property' include/drm/drm_crtc.h:1176: warning: No description found for parameter 'allow_fb_modifiers' include/drm/drm_fb_helper.h:148: warning: No description found for parameter 'connector_info' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_nack_count' include/drm/drm_dp_helper.h:713: warning: No description found for parameter 'i2c_defer_count' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' include/drm/drm_dp_mst_helper.h:97: warning: No description found for parameter 'cached_edid' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'max_dpcd_transaction_bytes' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'sink_count' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'avail_slots' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'total_pbn' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'qlock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_downq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_msg_upq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_down_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_up_in_progress' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'proposed_vcpis' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payloads' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'payload_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'vcpi_mask' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_waitq' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'tx_work' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_list' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_lock' include/drm/drm_dp_mst_helper.h:471: warning: No description found for parameter 'destroy_connector_work' drivers/gpu/drm/drm_dp_mst_topology.c:2226: warning: No description found for parameter 'connector' drivers/gpu/drm/drm_irq.c:173: warning: No description found for parameter 'flags' include/drm/drmP.h:164: warning: No description found for parameter 'fmt' include/drm/drmP.h:180: warning: No description found for parameter 'fmt' include/drm/drmP.h:198: warning: No description found for parameter 'fmt' include/drm/drmP.h:238: warning: No description found for parameter 'dev' include/drm/drmP.h:238: warning: No description found for parameter 'data' include/drm/drmP.h:238: warning: No description found for parameter 'file_priv' include/drm/drmP.h:271: warning: No description found for parameter 'ioctl' include/drm/drmP.h:271: warning: No description found for parameter '_func' include/drm/drmP.h:271: warning: No description found for parameter '_flags' include/drm/drmP.h:344: warning: cannot understand function prototype: 'struct drm_lock_data ' include/drm/drmP.h:397: warning: cannot understand function prototype: 'struct drm_driver ' include/drm/drmP.h:647: warning: cannot understand function prototype: 'struct drm_info_list ' include/drm/drmP.h:657: warning: cannot understand function prototype: 'struct drm_info_node ' include/drm/drmP.h:667: warning: cannot understand function prototype: 'struct drm_minor ' include/drm/drmP.h:715: warning: cannot understand function prototype: 'struct drm_device ' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'fmt' drivers/gpu/drm/i915/i915_irq.c:2582: warning: No description found for parameter 'wedged'
vim +/dev +407 drivers/gpu/drm/drm_atomic.c
391
392 /**
393 * drm_atomic_crtc_set_blob - find and set a blob
394 * @state_blob: reference pointer to the color blob in the crtc_state
395 * @blob_id: blob_id coming from set_property() call
396 *
397 * Set a color correction blob (originating from a set blob property) on the
398 * desired CRTC state. This function will take reference of the blob property
399 * in the CRTC state, finds the blob based on blob_id (which comes from
400 * set_property call) and set the blob at the proper place.
401 *
402 * RETURNS:
403 * Zero on success, error code on failure.
404 */
405 int drm_atomic_crtc_set_blob(struct drm_device *dev,
406 struct drm_property_blob **state_blob, uint32_t blob_id)
> 407 { 408 struct drm_property_blob *blob;
409
410 blob = drm_property_lookup_blob(dev, blob_id);
411 if (!blob) {
412 DRM_DEBUG_KMS("Invalid Blob ID\n");
413 return -EINVAL;
414 }
415
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 04/22] drm: Add set property support for color manager
In reply to Shashank SharmaHi Shashank,
Quoted 28 lines · Shashank Sharma
As per DRM color manager design, if a userspace wants to set a correction blob, it prepares it and sends the
blob_idto kernel viaset_propertycall. DRM framework takes thisblob_id, gets the blob, and saves it in the CRTC state, so that, during theatomic_commit, the color correction values from the blob can referred and applied on display controller registers.This patch adds this
set_propertysupport for color correction blobs in drm framework.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal malladi <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 53 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_atomic.c +4
-0@@ -390,6 +390,38 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,EXPORT_SYMBOL (drm_atomic_set_mode_prop_for_crtc);/** +* drm_atomic_crtc_set_blob - find and set a blob +* @state_blob: reference pointer to the color blob in the crtc_state +* @blob_id: blob_id coming from set_property() call +*
drivers/gpu/drm/drm_atomic.c int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, · line 406
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +10
-0+* Set a color correction blob (originating from a set blob property) on the +* desired CRTC state. This function will take reference of the blob property +* in the CRTC state, finds the blob based on blob_id (which comes from +* set_property call) and set the blob at the proper place. +* +* RETURNS: +* Zero on success, error code on failure. +*/ +int drm_atomic_crtc_set_blob (struct drm_device *dev, +struct drm_property_blob **state_blob,uint32_t blob_id)
You are missing the function declaration. Set it as static perhaps ?
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 04/22] drm: Add set property support for color manager
Regards
Shashank
Quoted 26 lines · Emil Velikov
Hi Shashank,
Quoted 23 lines · Shashank Sharma
As per DRM color manager design, if a userspace wants to set a correction blob, it prepares it and sends the
blob_idto kernel viaset_propertycall. DRM framework takes thisblob_id, gets the blob, and saves it in the CRTC state, so that, during theatomic_commit, the color correction values from the blob can referred and applied on display controller registers.This patch adds this
set_propertysupport for color correction blobs in drm framework.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal malladi <[email protected]>--- drivers/gpu/drm/drm_atomic.c | 53 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_atomic.c +0
-0@@ -390,6 +390,38 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,EXPORT_SYMBOL (drm_atomic_set_mode_prop_for_crtc);
Quoted 17 lines
Quoted 5 lines
drivers/gpu/drm/drm_atomic.c +4
-0/** +* drm_atomic_crtc_set_blob - find and set a blob +* @state_blob: reference pointer to the color blob in the crtc_state +* @blob_id: blob_id coming from set_property() call +* drivers/gpu/drm/drm_atomic.c int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state, · line 406
Quoted 10 lines
drivers/gpu/drm/drm_atomic.c +10
-0+* Set a color correction blob (originating from a set blob property) on the +* desired CRTC state. This function will take reference of the blob property +* in the CRTC state, finds the blob based on blob_id (which comes from +* set_property call) and set the blob at the proper place. +* +* RETURNS: +* Zero on success, error code on failure. +*/ +int drm_atomic_crtc_set_blob (struct drm_device *dev, +struct drm_property_blob **state_blob,uint32_t blob_id)You are missing the function declaration. Set it as static perhaps ?
Yes, This was meant to be used internally, I can make it static.
Quoted 3 lines
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/22 drm: Add get property support for color manager
In reply to Shashank SharmaAs per the DRM get_property implementation for a blob, framework is supposed to return the blob_id to the caller. All the color management blobs are saved in CRTC state during the set call.
This patch adds get_property support for color management properties, by referring to the existing blob for the property and passing its blob_id.
--- drivers/gpu/drm/drm_atomic.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/drm_atomic.c +8 -0
@@ -499,6 +499,14 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, *val = state->active; else if (property == config->prop_mode_id) *val = (state->mode_blob) ? state->mode_blob->base.id : 0; + else if (property == config->cm_palette_after_ctm_property) + *val = (state->palette_after_ctm_blob) ? + state->palette_after_ctm_blob->base.id :0 ; + else if (property == config->cm_palette_before_ctm_property) + *val = (state->palette_before_ctm_blob) ? + state->palette_before_ctm_blob->base.id :0 ; + else if (property == config->cm_ctm_property) + *val = (state->ctm_blob) ? state->ctm_blob->base.id : 0; else if (crtc->funcs->atomic_get_property) return crtc->funcs->atomic_get_property(crtc, state, property, val); else
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/22 drm: Add drm structures for palette color property
In reply to Shashank SharmaThis patch adds new structures in DRM layer for Palette color correction.These structures will be used by user space agents to configure appropriate number of samples and Palette LUT for a platform.
--- include/uapi/drm/drm.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
include/uapi/drm/drm.h +26 -0
@@ -829,6 +829,32 @@ struct drm_event_vblank {__u32 reserved; }; +struct drm_r32g32b32 { +/* +* Data is in U8.24 fixed point format. +* All platforms support values within [0, 1.0] range, +* for Red, Green and Blue colors. +*/ +__u32 r32; +__u32 g32; +__u32 b32; +__u32 reserved; +}; + +struct drm_palette { +/* +* This has to be a supported value during get call. +* Feature will be disabled if this is 0 while set +*/ +__u32 num_samples; +/* +* Starting of palette LUT in R32G32B32 format. +* Each of RGB value is in U8.24 fixed point format. +* Actual number of samples will depend upon num_samples +*/ +struct drm_r32g32b32 lut[0 ]; +}; +/* typedef area */ #ifndef __KERNEL__typedef struct drm_clip_rect drm_clip_rect_t ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/22 drm: Add structure to set/get a CTM color property
In reply to Shashank SharmaColor Manager framework defines a DRM property for color space transformation and Gamut mapping. This property is called CTM (Color Transformation Matrix).
This patch adds a new structure in DRM layer for CTM. This structure can be used by all user space agents to configure CTM coefficients for color correction.
--- include/uapi/drm/drm.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/uapi/drm/drm.h +10 -0
@@ -855,6 +855,16 @@ struct drm_palette {struct drm_r32g32b32 lut[0 ]; }; +struct drm_ctm { +/* +* Each value is in S31.32 format. +* This is 3x3 matrix in row major format. +* Integer part will be clipped to nearest +* max/min boundary as supported by the HW platform. +*/ +__s64 ctm_coeff[9 ]; +}; +/* typedef area */ #ifndef __KERNEL__typedef struct drm_clip_rect drm_clip_rect_t ;
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/22 drm/i915: Add set property interface for CRTC
In reply to Shashank SharmaThis patch adds set property interface for intel CRTC. This interface will be used for set operation on any DRM properties.
--- drivers/gpu/drm/i915/intel_display.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_display.c +1 -0
@@ -13237,6 +13237,7 @@ static const struct drm_crtc_funcs intel_crtc_funcs = { .page_flip = intel_crtc_page_flip, .atomic_duplicate_state = intel_crtc_duplicate_state, .atomic_destroy_state = intel_crtc_destroy_state, + .set_property = drm_atomic_helper_crtc_set_property, }; static bool ibx_pch_dpll_get_hw_state(struct drm_i915_private *dev_priv,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/22 drm/i915: Create color management files
In reply to Shashank SharmaThis patch create new files intel_color_manager.c which will contain the core color correction code for I915 driver and its header intel_color_manager.h
The per color property patches coming up in this patch series will fill the appropriate functions in this file.
--- drivers/gpu/drm/i915/Makefile | 3 +- drivers/gpu/drm/i915/intel_color_manager.c | 33 ++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 50 ++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/intel_color_manager.c create mode 100644 drivers/gpu/drm/i915/intel_color_manager.h
drivers/gpu/drm/i915/Makefile +2 -1
@@ -64,7 +64,8 @@ i915-y += intel_audio.o \ intel_overlay.o \ intel_psr.o \ intel_sideband.o \ - intel_sprite.o + intel_sprite.o \ + intel_color_manager.o i915-$(CONFIG_ACPI) += intel_acpi.o intel_opregion.o i915-$(CONFIG_DRM_FBDEV_EMULATION) += intel_fbdev.o
drivers/gpu/drm/i915/intel_color_manager.c new file +33 -0
@@ -0,0 +1,33 @@ +/* +* Copyright © 2015 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +* +* Authors: +* Shashank Sharma <[email protected]> +* Kausal Malladi <[email protected]> +*/ + +#include "intel_color_manager.h" + +void intel_attach_color_properties_to_crtc (struct drm_device *dev, +struct drm_mode_object *mode_obj) +{ +}
drivers/gpu/drm/i915/intel_color_manager.h new file +50 -0
50 lines not on this page · raw message
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/22] drm/i915: Create color management files
Hi Shashank,
On 9 October 2015 at 20:28, Shashank Sharma <[email protected]> wrote:
[snip]
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +11
-0+ +/* Color management bit utilities */ +#define GET_BIT_MASK (n) ((1 << n) - 1) + +/* Read bits of a word from bit no. 'start'(lsb) till 'n' bits */ +#define GET_BITS (x, start, nbits) ((x >> start) & GET_BIT_MASK(nbits)) + +/* Round off by adding 1 to the immediate lower bit */ +#define GET_BITS_ROUNDOFF (x, start, nbits) \ + ((GET_BITS(x, start, (nbits + 1)) + 1) >> 1) +
drivers/gpu/drm/i915/intel_color_manager.h line 50
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +10
-0+/* Clear bits of a word from bit no. 'start' till nbits */ +#define CLEAR_BITS (x, start, nbits) ( \ + x &= ~((GET_BIT_MASK(nbits) << start))) + +/* Write bit_pattern of no_bits bits in a target word */ +#define SET_BITS (target, bit_pattern, start_bit, no_bits) \ + do { \ + CLEAR_BITS(target, start_bit, no_bits); \ + target |= (bit_pattern << start_bit); \ + } while (0)
It feels suspicious that the kernel does not have macros for either one of these.
I would invite you to take a look at include/linux/bitops.h and other kernel headers.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/22] drm/i915: Create color management files
Regards
Shashank
Quoted 28 lines · Emil Velikov
Hi Shashank,
On 9 October 2015 at 20:28, Shashank Sharma <[email protected]> wrote:
[snip]Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +11
-0+ +/* Color management bit utilities */ +#define GET_BIT_MASK (n) ((1 << n) - 1) + +/* Read bits of a word from bit no. 'start'(lsb) till 'n' bits */ +#define GET_BITS (x, start, nbits) ((x >> start) & GET_BIT_MASK(nbits)) + +/* Round off by adding 1 to the immediate lower bit */ +#define GET_BITS_ROUNDOFF (x, start, nbits) \ + ((GET_BITS(x, start, (nbits + 1)) + 1) >> 1) +drivers/gpu/drm/i915/intel_color_manager.h line 50
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +10
-0+/* Clear bits of a word from bit no. 'start' till nbits */ +#define CLEAR_BITS (x, start, nbits) ( \ + x &= ~((GET_BIT_MASK(nbits) << start))) + +/* Write bit_pattern of no_bits bits in a target word */ +#define SET_BITS (target, bit_pattern, start_bit, no_bits) \ + do { \ + CLEAR_BITS(target, start_bit, no_bits); \ + target |= (bit_pattern << start_bit); \ + } while (0)It feels suspicious that the kernel does not have macros for either one of these.
Quoted 3 lines
I would invite you to take a look at
include/linux/bitops.hand other kernel headers.
Thanks for pointing this out, but if you closely observe, these macros are well tested, and created for color management operations, which have specific requirements, like:
- pick 8 bits from 16th bit onwards, make them LSB, and give result: GET_BITS
- take these 8 bits and move to bit 17th of the word, clearing the existing ones: SET_BITS
For core register programming, this was required, so we created it. I would still have a look
at the existing ones which you pointed out to avoid any duplication, if they fall directly in the implementation, else I would like to continue with these.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 09/22] drm/i915: Create color management files
Quoted 36 lines · Shashank
Quoted 32 lines · Emil Velikov
Hi Shashank,
On 9 October 2015 at 20:28, Shashank Sharma <[email protected]> wrote:
[snip]Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +11
-0+ +/* Color management bit utilities */ +#define GET_BIT_MASK (n) ((1 << n) - 1) + +/* Read bits of a word from bit no. 'start'(lsb) till 'n' bits */ +#define GET_BITS (x, start, nbits) ((x >> start) & GET_BIT_MASK(nbits)) + +/* Round off by adding 1 to the immediate lower bit */ +#define GET_BITS_ROUNDOFF (x, start, nbits) \ + ((GET_BITS(x, start, (nbits + 1)) + 1) >> 1) +drivers/gpu/drm/i915/intel_color_manager.h line 50
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +10
-0+/* Clear bits of a word from bit no. 'start' till nbits */ +#define CLEAR_BITS (x, start, nbits) ( \ + x &= ~((GET_BIT_MASK(nbits) << start))) + +/* Write bit_pattern of no_bits bits in a target word */ +#define SET_BITS (target, bit_pattern, start_bit, no_bits) \ + do { \ + CLEAR_BITS(target, start_bit, no_bits); \ + target |= (bit_pattern << start_bit); \ + } while (0)It feels suspicious that the kernel does not have macros for either one of these.
Quoted 3 lines
I would invite you to take a look at
include/linux/bitops.hand other kernel headers.
Quoted 12 lines
Thanks for pointing this out, but if you closely observe, these macros are well tested, and created for color management operations, which have specific requirements, like:
- pick 8 bits from 16th bit onwards, make them LSB, and give result:GET_BITS
- take these 8 bits and move to bit 17th of the word, clearing the existing
ones:SET_BITS
For core register programming, this was required, so we created it. I would still have a look
at the existing ones which you pointed out to avoid any duplication, if they fall directly in the implementation, else I would like to continue with these.
Unless I'm missing something, these are generic bit manipulation macros, are they not ? As such I'd imagine we have some of these already available, but I cannot say which ones off-hand.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/22] drm/i915: Create color management files
Thanks for the review Emil.
Please find my comments inline
Regards
Shashank
Quoted 49 lines · Emil Velikov
Quoted 36 lines · Shashank
Quoted 32 lines · Emil Velikov
Hi Shashank,
On 9 October 2015 at 20:28, Shashank Sharma <[email protected]> wrote:
[snip]Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +11
-0+ +/* Color management bit utilities */ +#define GET_BIT_MASK (n) ((1 << n) - 1) + +/* Read bits of a word from bit no. 'start'(lsb) till 'n' bits */ +#define GET_BITS (x, start, nbits) ((x >> start) & GET_BIT_MASK(nbits)) + +/* Round off by adding 1 to the immediate lower bit */ +#define GET_BITS_ROUNDOFF (x, start, nbits) \ + ((GET_BITS(x, start, (nbits + 1)) + 1) >> 1) +drivers/gpu/drm/i915/intel_color_manager.h line 50
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.h new file +10
-0+/* Clear bits of a word from bit no. 'start' till nbits */ +#define CLEAR_BITS (x, start, nbits) ( \ + x &= ~((GET_BIT_MASK(nbits) << start))) + +/* Write bit_pattern of no_bits bits in a target word */ +#define SET_BITS (target, bit_pattern, start_bit, no_bits) \ + do { \ + CLEAR_BITS(target, start_bit, no_bits); \ + target |= (bit_pattern << start_bit); \ + } while (0)It feels suspicious that the kernel does not have macros for either one of these.
Quoted 3 lines
I would invite you to take a look at
include/linux/bitops.hand other kernel headers.Quoted 12 lines
Thanks for pointing this out, but if you closely observe, these macros are well tested, and created for color management operations, which have specific requirements, like:
- pick 8 bits from 16th bit onwards, make them LSB, and give result:GET_BITS
- take these 8 bits and move to bit 17th of the word, clearing the existing
ones:SET_BITS
For core register programming, this was required, so we created it. I would still have a look
at the existing ones which you pointed out to avoid any duplication, if they fall directly in the implementation, else I would like to continue with these.
Quoted 4 lines
Unless I'm missing something, these are generic bit manipulation macros, are they not ? As such I'd imagine we have some of these already available, but I cannot say which ones off-hand.
If you closely observe, what set_bit does is picks up the bit pattern from nth to n+reqd bit, moves it to LSB and returns it. similarly set bits clears the bits, then copy the bit pattern in the respective bits and manipulates the shifts. I could not find any such examples which I can directly use from suggested macros.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/22 drm/i915: Register color correction capabilities
In reply to Shashank SharmaFrom DRM color management:
============================
DRM color manager supports these color properties:
1. "ctm": Color transformation matrix property, where a color transformation matrix of 9 correction values gets applied as correction.
2. "palette_before_ctm": for corrections which get applied beore color transformation matrix correction.
3. "palette_after_ctm": for corrections which get applied after color transformation matrix correction.
These color correction capabilities may differ per platform, supporting various different no. of correction coefficients. So DRM color manager support few properties using which a user space can query the platform's capability, and prepare color correction accordingly.
These query properties are:
1. cm_coeff_after_ctm_property
2. cm_coeff_before_ctm_property
(CTM is fix to 9 coefficients across industry)
Now, Intel color manager registers:
======================================
1. Gamma correction property as "palette_after_ctm" property
2. Degamma correction capability as "palette_bafore_ctm" property capability as "palette_after_ctm" DRM color property hook.
3. CSC as "ctm" property.
So finally, This patch does the following:
1. Add a function which loads the platform's color correction capabilities in the cm_crtc_palette_capabilities_property structure.
2. Attaches the cm_crtc_palette_capabilities_property to every CRTC getting initiaized.
3. Adds two new parameters "num_samples_after_ctm" and "num_samples_before_ctm" in intel_device_info as gamma and degamma coefficients vary per platform basis.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_color_manager.c | 33 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -798,6 +798,8 @@ struct intel_device_info {u8 num_sprites[I915_MAX_PIPES ];u8 gen;u8 ring_mask;/* Rings supported by the HW */ +u16 num_samples_after_ctm; +u16 num_samples_before_ctm;DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON );/* Register offsets for the various display pipes and transcoders */ int pipe_offsets[I915_MAX_TRANSCODERS ];
drivers/gpu/drm/i915/intel_color_manager.c +32 -1
@@ -28,6 +28,37 @@#include "intel_color_manager.h" void intel_attach_color_properties_to_crtc (struct drm_device *dev, -struct drm_mode_object *mode_obj) +struct drm_crtc *crtc) { +struct drm_mode_config *config = &dev->mode_config; +struct drm_mode_object *mode_obj = &crtc->base; + +/* +* Register: +* ========= +* Gamma correction as palette_after_ctm property +* Degamma correction as palette_before_ctm property +* +* Load: +* ===== +* no. of coefficients supported on this platform for gamma +* and degamma with the query properties. A user +* space agent should read these query property, and prepare +* the color correction values accordingly. Its expected from the +* driver to load the right number of coefficients during the init +* phase. +*/ +if (config->cm_coeff_after_ctm_property) { +drm_object_attach_property (mode_obj, + config->cm_coeff_after_ctm_property, +INTEL_INFO (dev)->num_samples_after_ctm); +DRM_DEBUG_DRIVER ("Gamma query property initialized\n" ); + } + +if (config->cm_coeff_before_ctm_property) { +drm_object_attach_property (mode_obj, + config->cm_coeff_before_ctm_property, +INTEL_INFO (dev)->num_samples_before_ctm); +DRM_DEBUG_DRIVER ("Degamma query property initialized\n" ); + } }
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/22] drm/i915: Register color correction capabilities
Hi Shashank,
Quoted 88 lines · Shashank Sharma
From DRM color management:
============================
DRM color manager supports these color properties:
1. "ctm": Color transformation matrix property, where a color transformation matrix of 9 correction values gets applied as correction.
2. "palette_before_ctm": for corrections which get applied beore color transformation matrix correction.
3. "palette_after_ctm": for corrections which get applied after color transformation matrix correction.These color correction capabilities may differ per platform, supporting various different no. of correction coefficients. So DRM color manager support few properties using which a user space can query the platform's capability, and prepare color correction accordingly.
These query properties are:
1.cm_coeff_after_ctm_property
2.cm_coeff_before_ctm_property
(CTM is fix to 9 coefficients across industry)Now, Intel color manager registers:
======================================
1. Gamma correction property as "palette_after_ctm" property
2. Degamma correction capability as "palette_bafore_ctm" property capability as "palette_after_ctm" DRM color property hook.
3. CSC as "ctm" property.So finally, This patch does the following:
1. Add a function which loads the platform's color correction capabilities in thecm_crtc_palette_capabilities_propertystructure.
2. Attaches thecm_crtc_palette_capabilities_propertyto every CRTC getting initiaized.
3. Adds two new parameters "num_samples_after_ctm" and "num_samples_before_ctm" inintel_device_infoas gamma and degamma coefficients vary per platform basis.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_color_manager.c | 33 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -798,6 +798,8 @@ struct intel_device_info {u8 num_sprites[I915_MAX_PIPES ];u8 gen;u8 ring_mask;/* Rings supported by the HW */ +u16 num_samples_after_ctm; +u16 num_samples_before_ctm;DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON );/* Register offsets for the various display pipes and transcoders */ int pipe_offsets[I915_MAX_TRANSCODERS ];drivers/gpu/drm/i915/intel_color_manager.c +22
-1@@ -28,6 +28,37 @@#include "intel_color_manager.h" void intel_attach_color_properties_to_crtc (struct drm_device *dev, -struct drm_mode_object *mode_obj) +struct drm_crtc *crtc) { +struct drm_mode_config *config = &dev->mode_config; +struct drm_mode_object *mode_obj = &crtc->base; + +/* +* Register: +* ========= +* Gamma correction as palette_after_ctm property +* Degamma correction as palette_before_ctm property +* +* Load: +* ===== +* no. of coefficients supported on this platform for gamma +* and degamma with the query properties. A user +* space agent should read these query property, and prepare +* the color correction values accordingly. Its expected from the +* driver to load the right number of coefficients during the init +* phase. +*/ +if (config->cm_coeff_after_ctm_property) { + drm_object_attach_property(mode_obj, + config->cm_coeff_after_ctm_property,
drivers/gpu/drm/i915/intel_color_manager.c line 63
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+ INTEL_INFO(dev)->num_samples_after_ctm); +DRM_DEBUG_DRIVER ("Gamma query property initialized\n" ); + } + +if (config->cm_coeff_before_ctm_property) { +drm_object_attach_property (mode_obj, + config->cm_coeff_before_ctm_property, +INTEL_INFO (dev)->num_samples_before_ctm); +DRM_DEBUG_DRIVER ("Degamma query property initialized\n" ); + }
Shouldn't this commit be squashed with the previous ? You're also missing the function declaration.
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/22] drm/i915: Register color correction capabilities
Regards
Shashank
Quoted 95 lines · Emil Velikov
Hi Shashank,
Quoted 92 lines · Shashank Sharma
From DRM color management:
============================
DRM color manager supports these color properties:
1. "ctm": Color transformation matrix property, where a color transformation matrix of 9 correction values gets applied as correction.
2. "palette_before_ctm": for corrections which get applied beore color transformation matrix correction.
3. "palette_after_ctm": for corrections which get applied after color transformation matrix correction.These color correction capabilities may differ per platform, supporting various different no. of correction coefficients. So DRM color manager support few properties using which a user space can query the platform's capability, and prepare color correction accordingly.
These query properties are:
1.cm_coeff_after_ctm_property
2.cm_coeff_before_ctm_property
(CTM is fix to 9 coefficients across industry)Now, Intel color manager registers:
======================================
1. Gamma correction property as "palette_after_ctm" property
2. Degamma correction capability as "palette_bafore_ctm" property capability as "palette_after_ctm" DRM color property hook.
3. CSC as "ctm" property.So finally, This patch does the following:
1. Add a function which loads the platform's color correction capabilities in thecm_crtc_palette_capabilities_propertystructure.
2. Attaches thecm_crtc_palette_capabilities_propertyto every CRTC getting initiaized.
3. Adds two new parameters "num_samples_after_ctm" and "num_samples_before_ctm" inintel_device_infoas gamma and degamma coefficients vary per platform basis.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_color_manager.c | 33 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -798,6 +798,8 @@ struct intel_device_info {u8 num_sprites[I915_MAX_PIPES ];u8 gen;u8 ring_mask;/* Rings supported by the HW */ +u16 num_samples_after_ctm; +u16 num_samples_before_ctm;DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON );/* Register offsets for the various display pipes and transcoders */ int pipe_offsets[I915_MAX_TRANSCODERS ];drivers/gpu/drm/i915/intel_color_manager.c +26
-1@@ -28,6 +28,37 @@#include "intel_color_manager.h" void intel_attach_color_properties_to_crtc (struct drm_device *dev, -struct drm_mode_object *mode_obj) +struct drm_crtc *crtc) { +struct drm_mode_config *config = &dev->mode_config; +struct drm_mode_object *mode_obj = &crtc->base; + +/* +* Register: +* ========= +* Gamma correction as palette_after_ctm property +* Degamma correction as palette_before_ctm property +* +* Load: +* ===== +* no. of coefficients supported on this platform for gamma +* and degamma with the query properties. A user +* space agent should read these query property, and prepare +* the color correction values accordingly. Its expected from the +* driver to load the right number of coefficients during the init +* phase. +*/ +if (config->cm_coeff_after_ctm_property) { +drm_object_attach_property (mode_obj, + config->cm_coeff_after_ctm_property, +INTEL_INFO (dev)->num_samples_after_ctm); +DRM_DEBUG_DRIVER ("Gamma query property initialized\n" ); + } +
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 63
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+if (config->cm_coeff_before_ctm_property) { +drm_object_attach_property (mode_obj, + config->cm_coeff_before_ctm_property, +INTEL_INFO (dev)->num_samples_before_ctm); +DRM_DEBUG_DRIVER ("Degamma query property initialized\n" ); + }Shouldn't this commit be squashed with the previous ? You're also missing the function declaration.
Please see the history of the review comments, initially this patch was like as you suggested. But one of the previous review comments, suggested to split that into two, as it was 'overdoing' stuff. So I had split it into two separate ones, so I think this is ok :)
Also, one of the previous review comments was to call this function only when the whole framework is in place, so that it would look like we are enabling, when we have stuff ready. So this is just the body of the function, and definition is coming up in next patch, where this function is being called from intel_crtc_init (patch 17/22 to be specific).
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/22] drm/i915: Register color correction capabilities
Quoted 114 lines · Shashank
Quoted 104 lines · Emil Velikov
Hi Shashank,
Quoted 99 lines · Shashank Sharma
From DRM color management:
============================
DRM color manager supports these color properties:
1. "ctm": Color transformation matrix property, where a color transformation matrix of 9 correction values gets applied as correction.
2. "palette_before_ctm": for corrections which get applied beore color transformation matrix correction.
3. "palette_after_ctm": for corrections which get applied after color transformation matrix correction.These color correction capabilities may differ per platform, supporting various different no. of correction coefficients. So DRM color manager support few properties using which a user space can query the platform's capability, and prepare color correction accordingly.
These query properties are:
1.cm_coeff_after_ctm_property
2.cm_coeff_before_ctm_property
(CTM is fix to 9 coefficients across industry)Now, Intel color manager registers:
======================================
1. Gamma correction property as "palette_after_ctm" property
2. Degamma correction capability as "palette_bafore_ctm" property capability as "palette_after_ctm" DRM color property hook.
3. CSC as "ctm" property.So finally, This patch does the following:
1. Add a function which loads the platform's color correction capabilities in thecm_crtc_palette_capabilities_propertystructure.
2. Attaches thecm_crtc_palette_capabilities_propertyto every CRTC getting initiaized.
3. Adds two new parameters "num_samples_after_ctm" and "num_samples_before_ctm" inintel_device_infoas gamma and degamma coefficients vary per platform basis.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_color_manager.c | 33 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -798,6 +798,8 @@ struct intel_device_info {u8 num_sprites[I915_MAX_PIPES ];u8 gen;u8 ring_mask;/* Rings supported by the HW */ +u16 num_samples_after_ctm; +u16 num_samples_before_ctm;DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON );/* Register offsets for the various display pipes and transcoders */
int pipe_offsets[I915_MAX_TRANSCODERS];drivers/gpu/drm/i915/intel_color_manager.c +17
-1@@ -28,6 +28,37 @@#include "intel_color_manager.h" void intel_attach_color_properties_to_crtc (struct drm_device *dev, -struct drm_mode_object *mode_obj) +struct drm_crtc *crtc) { +struct drm_mode_config *config = &dev->mode_config; +struct drm_mode_object *mode_obj = &crtc->base; + +/* +* Register: +* ========= +* Gamma correction as palette_after_ctm property +* Degamma correction as palette_before_ctm property +* +* Load: +* ===== +* no. of coefficients supported on this platform for gamma +* and degamma with the query properties. A user +* space agent should read these query property, and prepare +* the color correction values accordingly. Its expected from the +* driver to load the right number of coefficients during the init
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+* phase. +*/ +if (config->cm_coeff_after_ctm_property) { +drm_object_attach_property (mode_obj, + config->cm_coeff_after_ctm_property, +INTEL_INFO (dev)->num_samples_after_ctm); +DRM_DEBUG_DRIVER ("Gamma query property initialized\n" ); + } + +if (config->cm_coeff_before_ctm_property) {Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 63
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+drm_object_attach_property (mode_obj, + config->cm_coeff_before_ctm_property, +INTEL_INFO (dev)->num_samples_before_ctm); +DRM_DEBUG_DRIVER ("Degamma query property initialized\n" ); + }Shouldn't this commit be squashed with the previous ? You're also missing the function declaration.
Quoted 5 lines
Please see the history of the review comments, initially this patch was like as you suggested. But one of the previous review comments, suggested to split that into two, as it was 'overdoing' stuff. So I had split it into two separate ones, so I think this is ok :)
Sorry did not see it. The revision history should be within the patch either above or below the --- line.
Quoted 4 lines
So this is just the body of the
function, and definition is coming up in next patch, where this function is being called fromintel_crtc_init(patch 17/22 to be specific).
This is not how things work I'm afraid. The function declaration and definition must _always_ be in the same patch.
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 10/22] drm/i915: Register color correction capabilities
Regards
Shashank
Quoted 123 lines · Emil Velikov
Quoted 114 lines · Shashank
Quoted 104 lines · Emil Velikov
Hi Shashank,
Quoted 99 lines · Shashank Sharma
From DRM color management:
============================
DRM color manager supports these color properties:
1. "ctm": Color transformation matrix property, where a color transformation matrix of 9 correction values gets applied as correction.
2. "palette_before_ctm": for corrections which get applied beore color transformation matrix correction.
3. "palette_after_ctm": for corrections which get applied after color transformation matrix correction.These color correction capabilities may differ per platform, supporting various different no. of correction coefficients. So DRM color manager support few properties using which a user space can query the platform's capability, and prepare color correction accordingly.
These query properties are:
1.cm_coeff_after_ctm_property
2.cm_coeff_before_ctm_property
(CTM is fix to 9 coefficients across industry)Now, Intel color manager registers:
======================================
1. Gamma correction property as "palette_after_ctm" property
2. Degamma correction capability as "palette_bafore_ctm" property capability as "palette_after_ctm" DRM color property hook.
3. CSC as "ctm" property.So finally, This patch does the following:
1. Add a function which loads the platform's color correction capabilities in thecm_crtc_palette_capabilities_propertystructure.
2. Attaches thecm_crtc_palette_capabilities_propertyto every CRTC getting initiaized.
3. Adds two new parameters "num_samples_after_ctm" and "num_samples_before_ctm" inintel_device_infoas gamma and degamma coefficients vary per platform basis.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_color_manager.c | 33 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -798,6 +798,8 @@ struct intel_device_info {u8 num_sprites[I915_MAX_PIPES ];u8 gen;u8 ring_mask;/* Rings supported by the HW */ +u16 num_samples_after_ctm; +u16 num_samples_before_ctm;DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON );/* Register offsets for the various display pipes and transcoders */
int pipe_offsets[I915_MAX_TRANSCODERS];drivers/gpu/drm/i915/intel_color_manager.c +17
-1@@ -28,6 +28,37 @@#include "intel_color_manager.h" void intel_attach_color_properties_to_crtc (struct drm_device *dev, -struct drm_mode_object *mode_obj) +struct drm_crtc *crtc) { +struct drm_mode_config *config = &dev->mode_config; +struct drm_mode_object *mode_obj = &crtc->base; + +/* +* Register: +* ========= +* Gamma correction as palette_after_ctm property +* Degamma correction as palette_before_ctm property +* +* Load: +* ===== +* no. of coefficients supported on this platform for gamma +* and degamma with the query properties. A user +* space agent should read these query property, and prepare +* the color correction values accordingly. Its expected from the +* driver to load the right number of coefficients during the init
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+* phase. +*/ +if (config->cm_coeff_after_ctm_property) { +drm_object_attach_property (mode_obj, + config->cm_coeff_after_ctm_property, +INTEL_INFO (dev)->num_samples_after_ctm); +DRM_DEBUG_DRIVER ("Gamma query property initialized\n" ); + } + +if (config->cm_coeff_before_ctm_property) {Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 63
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+drm_object_attach_property (mode_obj, + config->cm_coeff_before_ctm_property, +INTEL_INFO (dev)->num_samples_before_ctm); +DRM_DEBUG_DRIVER ("Degamma query property initialized\n" ); + }Shouldn't this commit be squashed with the previous ? You're also missing the function declaration.
Quoted 5 lines
Please see the history of the review comments, initially this patch was like as you suggested. But one of the previous review comments, suggested to split that into two, as it was 'overdoing' stuff. So I had split it into two separate ones, so I think this is ok :)
Sorry did not see it. The revision history should be within the patch either above or below the --- line.
Quoted 6 lines
Quoted 4 lines
So this is just the body of the
function, and definition is coming up in next patch, where this function is being called fromintel_crtc_init(patch 17/22 to be specific).This is not how things work I'm afraid. The function declaration and definition must _always_ be in the same patch.
This is confusing, I have received previous comments which say the other way. But anyways, I can add the definition also in this patch, if you like that.
Quoted 4 lines
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/22] drm/i915: Register color correction capabilities
Quoted 143 lines · Shashank
Quoted 142 lines · Emil Velikov
Quoted 124 lines · Shashank
Quoted 113 lines · Emil Velikov
Hi Shashank,
Quoted 107 lines · Shashank Sharma
From DRM color management:
============================
DRM color manager supports these color properties:
1. "ctm": Color transformation matrix property, where a color transformation matrix of 9 correction values gets applied as correction.
2. "palette_before_ctm": for corrections which get applied beore color transformation matrix correction.
3. "palette_after_ctm": for corrections which get applied after color transformation matrix correction.These color correction capabilities may differ per platform, supporting various different no. of correction coefficients. So DRM color manager support few properties using which a user space can query the platform's
capability, and prepare color correction accordingly.
These query properties are:
1.cm_coeff_after_ctm_property
2.cm_coeff_before_ctm_property
(CTM is fix to 9 coefficients across industry)Now, Intel color manager registers:
======================================
1. Gamma correction property as "palette_after_ctm" property
2. Degamma correction capability as "palette_bafore_ctm" property capability as "palette_after_ctm" DRM color property hook.
3. CSC as "ctm" property.So finally, This patch does the following:
1. Add a function which loads the platform's color correction capabilities in thecm_crtc_palette_capabilities_property
structure.
2. Attaches thecm_crtc_palette_capabilities_propertyto every CRTC getting initiaized.
3. Adds two new parameters "num_samples_after_ctm" and "num_samples_before_ctm" inintel_device_infoas gamma and degamma coefficients vary per platform basis.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_color_manager.c | 33 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -798,6 +798,8 @@ struct intel_device_info {u8 num_sprites[I915_MAX_PIPES ];u8 gen;u8 ring_mask;/* Rings supported by the HW */ +u16 num_samples_after_ctm; +u16 num_samples_before_ctm;DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON );/* Register offsets for the various display pipes and transcoders */
int pipe_offsets[I915_MAX_TRANSCODERS];drivers/gpu/drm/i915/intel_color_manager.c +16
-1@@ -28,6 +28,37 @@#include "intel_color_manager.h" void intel_attach_color_properties_to_crtc (struct drm_device *dev, -struct drm_mode_object *mode_obj) +struct drm_crtc *crtc) { +struct drm_mode_config *config = &dev->mode_config; +struct drm_mode_object *mode_obj = &crtc->base; + +/* +* Register: +* ========= +* Gamma correction as palette_after_ctm property +* Degamma correction as palette_before_ctm property +* +* Load: +* ===== +* no. of coefficients supported on this platform for gamma +* and degamma with the query properties. A user +* space agent should read these query property, and prepare +* the color correction values accordingly. Its expected from the
+ * driver to load the right number of coefficients during the
initdrivers/gpu/drm/i915/intel_color_manager.c +6
-0+* phase. +*/ +if (config->cm_coeff_after_ctm_property) { + drm_object_attach_property(mode_obj, + config->cm_coeff_after_ctm_property, +INTEL_INFO(dev)->num_samples_after_ctm);
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+DRM_DEBUG_DRIVER ("Gamma query property initialized\n" ); + } + +if (config->cm_coeff_before_ctm_property) { + drm_object_attach_property(mode_obj, + config->cm_coeff_before_ctm_property, +Quoted 9 lines
Quoted 4 lines
INTEL_INFO(dev)->num_samples_before_ctm);
+ DRM_DEBUG_DRIVER("Degamma query property
initialized\n");
+ }Shouldn't this commit be squashed with the previous ? You're also missing the function declaration.
Quoted 7 lines
Please see the history of the review comments, initially this patch was like
as you suggested. But one of the previous review comments, suggested to split that into two, as it was 'overdoing' stuff. So I had split it into two
separate ones, so I think this is ok :)Sorry did not see it. The revision history should be within the patch either above or below the --- line.
Quoted 5 lines
So this is just the body of the
function, and definition is coming up in next patch, where this function is
being called fromintel_crtc_init(patch 17/22 to be specific).
Quoted 6 lines
Quoted 2 lines
This is not how things work I'm afraid. The function declaration and definition must _always_ be in the same patch.
This is confusing, I have received previous comments which say the other way. But anyways, I can add the definition also in this patch, if you like that.
Do you have a link handy ? I suspect that something else was mentioned in that comment as splitting function declaration and definition is extremely uncommon.
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/22] drm/i915: Register color correction capabilities
Quoted 1 line
Do you have a link handy ? I suspect that something else was mentioned in that comment as splitting function declaration and definition is extremely uncommon
Yep, maybe I misunderstood. I will add the definition here.
Regards
Shashank
-----Original Message-----
From: Emil Velikov [mailto:[email protected]]
Sent: Tuesday, October 13, 2015 7:24 PM
To: Sharma, Shashank
Cc: Matheson, Annie J; Bradford, Robert; Palleti, Avinash Reddy; [email protected]; ML dri-devel; Mukherjee, Indranil; Bish, Jim; Barnes, Jesse; Smith, Gary K; Kausal Malladi; Vetter, Daniel; Kumar, Kiran S
Subject: Re: [PATCH 10/22] drm/i915: Register color correction capabilities
Quoted 144 lines · Shashank
Quoted 143 lines · Emil Velikov
Quoted 126 lines · Shashank
Quoted 115 lines · Emil Velikov
Hi Shashank,
Quoted 108 lines · Shashank Sharma
From DRM color management:
============================
DRM color manager supports these color properties:
1. "ctm": Color transformation matrix property, where a color transformation matrix of 9 correction values gets applied as correction.
2. "palette_before_ctm": for corrections which get applied beore color transformation matrix correction.
3. "palette_after_ctm": for corrections which get applied after color transformation matrix correction.These color correction capabilities may differ per platform, supporting various different no. of correction coefficients. So DRM color manager support few properties using which a user space can query the platform's capability, and prepare color correction accordingly.
These query properties are:
1.cm_coeff_after_ctm_property
2.cm_coeff_before_ctm_property
(CTM is fix to 9 coefficients across industry)Now, Intel color manager registers:
======================================
1. Gamma correction property as "palette_after_ctm" property 2. Degamma correction capability as "palette_bafore_ctm" property capability as "palette_after_ctm" DRM color property hook.
3. CSC as "ctm" property.So finally, This patch does the following:
1. Add a function which loads the platform's color correction capabilities in thecm_crtc_palette_capabilities_property
structure.
2. Attaches thecm_crtc_palette_capabilities_propertyto every CRTC getting initiaized.
3. Adds two new parameters "num_samples_after_ctm" and "num_samples_before_ctm" inintel_device_infoas gamma and degamma coefficients vary per platform basis.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_color_manager.c | 33 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/i915/i915_drv.hindex ad37b25..8bf1d6f 100644drivers/gpu/drm/i915/i915_drv.h +2
-0@@ -798,6 +798,8 @@ struct intel_device_info {u8 num_sprites[I915_MAX_PIPES ];u8 gen;u8 ring_mask;/* Rings supported by the HW */ +u16 num_samples_after_ctm; +u16 num_samples_before_ctm;DEV_INFO_FOR_EACH_FLAG (DEFINE_FLAG ,SEP_SEMICOLON );/* Register offsets for the various display pipes and transcoders */
int pipe_offsets[I915_MAX_TRANSCODERS];drivers/gpu/drm/i915/intel_color_manager.c +17
-1@@ -28,6 +28,37 @@#include "intel_color_manager.h" void intel_attach_color_properties_to_crtc (struct drm_device *dev, -struct drm_mode_object *mode_obj) +struct drm_crtc *crtc) { +struct drm_mode_config *config = &dev->mode_config; +struct drm_mode_object *mode_obj = &crtc->base; + +/* +* Register: +* ========= +* Gamma correction as palette_after_ctm property +* Degamma correction as palette_before_ctm property +* +* Load: +* ===== +* no. of coefficients supported on this platform for gamma +* and degamma with the query properties. A user +* space agent should read these query property, and prepare +* the color correction values accordingly. Its expected +from the
+ * driver to load the right number of coefficients during
+ the
initdrivers/gpu/drm/i915/intel_color_manager.c +6
-0+* phase. +*/ +if (config->cm_coeff_after_ctm_property) { + drm_object_attach_property(mode_obj, + config->cm_coeff_after_ctm_property, +INTEL_INFO(dev)->num_samples_after_ctm);
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+DRM_DEBUG_DRIVER ("Gamma query property initialized\n" ); + } + +if (config->cm_coeff_before_ctm_property) { + drm_object_attach_property(mode_obj, + config->cm_coeff_before_ctm_property, +Quoted 9 lines
Quoted 4 lines
INTEL_INFO(dev)->num_samples_before_ctm);
+ DRM_DEBUG_DRIVER("Degamma query property
initialized\n");
+ }Shouldn't this commit be squashed with the previous ? You're also missing the function declaration.
Quoted 5 lines
Please see the history of the review comments, initially this patch was like as you suggested. But one of the previous review comments, suggested to split that into two, as it was 'overdoing' stuff. So I had split it into two separate ones, so I think this is ok :)
Sorry did not see it. The revision history should be within the patch either above or below the --- line.
Quoted 5 lines
So this is just the body of the
function, and definition is coming up in next patch, where this function is being called fromintel_crtc_init(patch 17/22 to be specific).
Quoted 6 lines
Quoted 2 lines
This is not how things work I'm afraid. The function declaration and definition must _always_ be in the same patch.
This is confusing, I have received previous comments which say the other way. But anyways, I can add the definition also in this patch, if you like that.
Do you have a link handy ? I suspect that something else was mentioned in that comment as splitting function declaration and definition is extremely uncommon.
Thanks
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/22 drm/i915: CHV: Load gamma color correction values
In reply to Shashank SharmaDRM color manager allows the driver to showcase its best color correction capabilities using the specific query property cm_coeff_after_ctm_property. The driver must loads the no. of coefficients for color correction as per the platform capability during the init time.
This patch adds no of coefficitents for best gamma color correction modes possible in CHV, in device info structure, which is:Gamma(10 bit, CGM HW unit): 257 coeff
These values will be loaded in cm_crtc_palette_capabilities_property during the CRTC init section, by color manager's attach function.
--- drivers/gpu/drm/i915/i915_drv.c | 2 ++ drivers/gpu/drm/i915/intel_color_manager.h | 3 +++ 2 files changed, 5 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -34,6 +34,7 @@#include "i915_drv.h" #include "i915_trace.h" #include "intel_drv.h" +#include "intel_color_manager.h" #include <linux/console.h> #include <linux/module.h>
@@ -349,6 +350,7 @@ static const struct intel_device_info intel_cherryview_info = { .gen = 8, .num_pipes = 3, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, + .num_samples_after_ctm = CHV_10BIT_GAMMA_MAX_VALS, .is_valleyview = 1, .display_mmio_offset =VLV_DISPLAY_BASE , GEN_CHV_PIPEOFFSETS,
drivers/gpu/drm/i915/intel_color_manager.h +3 -0
@@ -48,3 +48,6 @@CLEAR_BITS (target, start_bit, no_bits); \ target |= (bit_pattern << start_bit); \ }while (0 ) + +/* CHV */ +#define CHV_10BIT_GAMMA_MAX_VALS 257
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/22 drm/i915: CHV: Load degamma color correction values
In reply to Shashank SharmaDRM color manager allows the driver to showcase its best color correction capabilities using the specific query property cm_coeff_before_ctm_property. The driver must loads the no. of coefficients for color correction as per the platform capability during the init time.
This patch adds no of coefficitents for degamma color correction modes possible in CHV, in device info structure, which is:
CGM Degamma(10 bit, CGM HW unit): 65 coeff
These values will be loaded in cm_crtc_palette_capabilities_property during the CRTC init section, by color manager's attach function.
--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/intel_color_manager.h | 1 + 2 files changed, 2 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -351,6 +351,7 @@ static const struct intel_device_info intel_cherryview_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = CHV_10BIT_GAMMA_MAX_VALS, + .num_samples_before_ctm = CHV_DEGAMMA_MAX_VALS, .is_valleyview = 1, .display_mmio_offset =VLV_DISPLAY_BASE , GEN_CHV_PIPEOFFSETS,
drivers/gpu/drm/i915/intel_color_manager.h +1 -0
@@ -51,3 +51,4 @@/* CHV */ #define CHV_10BIT_GAMMA_MAX_VALS 257 +#define CHV_DEGAMMA_MAX_VALS 65
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/22 drm/i915: CHV: Pipe level Gamma correction
In reply to Shashank SharmaCHV/BSW platform supports two different pipe level gamma correction modes, which are:
1. Legacy 8-bit mode
2. 10-bit CGM (Color Gamut Mapping) mode
This patch does the following:
1. Attaches Gamma property to CRTC
3. Adds the core Gamma correction function for CHV/BSW
4. Adds Gamma correction macros
--- drivers/gpu/drm/i915/i915_reg.h | 12 +++ drivers/gpu/drm/i915/intel_color_manager.c | 114 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 13 ++++ 3 files changed, 139 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +12 -0
@@ -8038,4 +8038,16 @@ enum skl_disp_power_wells {#define GEN9_VEBOX_MOCS_0 0xcb00/* Video MOCS base register*/ #define GEN9_BLT_MOCS_0 0xcc00/* Blitter MOCS base register*/ +/* Color Management */ +#define PIPEA_CGM_CONTROL (VLV_DISPLAY_BASE + 0x67A00) +#define PIPEB_CGM_CONTROL (VLV_DISPLAY_BASE + 0x69A00) +#define PIPEC_CGM_CONTROL (VLV_DISPLAY_BASE + 0x6BA00) +#define PIPEA_CGM_GAMMA (VLV_DISPLAY_BASE + 0x67000) +#define PIPEB_CGM_GAMMA (VLV_DISPLAY_BASE + 0x69000) +#define PIPEC_CGM_GAMMA (VLV_DISPLAY_BASE + 0x6B000) +#define _PIPE_CGM_CONTROL (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CONTROL, PIPEB_CGM_CONTROL, PIPEC_CGM_CONTROL)) +#define _PIPE_GAMMA_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_GAMMA, PIPEB_CGM_GAMMA, PIPEC_CGM_GAMMA)) +#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_color_manager.c +114 -0
124 lines not on this page · raw message
drivers/gpu/drm/i915/intel_color_manager.h +13 -0
@@ -52,3 +52,16 @@/* CHV */ #define CHV_10BIT_GAMMA_MAX_VALS 257#define CHV_DEGAMMA_MAX_VALS 65 + +/* No of coeff for disabling gamma is 0 */ +#define GAMMA_DISABLE_VALS 0 + +/* Gamma on CHV */ +#define CHV_10BIT_GAMMA_MAX_VALS 257 +#define CHV_8BIT_GAMMA_MAX_VALS 256 +#define CHV_10BIT_GAMMA_MSB_SHIFT 6 +#define CHV_GAMMA_SHIFT_GREEN 16 +#define CHV_MAX_GAMMA ((1 << 24) - 1) + +/* CHV CGM Block */ +#define CGM_GAMMA_EN (1 << 2)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/22] drm/i915: CHV: Pipe level Gamma correction
Hi Shashank,
Quoted 50 lines · Shashank Sharma
CHV/BSW platform supports two different pipe level gamma correction modes, which are:
1. Legacy 8-bit mode
2. 10-bit CGM (Color Gamut Mapping) modeThis patch does the following:
1. Attaches Gamma property to CRTC
3. Adds the core Gamma correction function for CHV/BSW
4. Adds Gamma correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 +++ drivers/gpu/drm/i915/intel_color_manager.c | 114 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 13 ++++ 3 files changed, 139 insertions(+)drivers/gpu/drm/i915/i915_reg.h +12
-0@@ -8038,4 +8038,16 @@ enum skl_disp_power_wells {#define GEN9_VEBOX_MOCS_0 0xcb00/* Video MOCS base register*/ #define GEN9_BLT_MOCS_0 0xcc00/* Blitter MOCS base register*/ +/* Color Management */ +#define PIPEA_CGM_CONTROL (VLV_DISPLAY_BASE + 0x67A00) +#define PIPEB_CGM_CONTROL (VLV_DISPLAY_BASE + 0x69A00) +#define PIPEC_CGM_CONTROL (VLV_DISPLAY_BASE + 0x6BA00) +#define PIPEA_CGM_GAMMA (VLV_DISPLAY_BASE + 0x67000) +#define PIPEB_CGM_GAMMA (VLV_DISPLAY_BASE + 0x69000) +#define PIPEC_CGM_GAMMA (VLV_DISPLAY_BASE + 0x6B000) +#define _PIPE_CGM_CONTROL (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CONTROL, PIPEB_CGM_CONTROL, PIPEC_CGM_CONTROL)) +#define _PIPE_GAMMA_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_GAMMA, PIPEB_CGM_GAMMA, PIPEC_CGM_GAMMA)) +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +3
-0@@ -27,6 +27,112 @@#include "intel_color_manager.h" +static int chv_set_gamma (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{
drivers/gpu/drm/i915/intel_color_manager.c line 42
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+bool flag = false; +enum pipe pipe; +u16 red_fract, green_fract, blue_fract; +u32 red, green, blue, num_samples; +u32 word =0 ; +u32 count =0 ; +u32 cgm_gamma_reg =0 ; +u32 cgm_control_reg =0 ; +int ret =0 , length; +struct drm_r32g32b32 *correction_values =NULL ;
You can drop the useless initialization of correction_values. Same goes for patches 19 and 21.
drivers/gpu/drm/i915/intel_color_manager.c line 52
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+struct drm_palette *gamma_data; +struct drm_i915_private *dev_priv = dev->dev_private; + +if (WARN_ON (!blob)) +return -EINVAL ; + + gamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = gamma_data->num_samples; + length = num_samples *sizeof (struct drm_r32g32b32 );
Calculation can overflow.
drivers/gpu/drm/i915/intel_color_manager.c line 63
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.c +11
-0+ +switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe - CGM Block */ + cgm_control_reg =I915_READ (_PIPE_CGM_CONTROL (pipe)); + cgm_control_reg &= ~CGM_GAMMA_EN ; +I915_WRITE (_PIPE_CGM_CONTROL (pipe), cgm_control_reg); + +DRM_DEBUG_DRIVER ("Gamma disabled on Pipe %c\n" , +pipe_name (pipe));
Indentation looks wrong here.
drivers/gpu/drm/i915/intel_color_manager.c line 64
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ ret =0 ;
Drop the variable and return 0, at the bottom of the function ?
drivers/gpu/drm/i915/intel_color_manager.c line 74
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+break ; + +case CHV_8BIT_GAMMA_MAX_VALS : +case CHV_10BIT_GAMMA_MAX_VALS : + + count =0 ; + cgm_gamma_reg =_PIPE_GAMMA_BASE (pipe); + correction_values = (struct drm_r32g32b32 *)&gamma_data->lut; + +while (count < num_samples) {
Using for(i = 0;....) loop seems the more common approach ?
[snip]
drivers/gpu/drm/i915/intel_color_manager.c line 117
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c +12
-0+/* +* On CHV, the best supported Gamma capability is +* CGM block, that takes 257 samples. +* If user gives 256 samples (legacy mode), then +* duplicate the 256th value to 257th. +* "flag" is used to make sure it happens only once +*/ +if (num_samples ==CHV_8BIT_GAMMA_MAX_VALS && + count ==CHV_8BIT_GAMMA_MAX_VALS && !flag) { + count--; + flag = true; + }
There is little point in going over this if statement 256 odd times. Split it out of the loop ?
drivers/gpu/drm/i915/intel_color_manager.c line 124
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ } + +/* Enable (CGM) Gamma on Pipe */ +I915_WRITE (_PIPE_CGM_CONTROL (pipe), +I915_READ (_PIPE_CGM_CONTROL (pipe)) |CGM_GAMMA_EN ); +DRM_DEBUG_DRIVER ("CGM Gamma enabled on Pipe %c\n" , +pipe_name (pipe));
Indentation.
drivers/gpu/drm/i915/intel_color_manager.c line 94
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ ret =0 ;
Drop the variable ?
drivers/gpu/drm/i915/intel_color_manager.c line 130
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+break ; + +default : +DRM_ERROR ("Invalid number of samples for Gamma LUT\n" ); + ret = -EINVAL ;
return -EINVAL;
drivers/gpu/drm/i915/intel_color_manager.c line 133
Quoted 3 lines
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+ } + +return ret;
return 0;
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/22] drm/i915: CHV: Pipe level Gamma correction
Regards
Shashank
Quoted 50 lines · Emil Velikov
Hi Shashank,
Quoted 47 lines · Shashank Sharma
CHV/BSW platform supports two different pipe level gamma correction modes, which are:
1. Legacy 8-bit mode
2. 10-bit CGM (Color Gamut Mapping) modeThis patch does the following:
1. Attaches Gamma property to CRTC
3. Adds the core Gamma correction function for CHV/BSW
4. Adds Gamma correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 12 +++ drivers/gpu/drm/i915/intel_color_manager.c | 114 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 13 ++++ 3 files changed, 139 insertions(+)drivers/gpu/drm/i915/i915_reg.h +12
-0@@ -8038,4 +8038,16 @@ enum skl_disp_power_wells {#define GEN9_VEBOX_MOCS_0 0xcb00/* Video MOCS base register*/ #define GEN9_BLT_MOCS_0 0xcc00/* Blitter MOCS base register*/ +/* Color Management */ +#define PIPEA_CGM_CONTROL (VLV_DISPLAY_BASE + 0x67A00) +#define PIPEB_CGM_CONTROL (VLV_DISPLAY_BASE + 0x69A00) +#define PIPEC_CGM_CONTROL (VLV_DISPLAY_BASE + 0x6BA00) +#define PIPEA_CGM_GAMMA (VLV_DISPLAY_BASE + 0x67000) +#define PIPEB_CGM_GAMMA (VLV_DISPLAY_BASE + 0x69000) +#define PIPEC_CGM_GAMMA (VLV_DISPLAY_BASE + 0x6B000) +#define _PIPE_CGM_CONTROL (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CONTROL, PIPEB_CGM_CONTROL, PIPEC_CGM_CONTROL)) +#define _PIPE_GAMMA_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_GAMMA, PIPEB_CGM_GAMMA, PIPEC_CGM_GAMMA)) +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -27,6 +27,112 @@#include "intel_color_manager.h"
Quoted 15 lines
drivers/gpu/drm/i915/intel_color_manager.c line 42
Quoted 13 lines
drivers/gpu/drm/i915/intel_color_manager.c +13
-0+static int chv_set_gamma (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{ +bool flag = false; +enum pipe pipe; +u16 red_fract, green_fract, blue_fract; +u32 red, green, blue, num_samples; +u32 word =0 ; +u32 count =0 ; +u32 cgm_gamma_reg =0 ; +u32 cgm_control_reg =0 ; +int ret =0 , length; +struct drm_r32g32b32 *correction_values =NULL ;You can drop the useless initialization of
correction_values. Same goes for patches 19 and 21.
Agree, thanks for pointing it out.
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c line 52
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+struct drm_palette *gamma_data; +struct drm_i915_private *dev_priv = dev->dev_private; + +if (WARN_ON (!blob)) +return -EINVAL ; + + gamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = gamma_data->num_samples; + length = num_samples *sizeof (struct drm_r32g32b32 );Calculation can overflow.
good catch, will take care of this.
Quoted 14 lines
drivers/gpu/drm/i915/intel_color_manager.c line 63
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c +11
-0+ +switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe - CGM Block */ + cgm_control_reg =I915_READ (_PIPE_CGM_CONTROL (pipe)); + cgm_control_reg &= ~CGM_GAMMA_EN ; +I915_WRITE (_PIPE_CGM_CONTROL (pipe), cgm_control_reg); + +DRM_DEBUG_DRIVER ("Gamma disabled on Pipe %c\n" , +pipe_name (pipe));Indentation looks wrong here.
Oops, bloody SI :).
Quoted 3 lines
drivers/gpu/drm/i915/intel_color_manager.c line 64
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ ret =0 ;Drop the variable and return 0, at the bottom of the function ?
Let me check this out.
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.c line 74
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+break ; + +case CHV_8BIT_GAMMA_MAX_VALS : +case CHV_10BIT_GAMMA_MAX_VALS : + + count =0 ; + cgm_gamma_reg =_PIPE_GAMMA_BASE (pipe); + correction_values = (struct drm_r32g32b32 *)&gamma_data->lut; + +while (count < num_samples) {Using for(i = 0;....) loop seems the more common approach ?
Nah, we are good with while. The whole color management series prefers while (and me too.... :))
Quoted 14 lines
[snip]
drivers/gpu/drm/i915/intel_color_manager.c line 117
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c +12
-0+/* +* On CHV, the best supported Gamma capability is +* CGM block, that takes 257 samples. +* If user gives 256 samples (legacy mode), then +* duplicate the 256th value to 257th. +* "flag" is used to make sure it happens only once +*/ +if (num_samples ==CHV_8BIT_GAMMA_MAX_VALS && + count ==CHV_8BIT_GAMMA_MAX_VALS && !flag) { + count--; + flag = true; + }
Quoted 2 lines
There is little point in going over this if statement 256 odd times. Split it out of the loop ?
Makes sense for sure, let me try this out.
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 124
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ } + +/* Enable (CGM) Gamma on Pipe */ +I915_WRITE (_PIPE_CGM_CONTROL (pipe), +I915_READ (_PIPE_CGM_CONTROL (pipe)) |CGM_GAMMA_EN ); +DRM_DEBUG_DRIVER ("CGM Gamma enabled on Pipe %c\n" , +pipe_name (pipe));Indentation.
Guilty.
Quoted 3 lines
Quoted 2 lines
+ ret = 0;
Drop the variable ?
Agree
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c line 130
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+break ; + +default : +DRM_ERROR ("Invalid number of samples for Gamma LUT\n" ); + ret = -EINVAL ;return
-EINVAL;
Agree
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c line 133
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+ } + +return ret;return 0;
Agree
Quoted 5 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 13/22] drm/i915: CHV: Pipe level Gamma correction
Quoted 20 lines · Shashank
Quoted 19 lines · Emil Velikov
Hi Shashank,
Quoted 14 lines · Shashank Sharma
CHV/BSW platform supports two different pipe level gamma correction modes, which are:
1. Legacy 8-bit mode
2. 10-bit CGM (Color Gamut Mapping) modeThis patch does the following:
1. Attaches Gamma property to CRTC
3. Adds the core Gamma correction function for CHV/BSW
4. Adds Gamma correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>---
[snip]
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+ length =
num_samples*sizeof(struct drm_r32g32b32);Calculation can overflow.
good catch, will take care of this.
Actually we do not at all here as the variable is unused. Same applies for patch 21/22.
[snip]
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+ while (count <
num_samples) {Using for(i = 0;....) loop seems the more common approach ?
Nah, we are good with while. The whole color management series prefers while (and me too.... :))
Hmm... so you'd prefer your approach/coding style over the one already in i915? Feels a bit strange but as long as others are happy fine go with it.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/22] drm/i915: CHV: Pipe level Gamma correction
Regards
Shashank
Quoted 21 lines · Emil Velikov
Quoted 12 lines · Shashank
Quoted 11 lines · Emil Velikov
Hi Shashank,
Quoted 6 lines · Shashank Sharma
CHV/BSW platform supports two different pipe level gamma correction modes, which are:
1. Legacy 8-bit mode
2. 10-bit CGM (Color Gamut Mapping) modeQuoted 8 lines
Quoted 8 lines
Quoted 8 lines
This patch does the following:
1. Attaches Gamma property to CRTC
3. Adds the core Gamma correction function for CHV/BSW
4. Adds Gamma correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>---
Quoted 9 lines
[snip]
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
+ length =
num_samples*sizeof(struct drm_r32g32b32);Calculation can overflow.
good catch, will take care of this.
Actually we do not at all here as the variable is unused. Same applies for patch 21/22.
Yep, Rob mentioned that in his comment, I have removed this in the latest patch set I have sent.
Quoted 11 lines
[snip]
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+ while (count <
num_samples) {Using for(i = 0;....) loop seems the more common approach ?
Nah, we are good with while. The whole color management series prefers while (and me too.... :))
Hmm... so you'd prefer your approach/coding style over the one already in i915? Feels a bit strange but as long as others are happy fine go with it.
I am not sure if I915 follows a general rule of using for(...) over while(), coz I see many instances of using a while in i915_gem, i915_drv, i915_irq etc, so it should be good. I would see if someone else can suggest another good reason.
Quoted 3 lines
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/22] drm/i915: CHV: Pipe level Gamma correction
Quoted 4 lines · Shashank
I am not sure if I915 follows a general rule of using for(...) over
while(), coz I see many instances of using a while ini915_gem,i915_drv,i915_irqetc, so it should be good. I would see if someone else can suggest another good reason.
I'm not saying "you should never use while loops", but more of "people use for loops when accessing arrays of information". I cannot see any cases of the latter in i915. Perhaps I'm looking at some old code ?
The point I'm trying to make here is that people are unlikely to make comments about such trivial nitpicks (bikeshedding), but new contributions should stick with the existing approach, rather than going for "I like XXX" :)
Take any and all of my with a grain of salt, just in case.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 13/22] drm/i915: CHV: Pipe level Gamma correction
Regards
Shashank
Quoted 10 lines · Emil Velikov
Quoted 4 lines · Shashank
I am not sure if I915 follows a general rule of using for(...) over
while(), coz I see many instances of using a while ini915_gem,i915_drv,i915_irqetc, so it should be good. I would see if someone else can suggest another good reason.I'm not saying "you should never use while loops", but more of "people use for loops when accessing arrays of information". I cannot see any cases of the latter in i915. Perhaps I'm looking at some old code ?
Quoted 7 lines
The point I'm trying to make here is that people are unlikely to make comments about such trivial nitpicks (bikeshedding), but new contributions should stick with the existing approach, rather than going for "I like XXX" :)
Take any and all of my with a grain of salt, just in case.
Its a very well written and logical comment, but I like this last line the most :) :)
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/22 drm/i915: CHV: Pipe level degamma correction
In reply to Shashank SharmaCHV/BSW supports Degamma color correction, which linearizes all the non-linear color values. This will be applied before Color Transformation.
This patch does the following:
1. Attach deGamma property to CRTC
2. Add the core function to program DeGamma correction values for CHV/BSW platform
2. Add DeGamma correction macros/defines
--- drivers/gpu/drm/i915/i915_reg.h | 6 ++ drivers/gpu/drm/i915/intel_color_manager.c | 93 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 5 ++ 3 files changed, 104 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +6 -0
@@ -8050,4 +8050,10 @@ enum skl_disp_power_wells {#define _PIPE_GAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_GAMMA, PIPEB_CGM_GAMMA, PIPEC_CGM_GAMMA)) +#define PIPEA_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x66000) +#define PIPEB_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x68000) +#define PIPEC_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x6A000) +#define _PIPE_DEGAMMA_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_color_manager.c +93 -0
103 lines not on this page · raw message
drivers/gpu/drm/i915/intel_color_manager.h +5 -0
@@ -63,5 +63,10 @@#define CHV_GAMMA_SHIFT_GREEN 16#define CHV_MAX_GAMMA ((1 << 24) - 1) +/* Degamma on CHV */ +#define CHV_DEGAMMA_MSB_SHIFT 2 +#define CHV_DEGAMMA_GREEN_SHIFT 16 +/* CHV CGM Block */ #define CGM_GAMMA_EN (1 << 2) +#define CGM_DEGAMMA_EN (1 << 0)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/22] drm/i915: CHV: Pipe level degamma correction
Hi Shashank,
Quoted 47 lines · Shashank Sharma
CHV/BSW supports Degamma color correction, which linearizes all the non-linear color values. This will be applied before Color Transformation.
This patch does the following:
1. Attach deGamma property to CRTC
2. Add the core function to program DeGamma correction values for CHV/BSW platform
2. Add DeGamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 6 ++ drivers/gpu/drm/i915/intel_color_manager.c | 93 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 5 ++ 3 files changed, 104 insertions(+)drivers/gpu/drm/i915/i915_reg.h +6
-0@@ -8050,4 +8050,10 @@ enum skl_disp_power_wells {#define _PIPE_GAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_GAMMA, PIPEB_CGM_GAMMA, PIPEC_CGM_GAMMA)) +#define PIPEA_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x66000) +#define PIPEB_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x68000) +#define PIPEC_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x6A000) +#define _PIPE_DEGAMMA_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +6
-0@@ -27,6 +27,93 @@#include "intel_color_manager.h" +static int chv_set_degamma (struct drm_device *dev, +struct drm_property_blob *blob,struct drm_crtc *crtc) +{ +u16 red_fract, green_fract, blue_fract; +u32 red, green, blue; +u32 num_samples;
drivers/gpu/drm/i915/intel_color_manager.c line 45
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+u32 word =0 ; +u32 count =0 ; +u32 cgm_control_reg =0 ; +u32 cgm_degamma_reg =0 ; +int length; +int ret =0 ; +enum pipe pipe; +struct drm_palette *degamma_data; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ;
Most of the above initializations can go.
drivers/gpu/drm/i915/intel_color_manager.c line 53
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c +8
-0+ +if (WARN_ON (!blob)) +return -EINVAL ; + + degamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = degamma_data->num_samples; + length = num_samples *sizeof (struct drm_r32g32b32 );
This can overflow.
drivers/gpu/drm/i915/intel_color_manager.c line 55
Quoted 2 lines
drivers/gpu/drm/i915/intel_color_manager.c +2
-0+ +if (num_samples ==GAMMA_DISABLE_VALS ) {
You've opted for switch statements in other patches. Why the if else ladder in here ?
drivers/gpu/drm/i915/intel_color_manager.c line 62
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+/* Disable DeGamma functionality on Pipe - CGM Block */ + cgm_control_reg =I915_READ (_PIPE_CGM_CONTROL (pipe)); + cgm_control_reg &= ~CGM_DEGAMMA_EN ; +I915_WRITE (_PIPE_CGM_CONTROL (pipe), cgm_control_reg); +DRM_DEBUG_DRIVER ("DeGamma disabled on Pipe %c\n" , +pipe_name (pipe)); + ret =0 ;
Drop the ret variable through the function ?
drivers/gpu/drm/i915/intel_color_manager.c line 68
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+ }else if (num_samples ==CHV_DEGAMMA_MAX_VALS ) { + cgm_degamma_reg =_PIPE_DEGAMMA_BASE (pipe); + + count =0 ; + correction_values = (struct drm_r32g32b32 *)°amma_data->lut; +while (count <CHV_DEGAMMA_MAX_VALS ) {
For loop ?
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 14/22] drm/i915: CHV: Pipe level degamma correction
Regards
Shashank
Quoted 53 lines · Emil Velikov
Hi Shashank,
Quoted 50 lines · Shashank Sharma
CHV/BSW supports Degamma color correction, which linearizes all the non-linear color values. This will be applied before Color Transformation.
This patch does the following:
1. Attach deGamma property to CRTC
2. Add the core function to program DeGamma correction values for CHV/BSW platform
2. Add DeGamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 6 ++ drivers/gpu/drm/i915/intel_color_manager.c | 93 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 5 ++ 3 files changed, 104 insertions(+)drivers/gpu/drm/i915/i915_reg.h +6
-0@@ -8050,4 +8050,10 @@ enum skl_disp_power_wells {#define _PIPE_GAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_GAMMA, PIPEB_CGM_GAMMA, PIPEC_CGM_GAMMA)) +#define PIPEA_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x66000) +#define PIPEB_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x68000) +#define PIPEC_CGM_DEGAMMA (VLV_DISPLAY_BASE + 0x6A000) +#define _PIPE_DEGAMMA_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +9
-0@@ -27,6 +27,93 @@#include "intel_color_manager.h" +static int chv_set_degamma (struct drm_device *dev, +struct drm_property_blob *blob,struct drm_crtc *crtc) +{ +u16 red_fract, green_fract, blue_fract; +u32 red, green, blue; +u32 num_samples; +u32 word =0 ; +u32 count =0 ; +u32 cgm_control_reg =0 ;
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c line 45
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+u32 cgm_degamma_reg =0 ; +int length; +int ret =0 ; +enum pipe pipe; +struct drm_palette *degamma_data; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ;Most of the above initializations can go.
Agree.
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c line 53
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c +8
-0+ +if (WARN_ON (!blob)) +return -EINVAL ; + + degamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = degamma_data->num_samples; + length = num_samples *sizeof (struct drm_r32g32b32 );This can overflow.
Agree
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c line 55
Quoted 3 lines
drivers/gpu/drm/i915/intel_color_manager.c +2
-0+ +if (num_samples ==GAMMA_DISABLE_VALS ) {You've opted for switch statements in other patches. Why the if else ladder in here ?
As a general programming rule, we tend to switch to switch, when no of if-else conditions is > 3, here its just 3, enable/disable/invalid so kept as if/else condition for simpler code.
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 62
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+/* Disable DeGamma functionality on Pipe - CGM Block */ + cgm_control_reg =I915_READ (_PIPE_CGM_CONTROL (pipe)); + cgm_control_reg &= ~CGM_DEGAMMA_EN ; +I915_WRITE (_PIPE_CGM_CONTROL (pipe), cgm_control_reg); +DRM_DEBUG_DRIVER ("DeGamma disabled on Pipe %c\n" , +pipe_name (pipe)); + ret =0 ;Drop the ret variable through the function ?
Agree
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c line 68
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+ }else if (num_samples ==CHV_DEGAMMA_MAX_VALS ) { + cgm_degamma_reg =_PIPE_DEGAMMA_BASE (pipe); + + count =0 ; + correction_values = (struct drm_r32g32b32 *)°amma_data->lut; +while (count <CHV_DEGAMMA_MAX_VALS ) {For loop ?
Will pass, prefer while.
Quoted 4 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 15/22 drm/i915: CHV: Pipe level CSC correction
In reply to Shashank SharmaCHV/BSW supports Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into CGM (Color Gamut Mapping) registers.
This patch does the following:
1. Attaches CSC property to CRTC
2. Adds the core function to program CSC correction values
3. Adds CSC correction macros
--- drivers/gpu/drm/i915/i915_reg.h | 8 +++ drivers/gpu/drm/i915/intel_color_manager.c | 94 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 19 ++++++ 3 files changed, 121 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +8 -0
@@ -8056,4 +8056,12 @@ enum skl_disp_power_wells {#define _PIPE_DEGAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#define PIPEA_CGM_CSC (VLV_DISPLAY_BASE + 0x67900) +#define PIPEB_CGM_CSC (VLV_DISPLAY_BASE + 0x69900) +#define PIPEC_CGM_CSC (VLV_DISPLAY_BASE + 0x6B900) +#define _PIPE_CSC_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) + + +#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_color_manager.c +94 -0
104 lines not on this page · raw message
drivers/gpu/drm/i915/intel_color_manager.h +19 -0
@@ -63,10 +63,29 @@#define CHV_GAMMA_SHIFT_GREEN 16#define CHV_MAX_GAMMA ((1 << 24) - 1) +/* +* CSC on CHV +* Fractional part is 32 bit, and we need only 12 MSBs for programming +* into registers. ROUNDOFF is required to minimize loss of precision. +*/ +#define CHV_CSC_FRACT_ROUNDOFF (1 << 19) +/* +* CSC values are 64-bit values. For CHV, the maximum CSC value that +* user can program is 7.99999..., which can be represented in fixed point +* S31.32 format like this, with all fractional bits as 1 +*/ +#define CHV_CSC_COEFF_MAX 0x00000007FFFFFFFF +#define CHV_CSC_COEFF_SHIFT 32 +#define CHV_CSC_COEFF_INT_SHIFT 28 +#define CSC_COEFF_SIGN (1 << 31) +#define CHV_CSC_COEFF_FRACT_SHIFT 4 +#define CSC_MAX_VALS 9 +/* Degamma on CHV */ #define CHV_DEGAMMA_MSB_SHIFT 2#define CHV_DEGAMMA_GREEN_SHIFT 16/* CHV CGM Block */ #define CGM_GAMMA_EN (1 << 2) +#define CGM_CSC_EN (1 << 1)#define CGM_DEGAMMA_EN (1 << 0)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/22] drm/i915: CHV: Pipe level CSC correction
Quoted 39 lines · Shashank Sharma
CHV/BSW supports Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into CGM (Color Gamut Mapping) registers.
This patch does the following:
1. Attaches CSC property to CRTC
2. Adds the core function to program CSC correction values
3. Adds CSC correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 8 +++ drivers/gpu/drm/i915/intel_color_manager.c | 94 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 19 ++++++ 3 files changed, 121 insertions(+)drivers/gpu/drm/i915/i915_reg.h +8
-0@@ -8056,4 +8056,12 @@ enum skl_disp_power_wells {#define _PIPE_DEGAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#define PIPEA_CGM_CSC (VLV_DISPLAY_BASE + 0x67900) +#define PIPEB_CGM_CSC (VLV_DISPLAY_BASE + 0x69900) +#define PIPEC_CGM_CSC (VLV_DISPLAY_BASE + 0x6B900) +#define _PIPE_CSC_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) + + +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +0
-0
drivers/gpu/drm/i915/intel_color_manager.c line 34
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0@@ -27,6 +27,93 @@#include "intel_color_manager.h" +static s16 chv_prepare_csc_coeff (s64 csc_value) +{ +s32 csc_int_value; +u32 csc_fract_value; +s16 csc_s3_12_format;
The type of csc_s3_12_format and chv_prepare_csc_coeff() does not see correct. Seem like the fix got merged into another patch :\
[snip]
Quoted 35 lines
drivers/gpu/drm/i915/intel_color_manager.c +35
-0+static int chv_set_csc (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{ +struct drm_ctm *csc_data; +struct drm_i915_private *dev_priv = dev->dev_private; +u32 reg; +enum pipe pipe; +s32 word =0 , temp; +int count =0 ; + +if (WARN_ON (!blob)) +return -EINVAL ; + +if (blob->length !=sizeof (struct drm_ctm )) { +DRM_ERROR ("Invalid length of data received\n" ); +return -EINVAL ; + } + + csc_data = (struct drm_ctm *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + +/* Disable CSC functionality */ + reg =_PIPE_CGM_CONTROL (pipe); +I915_WRITE (reg,I915_READ (reg) & (~CGM_CSC_EN )); + +DRM_DEBUG_DRIVER ("Disabled CSC Functionality on Pipe %c\n" , +pipe_name (pipe)); + + reg =_PIPE_CSC_BASE (pipe); +while (count <CSC_MAX_VALS ) { + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),0 ,16 ); + +/*
drivers/gpu/drm/i915/intel_color_manager.c line 104
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+* Last value to be written in 1 register. +* Otherwise, each pair of CSC values go +* into 1 register +*/ +if (count != (CSC_MAX_VALS -1 )) { + count++; + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),16 ,16 ); + }
This looks a bit odd. Use the same approach as inbdw_write_12bit_gamma_precision() ?
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 15/22] drm/i915: CHV: Pipe level CSC correction
Regards
Shashank
Quoted 43 lines · Emil Velikov
Quoted 42 lines · Shashank Sharma
CHV/BSW supports Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into CGM (Color Gamut Mapping) registers.
This patch does the following:
1. Attaches CSC property to CRTC
2. Adds the core function to program CSC correction values
3. Adds CSC correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 8 +++ drivers/gpu/drm/i915/intel_color_manager.c | 94 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 19 ++++++ 3 files changed, 121 insertions(+)drivers/gpu/drm/i915/i915_reg.h +8
-0@@ -8056,4 +8056,12 @@ enum skl_disp_power_wells {#define _PIPE_DEGAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#define PIPEA_CGM_CSC (VLV_DISPLAY_BASE + 0x67900) +#define PIPEB_CGM_CSC (VLV_DISPLAY_BASE + 0x69900) +#define PIPEC_CGM_CSC (VLV_DISPLAY_BASE + 0x6B900) +#define _PIPE_CSC_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) + + +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -27,6 +27,93 @@#include "intel_color_manager.h"
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c line 34
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+static s16 chv_prepare_csc_coeff (s64 csc_value) +{ +s32 csc_int_value; +u32 csc_fract_value; +s16 csc_s3_12_format;The type of
csc_s3_12_formatandchv_prepare_csc_coeff()does not see correct. Seem like the fix got merged into another patch :\
Can you please elaborate this comment, I dont get it.
Quoted 40 lines
[snip]
Quoted 39 lines
drivers/gpu/drm/i915/intel_color_manager.c +39
-0+static int chv_set_csc (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{ +struct drm_ctm *csc_data; +struct drm_i915_private *dev_priv = dev->dev_private; +u32 reg; +enum pipe pipe; +s32 word =0 , temp; +int count =0 ; + +if (WARN_ON (!blob)) +return -EINVAL ; + +if (blob->length !=sizeof (struct drm_ctm )) { +DRM_ERROR ("Invalid length of data received\n" ); +return -EINVAL ; + } + + csc_data = (struct drm_ctm *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + +/* Disable CSC functionality */ + reg =_PIPE_CGM_CONTROL (pipe); +I915_WRITE (reg,I915_READ (reg) & (~CGM_CSC_EN )); + +DRM_DEBUG_DRIVER ("Disabled CSC Functionality on Pipe %c\n" , +pipe_name (pipe)); + + reg =_PIPE_CSC_BASE (pipe); +while (count <CSC_MAX_VALS ) { + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),0 ,16 ); + +/* +* Last value to be written in 1 register. +* Otherwise, each pair of CSC values go +* into 1 register +*/
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c line 104
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+if (count != (CSC_MAX_VALS -1 )) { + count++; + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),16 ,16 ); + }This looks a bit odd. Use the same approach as in
bdw_write_12bit_gamma_precision()?
Again, can you please give little more details here ?
Quoted 4 lines
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 15/22] drm/i915: CHV: Pipe level CSC correction
Quoted 63 lines · Shashank
Quoted 53 lines · Emil Velikov
Quoted 50 lines · Shashank Sharma
CHV/BSW supports Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into CGM (Color Gamut Mapping) registers.
This patch does the following:
1. Attaches CSC property to CRTC
2. Adds the core function to program CSC correction values
3. Adds CSC correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 8 +++ drivers/gpu/drm/i915/intel_color_manager.c | 94 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 19 ++++++ 3 files changed, 121 insertions(+)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -8056,4 +8056,12 @@ enum skl_disp_power_wells {#define _PIPE_DEGAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#define PIPEA_CGM_CSC (VLV_DISPLAY_BASE +
0x67900)
+#definePIPEB_CGM_CSC(VLV_DISPLAY_BASE+0x69900)
+#definePIPEC_CGM_CSC(VLV_DISPLAY_BASE+0x6B900)drivers/gpu/drm/i915/i915_reg.h +5
-0+#define _PIPE_CSC_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) + + +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -27,6 +27,93 @@#include "intel_color_manager.h" Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 34
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+static s16 chv_prepare_csc_coeff (s64 csc_value) +{ +s32 csc_int_value; +u32 csc_fract_value; +s16 csc_s3_12_format;The type of
csc_s3_12_formatandchv_prepare_csc_coeff()does not see correct. Seem like the fix got merged into another patch :\
Quoted 2 lines
Can you please elaborate this comment, I dont get it.
You have two typos above s16 > s32 which you've fixed in the next patch. That fix should belong here imho.
[snip]
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_color_manager.c +16
-0+while (count <CSC_MAX_VALS ) { + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),0 ,16 ); + +/* +* Last value to be written in 1 register. +* Otherwise, each pair of CSC values go +* into 1 register +*/ +if (count != (CSC_MAX_VALS -1 )) { + count++; + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),16 ,16 ); + }
Quoted 4 lines
Quoted 2 lines
This looks a bit odd. Use the same approach as in
bdw_write_12bit_gamma_precision()?Again, can you please give little more details here ?
Take a look at the loop construct in bdw_write_12bit_gamma_precision()
- both of them are essentially doing the same thing.
Here you havewhile(i < odd_number) {
foo()
if (if != odd_number-1) {
I++
foo() }
}
while in the mentioned function
while (i < odd_number -1) {
foo()
foo()
i++
}foo()
Normally you'd use one or the other. Esp. since this is a single patchset :-) I'm leaning towards the latter as it's more obvious but others may prefer the former approach.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 15/22] drm/i915: CHV: Pipe level CSC correction
Regards
Shashank
Quoted 64 lines · Emil Velikov
Quoted 63 lines · Shashank
Quoted 62 lines · Emil Velikov
Quoted 47 lines · Shashank Sharma
CHV/BSW supports Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into CGM (Color Gamut Mapping) registers.
This patch does the following:
1. Attaches CSC property to CRTC
2. Adds the core function to program CSC correction values
3. Adds CSC correction macrosSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 8 +++ drivers/gpu/drm/i915/intel_color_manager.c | 94 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 19 ++++++ 3 files changed, 121 insertions(+)drivers/gpu/drm/i915/i915_reg.h +1
-0@@ -8056,4 +8056,12 @@ enum skl_disp_power_wells {#define _PIPE_DEGAMMA_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_DEGAMMA, PIPEB_CGM_DEGAMMA, PIPEC_CGM_DEGAMMA)) +#define PIPEA_CGM_CSC (VLV_DISPLAY_BASE +
0x67900)
+#definePIPEB_CGM_CSC(VLV_DISPLAY_BASE+0x69900)
+#definePIPEC_CGM_CSC(VLV_DISPLAY_BASE+0x6B900)drivers/gpu/drm/i915/i915_reg.h +5
-0+#define _PIPE_CSC_BASE (pipe) \ + (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) + + +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +0
-0drivers/gpu/drm/i915/intel_color_manager.c line 34
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0@@ -27,6 +27,93 @@#include "intel_color_manager.h" +static s16 chv_prepare_csc_coeff (s64 csc_value) +{ +s32 csc_int_value; +u32 csc_fract_value; +s16 csc_s3_12_format;The type of
csc_s3_12_formatandchv_prepare_csc_coeff()does not see correct. Seem like the fix got merged into another patch :\
Quoted 5 lines
Quoted 2 lines
Can you please elaborate this comment, I dont get it.
You have two typos above s16 > s32 which you've fixed in the next patch. That fix should belong here imho.
Yes, I got that later, current patch set contains this fix.
Quoted 41 lines
[snip]
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_color_manager.c +16
-0+while (count <CSC_MAX_VALS ) { + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),0 ,16 ); + +/* +* Last value to be written in 1 register. +* Otherwise, each pair of CSC values go +* into 1 register +*/ +if (count != (CSC_MAX_VALS -1 )) { + count++; + temp =chv_prepare_csc_coeff ( + csc_data->ctm_coeff[count]); +SET_BITS (word,GET_BITS (temp,16 ,16 ),16 ,16 ); + }Quoted 4 lines
Quoted 2 lines
This looks a bit odd. Use the same approach as in
bdw_write_12bit_gamma_precision()?Again, can you please give little more details here ?
Take a look at the loop construct in
bdw_write_12bit_gamma_precision()
- both of them are essentially doing the same thing.Here you have
while(i < odd_number) { foo() if (if != odd_number-1) { I++ foo() } }while in the mentioned function
while (i < odd_number -1) { foo() foo() i++ }
Quoted 6 lines
foo()Normally you'd use one or the other. Esp. since this is a single patchset :-) I'm leaning towards the latter as it's more obvious but others may prefer the former approach.
Yes, I got this one also, later :). New patch set has an implementation similar to this, please have a look.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 16/22 drm/i915: Commit color correction to CRTC
In reply to Shashank SharmaThe color correction blob values are loaded during set_property calls. This patch adds a function to find the blob and apply the correction values to the display registers, during the atomic commit call.
--- drivers/gpu/drm/i915/intel_color_manager.c | 44 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++ 3 files changed, 49 insertions(+)
drivers/gpu/drm/i915/intel_color_manager.c +44 -0
@@ -307,6 +307,50 @@ static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,return ret; } +void intel_color_manager_crtc_commit (struct drm_device *dev, +struct drm_crtc_state *crtc_state) +{ +struct drm_property_blob *blob; +struct drm_crtc *crtc = crtc_state->crtc; +int ret = -EINVAL ; + + blob = crtc_state->palette_after_ctm_blob; +if (blob) { +/* Gamma correction is platform specific */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_gamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set Gamma correction failed\n" ); +else +DRM_DEBUG_DRIVER ("Gamma correction success\n" ); + } + + blob = crtc_state->palette_before_ctm_blob; +if (blob) { +/* Degamma correction */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_degamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set degamma correction failed\n" ); +else +DRM_DEBUG_DRIVER ("degamma correction success\n" ); + } + + blob = crtc_state->ctm_blob; +if (blob) { +/* CSC correction */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_csc (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set CSC correction failed\n" ); +else +DRM_DEBUG_DRIVER ("CSC correction success\n" ); + } +} +void intel_attach_color_properties_to_crtc (struct drm_device *dev,struct drm_crtc *crtc) {
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -13528,6 +13528,8 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,intel_update_pipe_config (intel_crtc, old_intel_state); else if (INTEL_INFO(dev)->gen >= 9) skl_detach_scalers(intel_crtc); + +intel_color_manager_crtc_commit (dev, crtc->state); } static void intel_finish_crtc_commit(struct drm_crtc *crtc,
drivers/gpu/drm/i915/intel_drv.h +3 -0
@@ -1469,4 +1469,7 @@ void intel_plane_destroy_state(struct drm_plane *plane, struct drm_plane_state *state);extern const struct drm_plane_helper_funcs intel_plane_helper_funcs; +/* intel_color_mnager.c */ +void intel_color_manager_crtc_commit (struct drm_device *dev, +struct drm_crtc_state *crtc_state);#endif /* __INTEL_DRV_H__ */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 16/22] drm/i915: Commit color correction to CRTC
Hi Shashank,
Quoted 18 lines · Shashank Sharma
The color correction blob values are loaded during
set_propertycalls. This patch adds a function to find the blob and apply the correction values to the display registers, during the atomic commit call.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 44 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++ 3 files changed, 49 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +0
-0
drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 315
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0@@ -307,6 +307,50 @@ static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,return ret; } +void intel_color_manager_crtc_commit (struct drm_device *dev, +struct drm_crtc_state *crtc_state) +{ +struct drm_property_blob *blob; +struct drm_crtc *crtc = crtc_state->crtc; +int ret = -EINVAL ;
Most places/people advise against pre-emptively initializing ret.
drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 324
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ + blob = crtc_state->palette_after_ctm_blob; +if (blob) { +/* Gamma correction is platform specific */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_gamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set Gamma correction failed\n" );
Do we really want to spam dmesg on for each non Cherryview device ?
Quoted 50 lines
drivers/gpu/drm/i915/intel_color_manager.c +29
-0+else +DRM_DEBUG_DRIVER ("Gamma correction success\n" ); + } + + blob = crtc_state->palette_before_ctm_blob; +if (blob) { +/* Degamma correction */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_degamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set degamma correction failed\n" ); +else +DRM_DEBUG_DRIVER ("degamma correction success\n" ); + } + + blob = crtc_state->ctm_blob; +if (blob) { +/* CSC correction */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_csc (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set CSC correction failed\n" ); +else +DRM_DEBUG_DRIVER ("CSC correction success\n" ); + } +} +void intel_attach_color_properties_to_crtc (struct drm_device *dev,struct drm_crtc *crtc) {drivers/gpu/drm/i915/intel_display.c +2
-0@@ -13528,6 +13528,8 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,intel_update_pipe_config (intel_crtc, old_intel_state); else if (INTEL_INFO(dev)->gen >= 9) skl_detach_scalers(intel_crtc); + +intel_color_manager_crtc_commit (dev, crtc->state); } static void intel_finish_crtc_commit(struct drm_crtc *crtc,drivers/gpu/drm/i915/intel_drv.h +0
-0
drivers/gpu/drm/i915/intel_drv.h void intel_plane_destroy_state(struct drm_plane *plane, · line 1472
Quoted 4 lines
drivers/gpu/drm/i915/intel_drv.h +1
-0@@ -1469,4 +1469,7 @@ void intel_plane_destroy_state(struct drm_plane *plane, struct drm_plane_state *state);extern const struct drm_plane_helper_funcs intel_plane_helper_funcs; +/* intel_color_mnager.c */
Typo -> manager.
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 16/22] drm/i915: Commit color correction to CRTC
Regards
Shashank
Quoted 24 lines · Emil Velikov
Hi Shashank,
Quoted 21 lines · Shashank Sharma
The color correction blob values are loaded during
set_propertycalls. This patch adds a function to find the blob and apply the correction values to the display registers, during the atomic commit call.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 44 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++ 3 files changed, 49 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -307,6 +307,50 @@ static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,return ret; }
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 315
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+void intel_color_manager_crtc_commit (struct drm_device *dev, +struct drm_crtc_state *crtc_state) +{ +struct drm_property_blob *blob; +struct drm_crtc *crtc = crtc_state->crtc; +int ret = -EINVAL ;Most places/people advise against pre-emptively initializing ret.
Just in this case, if makes sense to keep one, coz there might be multiple blobs which we are applying in the commit action, and every blob can return error, from the core function. Assume that there is a situation where both palette_after_ctm(gamma) and CTM is in place, then we will be going through multiple if() cases and have to check the return values.
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 324
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ + blob = crtc_state->palette_after_ctm_blob; +if (blob) { +/* Gamma correction is platform specific */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_gamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set Gamma correction failed\n" );Do we really want to spam dmesg on for each non Cherryview device ?
If you see the complete implementation, as IS_GEN8()/IS_SKL is coming up here after IS_CHV(patch 19,20,21) which will cover BDW/SKL/BXT. Anything else which comes here, deserves a DRM_ERROR() as this platform will not be supported.
Quoted 54 lines
Quoted 54 lines
drivers/gpu/drm/i915/intel_color_manager.c +29
-0+else +DRM_DEBUG_DRIVER ("Gamma correction success\n" ); + } + + blob = crtc_state->palette_before_ctm_blob; +if (blob) { +/* Degamma correction */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_degamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set degamma correction failed\n" ); +else +DRM_DEBUG_DRIVER ("degamma correction success\n" ); + } + + blob = crtc_state->ctm_blob; +if (blob) { +/* CSC correction */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_csc (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set CSC correction failed\n" ); +else +DRM_DEBUG_DRIVER ("CSC correction success\n" ); + } +} +void intel_attach_color_properties_to_crtc (struct drm_device *dev,struct drm_crtc *crtc) {drivers/gpu/drm/i915/intel_display.c +2
-0@@ -13528,6 +13528,8 @@ static void intel_begin_crtc_commit(struct drm_crtc *crtc,intel_update_pipe_config (intel_crtc, old_intel_state); else if (INTEL_INFO(dev)->gen >= 9) skl_detach_scalers(intel_crtc); + +intel_color_manager_crtc_commit (dev, crtc->state); } static void intel_finish_crtc_commit(struct drm_crtc *crtc,drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -1469,4 +1469,7 @@ void intel_plane_destroy_state(struct drm_plane *plane, struct drm_plane_state *state);extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;
Quoted 3 lines
drivers/gpu/drm/i915/intel_drv.h void intel_plane_destroy_state(struct drm_plane *plane, · line 1472
Quoted 1 line
drivers/gpu/drm/i915/intel_drv.h +1
-0+/* intel_color_mnager.c */ Typo -> manager.
Oops, thanks.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 16/22] drm/i915: Commit color correction to CRTC
Quoted 40 lines · Shashank
Quoted 30 lines · Emil Velikov
Hi Shashank,
Quoted 25 lines · Shashank Sharma
The color correction blob values are loaded during
set_propertycalls. This patch adds a function to find the blob and apply the correction values to the display registers, during the atomic commit call.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 44 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++ 3 files changed, 49 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -307,6 +307,50 @@ static int chv_set_gamma(struct drm_device *dev,struct drm_property_blob *blob, return ret; }Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 315
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+void intel_color_manager_crtc_commit (struct drm_device *dev, +struct drm_crtc_state *crtc_state) +{ +struct drm_property_blob *blob; +struct drm_crtc *crtc = crtc_state->crtc; +int ret = -EINVAL ;Most places/people advise against pre-emptively initializing ret.
Quoted 6 lines
Just in this case, if makes sense to keep one, coz there might be multiple blobs which we are applying in the commit action, and every blob can return error, from the core function.
Assume that there is a situation where bothpalette_after_ctm(gamma)and CTM is in place, then we will be going through multipleif()cases and have to check the return values.
When you have an exception of any rule, this implies that you are using a suboptimal way of doing things.
Quoted 13 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 324
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ + blob = crtc_state->palette_after_ctm_blob; +if (blob) { +/* Gamma correction is platform specific */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_gamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set Gamma correction failed\n" );Do we really want to spam dmesg on for each non Cherryview device ?
Quoted 5 lines
If you see the complete implementation, as IS_GEN8()/IS_SKL is coming up here after
IS_CHV(patch 19,20,21)which will cover BDW/SKL/BXT. Anything else which comes here, deserves aDRM_ERROR()as this platform will not be supported.
Your patches should be independent changes. You cannot say "I'm adding something iffy here, but it will be fixed with another patch". Otherwise you'll get developer/user X bisecting the kernel, which will end up with broken system (flooded dmesg in this case) half way through the bisect.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 16/22] drm/i915: Commit color correction to CRTC
Regards
Shashank
Quoted 41 lines · Emil Velikov
Quoted 40 lines · Shashank
Quoted 39 lines · Emil Velikov
Hi Shashank,
Quoted 21 lines · Shashank Sharma
The color correction blob values are loaded during
set_propertycalls. This patch adds a function to find the blob and apply the correction values to the display registers, during the atomic commit call.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 44 ++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_display.c | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 3 ++ 3 files changed, 49 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +0
-0drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, · line 316
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0@@ -307,6 +307,50 @@ static int chv_set_gamma(struct drm_device *dev,struct drm_property_blob *blob, return ret; } +void intel_color_manager_crtc_commit (struct drm_device *dev, +struct drm_crtc_state *crtc_state) +{ +struct drm_property_blob *blob; +struct drm_crtc *crtc = crtc_state->crtc; +int ret = -EINVAL ;Most places/people advise against pre-emptively initializing ret.
Quoted 9 lines
Quoted 6 lines
Just in this case, if makes sense to keep one, coz there might be multiple blobs which we are applying in the commit action, and every blob can return error, from the core function.
Assume that there is a situation where bothpalette_after_ctm(gamma)and CTM is in place, then we will be going through multipleif()cases and have to check the return values.When you have an exception of any rule, this implies that you are using a suboptimal way of doing things.
Not sure, but if you think its that serious, I will gladly change it to as you suggested :)
Quoted 18 lines
Quoted 13 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c static int chv_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 324
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ + blob = crtc_state->palette_after_ctm_blob; +if (blob) { +/* Gamma correction is platform specific */ +if (IS_CHERRYVIEW (dev)) + ret =chv_set_gamma (dev, blob, crtc); + +if (ret) +DRM_ERROR ("set Gamma correction failed\n" );Do we really want to spam dmesg on for each non Cherryview device ?
Quoted 5 lines
If you see the complete implementation, as IS_GEN8()/IS_SKL is coming up here after
IS_CHV(patch 19,20,21)which will cover BDW/SKL/BXT. Anything else which comes here, deserves aDRM_ERROR()as this platform will not be supported.
Quoted 6 lines
Your patches should be independent changes. You cannot say "I'm adding something iffy here, but it will be fixed with another patch". Otherwise you'll get developer/user X bisecting the kernel, which will end up with broken system (flooded dmesg in this case) half way through the bisect.
There is no confusion here, and its an independent change.
Till this patch, we have color management implemented for CHV only and any other platforms, should not even register this property, so naturally it must not hit this part of code. If its hitting, yes I would like to show this DRM_ERROR. So there is nothing wrong even if we bisect.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 17/22 drm/i915: Attach color properties to CRTC
In reply to Shashank SharmaFunction intel_attach_color_properties_to_crtc attaches a color property to its CRTC object. This patch calls this function from crtc initialization sequence.
--- drivers/gpu/drm/i915/intel_display.c | 1 + drivers/gpu/drm/i915/intel_drv.h | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/i915/intel_display.c +1 -0
@@ -13859,6 +13859,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) intel_crtc->cursor_size = ~0 ; intel_crtc->wm.cxsr_allowed = true; +intel_attach_color_properties_to_crtc (dev, &intel_crtc->base);BUG_ON (pipe >=ARRAY_SIZE (dev_priv->plane_to_crtc_mapping) || dev_priv->plane_to_crtc_mapping[intel_crtc->plane] !=NULL );
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1472,4 +1472,6 @@ extern const struct drm_plane_helper_funcs intel_plane_helper_funcs;/* intel_color_mnager.c */ void intel_color_manager_crtc_commit (struct drm_device *dev,struct drm_crtc_state *crtc_state); +void intel_attach_color_properties_to_crtc (struct drm_device *dev, +struct drm_crtc *crtc);#endif /* __INTEL_DRV_H__ */
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 17/22] drm/i915: Attach color properties to CRTC
Quoted 6 lines · Shashank Sharma
Function
intel_attach_color_properties_to_crtcattaches a color property to its CRTC object. This patch calls this function from crtc initialization sequence.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>
Maybe squash this with patch 10, following the pattern set by other patches ?
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 17/22] drm/i915: Attach color properties to CRTC
Regards
Shashank
Quoted 9 lines · Emil Velikov
Quoted 6 lines · Shashank Sharma
Function
intel_attach_color_properties_to_crtcattaches a color property to its CRTC object. This patch calls this function from crtc initialization sequence.Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Maybe squash this with patch 10, following the pattern set by other patches ?
As explained in the previous patch, attaching the property is like enabling the framework. It was Matt's comment to do it, only when atleast one platform is ready. That's why we added this patch after CHV implementation is completed.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 18/22 drm/i915: BDW: Load gamma correction values
In reply to Shashank SharmaI915 color manager registers pipe gamma correction as palette correction after CTM property.
For BDW and higher platforms, split gamma correction is the best gamma correction. This patch adds the no of coefficients(512) for split gamma correction as "num_samples_after_ctm" parameter in device info structures, for all of those.
--- drivers/gpu/drm/i915/i915_drv.c | 7 +++++++ drivers/gpu/drm/i915/intel_color_manager.h | 3 +++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +7 -0
@@ -302,6 +302,7 @@ static const struct intel_device_info intel_broadwell_d_info = { .gen = 8, .num_pipes = 3, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, + .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -314,6 +315,7 @@ static const struct intel_device_info intel_broadwell_m_info = { .gen = 8, .is_mobile = 1, .num_pipes = 3, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, + .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -326,6 +328,7 @@ static const struct intel_device_info intel_broadwell_gt3d_info = { .gen = 8, .num_pipes = 3, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, + .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -338,6 +341,7 @@ static const struct intel_device_info intel_broadwell_gt3m_info = { .gen = 8, .is_mobile = 1, .num_pipes = 3, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, + .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -363,6 +367,7 @@ static const struct intel_device_info intel_skylake_info = { .gen = 9, .num_pipes = 3, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, + .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -376,6 +381,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { .gen = 9, .num_pipes = 3, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, + .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -389,6 +395,7 @@ static const struct intel_device_info intel_broxton_info = { .gen = 9, .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, + .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, .num_pipes = 3, .has_ddi = 1, .has_fpga_dbg = 1,
drivers/gpu/drm/i915/intel_color_manager.h +3 -0
@@ -89,3 +89,6 @@#define CGM_GAMMA_EN (1 << 2)#define CGM_CSC_EN (1 << 1)#define CGM_DEGAMMA_EN (1 << 0) + +/* Gamma on BDW */ +#define BDW_SPLITGAMMA_MAX_VALS 512
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 19/22 drm/i915: BDW: Pipe level Gamma correction
In reply to Shashank SharmaBDW/SKL/BXT platforms support various Gamma correction modes which are:
1. Legacy 8-bit mode
2. 10-bit Split Gamma mode
3. 12-bit mode
This patch does the following:
1. Adds the core function to program Gamma correction values for BDW/SKL/BXT platforms
2. Adds Gamma correction macros/defines
--- drivers/gpu/drm/i915/i915_reg.h | 25 ++- drivers/gpu/drm/i915/intel_color_manager.c | 248 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 6 + 3 files changed, 277 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +23 -2
@@ -5647,11 +5647,15 @@ enum skl_disp_power_wells {/* legacy palette */ #define _LGC_PALETTE_A 0x4a000#define _LGC_PALETTE_B 0x4a800 -#define LGC_PALETTE (pipe, i) (_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4) +#define _LGC_PALETTE_C 0x4b000 +#define LGC_PALETTE (pipe, i) (_PIPE3(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B, \ + _LGC_PALETTE_C) + (i) * 4)#define _GAMMA_MODE_A 0x4a480#define _GAMMA_MODE_B 0x4ac80 -#define GAMMA_MODE (pipe) _PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B) +#define _GAMMA_MODE_C 0x4b480 +#define GAMMA_MODE (pipe) \ + _PIPE3(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B, _GAMMA_MODE_C)#define GAMMA_MODE_MODE_MASK (3 << 0)#define GAMMA_MODE_MODE_8BIT (0 << 0)#define GAMMA_MODE_MODE_10BIT (1 << 0)
@@ -8062,6 +8066,23 @@ enum skl_disp_power_wells {#define _PIPE_CSC_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) +/* BDW gamma correction */ +#define PAL_PREC_INDEX_A 0x4A400 +#define PAL_PREC_INDEX_B 0x4AC00 +#define PAL_PREC_INDEX_C 0x4B400 +#define PAL_PREC_DATA_A 0x4A404 +#define PAL_PREC_DATA_B 0x4AC04 +#define PAL_PREC_DATA_C 0x4B404 +#define PAL_PREC_GCMAX_A 0x4A410 +#define PAL_PREC_GCMAX_B 0x4AC10 +#define PAL_PREC_GCMAX_C 0x4B410 + +#define _PREC_PAL_INDEX (pipe) \ + (_PIPE3(pipe, PAL_PREC_INDEX_A, PAL_PREC_INDEX_B, PAL_PREC_INDEX_C)) +#define _PREC_PAL_DATA (pipe) \ + (_PIPE3(pipe, PAL_PREC_DATA_A, PAL_PREC_DATA_B, PAL_PREC_DATA_C)) +#define _PREC_PAL_GCMAX (pipe) \ + (_PIPE3(pipe, PAL_PREC_GCMAX_A, PAL_PREC_GCMAX_B, PAL_PREC_GCMAX_C))#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_color_manager.c +248 -0
260 lines not on this page · raw message
drivers/gpu/drm/i915/intel_color_manager.h +6 -0
@@ -92,3 +92,9 @@/* Gamma on BDW */ #define BDW_SPLITGAMMA_MAX_VALS 512 +#define BDW_8BIT_GAMMA_MAX_VALS 256 +#define BDW_10BIT_GAMMA_MAX_VALS 1024 +#define BDW_12BIT_GAMMA_MAX_VALS 513 +#define BDW_MAX_GAMMA ((1 << 24) - 1) +#define BDW_INDEX_AUTO_INCREMENT (1 << 15) +#define BDW_INDEX_SPLIT_MODE (1 << 31)
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/22] drm/i915: BDW: Pipe level Gamma correction
Hi Shashank,
On 9 October 2015 at 20:29, Shashank Sharma <[email protected]> wrote:
[snip]
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c +1
-0@@ -26,6 +26,252 @@*/ #include "intel_color_manager.h" +static void bdw_write_10bit_gamma_precision(struct drm_device *dev,
drivers/gpu/drm/i915/intel_color_manager.c line 39
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+ struct drm_r32g32b32 *correction_values, u32 pal_prec_data, + u32 no_of_coeff) +{ + u16 blue_fract, green_fract, red_fract; +u32 word =0 ; +u32 count =0 ; +u32 blue, green, red; +struct drm_i915_private *dev_priv = dev->dev_private; + +while (count < no_of_coeff) {
Use for loop ? Here and through the rest of the patch.
[snip]
drivers/gpu/drm/i915/intel_color_manager.c line 81
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+void bdw_write_12bit_gamma_precision (struct drm_device *dev, +struct drm_r32g32b32 *correction_values,u32 pal_prec_data, +enum pipe pipe) +{
Make the function static ?
[snip]
Quoted 22 lines
drivers/gpu/drm/i915/intel_color_manager.c +22
-0+static int bdw_set_gamma (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{ +u16 blue_fract, green_fract, red_fract; +enum pipe pipe; +int count, num_samples; +u32 blue, green, red; +u32 mode, pal_prec_index, pal_prec_data; +u32 index; +u32 word =0 ; +struct drm_palette *gamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + gamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = gamma_data->num_samples; +
drivers/gpu/drm/i915/intel_color_manager.c line 199
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+ pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)&gamma_data->lut; + index =I915_READ (pal_prec_index); + +switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe */
Drop the extra newline between the case and the comment ? Here and below.
[snip]
drivers/gpu/drm/i915/intel_color_manager.c line 272
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+ mode =I915_READ (GAMMA_MODE (pipe)); + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode | word); +DRM_DEBUG_DRIVER ("Gamma applied on pipe %c\n" , +pipe_name (pipe));
Indentation seems off here.
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 19/22] drm/i915: BDW: Pipe level Gamma correction
Regards
Shashank
Quoted 11 lines · Emil Velikov
Hi Shashank,
On 9 October 2015 at 20:29, Shashank Sharma <[email protected]> wrote:
[snip]Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -26,6 +26,252 @@*/
Quoted 14 lines
drivers/gpu/drm/i915/intel_color_manager.c line 39
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c +11
-0#include "intel_color_manager.h" +static void bdw_write_10bit_gamma_precision (struct drm_device *dev, +struct drm_r32g32b32 *correction_values,u32 pal_prec_data, +u32 no_of_coeff) +{ +u16 blue_fract, green_fract, red_fract; +u32 word =0 ; +u32 count =0 ; +u32 blue, green, red; +struct drm_i915_private *dev_priv = dev->dev_private; + +while (count < no_of_coeff) {Use for loop ? Here and through the rest of the patch.
Nah, I will prefer while().
Quoted 8 lines
[snip]
drivers/gpu/drm/i915/intel_color_manager.c line 81
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+void bdw_write_12bit_gamma_precision (struct drm_device *dev, +struct drm_r32g32b32 *correction_values,u32 pal_prec_data, +enum pipe pipe) +{Make the function static ?
Agree.
Quoted 26 lines
[snip]
Quoted 25 lines
drivers/gpu/drm/i915/intel_color_manager.c +25
-0+static int bdw_set_gamma (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{ +u16 blue_fract, green_fract, red_fract; +enum pipe pipe; +int count, num_samples; +u32 blue, green, red; +u32 mode, pal_prec_index, pal_prec_data; +u32 index; +u32 word =0 ; +struct drm_palette *gamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + gamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = gamma_data->num_samples; + + pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); +
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 199
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ correction_values = (struct drm_r32g32b32 *)&gamma_data->lut; + index =I915_READ (pal_prec_index); + +switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe */ Drop the extra newline between the case and the comment ? Here and below.
I was trying to make it look good :(
Quoted 8 lines
[snip]
drivers/gpu/drm/i915/intel_color_manager.c line 272
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+ mode =I915_READ (GAMMA_MODE (pipe)); + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode | word); +DRM_DEBUG_DRIVER ("Gamma applied on pipe %c\n" , +pipe_name (pipe));Indentation seems off here.
Agree.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 19/22] drm/i915: BDW: Pipe level Gamma correction
Quoted 5 lines · Shashank
Quoted 4 lines · Emil Velikov
Hi Shashank,
On 9 October 2015 at 20:29, Shashank Sharma <[email protected]>
[snip]
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c line 199
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe */ Drop the extra newline between the case and the comment ? Here and below.
I was trying to make it look good :(
Beauty is in the eye of the beholder. The most important part here is consistency.
Afaict there isn't (m)any i915 code the uses this approach, is there ? Some of your other patches use this approach while others don't.
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 19/22] drm/i915: BDW: Pipe level Gamma correction
Regards
Shashank
Quoted 12 lines · Emil Velikov
Quoted 5 lines · Shashank
Quoted 4 lines · Emil Velikov
Hi Shashank,
On 9 October 2015 at 20:29, Shashank Sharma <[email protected]>
[snip]
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe */
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Drop the extra newline between the case and the comment ? Here and below.
I was trying to make it look good :(
Beauty is in the eye of the beholder. The most important part here is consistency.
Afaict there isn't (m)any i915 code the uses this approach, is there ? Some of your other patches use this approach while others don't.
I prefer to leave one extra line when I have a comment, so that comment is more visible, instead of being sandwiched between lines of C code. May be I missed some places, so I can make it consistent.
Quoted 3 lines
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 19/22] drm/i915: BDW: Pipe level Gamma correction
In reply to Shashank SharmaQuoted 101 lines · Shashank Sharma
BDW/SKL/BXT platforms support various Gamma correction modes which are:
1. Legacy 8-bit mode
2. 10-bit Split Gamma mode
3. 12-bit modeThis patch does the following:
1. Adds the core function to program Gamma correction values for BDW/SKL/BXT platforms
2. Adds Gamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 25 ++- drivers/gpu/drm/i915/intel_color_manager.c | 248 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 6 + 3 files changed, 277 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +6
-2@@ -5647,11 +5647,15 @@ enum skl_disp_power_wells {/* legacy palette */ #define _LGC_PALETTE_A 0x4a000#define _LGC_PALETTE_B 0x4a800 -#define LGC_PALETTE (pipe, i) (_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4) +#define _LGC_PALETTE_C 0x4b000 +#define LGC_PALETTE (pipe, i) (_PIPE3(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B, \ + _LGC_PALETTE_C) + (i) * 4)#define _GAMMA_MODE_A 0x4a480#define _GAMMA_MODE_B 0x4ac80 -#define GAMMA_MODE (pipe) _PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B) +#define _GAMMA_MODE_C 0x4b480 +#define GAMMA_MODE (pipe) \ + _PIPE3(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B, _GAMMA_MODE_C)#define GAMMA_MODE_MODE_MASK (3 << 0)#define
GAMMA_MODE_MODE_8BIT(0 << 0)
#defineGAMMA_MODE_MODE_10BIT(1 << 0)drivers/gpu/drm/i915/i915_reg.h +17
-0@@ -8062,6 +8066,23 @@ enum skl_disp_power_wells {#define _PIPE_CSC_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) +/* BDW gamma correction */ +#define PAL_PREC_INDEX_A 0x4A400 +#define PAL_PREC_INDEX_B 0x4AC00 +#define PAL_PREC_INDEX_C 0x4B400 +#define PAL_PREC_DATA_A 0x4A404 +#define PAL_PREC_DATA_B 0x4AC04 +#define PAL_PREC_DATA_C 0x4B404 +#define PAL_PREC_GCMAX_A 0x4A410 +#define PAL_PREC_GCMAX_B 0x4AC10 +#define PAL_PREC_GCMAX_C 0x4B410 + +#define _PREC_PAL_INDEX (pipe) \ + (_PIPE3(pipe, PAL_PREC_INDEX_A, PAL_PREC_INDEX_B, PAL_PREC_INDEX_C)) +#define _PREC_PAL_DATA (pipe) \ + (_PIPE3(pipe, PAL_PREC_DATA_A, PAL_PREC_DATA_B, PAL_PREC_DATA_C)) +#define _PREC_PAL_GCMAX (pipe) \ + (_PIPE3(pipe, PAL_PREC_GCMAX_A, PAL_PREC_GCMAX_B, PAL_PREC_GCMAX_C))#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_color_manager.c +19
-0@@ -26,6 +26,252 @@*/ #include "intel_color_manager.h" +static void bdw_write_10bit_gamma_precision (struct drm_device *dev, +struct drm_r32g32b32 *correction_values,u32 pal_prec_data, +u32 no_of_coeff) +{ +u16 blue_fract, green_fract, red_fract; +u32 word =0 ; +u32 count =0 ; +u32 blue, green, red; +struct drm_i915_private *dev_priv = dev->dev_private; + +while (count < no_of_coeff) { + + blue = correction_values[count].b32; + green = correction_values[count].g32; + red = correction_values[count].r32; + +/* +* Maximum possible gamma correction value supported +* for BDW is 0xFFFFFFFF, so clip the values accordingly
drivers/gpu/drm/i915/intel_color_manager.c
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+*/
I think you mean clamp not clip.
drivers/gpu/drm/i915/intel_color_manager.c line 54
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+if (blue >=BDW_MAX_GAMMA ) + blue =BDW_MAX_GAMMA ; +if (green >=BDW_MAX_GAMMA ) + green =BDW_MAX_GAMMA ; +if (red >=BDW_MAX_GAMMA ) + red =BDW_MAX_GAMMA ;
So this handles the issue that was raised before that 1.0 in 8.24 should map to 1023.
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+ +/* +* Gamma correction values are sent in 8.24 format +* with 8 int and 24 fraction bits. BDW 10 bit gamma +* unit expects correction registers to be programmed in
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* 0.10 format, with 0 int and 16 fraction bits. So take
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* MSB 10 bit values(bits 23-14) from the fraction part and
drivers/gpu/drm/i915/intel_color_manager.c line 67
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+* prepare the correction registers. +*/ + blue_fract =GET_BITS (blue,14 ,10 ); + green_fract =GET_BITS (green,14 ,10 ); + red_fract =GET_BITS (red,14 ,10 ); +
I think this should round to the nearest rather than floor.
drivers/gpu/drm/i915/intel_color_manager.c line 71
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+/* Arrange: Red (29:20) Green (19:10) and Blue (9:0) */
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+SET_BITS (word, red_fract,20 ,10 ); +SET_BITS (word, red_fract,10 ,10 ); +SET_BITS (word, red_fract,0 ,10 );
Red is my favourite colour too, is that why you programmed all the channels to the red bits? :-)
Quoted 33 lines
drivers/gpu/drm/i915/intel_color_manager.c +21
-0+I915_WRITE (pal_prec_data, word); + count++; + } +DRM_DEBUG_DRIVER ("Gamma correction programmed\n" ); +} + +void bdw_write_12bit_gamma_precision (struct drm_device *dev, +struct drm_r32g32b32 *correction_values,u32 pal_prec_data, +enum pipe pipe) +{ +uint16_t blue_fract, green_fract, red_fract; +uint32_t gcmax; +uint32_t word =0 ; +uint32_t count =0 ; +uint32_t gcmax_reg; +struct drm_i915_private *dev_priv = dev->dev_private; + +/* Program first 512 values in precision palette */ +while (count <BDW_12BIT_GAMMA_MAX_VALS -1 ) { +/* +* Framework's general gamma format is 8.24 (8 int 16 fraction)
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* BDW Platform's supported gamma format is 16 bit correction
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* values in 0.16 format. So extract higher 16 fraction bits
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+* from 8.24 gamma correction values. +*/ + red_fract = GET_BITS(correction_values[count].r32,8, 16);
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ green_fract = GET_BITS(correction_values[count].g32,8, 16);
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ blue_fract = GET_BITS(correction_values[count].b32,
Quoted 1 line
8, 16);
Again, 1.0 in 8.24 will result in you programming zeros rather than max.
Quoted 115 lines
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+/* +* From the bspec: +* For 12 bit gamma correction, program precision palette
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* with 16 bits per color in a 0.16 format with 0 integer and
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* 16 fractional bits (upper 10 bits in odd indexes, lower 6
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+* bits in even indexes) +*/ + +/* Even index: Lower 6 bits from correction should go as MSB */
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+SET_BITS (word,GET_BITS (red_fract,0 ,6 ),24 ,6 ); +SET_BITS (word,GET_BITS (green_fract,0 ,6 ),14 ,6 ); +SET_BITS (word,GET_BITS (blue_fract,0 ,6 ),4 ,6 ); +I915_WRITE (pal_prec_data, word); + + word =0x0 ; +/* Odd index: Upper 10 bits of correction should go as MSB */
drivers/gpu/drm/i915/intel_color_manager.c +2
-0+SET_BITS (word,GET_BITS (red_fract,6 ,10 ),20 ,10 ); + SET_BITS(word, GET_BITS(green_fract, 6, 10), 10,10);
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+SET_BITS (word,GET_BITS (blue_fract,6 ,10 ),0 ,10 ); + +I915_WRITE (pal_prec_data, word); + count++; + } + +/* Now program the 513th value in GCMAX regs */ + word =0 ; + gcmax_reg =_PREC_PAL_GCMAX (pipe); + gcmax = min_t(u32, GET_BITS(correction_values[count].r32, 8,17),
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ BDW_MAX_GAMMA); +SET_BITS (word, gcmax,0 ,17 ); +I915_WRITE (gcmax_reg, word); + gcmax_reg +=4 ; + + word =0 ; + gcmax = min_t(u32, GET_BITS(correction_values[count].g32, 8,17),
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ BDW_MAX_GAMMA); +SET_BITS (word, gcmax,0 ,17 ); +I915_WRITE (gcmax_reg, word); + gcmax_reg +=4 ; + + word =0 ; + gcmax = min_t(u32, GET_BITS(correction_values[count].b32, 8,17),
drivers/gpu/drm/i915/intel_color_manager.c +26
-0+ BDW_MAX_GAMMA); +SET_BITS (word, gcmax,0 ,17 ); +I915_WRITE (gcmax_reg, word); +} + +/* Apply unity gamma for gamma reset */ +static void bdw_reset_gamma (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +u16 count =0 ; +u32 val; +u32 pal_prec_data =LGC_PALETTE (pipe,0 ); + +DRM_DEBUG_DRIVER ("\n" ); + +/* Reset the palette for unit gamma */ +while (count <BDW_8BIT_GAMMA_MAX_VALS ) { +/* Red (23:16) Green (15:8) and Blue (7:0) */ + val = (count <<16 ) | (count <<8 ) | count; +I915_WRITE (pal_prec_data, val); + pal_prec_data +=4 ; + count++; + } +} + +static int bdw_set_gamma(struct drm_device *dev, struct
drm_property_blob*blob,drivers/gpu/drm/i915/intel_color_manager.c +35
-1+ struct drm_crtc *crtc) +{ +u16 blue_fract, green_fract, red_fract; +enum pipe pipe; +int count, num_samples; +u32 blue, green, red; +u32 mode, pal_prec_index, pal_prec_data; +u32 index; +u32 word =0 ; +struct drm_palette *gamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + gamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = gamma_data->num_samples; + + pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)&gamma_data ->lut; + index = I915_READ(pal_prec_index); + +switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe */ +DRM_DEBUG_DRIVER ("Disabling gamma on Pipe %c\n" , +pipe_name (pipe)); + mode =I915_READ (GAMMA_MODE (pipe)); + if ((mode & GAMMA_MODE_MODE_MASK) ==
GAMMA_MODE_MODE_12BIT)
drivers/gpu/drm/i915/intel_color_manager.c line 204
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+bdw_reset_gamma (dev_priv, pipe);
Why only call bdw_reset_gamma() if we were in 12-bit mode? What about the other modes? What about if somebody has programmed the value through the legacy ioctl?
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ state->palette_after_ctm_blob =NULL ; + word =GAMMA_MODE_MODE_8BIT ; +break ; + +case BDW_8BIT_GAMMA_MAX_VALS : + +/* Legacy palette */
drivers/gpu/drm/i915/intel_color_manager.c line 221
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+ pal_prec_data =LGC_PALETTE (pipe,0 ); + count =0 ; +while (count <BDW_8BIT_GAMMA_MAX_VALS ) { + blue = correction_values[count].b32; + green = correction_values[count].g32; + red = correction_values[count].r32; + + blue_fract =GET_BITS (blue,16 ,8 ); + green_fract =GET_BITS (green,16 ,8 ); + red_fract =GET_BITS (red,16 ,8 );
Shouldn't these round? Rather than always floor. Also 1.0 in 8.24 format will result in you programming zero into the palette. You need to do the max clamping again.
drivers/gpu/drm/i915/intel_color_manager.c line 229
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c +2
-0+ +/* Blue (7:0) Green (15:8) and Red (23:16) */
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+SET_BITS (word, blue_fract,0 ,8 ); +SET_BITS (word, green_fract,8 ,8 ); +SET_BITS (word, blue_fract,16 ,8 ); +I915_WRITE (pal_prec_data, word); + pal_prec_data +=4 ; + count++;
This code also needs to be made to work nicely with other users of LGC_PALETTE.
Quoted 68 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ } + word =GAMMA_MODE_MODE_8BIT ; +break ; + +case BDW_SPLITGAMMA_MAX_VALS : + + index |= BDW_INDEX_AUTO_INCREMENT |
BDW_INDEX_SPLIT_MODE;drivers/gpu/drm/i915/intel_color_manager.c +2
-0+I915_WRITE (pal_prec_index, index); + bdw_write_10bit_gamma_precision(dev,
correction_values,drivers/gpu/drm/i915/intel_color_manager.c +10
-0+ pal_prec_data, BDW_SPLITGAMMA_MAX_VALS); + word =GAMMA_MODE_MODE_SPLIT ; +break ; + +case BDW_12BIT_GAMMA_MAX_VALS : + + index |=BDW_INDEX_AUTO_INCREMENT ; + index &= ~BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + bdw_write_12bit_gamma_precision(dev,
correction_values,drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ pal_prec_data, pipe); + word =GAMMA_MODE_MODE_12BIT ; +break ; + +case BDW_10BIT_GAMMA_MAX_VALS : + index |=BDW_INDEX_AUTO_INCREMENT ; + index &= ~BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + bdw_write_10bit_gamma_precision(dev,
correction_values,drivers/gpu/drm/i915/intel_color_manager.c +19
-0+ pal_prec_data, BDW_10BIT_GAMMA_MAX_VALS); + word =GAMMA_MODE_MODE_10BIT ; +break ; + +default : +DRM_ERROR ("Invalid number of samples\n" ); +return -EINVAL ; + } + +/* Set gamma mode on pipe control reg */ + mode =I915_READ (GAMMA_MODE (pipe)); + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode | word); +DRM_DEBUG_DRIVER ("Gamma applied on pipe %c\n" , +pipe_name (pipe)); +return 0 ; +}static s16 chv_prepare_csc_coeff (s64 csc_value) {@@ -319,6 +565,8 @@ void intel_color_manager_crtc_commit(structdrm_device *dev,/* Gamma correction is platform specific */ if (IS_CHERRYVIEW(dev)) ret =chv_set_gamma (dev, blob, crtc); + else if (IS_BROADWELL(dev) || IS_GEN9(dev)) + ret =bdw_set_gamma (dev, blob, crtc);if (ret)drivers/gpu/drm/i915/intel_color_manager.c +0
-0DRM_ERROR ("set Gamma correction failed\n" );drivers/gpu/drm/i915/intel_color_manager.h +0
-0
drivers/gpu/drm/i915/intel_color_manager.h line 100
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.h +6
-0@@ -92,3 +92,9 @@/* Gamma on BDW */ #define BDW_SPLITGAMMA_MAX_VALS 512 +#define BDW_8BIT_GAMMA_MAX_VALS 256 +#define BDW_10BIT_GAMMA_MAX_VALS 1024 +#define BDW_12BIT_GAMMA_MAX_VALS 513 +#define BDW_MAX_GAMMA ((1 << 24) - 1) +#define BDW_INDEX_AUTO_INCREMENT (1 << 15) +#define BDW_INDEX_SPLIT_MODE (1 << 31)
Rob
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 19/22] drm/i915: BDW: Pipe level Gamma correction
Regards
Shashank
Quoted 97 lines · Rob Bradford
Quoted 96 lines · Shashank Sharma
BDW/SKL/BXT platforms support various Gamma correction modes which are:
1. Legacy 8-bit mode
2. 10-bit Split Gamma mode
3. 12-bit modeThis patch does the following:
1. Adds the core function to program Gamma correction values for BDW/SKL/BXT platforms
2. Adds Gamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 25 ++- drivers/gpu/drm/i915/intel_color_manager.c | 248 +++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_color_manager.h | 6 + 3 files changed, 277 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/i915_reg.h +6
-2@@ -5647,11 +5647,15 @@ enum skl_disp_power_wells {/* legacy palette */ #define _LGC_PALETTE_A 0x4a000#define _LGC_PALETTE_B 0x4a800 -#define LGC_PALETTE (pipe, i) (_PIPE(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B) + (i) * 4) +#define _LGC_PALETTE_C 0x4b000 +#define LGC_PALETTE (pipe, i) (_PIPE3(pipe, _LGC_PALETTE_A, _LGC_PALETTE_B, \ + _LGC_PALETTE_C) + (i) * 4)#define _GAMMA_MODE_A 0x4a480#define _GAMMA_MODE_B 0x4ac80 -#define GAMMA_MODE (pipe) _PIPE(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B) +#define _GAMMA_MODE_C 0x4b480 +#define GAMMA_MODE (pipe) \ + _PIPE3(pipe, _GAMMA_MODE_A, _GAMMA_MODE_B, _GAMMA_MODE_C)#define GAMMA_MODE_MODE_MASK (3 << 0)#define GAMMA_MODE_MODE_8BIT (0 << 0) #define GAMMA_MODE_MODE_10BIT (1 << 0)drivers/gpu/drm/i915/i915_reg.h +17
-0@@ -8062,6 +8066,23 @@ enum skl_disp_power_wells {#define _PIPE_CSC_BASE (pipe) \ (_PIPE3(pipe, PIPEA_CGM_CSC, PIPEB_CGM_CSC, PIPEC_CGM_CSC)) +/* BDW gamma correction */ +#define PAL_PREC_INDEX_A 0x4A400 +#define PAL_PREC_INDEX_B 0x4AC00 +#define PAL_PREC_INDEX_C 0x4B400 +#define PAL_PREC_DATA_A 0x4A404 +#define PAL_PREC_DATA_B 0x4AC04 +#define PAL_PREC_DATA_C 0x4B404 +#define PAL_PREC_GCMAX_A 0x4A410 +#define PAL_PREC_GCMAX_B 0x4AC10 +#define PAL_PREC_GCMAX_C 0x4B410 + +#define _PREC_PAL_INDEX (pipe) \ + (_PIPE3(pipe, PAL_PREC_INDEX_A, PAL_PREC_INDEX_B, PAL_PREC_INDEX_C)) +#define _PREC_PAL_DATA (pipe) \ + (_PIPE3(pipe, PAL_PREC_DATA_A, PAL_PREC_DATA_B, PAL_PREC_DATA_C)) +#define _PREC_PAL_GCMAX (pipe) \ + (_PIPE3(pipe, PAL_PREC_GCMAX_A, PAL_PREC_GCMAX_B, PAL_PREC_GCMAX_C))#endif /* _I915_REG_H_ */drivers/gpu/drm/i915/intel_color_manager.c +15
-0@@ -26,6 +26,252 @@*/ #include "intel_color_manager.h" +static void bdw_write_10bit_gamma_precision (struct drm_device *dev, +struct drm_r32g32b32 *correction_values,u32 pal_prec_data, +u32 no_of_coeff) +{ +u16 blue_fract, green_fract, red_fract; +u32 word =0 ; +u32 count =0 ; +u32 blue, green, red; +struct drm_i915_private *dev_priv = dev->dev_private; + +while (count < no_of_coeff) { + + blue = correction_values[count].b32; + green = correction_values[count].g32; + red = correction_values[count].r32;
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+ +/* +* Maximum possible gamma correction value supported +* for BDW is 0xFFFFFFFF, so clip the values accordingly
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+*/ I think you mean clamp not clip.
Yes, will fix this.
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c line 54
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+if (blue >=BDW_MAX_GAMMA ) + blue =BDW_MAX_GAMMA ; +if (green >=BDW_MAX_GAMMA ) + green =BDW_MAX_GAMMA ; +if (red >=BDW_MAX_GAMMA ) + red =BDW_MAX_GAMMA ;So this handles the issue that was raised before that 1.0 in 8.24 should map to 1023.
Yes.
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+ +/* +* Gamma correction values are sent in 8.24 format +* with 8 int and 24 fraction bits. BDW 10 bit gamma +* unit expects correction registers to be programmed in
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* 0.10 format, with 0 int and 16 fraction bits. So take
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* MSB 10 bit values(bits 23-14) from the fraction part and
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c line 67
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+* prepare the correction registers. +*/ + blue_fract =GET_BITS (blue,14 ,10 ); + green_fract =GET_BITS (green,14 ,10 ); + red_fract =GET_BITS (red,14 ,10 ); +I think this should round to the nearest rather than floor.
Why ? we are getting the exact values already.
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c line 71
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+/* Arrange: Red (29:20) Green (19:10) and Blue (9:0) */
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+SET_BITS (word, red_fract,20 ,10 ); +SET_BITS (word, red_fract,10 ,10 ); +SET_BITS (word, red_fract,0 ,10 );Red is my favourite colour too, is that why you programmed all the channels to the red bits? :-)
Guilty :). While testing, all the channels have the same values, so it dint matter. I will fix this.
Quoted 30 lines
Quoted 30 lines
drivers/gpu/drm/i915/intel_color_manager.c +21
-0+I915_WRITE (pal_prec_data, word); + count++; + } +DRM_DEBUG_DRIVER ("Gamma correction programmed\n" ); +} + +void bdw_write_12bit_gamma_precision (struct drm_device *dev, +struct drm_r32g32b32 *correction_values,u32 pal_prec_data, +enum pipe pipe) +{ +uint16_t blue_fract, green_fract, red_fract; +uint32_t gcmax; +uint32_t word =0 ; +uint32_t count =0 ; +uint32_t gcmax_reg; +struct drm_i915_private *dev_priv = dev->dev_private; + +/* Program first 512 values in precision palette */ +while (count <BDW_12BIT_GAMMA_MAX_VALS -1 ) { +/* +* Framework's general gamma format is 8.24 (8 int 16 fraction)
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* BDW Platform's supported gamma format is 16 bit correction
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* values in 0.16 format. So extract higher 16 fraction bits
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+* from 8.24 gamma correction values. +*/ + red_fract = GET_BITS(correction_values[count].r32,
Quoted 8 lines
Quoted 5 lines
8, 16);
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ green_fract = GET_BITS(correction_values[count].g32,8, 16);
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ blue_fract = GET_BITS(correction_values[count].b32,8, 16);
Again, 1.0 in 8.24 will result in you programming zeros rather than max.
Will add the max check and conversion here also.
Quoted 113 lines
Quoted 113 lines
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+/* +* From the bspec: +* For 12 bit gamma correction, program precision palette
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* with 16 bits per color in a 0.16 format with 0 integer and
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+* 16 fractional bits (upper 10 bits in odd indexes, lower 6
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+* bits in even indexes) +*/ + +/* Even index: Lower 6 bits from correction should go as MSB */
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+SET_BITS (word,GET_BITS (red_fract,0 ,6 ),24 ,6 ); +SET_BITS (word,GET_BITS (green_fract,0 ,6 ),14 ,6 ); +SET_BITS (word,GET_BITS (blue_fract,0 ,6 ),4 ,6 ); +I915_WRITE (pal_prec_data, word); + + word =0x0 ; +/* Odd index: Upper 10 bits of correction should go as MSB */
drivers/gpu/drm/i915/intel_color_manager.c +2
-0+SET_BITS (word,GET_BITS (red_fract,6 ,10 ),20 ,10 ); + SET_BITS(word, GET_BITS(green_fract, 6, 10), 10,10);
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+SET_BITS (word,GET_BITS (blue_fract,6 ,10 ),0 ,10 ); + +I915_WRITE (pal_prec_data, word); + count++; + } + +/* Now program the 513th value in GCMAX regs */ + word =0 ; + gcmax_reg =_PREC_PAL_GCMAX (pipe); + gcmax = min_t(u32, GET_BITS(correction_values[count].r32, 8,17),
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ BDW_MAX_GAMMA); +SET_BITS (word, gcmax,0 ,17 ); +I915_WRITE (gcmax_reg, word); + gcmax_reg +=4 ; + + word =0 ; + gcmax = min_t(u32, GET_BITS(correction_values[count].g32, 8,17),
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ BDW_MAX_GAMMA); +SET_BITS (word, gcmax,0 ,17 ); +I915_WRITE (gcmax_reg, word); + gcmax_reg +=4 ; + + word =0 ; + gcmax = min_t(u32, GET_BITS(correction_values[count].b32, 8,17),
drivers/gpu/drm/i915/intel_color_manager.c +26
-0+ BDW_MAX_GAMMA); +SET_BITS (word, gcmax,0 ,17 ); +I915_WRITE (gcmax_reg, word); +} + +/* Apply unity gamma for gamma reset */ +static void bdw_reset_gamma (struct drm_i915_private *dev_priv, +enum pipe pipe) +{ +u16 count =0 ; +u32 val; +u32 pal_prec_data =LGC_PALETTE (pipe,0 ); + +DRM_DEBUG_DRIVER ("\n" ); + +/* Reset the palette for unit gamma */ +while (count <BDW_8BIT_GAMMA_MAX_VALS ) { +/* Red (23:16) Green (15:8) and Blue (7:0) */ + val = (count <<16 ) | (count <<8 ) | count; +I915_WRITE (pal_prec_data, val); + pal_prec_data +=4 ; + count++; + } +} + +static int bdw_set_gamma(struct drm_device *dev, struct
drm_property_blob*blob,drivers/gpu/drm/i915/intel_color_manager.c +33
-1+ struct drm_crtc *crtc) +{ +u16 blue_fract, green_fract, red_fract; +enum pipe pipe; +int count, num_samples; +u32 blue, green, red; +u32 mode, pal_prec_index, pal_prec_data; +u32 index; +u32 word =0 ; +struct drm_palette *gamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + gamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = gamma_data->num_samples; + + pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)&gamma_data ->lut; + index = I915_READ(pal_prec_index); + +switch (num_samples) { +case GAMMA_DISABLE_VALS : + +/* Disable Gamma functionality on Pipe */ +DRM_DEBUG_DRIVER ("Disabling gamma on Pipe %c\n" , +pipe_name (pipe));
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c line 204
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +2
-0+ mode =I915_READ (GAMMA_MODE (pipe)); + if ((mode & GAMMA_MODE_MODE_MASK) ==
GAMMA_MODE_MODE_12BIT)drivers/gpu/drm/i915/intel_color_manager.c +1
-0+bdw_reset_gamma (dev_priv, pipe);Why only call
bdw_reset_gamma()if we were in 12-bit mode? What about the other modes? What about if somebody has programmed the value through the legacy ioctl?
We tested this part, its only required for 12 bit gamma. The legacy IOCTL only programs 8bit gamma, which doesnt need this anyways, coz we are overwriting legacy palette to gamma = 1, while disabling gamma. If we dont do this for 12 bit gamma, screen goes all black.
Quoted 12 lines
Quoted 12 lines
drivers/gpu/drm/i915/intel_color_manager.c +11
-0+ state->palette_after_ctm_blob =NULL ; + word =GAMMA_MODE_MODE_8BIT ; +break ; + +case BDW_8BIT_GAMMA_MAX_VALS : + +/* Legacy palette */ + pal_prec_data =LGC_PALETTE (pipe,0 ); + count =0 ; +while (count <BDW_8BIT_GAMMA_MAX_VALS ) { + blue = correction_values[count].b32;
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c line 221
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+ green = correction_values[count].g32; + red = correction_values[count].r32; + + blue_fract =GET_BITS (blue,16 ,8 ); + green_fract =GET_BITS (green,16 ,8 ); + red_fract =GET_BITS (red,16 ,8 );Shouldn't these round? Rather than always floor.
Why ? This is exact value.
Quoted 3 lines
Also 1.0 in 8.24
format will result in you programming zero into the palette. You need to do the max clamping again.
Will fix this part.
Quoted 13 lines
drivers/gpu/drm/i915/intel_color_manager.c line 229
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +2
-0+ +/* Blue (7:0) Green (15:8) and Red (23:16) */
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+SET_BITS (word, blue_fract,0 ,8 ); +SET_BITS (word, green_fract,8 ,8 ); +SET_BITS (word, blue_fract,16 ,8 ); +I915_WRITE (pal_prec_data, word); + pal_prec_data +=4 ; + count++;This code also needs to be made to work nicely with other users of
LGC_PALETTE.
This is anyways working with LGC IOCTL, but will clean it up further.
Quoted 70 lines
Quoted 70 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ } + word =GAMMA_MODE_MODE_8BIT ; +break ; + +case BDW_SPLITGAMMA_MAX_VALS : + + index |= BDW_INDEX_AUTO_INCREMENT |
BDW_INDEX_SPLIT_MODE;drivers/gpu/drm/i915/intel_color_manager.c +2
-0+I915_WRITE (pal_prec_index, index); + bdw_write_10bit_gamma_precision(dev,
correction_values,drivers/gpu/drm/i915/intel_color_manager.c +10
-0+ pal_prec_data, BDW_SPLITGAMMA_MAX_VALS); + word =GAMMA_MODE_MODE_SPLIT ; +break ; + +case BDW_12BIT_GAMMA_MAX_VALS : + + index |=BDW_INDEX_AUTO_INCREMENT ; + index &= ~BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + bdw_write_12bit_gamma_precision(dev,
correction_values,drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ pal_prec_data, pipe); + word =GAMMA_MODE_MODE_12BIT ; +break ; + +case BDW_10BIT_GAMMA_MAX_VALS : + index |=BDW_INDEX_AUTO_INCREMENT ; + index &= ~BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + bdw_write_10bit_gamma_precision(dev,
correction_values,drivers/gpu/drm/i915/intel_color_manager.c +19
-0+ pal_prec_data, BDW_10BIT_GAMMA_MAX_VALS); + word =GAMMA_MODE_MODE_10BIT ; +break ; + +default : +DRM_ERROR ("Invalid number of samples\n" ); +return -EINVAL ; + } + +/* Set gamma mode on pipe control reg */ + mode =I915_READ (GAMMA_MODE (pipe)); + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode | word); +DRM_DEBUG_DRIVER ("Gamma applied on pipe %c\n" , +pipe_name (pipe)); +return 0 ; +}static s16 chv_prepare_csc_coeff (s64 csc_value) {@@ -319,6 +565,8 @@ void intel_color_manager_crtc_commit(structdrm_device *dev,/* Gamma correction is platform specific */ if (IS_CHERRYVIEW(dev)) ret =chv_set_gamma (dev, blob, crtc); + else if (IS_BROADWELL(dev) || IS_GEN9(dev)) + ret =bdw_set_gamma (dev, blob, crtc);if (ret)DRM_ERROR("set Gamma correction failed\n");drivers/gpu/drm/i915/intel_color_manager.h +0
-0@@ -92,3 +92,9 @@
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.h line 100
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.h +6
-0/* Gamma on BDW */ #define BDW_SPLITGAMMA_MAX_VALS 512 +#define BDW_8BIT_GAMMA_MAX_VALS 256 +#define BDW_10BIT_GAMMA_MAX_VALS 1024 +#define BDW_12BIT_GAMMA_MAX_VALS 513 +#define BDW_MAX_GAMMA ((1 << 24) - 1) +#define BDW_INDEX_AUTO_INCREMENT (1 << 15) +#define BDW_INDEX_SPLIT_MODE (1 << 31)Rob
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 20/22 drm/i915: BDW: Load degamma correction values
In reply to Shashank SharmaI915 color manager registers pipe degamma correction as palette correction before CTM, DRM property.
This patch adds the no of coefficients(65) for degamma correction as "num_samples_before_ctm" parameter in device info structures, for BDW and higher platforms.
--- drivers/gpu/drm/i915/i915_drv.c | 7 +++++++ drivers/gpu/drm/i915/intel_color_manager.h | 3 +++ 2 files changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +7 -0
@@ -303,6 +303,7 @@ static const struct intel_device_info intel_broadwell_d_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -316,6 +317,7 @@ static const struct intel_device_info intel_broadwell_m_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -329,6 +331,7 @@ static const struct intel_device_info intel_broadwell_gt3d_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -342,6 +345,7 @@ static const struct intel_device_info intel_broadwell_gt3m_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -368,6 +372,7 @@ static const struct intel_device_info intel_skylake_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -382,6 +387,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1, .has_fpga_dbg = 1,
@@ -396,6 +402,7 @@ static const struct intel_device_info intel_broxton_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .num_pipes = 3, .has_ddi = 1, .has_fpga_dbg = 1,
drivers/gpu/drm/i915/intel_color_manager.h +3 -0
@@ -98,3 +98,6 @@#define BDW_MAX_GAMMA ((1 << 24) - 1)#define BDW_INDEX_AUTO_INCREMENT (1 << 15)#define BDW_INDEX_SPLIT_MODE (1 << 31) + +/* Degamma on BDW */ +#define BDW_DEGAMMA_MAX_VALS 512
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 20/22] drm/i915: BDW: Load degamma correction values
Quoted 6 lines · Shashank Sharma
I915 color manager registers pipe degamma correction as palette correction before CTM, DRM property.
This patch adds the no of coefficients(65) for degamma correction as "
num_samples_before_ctm" parameter in device info structures, for BDW and higher platforms.
Did you copy and paste this from the CHV version? The only constant you add for degamma here is 512?
Rob
Quoted 85 lines
Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 7 +++++++ drivers/gpu/drm/i915/intel_color_manager.h | 3 +++ 2 files changed, 10 insertions(+)drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -303,6 +303,7 @@ static const struct intel_device_info intel_broadwell_d_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0.has_fpga_dbg = 1,@@ -316,6 +317,7 @@ static const struct intel_device_info intel_broadwell_m_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0.has_fpga_dbg = 1,@@ -329,6 +331,7 @@ static const struct intel_device_info intel_broadwell_gt3d_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0.has_ddi = 1, .has_fpga_dbg = 1,@@ -342,6 +345,7 @@ static const struct intel_device_info intel_broadwell_gt3m_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0.has_ddi = 1, .has_fpga_dbg = 1,@@ -368,6 +372,7 @@ static const struct intel_device_info intel_skylake_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0.has_fpga_dbg = 1,@@ -382,6 +387,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0.has_ddi = 1, .has_fpga_dbg = 1,@@ -396,6 +402,7 @@ static const struct intel_device_info intel_broxton_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .num_pipes = 3, .has_ddi = 1,drivers/gpu/drm/i915/i915_drv.c +0
-0.has_fpga_dbg = 1,drivers/gpu/drm/i915/intel_color_manager.h +0
-0
drivers/gpu/drm/i915/intel_color_manager.h line 103
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.h +3
-0@@ -98,3 +98,6 @@#define BDW_MAX_GAMMA ((1 << 24) - 1)#define BDW_INDEX_AUTO_INCREMENT (1 << 15)#define BDW_INDEX_SPLIT_MODE (1 << 31) + +/* Degamma on BDW */ +#define BDW_DEGAMMA_MAX_VALS 512
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 20/22] drm/i915: BDW: Load degamma correction values
Regards
Shashank
Quoted 10 lines · Rob Bradford
Quoted 6 lines · Shashank Sharma
I915 color manager registers pipe degamma correction as palette correction before CTM, DRM property.
This patch adds the no of coefficients(65) for degamma correction as "
num_samples_before_ctm" parameter in device info structures, for BDW and higher platforms.Did you copy and paste this from the CHV version? The only constant you add for degamma here is 512?
Oops, side effects of too many code-refactoring without proper sleep :) will fix this.
Quoted 86 lines
Rob
Quoted 83 lines
Signed-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 7 +++++++ drivers/gpu/drm/i915/intel_color_manager.h | 3 +++ 2 files changed, 10 insertions(+)drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -303,6 +303,7 @@ static const struct intel_device_info intel_broadwell_d_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1,.has_fpga_dbg = 1,
drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -316,6 +317,7 @@ static const struct intel_device_info intel_broadwell_m_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1,.has_fpga_dbg = 1,
drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -329,6 +331,7 @@ static const struct intel_device_info intel_broadwell_gt3d_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1,.has_ddi = 1,
.has_fpga_dbg = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -342,6 +345,7 @@ static const struct intel_device_info intel_broadwell_gt3m_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1,.has_ddi = 1,
.has_fpga_dbg = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -368,6 +372,7 @@ static const struct intel_device_info intel_skylake_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1, .has_ddi = 1,.has_fpga_dbg = 1,
drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -382,6 +387,7 @@ static const struct intel_device_info intel_skylake_gt3_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask =RENDER_RING |BSD_RING |BLT_RING |VEBOX_RING | BSD2_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .has_llc = 1,.has_ddi = 1,
.has_fpga_dbg = 1,drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -396,6 +402,7 @@ static const struct intel_device_info intel_broxton_info = { .need_gfx_hws = 1, .has_hotplug = 1, .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, .num_samples_after_ctm = BDW_SPLITGAMMA_MAX_VALS, + .num_samples_before_ctm = BDW_DEGAMMA_MAX_VALS, .num_pipes = 3, .has_ddi = 1,.has_fpga_dbg = 1,
drivers/gpu/drm/i915/intel_color_manager.h +0
-1--- a/drivers/gpu/drm/i915/intel_color_manager.h
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.h line 103
Quoted 8 lines
+++
b/drivers/gpu/drm/i915/intel_color_manager.hdrivers/gpu/drm/i915/intel_color_manager.h +3
-0@@ -98,3 +98,6 @@#define BDW_MAX_GAMMA ((1 << 24) - 1)#define BDW_INDEX_AUTO_INCREMENT (1 << 15)#define BDW_INDEX_SPLIT_MODE (1 << 31) + +/* Degamma on BDW */ +#define BDW_DEGAMMA_MAX_VALS 512
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 21/22 drm/i915: BDW: Pipe level degamma correction
In reply to Shashank SharmaBDW/SKL/BXT supports Degamma color correction feature, which linearizes the non-linearity due to gamma encoded color values. This will be applied before Color Transformation.
This patch does the following:
1. Adds the core function to program DeGamma correction values for BDW/SKL/BXT platform
2. Adds DeGamma correction macros/defines
--- drivers/gpu/drm/i915/intel_color_manager.c | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)
drivers/gpu/drm/i915/intel_color_manager.c +59 -0
@@ -273,6 +273,63 @@ static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,return 0 ; } +static int bdw_set_degamma (struct drm_device *dev, +struct drm_property_blob *blob,struct drm_crtc *crtc) +{ +enum pipe pipe; +int num_samples, length; +u32 index, mode; +u32 pal_prec_index, pal_prec_data; +struct drm_palette *degamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + degamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = degamma_data->num_samples; + +if (num_samples ==GAMMA_DISABLE_VALS ) { +/* Disable degamma on Pipe */ + mode =I915_READ (GAMMA_MODE (pipe)) & ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_8BIT ); + + state->palette_before_ctm_blob =NULL ; +DRM_DEBUG_DRIVER ("Disabling degamma on Pipe %c\n" , +pipe_name (pipe)); +return 0 ; + } + +if (num_samples !=BDW_SPLITGAMMA_MAX_VALS ) { +DRM_ERROR ("Invalid number of samples\n" ); +return -EINVAL ; + } + + length = num_samples *sizeof (struct drm_r32g32b32 ); + mode =I915_READ (GAMMA_MODE (pipe)); + pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)°amma_data->lut; + index =I915_READ (pal_prec_index); + index |=BDW_INDEX_AUTO_INCREMENT |BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + +bdw_write_10bit_gamma_precision (dev, correction_values, + pal_prec_data,BDW_SPLITGAMMA_MAX_VALS ); + +/* Enable DeGamma on Pipe */ + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_SPLIT ); +DRM_DEBUG_DRIVER ("DeGamma correction enabled on Pipe %c\n" , +pipe_name (pipe)); + +return 0 ; +} +static s16 chv_prepare_csc_coeff (s64 csc_value) {s32 csc_int_value;
@@ -579,6 +636,8 @@ void intel_color_manager_crtc_commit(struct drm_device *dev,/* Degamma correction */ if (IS_CHERRYVIEW (dev)) ret =chv_set_degamma (dev, blob, crtc); +else if (IS_BROADWELL (dev) ||IS_GEN9 (dev)) + ret =bdw_set_degamma (dev, blob, crtc);if (ret)DRM_ERROR ("set degamma correction failed\n" );
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 21/22] drm/i915: BDW: Pipe level degamma correction
Hi Shashank,
Quoted 48 lines · Shashank Sharma
BDW/SKL/BXT supports Degamma color correction feature, which linearizes the non-linearity due to gamma encoded color values. This will be applied before Color Transformation.
This patch does the following:
1. Adds the core function to program DeGamma correction values for BDW/SKL/BXT platform
2. Adds DeGamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +25
-0@@ -273,6 +273,63 @@ static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,return 0 ; } +static int bdw_set_degamma (struct drm_device *dev, +struct drm_property_blob *blob,struct drm_crtc *crtc) +{ +enum pipe pipe; +int num_samples, length; +u32 index, mode; +u32 pal_prec_index, pal_prec_data; +struct drm_palette *degamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + degamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = degamma_data->num_samples; + +if (num_samples ==GAMMA_DISABLE_VALS ) { +/* Disable degamma on Pipe */ + mode =I915_READ (GAMMA_MODE (pipe)) & ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_8BIT ); + + state->palette_before_ctm_blob =NULL ;
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 310
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+DRM_DEBUG_DRIVER ("Disabling degamma on Pipe %c\n" , +pipe_name (pipe)); +return 0 ; + } + +if (num_samples !=BDW_SPLITGAMMA_MAX_VALS ) { +DRM_ERROR ("Invalid number of samples\n" ); +return -EINVAL ; + } +
Why don't you use switch statement here ?
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c +8
-0+ length = num_samples *sizeof (struct drm_r32g32b32 ); + mode =I915_READ (GAMMA_MODE (pipe)); + pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)°amma_data->lut; + index =I915_READ (pal_prec_index); + index |=BDW_INDEX_AUTO_INCREMENT |BDW_INDEX_SPLIT_MODE ;
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 328
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+I915_WRITE (pal_prec_index, index); + +bdw_write_10bit_gamma_precision (dev, correction_values, + pal_prec_data,BDW_SPLITGAMMA_MAX_VALS ); + +/* Enable DeGamma on Pipe */ + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_SPLIT ); +DRM_DEBUG_DRIVER ("DeGamma correction enabled on Pipe %c\n" , +pipe_name (pipe));
Indentation seems funny here.
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 21/22] drm/i915: BDW: Pipe level degamma correction
Regards
Shashank
Quoted 54 lines · Emil Velikov
Hi Shashank,
Quoted 51 lines · Shashank Sharma
BDW/SKL/BXT supports Degamma color correction feature, which linearizes the non-linearity due to gamma encoded color values. This will be applied before Color Transformation.
This patch does the following:
1. Adds the core function to program DeGamma correction values for BDW/SKL/BXT platform
2. Adds DeGamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +28
-0@@ -273,6 +273,63 @@ static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,return 0 ; } +static int bdw_set_degamma (struct drm_device *dev, +struct drm_property_blob *blob,struct drm_crtc *crtc) +{ +enum pipe pipe; +int num_samples, length; +u32 index, mode; +u32 pal_prec_index, pal_prec_data; +struct drm_palette *degamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + degamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = degamma_data->num_samples; + +if (num_samples ==GAMMA_DISABLE_VALS ) { +/* Disable degamma on Pipe */ + mode =I915_READ (GAMMA_MODE (pipe)) & ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_8BIT ); + + state->palette_before_ctm_blob =NULL ; +DRM_DEBUG_DRIVER ("Disabling degamma on Pipe %c\n" , +pipe_name (pipe)); +return 0 ;
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 310
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ } + +if (num_samples !=BDW_SPLITGAMMA_MAX_VALS ) { +DRM_ERROR ("Invalid number of samples\n" ); +return -EINVAL ; + } +Why don't you use switch statement here ?
Same as CHV degamma. Degamma has only 3 conditions (enable/disable and invalid), and we generally try to accommodate upto 3 condition within if ... else.
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.c +11
-0+ length = num_samples *sizeof (struct drm_r32g32b32 ); + mode =I915_READ (GAMMA_MODE (pipe)); + pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)°amma_data->lut; + index =I915_READ (pal_prec_index); + index |=BDW_INDEX_AUTO_INCREMENT |BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + + bdw_write_10bit_gamma_precision(dev, correction_values,
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 328
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ pal_prec_data, BDW_SPLITGAMMA_MAX_VALS); + +/* Enable DeGamma on Pipe */ + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_SPLIT ); +DRM_DEBUG_DRIVER ("DeGamma correction enabled on Pipe %c\n" , +pipe_name (pipe));Indentation seems funny here.
Yeah, every time time we try to publish a success story, pipe_name() ruins it :). Will fix it.
Quoted 3 lines
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 21/22] drm/i915: BDW: Pipe level degamma correction
Quoted 19 lines · Shashank
Quoted 18 lines · Emil Velikov
Hi Shashank,
Quoted 13 lines · Shashank Sharma
BDW/SKL/BXT supports Degamma color correction feature, which linearizes the non-linearity due to gamma encoded color values. This will be applied before Color Transformation.
This patch does the following:
1. Adds the core function to program DeGamma correction values for BDW/SKL/BXT platform
2. Adds DeGamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>---
[snip]
Quoted 5 lines
Quoted 2 lines
Why don't you use switch statement here ?
Same as CHV degamma. Degamma has only 3 conditions (enable/disable and invalid), and we generally try to accommodate upto 3 condition within if ... else.
That rule sounds a bit funny bth. I'm not sure where it comes from, but as is the codeflow isn't that obvious and the patches look inconsistent with one another.
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 21/22] drm/i915: BDW: Pipe level degamma correction
In reply to Shashank SharmaQuoted 41 lines · Shashank Sharma
BDW/SKL/BXT supports Degamma color correction feature, which linearizes the non-linearity due to gamma encoded color values. This will be applied before Color Transformation.
This patch does the following:
1. Adds the core function to program DeGamma correction values for BDW/SKL/BXT platform
2. Adds DeGamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +15
-0@@ -273,6 +273,63 @@ static int bdw_set_gamma(struct drm_device *dev,struct drm_property_blob *blob, return 0; } +static int bdw_set_degamma (struct drm_device *dev, +struct drm_property_blob *blob,struct drm_crtc *crtc) +{ +enum pipe pipe; +int num_samples, length; +u32 index, mode; +u32 pal_prec_index, pal_prec_data; +struct drm_palette *degamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; +
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, · line 301
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +8
-0+ degamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = degamma_data->num_samples; + +if (num_samples ==GAMMA_DISABLE_VALS ) { +/* Disable degamma on Pipe */ + mode =I915_READ (GAMMA_MODE (pipe)) & ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_8BIT );
When you turn off gamma you call bdw_reset_gamma() should you do the same for degamma?
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 311
Quoted 13 lines
drivers/gpu/drm/i915/intel_color_manager.c +13
-0+ + state->palette_before_ctm_blob =NULL ; +DRM_DEBUG_DRIVER ("Disabling degamma on Pipe %c\n" , +pipe_name (pipe)); +return 0 ; + } + +if (num_samples !=BDW_SPLITGAMMA_MAX_VALS ) { +DRM_ERROR ("Invalid number of samples\n" ); +return -EINVAL ; + } + + length = num_samples *sizeof (struct drm_r32g32b32 );
Uh, you calculate this length and don't use it anywhere? Was your intention to check the blob length? And the length check should be in the generic DRM code anyway...
I think it was suggested in the past that the number of samples could be derived from the length of the data allowing the removal of the struct member.
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 312
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ mode =I915_READ (GAMMA_MODE (pipe));
Move this closer to where you use it?
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-1+ pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)°amma_data ->lut;
Why do you need this cast?
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 327
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.c +11
-0+ index =I915_READ (pal_prec_index); + index |=BDW_INDEX_AUTO_INCREMENT |BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + +bdw_write_10bit_gamma_precision (dev, correction_values, + pal_prec_data,BDW_SPLITGAMMA_MAX_VALS ); + +/* Enable DeGamma on Pipe */ + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_SPLIT ); + DRM_DEBUG_DRIVER("DeGamma correction enabled on Pipe %c\n",
Choose your capitalisation DeGamma or degamma. Pick one and use it consistently to make it easier to grep through the code.
It also looks like you should check if the gamma mode is not something other than split / off. Otherwise strange things could happen. Similarly in the gamma code you shouldn't be able to program something other than split if you have a degamma mode set.
Quoted 17 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ pipe_name(pipe)); + +return 0 ; +} +static s16 chv_prepare_csc_coeff (s64 csc_value) {s32 csc_int_value;@@ -579,6 +636,8 @@ void intel_color_manager_crtc_commit(structdrm_device *dev,/* Degamma correction */ if (IS_CHERRYVIEW(dev)) ret =chv_set_degamma (dev, blob, crtc); + else if (IS_BROADWELL(dev) || IS_GEN9(dev)) + ret =bdw_set_degamma (dev, blob, crtc);if (ret)
Quoted 2 lines
DRM_ERROR("set degamma correction
failed\n");
Rob
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 21/22] drm/i915: BDW: Pipe level degamma correction
Thanks for the review Rob.
Regards
Shashank
Quoted 47 lines · Rob Bradford
Quoted 46 lines · Shashank Sharma
BDW/SKL/BXT supports Degamma color correction feature, which linearizes the non-linearity due to gamma encoded color values. This will be applied before Color Transformation.
This patch does the following:
1. Adds the core function to program DeGamma correction values for BDW/SKL/BXT platform
2. Adds DeGamma correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>--- drivers/gpu/drm/i915/intel_color_manager.c | 59 ++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)drivers/gpu/drm/i915/intel_color_manager.c +20
-0@@ -273,6 +273,63 @@ static int bdw_set_gamma(struct drm_device *dev,struct drm_property_blob *blob, return 0; } +static int bdw_set_degamma (struct drm_device *dev, +struct drm_property_blob *blob,struct drm_crtc *crtc) +{ +enum pipe pipe; +int num_samples, length; +u32 index, mode; +u32 pal_prec_index, pal_prec_data; +struct drm_palette *degamma_data; +struct drm_crtc_state *state = crtc->state; +struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_r32g32b32 *correction_values =NULL ; + +if (WARN_ON (!blob)) +return -EINVAL ; + + degamma_data = (struct drm_palette *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + num_samples = degamma_data->num_samples; + +if (num_samples ==GAMMA_DISABLE_VALS ) {
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, · line 301
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +3
-0+/* Disable degamma on Pipe */ + mode =I915_READ (GAMMA_MODE (pipe)) & ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_8BIT );When you turn off gamma you call
bdw_reset_gamma()should you do the same for degamma?
No, we tested this part, its not required, its only required for 12 bit gamma.
Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ + state->palette_before_ctm_blob =NULL ; +DRM_DEBUG_DRIVER ("Disabling degamma on Pipe %c\n" , +pipe_name (pipe)); +return 0 ; + } + +if (num_samples !=BDW_SPLITGAMMA_MAX_VALS ) { +DRM_ERROR ("Invalid number of samples\n" );
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 311
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+return -EINVAL ; + } + + length = num_samples *sizeof (struct drm_r32g32b32 );Uh, you calculate this length and don't use it anywhere? Was your intention to check the blob length? And the length check should be in the generic DRM code anyway...
Yes, this was left over from the previous patch set, will remove this.
Quoted 4 lines
I think it was suggested in the past that the number of samples could be derived from the length of the data allowing the removal of the struct member.
Right now, its better to have the no of samples coming from userspace. As the platform is under development, its good to have this control available so that userspace will be clear on what it wants to do, I have added this in my to do list, when we are sure that we dont need it, we will remove and optimize it.
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 312
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ mode =I915_READ (GAMMA_MODE (pipe));Move this closer to where you use it?
Agree.
Quoted 8 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob,
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-1+ pal_prec_index =_PREC_PAL_INDEX (pipe); + pal_prec_data =_PREC_PAL_DATA (pipe); + + correction_values = (struct drm_r32g32b32 *)°amma_data ->lut;Why do you need this cast?
Not required, agree, will remove.
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+ index =I915_READ (pal_prec_index); + index |=BDW_INDEX_AUTO_INCREMENT |BDW_INDEX_SPLIT_MODE ; +I915_WRITE (pal_prec_index, index); + +bdw_write_10bit_gamma_precision (dev, correction_values, + pal_prec_data,BDW_SPLITGAMMA_MAX_VALS );
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_gamma(struct drm_device *dev, struct drm_property_blob *blob, · line 327
Quoted 5 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+ +/* Enable DeGamma on Pipe */ + mode &= ~GAMMA_MODE_MODE_MASK ; +I915_WRITE (GAMMA_MODE (pipe), mode |GAMMA_MODE_MODE_SPLIT ); + DRM_DEBUG_DRIVER("DeGamma correction enabled on Pipe %c\n",Choose your capitalisation DeGamma or degamma. Pick one and use it consistently to make it easier to grep through the code.
Will stick with degamma now.
Quoted 5 lines
It also looks like you should check if the gamma mode is not something other than split / off. Otherwise strange things could happen. Similarly in the gamma code you shouldn't be able to program something other than split if you have a degamma mode set.
We discussed this in the design phase itself. This decision has to go to userspcae only, whom should know, what its doing. There are various permutation and combinations possbile which make kernel code unnecessary complex. Kernel will just follow what is being requested from usp.
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ pipe_name(pipe)); + +return 0 ; +} +static s16 chv_prepare_csc_coeff (s64 csc_value) {s32 csc_int_value;@@ -579,6 +636,8 @@ void intel_color_manager_crtc_commit(structdrm_device *dev,/* Degamma correction */ if (IS_CHERRYVIEW(dev)) ret =chv_set_degamma (dev, blob, crtc); + else if (IS_BROADWELL(dev) || IS_GEN9(dev)) + ret =bdw_set_degamma (dev, blob, crtc);
Quoted 6 lines
Quoted 3 lines
drivers/gpu/drm/i915/intel_color_manager.c +0
-0if (ret)DRM_ERROR("set degamma correction
failed\n");Rob
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 22/22 drm/i915: BDW: Pipe level CSC correction
In reply to Shashank SharmaBDW/SKL/BXT support Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into respective CSC registers.
This patch does the following:
1. Adds the core function to program CSC correction values for BDW/SKL/BXT platform
2. Adds CSC correction macros/defines
--- drivers/gpu/drm/i915/i915_reg.h | 7 ++ drivers/gpu/drm/i915/intel_color_manager.c | 114 ++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_color_manager.h | 12 ++- 3 files changed, 129 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +7 -0
@@ -8085,4 +8085,11 @@ enum skl_disp_power_wells { (_PIPE3 (pipe,PAL_PREC_GCMAX_A ,PAL_PREC_GCMAX_B ,PAL_PREC_GCMAX_C )) +/* BDW CSC correction */ +#define CSC_COEFF_A 0x49010 +#define CSC_COEFF_B 0x49110 +#define CSC_COEFF_C 0x49210 +#define _PIPE_CSC_COEFF (pipe) \ + (_PIPE3(pipe, CSC_COEFF_A, CSC_COEFF_B, CSC_COEFF_C)) +#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_color_manager.c +112 -2
129 lines not on this page · raw message
drivers/gpu/drm/i915/intel_color_manager.h +10 -2
@@ -90,7 +90,15 @@#define CGM_CSC_EN (1 << 1)#define CGM_DEGAMMA_EN (1 << 0) -/* Gamma on BDW */ +/* BDW CSC */ +/* 1.0000000 in S31.32 format */ +#define BDW_CSC_COEFF_UNITY_VAL 0x100000000 +/* 3.9921875 in S31.32 format */ +#define BDW_CSC_COEFF_MAX_VAL 0x3FE000000 +/*-4.000000 in S31.32 format */ +#define BDW_CSC_COEFF_MIN_VAL 0xFFFFFFFC00000000 + +/* BDW Gamma */ #define BDW_SPLITGAMMA_MAX_VALS 512#define BDW_8BIT_GAMMA_MAX_VALS 256#define BDW_10BIT_GAMMA_MAX_VALS 1024
@@ -99,5 +107,5 @@#define BDW_INDEX_AUTO_INCREMENT (1 << 15)#define BDW_INDEX_SPLIT_MODE (1 << 31) -/* Degamma on BDW */ +/* BDW Degamma*/ #define BDW_DEGAMMA_MAX_VALS 512
Signature · 6 lines
1.9.1 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 22/22] drm/i915: BDW: Pipe level CSC correction
Hi Shashank,
Quoted 38 lines · Shashank Sharma
BDW/SKL/BXT support Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into respective CSC registers.
This patch does the following:
1. Adds the core function to program CSC correction values for BDW/SKL/BXT platform
2. Adds CSC correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++ drivers/gpu/drm/i915/intel_color_manager.c | 114 ++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_color_manager.h | 12 ++- 3 files changed, 129 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_reg.h +7
-0@@ -8085,4 +8085,11 @@ enum skl_disp_power_wells { (_PIPE3 (pipe,PAL_PREC_GCMAX_A ,PAL_PREC_GCMAX_B ,PAL_PREC_GCMAX_C )) +/* BDW CSC correction */ +#define CSC_COEFF_A 0x49010 +#define CSC_COEFF_B 0x49110 +#define CSC_COEFF_C 0x49210 +#define _PIPE_CSC_COEFF (pipe) \ + (_PIPE3(pipe, CSC_COEFF_A, CSC_COEFF_B, CSC_COEFF_C)) +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +0
-0
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 333
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +0
-1@@ -330,11 +330,119 @@ static int bdw_set_degamma(struct drm_device *dev,return 0 ; } -static s16 chv_prepare_csc_coeff (s64 csc_value)
As mentioned previously, this should be part of the respective patch.
Quoted 35 lines
drivers/gpu/drm/i915/intel_color_manager.c +35
-0+static uint32_t bdw_prepare_csc_coeff (int64_t coeff) +{ +uint32_t reg_val, ls_bit_pos, exponent_bits, sign_bit =0 ; +int32_t mantissa; +uint64_t abs_coeff; + + coeff =min_t (int64_t, coeff,BDW_CSC_COEFF_MAX_VAL ); + coeff =max_t (int64_t, coeff,BDW_CSC_COEFF_MIN_VAL ); + + abs_coeff =abs (coeff); +if (abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>3 )) { +/* abs_coeff < 0.125 */ + exponent_bits =3 ; + ls_bit_pos =19 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>3 ) && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>2 )) { +/* abs_coeff >= 0.125 && val < 0.25 */ + exponent_bits =2 ; + ls_bit_pos =20 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>2 ) + && abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>1 )) { +/* abs_coeff >= 0.25 && val < 0.5 */ + exponent_bits =1 ; + ls_bit_pos =21 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>1 ) + && abs_coeff <BDW_CSC_COEFF_UNITY_VAL ) { +/* abs_coeff >= 0.5 && val < 1.0 */ + exponent_bits =0 ; + ls_bit_pos =22 ; + }else if (abs_coeff >=BDW_CSC_COEFF_UNITY_VAL && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL <<1 )) { +/* abs_coeff >= 1.0 && val < 2.0 */ + exponent_bits =7 ; + ls_bit_pos =23 ; + }else {
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 377
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +10
-0+/* abs_coeff >= 2.0 && val < 4.0 */ + exponent_bits =6 ; + ls_bit_pos =24 ; + } + + mantissa =GET_BITS_ROUNDOFF (abs_coeff, ls_bit_pos,CSC_MAX_VALS ); +if (coeff <0 ) { + sign_bit =1 ; + mantissa = -mantissa; + mantissa &= ((1 <<CSC_MAX_VALS ) -1 );
I think there is a macro for this already ?
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 390
Quoted 13 lines
drivers/gpu/drm/i915/intel_color_manager.c +13
-0+ } + + reg_val =0 ; +SET_BITS (reg_val, exponent_bits,12 ,3 ); +SET_BITS (reg_val, mantissa,3 ,9 ); +SET_BITS (reg_val, sign_bit,15 ,1 ); +DRM_DEBUG_DRIVER ("CSC: reg_val=0x%x\n" , reg_val); +return reg_val; +} + +int bdw_set_csc (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{
The function should be static ?
Regards,
Emil
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 22/22] drm/i915: BDW: Pipe level CSC correction
Regards
Shashank
Quoted 44 lines · Emil Velikov
Hi Shashank,
Quoted 41 lines · Shashank Sharma
BDW/SKL/BXT support Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into respective CSC registers.
This patch does the following:
1. Adds the core function to program CSC correction values for BDW/SKL/BXT platform
2. Adds CSC correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++ drivers/gpu/drm/i915/intel_color_manager.c | 114 ++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_color_manager.h | 12 ++- 3 files changed, 129 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_reg.h +7
-0@@ -8085,4 +8085,11 @@ enum skl_disp_power_wells { (_PIPE3 (pipe,PAL_PREC_GCMAX_A ,PAL_PREC_GCMAX_B ,PAL_PREC_GCMAX_C )) +/* BDW CSC correction */ +#define CSC_COEFF_A 0x49010 +#define CSC_COEFF_B 0x49110 +#define CSC_COEFF_C 0x49210 +#define _PIPE_CSC_COEFF (pipe) \ + (_PIPE3(pipe, CSC_COEFF_A, CSC_COEFF_B, CSC_COEFF_C)) +#endif /* _I915_REG_H_ */ drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -330,11 +330,119 @@ static int bdw_set_degamma(struct drm_device *dev,return 0 ; }
Quoted 3 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 333
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +0
-1-static s16 chv_prepare_csc_coeff (s64 csc_value)As mentioned previously, this should be part of the respective patch.
Agree. Looks like diff is messing up a bit. Will take care of this.
Quoted 38 lines
Quoted 38 lines
drivers/gpu/drm/i915/intel_color_manager.c +38
-0+static uint32_t bdw_prepare_csc_coeff (int64_t coeff) +{ +uint32_t reg_val, ls_bit_pos, exponent_bits, sign_bit =0 ; +int32_t mantissa; +uint64_t abs_coeff; + + coeff =min_t (int64_t, coeff,BDW_CSC_COEFF_MAX_VAL ); + coeff =max_t (int64_t, coeff,BDW_CSC_COEFF_MIN_VAL ); + + abs_coeff =abs (coeff); +if (abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>3 )) { +/* abs_coeff < 0.125 */ + exponent_bits =3 ; + ls_bit_pos =19 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>3 ) && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>2 )) { +/* abs_coeff >= 0.125 && val < 0.25 */ + exponent_bits =2 ; + ls_bit_pos =20 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>2 ) + && abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>1 )) { +/* abs_coeff >= 0.25 && val < 0.5 */ + exponent_bits =1 ; + ls_bit_pos =21 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>1 ) + && abs_coeff <BDW_CSC_COEFF_UNITY_VAL ) { +/* abs_coeff >= 0.5 && val < 1.0 */ + exponent_bits =0 ; + ls_bit_pos =22 ; + }else if (abs_coeff >=BDW_CSC_COEFF_UNITY_VAL && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL <<1 )) { +/* abs_coeff >= 1.0 && val < 2.0 */ + exponent_bits =7 ; + ls_bit_pos =23 ; + }else { +/* abs_coeff >= 2.0 && val < 4.0 */ + exponent_bits =6 ; + ls_bit_pos =24 ;
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 377
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ } + + mantissa =GET_BITS_ROUNDOFF (abs_coeff, ls_bit_pos,CSC_MAX_VALS ); +if (coeff <0 ) { + sign_bit =1 ; + mantissa = -mantissa; + mantissa &= ((1 <<CSC_MAX_VALS ) -1 );I think there is a macro for this already ?
Thats for GAMMA_MAX, not for CSC_MAX. Or you mean the whole (1 << CSC_MAX_VALS -1) to be replaced with GET/SET bits ?
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +6
-0+ } + + reg_val =0 ; +SET_BITS (reg_val, exponent_bits,12 ,3 ); +SET_BITS (reg_val, mantissa,3 ,9 ); +SET_BITS (reg_val, sign_bit,15 ,1 );
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 390
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+DRM_DEBUG_DRIVER ("CSC: reg_val=0x%x\n" , reg_val); +return reg_val; +} + +int bdw_set_csc (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{The function should be static ?
Agree.
Quoted 3 lines
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 22/22] drm/i915: BDW: Pipe level CSC correction
Quoted 107 lines · Shashank
Quoted 51 lines · Emil Velikov
Hi Shashank,
Quoted 46 lines · Shashank Sharma
BDW/SKL/BXT support Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into respective CSC registers.
This patch does the following:
1. Adds the core function to program CSC correction values for BDW/SKL/BXT platform
2. Adds CSC correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++ drivers/gpu/drm/i915/intel_color_manager.c | 114 ++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_color_manager.h | 12 ++- 3 files changed, 129 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_reg.h +7
-0@@ -8085,4 +8085,11 @@ enum skl_disp_power_wells { (_PIPE3 (pipe,PAL_PREC_GCMAX_A ,PAL_PREC_GCMAX_B ,PAL_PREC_GCMAX_C )) +/* BDW CSC correction */ +#define CSC_COEFF_A 0x49010 +#define CSC_COEFF_B 0x49110 +#define CSC_COEFF_C 0x49210 +#define _PIPE_CSC_COEFF (pipe) \ + (_PIPE3(pipe, CSC_COEFF_A, CSC_COEFF_B, CSC_COEFF_C)) +#endif /* _I915_REG_H_ */drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -330,11 +330,119 @@ static int bdw_set_degamma(struct drm_device *dev,return 0 ; }Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 333
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +0
-1-static s16 chv_prepare_csc_coeff (s64 csc_value)As mentioned previously, this should be part of the respective patch.
Agree. Looks like diff is messing up a bit. Will take care of this.
Quoted 40 lines
Quoted 40 lines
drivers/gpu/drm/i915/intel_color_manager.c +40
-0+static uint32_t bdw_prepare_csc_coeff (int64_t coeff) +{ +uint32_t reg_val, ls_bit_pos, exponent_bits, sign_bit =0 ; +int32_t mantissa; +uint64_t abs_coeff; + + coeff =min_t (int64_t, coeff,BDW_CSC_COEFF_MAX_VAL ); + coeff =max_t (int64_t, coeff,BDW_CSC_COEFF_MIN_VAL ); + + abs_coeff =abs (coeff); +if (abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>3 )) { +/* abs_coeff < 0.125 */ + exponent_bits =3 ; + ls_bit_pos =19 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>3 ) && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>2 )) { +/* abs_coeff >= 0.125 && val < 0.25 */ + exponent_bits =2 ; + ls_bit_pos =20 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>2 ) + && abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>1 )) { +/* abs_coeff >= 0.25 && val < 0.5 */ + exponent_bits =1 ; + ls_bit_pos =21 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>1 ) + && abs_coeff <BDW_CSC_COEFF_UNITY_VAL ) { +/* abs_coeff >= 0.5 && val < 1.0 */ + exponent_bits =0 ; + ls_bit_pos =22 ; + }else if (abs_coeff >=BDW_CSC_COEFF_UNITY_VAL && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL <<1 )) { +/* abs_coeff >= 1.0 && val < 2.0 */ + exponent_bits =7 ; + ls_bit_pos =23 ; + }else { +/* abs_coeff >= 2.0 && val < 4.0 */ + exponent_bits =6 ; + ls_bit_pos =24 ; + } +Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 377
Quoted 6 lines
drivers/gpu/drm/i915/intel_color_manager.c +5
-0+ mantissa =GET_BITS_ROUNDOFF (abs_coeff, ls_bit_pos,CSC_MAX_VALS ); +if (coeff <0 ) { + sign_bit =1 ; + mantissa = -mantissa; + mantissa &= ((1 <<CSC_MAX_VALS ) -1 );I think there is a macro for this already ?
Quoted 2 lines
Thats for
GAMMA_MAX, not forCSC_MAX. Or you mean the whole (1 <<CSC_MAX_VALS-1) to be replaced with GET/SET bits ?
What I mean is - the above looks exactly like the GET_BIT_MASK (which you introduced). Perhaps you can use it ?
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 22/22] drm/i915: BDW: Pipe level CSC correction
Regards
Shashank
Quoted 108 lines · Emil Velikov
Quoted 107 lines · Shashank
Quoted 51 lines · Emil Velikov
Hi Shashank,
Quoted 46 lines · Shashank Sharma
BDW/SKL/BXT support Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into respective CSC registers.
This patch does the following:
1. Adds the core function to program CSC correction values for BDW/SKL/BXT platform
2. Adds CSC correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++ drivers/gpu/drm/i915/intel_color_manager.c | 114 ++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_color_manager.h | 12 ++- 3 files changed, 129 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_reg.h +7
-0@@ -8085,4 +8085,11 @@ enum skl_disp_power_wells { (_PIPE3 (pipe,PAL_PREC_GCMAX_A ,PAL_PREC_GCMAX_B ,PAL_PREC_GCMAX_C )) +/* BDW CSC correction */ +#define CSC_COEFF_A 0x49010 +#define CSC_COEFF_B 0x49110 +#define CSC_COEFF_C 0x49210 +#define _PIPE_CSC_COEFF (pipe) \ + (_PIPE3(pipe, CSC_COEFF_A, CSC_COEFF_B, CSC_COEFF_C)) +#endif /* _I915_REG_H_ */drivers/gpu/drm/i915/intel_color_manager.c +0
-0@@ -330,11 +330,119 @@ static int bdw_set_degamma(struct drm_device *dev,return 0 ; }Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 333
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.c +0
-1-static s16 chv_prepare_csc_coeff (s64 csc_value)As mentioned previously, this should be part of the respective patch.
Agree. Looks like diff is messing up a bit. Will take care of this.
Quoted 49 lines
Quoted 36 lines
drivers/gpu/drm/i915/intel_color_manager.c +36
-0+static uint32_t bdw_prepare_csc_coeff (int64_t coeff) +{ +uint32_t reg_val, ls_bit_pos, exponent_bits, sign_bit =0 ; +int32_t mantissa; +uint64_t abs_coeff; + + coeff =min_t (int64_t, coeff,BDW_CSC_COEFF_MAX_VAL ); + coeff =max_t (int64_t, coeff,BDW_CSC_COEFF_MIN_VAL ); + + abs_coeff =abs (coeff); +if (abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>3 )) { +/* abs_coeff < 0.125 */ + exponent_bits =3 ; + ls_bit_pos =19 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>3 ) && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>2 )) { +/* abs_coeff >= 0.125 && val < 0.25 */ + exponent_bits =2 ; + ls_bit_pos =20 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>2 ) + && abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>1 )) { +/* abs_coeff >= 0.25 && val < 0.5 */ + exponent_bits =1 ; + ls_bit_pos =21 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>1 ) + && abs_coeff <BDW_CSC_COEFF_UNITY_VAL ) { +/* abs_coeff >= 0.5 && val < 1.0 */ + exponent_bits =0 ; + ls_bit_pos =22 ; + }else if (abs_coeff >=BDW_CSC_COEFF_UNITY_VAL && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL <<1 )) { +/* abs_coeff >= 1.0 && val < 2.0 */ + exponent_bits =7 ; + ls_bit_pos =23 ; + }else { +/* abs_coeff >= 2.0 && val < 4.0 */ drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 377
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ exponent_bits =6 ; + ls_bit_pos =24 ; + } + + mantissa =GET_BITS_ROUNDOFF (abs_coeff, ls_bit_pos,CSC_MAX_VALS ); +if (coeff <0 ) { + sign_bit =1 ; + mantissa = -mantissa; + mantissa &= ((1 <<CSC_MAX_VALS ) -1 );I think there is a macro for this already ?
Quoted 5 lines
Quoted 2 lines
Thats for
GAMMA_MAX, not forCSC_MAX. Or you mean the whole (1 <<CSC_MAX_VALS-1) to be replaced with GET/SET bits ?What I mean is - the above looks exactly like the
GET_BIT_MASK(which you introduced). Perhaps you can use it ?
Yes, Agree. but in later code review phase we realized that we dont even need this masking for mantissa. New patch set doesnt have this &ing, so we dont need this.
Quoted 3 lines
Regards,
Emil
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 22/22] drm/i915: BDW: Pipe level CSC correction
In reply to Shashank SharmaQuoted 79 lines · Shashank Sharma
BDW/SKL/BXT support Color Space Conversion (CSC) using a 3x3 matrix that needs to be programmed into respective CSC registers.
This patch does the following:
1. Adds the core function to program CSC correction values for BDW/SKL/BXT platform
2. Adds CSC correction macros/definesSigned-off-by Shashank Sharma <[email protected]>Signed-off-by Kausal Malladi <[email protected]>Signed-off-by Kumar, Kiran S <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 7 ++ drivers/gpu/drm/i915/intel_color_manager.c | 114 ++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_color_manager.h | 12 ++- 3 files changed, 129 insertions(+), 4 deletions(-)drivers/gpu/drm/i915/i915_reg.h +7
-0@@ -8085,4 +8085,11 @@ enum skl_disp_power_wells { (_PIPE3 (pipe,PAL_PREC_GCMAX_A ,PAL_PREC_GCMAX_B ,PAL_PREC_GCMAX_C )) +/* BDW CSC correction */ +#define CSC_COEFF_A 0x49010 +#define CSC_COEFF_B 0x49110 +#define CSC_COEFF_C 0x49210 +#define _PIPE_CSC_COEFF (pipe) \ + (_PIPE3(pipe, CSC_COEFF_A, CSC_COEFF_B, CSC_COEFF_C)) +#endif /* _I915_REG_H_ */
drivers/gpu/drm/i915/intel_color_manager.c +32
-1@@ -330,11 +330,119 @@ static int bdw_set_degamma(struct drm_device *dev, return 0; } -static s16 chv_prepare_csc_coeff (s64 csc_value) +static uint32_t bdw_prepare_csc_coeff (int64_t coeff) +{ +uint32_t reg_val, ls_bit_pos, exponent_bits, sign_bit =0 ; +int32_t mantissa; +uint64_t abs_coeff; + + coeff =min_t (int64_t, coeff,BDW_CSC_COEFF_MAX_VAL ); + coeff =max_t (int64_t, coeff,BDW_CSC_COEFF_MIN_VAL ); + + abs_coeff =abs (coeff); +if (abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>3 )) { +/* abs_coeff < 0.125 */ + exponent_bits =3 ; + ls_bit_pos =19 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>3 ) && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>2 )) { +/* abs_coeff >= 0.125 && val < 0.25 */ + exponent_bits =2 ; + ls_bit_pos =20 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>2 ) + && abs_coeff < (BDW_CSC_COEFF_UNITY_VAL >>1 )) { +/* abs_coeff >= 0.25 && val < 0.5 */ + exponent_bits =1 ; + ls_bit_pos =21 ; + }else if (abs_coeff >= (BDW_CSC_COEFF_UNITY_VAL >>1 ) + && abs_coeff <BDW_CSC_COEFF_UNITY_VAL ) { +/* abs_coeff >= 0.5 && val < 1.0 */ + exponent_bits =0 ; + ls_bit_pos =22 ; + }else if (abs_coeff >=BDW_CSC_COEFF_UNITY_VAL && + abs_coeff < (BDW_CSC_COEFF_UNITY_VAL <<1 )) { +/* abs_coeff >= 1.0 && val < 2.0 */
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device · line 375
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +9
-0+ exponent_bits =7 ; + ls_bit_pos =23 ; + }else { +/* abs_coeff >= 2.0 && val < 4.0 */ + exponent_bits =6 ; + ls_bit_pos =24 ; + } + + mantissa =GET_BITS_ROUNDOFF (abs_coeff, ls_bit_pos,CSC_MAX_VALS );
Is GET_BITS_ROUNDOFF safe for negative values?
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 377
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+if (coeff <0 ) { + sign_bit =1 ; + mantissa = -mantissa; + mantissa &= ((1 <<CSC_MAX_VALS ) -1 );
Oops. It looks like you are reusing the macro/define for the number of coefficients for the size of the mantissa. Also you defined a macro for this very purpose in your other patch.
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 384
Quoted 7 lines
drivers/gpu/drm/i915/intel_color_manager.c +7
-0+ } + + reg_val =0 ; +SET_BITS (reg_val, exponent_bits,12 ,3 ); +SET_BITS (reg_val, mantissa,3 ,9 ); +SET_BITS (reg_val, sign_bit,15 ,1 ); +DRM_DEBUG_DRIVER ("CSC: reg_val=0x%x\n" , reg_val);
This debug message is superfluous as you can easily read register values out with i-g-t.
Quoted 42 lines
drivers/gpu/drm/i915/intel_color_manager.c +39
-2+return reg_val; +} + +int bdw_set_csc (struct drm_device *dev,struct drm_property_blob *blob, +struct drm_crtc *crtc) +{ +enum pipe pipe; +enum plane plane; +int i, j, temp; +int word =0 ; +u32 reg, plane_ctl, mode; +struct drm_ctm *csc_data; +struct drm_i915_private *dev_priv = dev->dev_private; + +if (WARN_ON (!blob)) +return -EINVAL ; + +if (blob->length !=sizeof (struct drm_ctm )) { +DRM_ERROR ("Invalid length of data received\n" ); +return -EINVAL ; + } + + csc_data = (struct drm_ctm *)blob->data; + pipe =to_intel_crtc (crtc)->pipe; + plane =to_intel_crtc (crtc)->plane; + + plane_ctl =I915_READ (PLANE_CTL (pipe, plane)); + plane_ctl |=PLANE_CTL_PIPE_CSC_ENABLE ; +I915_WRITE (PLANE_CTL (pipe, plane), plane_ctl); + reg =_PIPE_CSC_COEFF (pipe); +/* Write csc coeff to csc regs */ +for (i =0 , j =0 ; i <CSC_MAX_VALS ; i++) { +if ((i %3 ) ==0 ) { + temp = bdw_prepare_csc_coeff(csc_data ->ctm_coeff[i]); + SET_BITS(word, temp, 16, 16); + i++; + temp = bdw_prepare_csc_coeff(csc_data ->ctm_coeff[i]); + SET_BITS(word, temp, 0, 16); + }else {
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev,
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.c +8
-1+ temp = bdw_prepare_csc_coeff(csc_data ->ctm_coeff[i]); + SET_BITS(word, temp, 16, 16); + } + +I915_WRITE (reg + j, word); + j = j +4 ; + } +
Although this loops looks like it should work, i'm not convinced of it's merits over programming the 5 registers directly. That's a style question for the more experienced kernel folk.
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 436
Quoted 4 lines
drivers/gpu/drm/i915/intel_color_manager.c +4
-0+/* Enable CSC functionality */ + mode =I915_READ (PIPE_CSC_MODE (pipe)); + mode |=CSC_POSITION_BEFORE_GAMMA ; +I915_WRITE (PIPE_CSC_MODE (pipe), mode);
The specs indicate that this value is ignored in split gamma mode, but at the same time say that this register arms the CSC registers above. A comment to that affect might would be helpful.
drivers/gpu/drm/i915/intel_color_manager.c static int bdw_set_degamma(struct drm_device *dev, · line 445
Quoted 11 lines
drivers/gpu/drm/i915/intel_color_manager.c +1
-0+ DRM_DEBUG_DRIVER("CSC enabled on Pipe %c\n",
pipe_name(pipe));drivers/gpu/drm/i915/intel_color_manager.c +5
-1+return 0 ; +} + +static s32 chv_prepare_csc_coeff (s64 csc_value) {s32 csc_int_value;u32 csc_fract_value; -s16 csc_s3_12_format; +s32 csc_s3_12_format;
Why is this change in this patch?
Quoted 21 lines
drivers/gpu/drm/i915/intel_color_manager.c +2
-0if (csc_value >=0 ) { csc_value +=CHV_CSC_FRACT_ROUNDOFF ;@@ -650,6 +758,8 @@ void intel_color_manager_crtc_commit(structdrm_device *dev,/* CSC correction */ if (IS_CHERRYVIEW(dev)) ret =chv_set_csc (dev, blob, crtc); + else if (IS_BROADWELL(dev) || IS_GEN9(dev)) + ret =bdw_set_csc (dev, blob, crtc);if (ret)drivers/gpu/drm/i915/intel_color_manager.c +0
-0DRM_ERROR ("set CSC correction failed\n" );drivers/gpu/drm/i915/intel_color_manager.h +0
-0@@ -90,7 +90,15 @@#define CGM_CSC_EN (1 << 1)#define CGM_DEGAMMA_EN (1 << 0)
drivers/gpu/drm/i915/intel_color_manager.h line 101
Quoted 10 lines
drivers/gpu/drm/i915/intel_color_manager.h +9
-1-/* Gamma on BDW */ +/* BDW CSC */ +/* 1.0000000 in S31.32 format */ +#define BDW_CSC_COEFF_UNITY_VAL 0x100000000 +/* 3.9921875 in S31.32 format */ +#define BDW_CSC_COEFF_MAX_VAL 0x3FE000000 +/*-4.000000 in S31.32 format */ +#define BDW_CSC_COEFF_MIN_VAL 0xFFFFFFFC00000000 + +/* BDW Gamma */
Another change that has nothing to do with CSC.
drivers/gpu/drm/i915/intel_color_manager.h line 110
Quoted 9 lines
drivers/gpu/drm/i915/intel_color_manager.h +1
-1#define BDW_SPLITGAMMA_MAX_VALS 512#define BDW_8BIT_GAMMA_MAX_VALS 256#define BDW_10BIT_GAMMA_MAX_VALS 1024@@ -99,5 +107,5 @@#define BDW_INDEX_AUTO_INCREMENT (1 << 15)#define BDW_INDEX_SPLIT_MODE (1 << 31) -/* Degamma on BDW */ +/* BDW Degamma*/
Ditto.
drivers/gpu/drm/i915/intel_color_manager.h line 111
Quoted 1 line
drivers/gpu/drm/i915/intel_color_manager.h +0
-0#define BDW_DEGAMMA_MAX_VALS 512
Rob
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx