CRTC background color
Subsystems (4)
v2 cover CRTC background color
This is a second revision of the series previously posted here:
https://lists.freedesktop.org/archives/intel-gfx/2018-October/178202.html
As noted before, this functionality adds new ABI so we need a userspace consumer ready before we merge the kernel work. My understanding is that some of the folks involved with ChromeOS are looking at this and that there's a ChromeOS userspace review happening at
https://chromium-review.googlesource.com/c/chromium/src/+/1278858
Since there are a few Intel-specific background color changes that we want to make independently of the new ABI, I've separated those out into a new patch #1; we may want to consider landing that patch before the rest of the series since it fixes an inconsistency in how we currently program our hardware.
On the i915-side of things, this series only deals with gen9+ at the moment. It looks like CHV may also have support for background color functionality, but I couldn't find the register layout details for that platform, so I haven't added support for it yet.
Matt Roper (3):
drm/i915: Force background color to black for gen9+
drm: Add CRTC background color property (v2) drm/i915/gen9+: Add support for pipe background color (v2)
drivers/gpu/drm/drm_atomic_state_helper.c | 1 + drivers/gpu/drm/drm_atomic_uapi.c | 5 ++++ drivers/gpu/drm/drm_blend.c | 21 ++++++++++++++--- drivers/gpu/drm/drm_mode_config.c | 6 +++++ drivers/gpu/drm/i915/i915_debugfs.c | 9 +++++++ drivers/gpu/drm/i915/i915_reg.h | 6 +++++ drivers/gpu/drm/i915/intel_display.c | 39 +++++++++++++++++++++++++++++++ include/drm/drm_blend.h | 1 + include/drm/drm_crtc.h | 17 ++++++++++++++ include/drm/drm_mode_config.h | 5 ++++ include/uapi/drm/drm_mode.h | 26 +++++++++++++++++++++ 11 files changed, 133 insertions(+), 3 deletions(-)
Signature · 6 lines
2.14.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/3 drm: Add CRTC background color property (v2)
Some display controllers can be programmed to present non-black colors for pixels not covered by any plane (or pixels covered by the transparent regions of higher planes). Compositors that want a UI with a solid color background can potentially save memory bandwidth by setting the CRTC background property and using smaller planes to display the rest of the content.
To avoid confusion between different ways of encoding RGB data, we define a standard 64-bit format that should be used for this property's value. Helper functions and macros are provided to generate and dissect values in this standard format with varying component precision values.
v2:
- Swap internal representation's blue and red bits to make it easier to read if printed out. (Ville)
- Document bgcolor property in drm_blend.c. (Sean Paul)
- s/background_color/bgcolor/ for consistency between property name and value storage field. (Sean Paul)
- Add a convenience function to attach property to a given crtc.
--- drivers/gpu/drm/drm_atomic_state_helper.c | 1 + drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_blend.c | 21 ++++++++++++++++++--- drivers/gpu/drm/drm_mode_config.c | 6 ++++++ include/drm/drm_blend.h | 1 + include/drm/drm_crtc.h | 17 +++++++++++++++++ include/drm/drm_mode_config.h | 5 +++++ include/uapi/drm/drm_mode.h | 26 ++++++++++++++++++++++++++ 8 files changed, 79 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic_state_helper.c +1 -0
@@ -101,6 +101,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, state->planes_changed = false; state->connectors_changed = false; state->color_mgmt_changed = false; + state->bgcolor_changed = false; state->zpos_changed = false; state->commit =NULL ; state->event =NULL ;
drivers/gpu/drm/drm_atomic_uapi.c +5 -0
@@ -467,6 +467,9 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,return -EFAULT ;set_out_fence_for_crtc (state->state, crtc, fence_ptr); + }else if (property == config->bgcolor_property) { + state->bgcolor = val; + state->bgcolor_changed = true; }else if (crtc->funcs->atomic_set_property) {return crtc->funcs->atomic_set_property (crtc, state, property, val); }else {
@@ -499,6 +502,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, *val = (state->gamma_lut) ? state->gamma_lut->base.id :0 ; else if (property == config->prop_out_fence_ptr) *val = 0; + else if (property == config->bgcolor_property) + *val = state->bgcolor; else if (crtc->funcs->atomic_get_property) return crtc->funcs->atomic_get_property(crtc, state, property, val); else
drivers/gpu/drm/drm_blend.c +18 -3
@@ -175,9 +175,16 @@* plane does not expose the "alpha" property, then this is * assumed to be 1.0 * -* Note that all the property extensions described here apply either to the -* plane or the CRTC (e.g. for the background color, which currently is not -* exposed and assumed to be black). +* The property extensions described above all apply to the plane. Drivers +* may also expose the following crtc property extension: +* +* bgcolor: +* Background color is setup with drm_crtc_add_bgcolor_property(). It +* controls the RGB color of a full-screen, fully-opaque layer that exists +* below all planes. This color will be used for pixels not covered by +* any plane and may also be blended with plane contents as allowed by a +* plane's alpha values. The background color defaults to black, and is +* assumed to be black for drivers that do not expose this property. */ /**
@@ -593,3 +600,11 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane,return 0 ; }EXPORT_SYMBOL (drm_plane_create_blend_mode_property); + +void drm_crtc_add_bgcolor_property (struct drm_crtc *crtc) +{ +drm_object_attach_property (&crtc->base, + crtc->dev->mode_config.bgcolor_property, +drm_rgba (16 ,0 ,0 ,0 ,0xffff )); +} +EXPORT_SYMBOL (drm_crtc_add_bgcolor_property);
drivers/gpu/drm/drm_mode_config.c +6 -0
@@ -352,6 +352,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)return -ENOMEM ; dev->mode_config.modifiers_property = prop; + prop =drm_property_create_range (dev,0 ,"BACKGROUND_COLOR" , +0 ,GENMASK_ULL (63 ,0 )); +if (!prop) +return -ENOMEM ; + dev->mode_config.bgcolor_property = prop; +return 0 ; }
include/drm/drm_blend.h +1 -0
@@ -58,4 +58,5 @@ int drm_atomic_normalize_zpos(struct drm_device *dev, struct drm_atomic_state *state);int drm_plane_create_blend_mode_property (struct drm_plane *plane,unsigned int supported_modes); +void drm_crtc_add_bgcolor_property (struct drm_crtc *crtc);#endif
include/drm/drm_crtc.h +17 -0
@@ -168,6 +168,11 @@ struct drm_crtc_state {* drivers to steer the atomic commit control flow. */ bool color_mgmt_changed : 1; +/** +* @bgcolor_changed: Background color value has changed. Used by +* drivers to steer the atomic commit control flow. +*/ + bool bgcolor_changed : 1;/** * @no_vblank:
@@ -274,6 +279,18 @@ struct drm_crtc_state {*/ struct drm_property_blob *gamma_lut; +/** +* @bgcolor: +* +* RGB value representing the pipe's background color. The background +* color (aka "canvas color") of a pipe is the color that will be used +* for pixels not covered by a plane, or covered by transparent pixels +* of a plane. The value here should be built via drm_rgba(); +* individual color components can be extracted with desired precision +* via the DRM_RGBA_*() macros. +*/ +u64 bgcolor; +/** * @target_vblank: *
include/drm/drm_mode_config.h +5 -0
@@ -813,6 +813,11 @@ struct drm_mode_config {*/ struct drm_property *writeback_out_fence_ptr_property; +/** +* @bgcolor_property: RGBA background color for CRTC. +*/ +struct drm_property *bgcolor_property; +/* dumb ioctl parameters */ uint32_t preferred_depth, prefer_shadow;
include/uapi/drm/drm_mode.h +26 -0
@@ -888,6 +888,32 @@ struct drm_mode_revoke_lease {__u32 lessee_id; }; +/* +* Put RGBA values into a standard 64-bit representation that can be used +* for ioctl parameters, inter-driver commmunication, etc. If the component +* values being provided contain less than 16 bits of precision, they'll +* be shifted into the most significant bits. +*/ +static inline __u64 +drm_rgba (__u8 bpc,__u16 red,__u16 green,__u16 blue,__u16 alpha) +{ +int msb_shift =16 - bpc; + +return (__u64 )alpha << msb_shift <<48 | + (__u64 )red << msb_shift <<32 | + (__u64 )green << msb_shift <<16 | + (__u64 )blue << msb_shift; +} + +/* +* Extract the specified number of bits of a specific color component from a +* standard 64-bit RGBA value. +*/ +#define DRM_RGBA_BLUE (c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits)) +#define DRM_RGBA_GREEN (c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits)) +#define DRM_RGBA_RED (c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits)) +#define DRM_RGBA_ALPHA (c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits)) +#if defined(__cplusplus) }#endif
Signature · 6 lines
2.14.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/3 drm/i915/gen9+: Add support for pipe background color (v2)
In reply to Matt RoperGen9+ platforms allow CRTC's to be programmed with a background/canvas color below the programmable planes. Let's expose this for use by compositors.
v2:
- Split out bgcolor sanitization and programming of csc/gamma bits to a separate patch that we can land before the ABI changes are ready to go in. (Ville)
- Change a temporary variable name to be more consistent with other similar functions. (Ville)
- Change register name to SKL_CANVAS for consistency with the CHV_CANVAS register.
--- drivers/gpu/drm/i915/i915_debugfs.c | 9 +++++++++ drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +9 -0
@@ -3254,6 +3254,15 @@ static int i915_display_info(struct seq_file *m, void *unused)intel_plane_info (m, crtc); } +if (INTEL_GEN (dev_priv) >=9 && pipe_config->base.active) { +uint64_t background = pipe_config->base.bgcolor; + +seq_printf (m,"\tbackground color (10bpc): r=%x g=%x b=%x\n" , +DRM_RGBA_RED (background,10 ), +DRM_RGBA_GREEN (background,10 ), +DRM_RGBA_BLUE (background,10 )); + } +seq_printf (m,"\tunderrun reporting: cpu=%s pch=%s \n" ,yesno (!crtc->cpu_fifo_underrun_disabled),yesno (!crtc->pch_fifo_underrun_disabled));
drivers/gpu/drm/i915/intel_display.c +28 -7
@@ -3834,6 +3834,27 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)clear_bit (I915_RESET_MODESET , &dev_priv->gpu_error.flags); } +static void skl_update_background_color (const struct intel_crtc_state *cstate) +{ +struct intel_crtc *crtc =to_intel_crtc (cstate->base.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +uint64_t propval = cstate->base.bgcolor; +uint32_t tmp; + +/* Hardware is programmed with 10 bits of precision */ + tmp =DRM_RGBA_RED (propval,10 ) <<20 + |DRM_RGBA_GREEN (propval,10 ) <<10 + |DRM_RGBA_BLUE (propval,10 ); + +/* +* Set CSC and gamma for bottom color to ensure background pixels +* receive the same color transformations as plane content. +*/ + tmp |=SKL_CANVAS_CSC_ENABLE |SKL_CANVAS_GAMMA_ENABLE ; + +I915_WRITE_FW (SKL_CANVAS (crtc->pipe), tmp); +} +static void intel_update_pipe_config (const struct intel_crtc_state *old_crtc_state,const struct intel_crtc_state *new_crtc_state) {
@@ -3869,14 +3890,8 @@ static void intel_update_pipe_config(const struct intel_crtc_state *old_crtc_staironlake_pfit_disable (old_crtc_state); } -/* -* We don't (yet) allow userspace to control the pipe background color, -* so force it to black, but apply pipe gamma and CSC so that its -* handling will match how we program our planes. -*/ if (INTEL_GEN (dev_priv) >=9 ) -I915_WRITE (SKL_CANVAS (crtc->pipe), -SKL_CANVAS_GAMMA_ENABLE |SKL_CANVAS_CSC_ENABLE ); +skl_update_background_color (new_crtc_state); }static void intel_fdi_normal_train (struct intel_crtc *crtc)
@@ -10896,6 +10911,9 @@ static int intel_crtc_atomic_check(struct drm_crtc *crtc, crtc_state->planes_changed = true; } +if (crtc_state->bgcolor_changed) + pipe_config->update_pipe = true; + ret =0 ;if (dev_priv->display.compute_pipe_wm) { ret = dev_priv->display.compute_pipe_wm (pipe_config);
@@ -14035,6 +14053,9 @@ static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)WARN_ON (drm_crtc_index (&intel_crtc->base) != intel_crtc->pipe); +if (INTEL_GEN (dev_priv) >=9 ) +drm_crtc_add_bgcolor_property (&intel_crtc->base); +return 0 ; fail:
Signature · 6 lines
2.14.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/3 drm/i915: Force background color to black for gen9+
In reply to Matt RoperWe don't yet allow userspace to control the CRTC background color, but we should manually program the color to black to ensure the BIOS didn't leave us with some other color. We should also set the pipe gamma and pipe CSC bits so that the background color goes through the same color management transformations that a plane with black pixels would.
---
We may want to land this patch before the rest of the series since it's still valuable even without the new ABI the rest of the series adds.
drivers/gpu/drm/i915/i915_reg.h | 6 ++++++ drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +6 -0
@@ -5662,6 +5662,12 @@ enum {#define PIPEMISC_DITHER_TYPE_SP (0 << 2)#define PIPEMISC (pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A) +/* Skylake+ pipe bottom (background) color */ +#define _SKL_CANVAS_A 0x70034 +#define SKL_CANVAS_GAMMA_ENABLE (1 << 31) +#define SKL_CANVAS_CSC_ENABLE (1 << 30) +#define SKL_CANVAS (pipe) _MMIO_PIPE2(pipe, _SKL_CANVAS_A) +#define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)#define PIPEB_LINE_COMPARE_INT_EN (1 << 29)#define PIPEB_HLINE_INT_EN (1 << 28)
drivers/gpu/drm/i915/intel_display.c +18 -0
@@ -3868,6 +3868,15 @@ static void intel_update_pipe_config(const struct intel_crtc_state *old_crtc_staelse if (old_crtc_state->pch_pfit.enabled)ironlake_pfit_disable (old_crtc_state); } + +/* +* We don't (yet) allow userspace to control the pipe background color, +* so force it to black, but apply pipe gamma and CSC so that its +* handling will match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE |SKL_CANVAS_CSC_ENABLE ); }static void intel_fdi_normal_train (struct intel_crtc *crtc)
@@ -15356,6 +15365,15 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, plane->base.type != DRM_PLANE_TYPE_PRIMARY)intel_plane_disable_noatomic (crtc, plane); } + +/* +* Disable any background color set by the BIOS, but enable the +* gamma and CSC to match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE | +SKL_CANVAS_CSC_ENABLE ); }/* Adjust the state of the output pipe according to whether we
Signature · 6 lines
2.14.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/1 tests/kms_crtc_background_color: overhaul for latest ABI proposal (v2)
In reply to Matt RoperCRTC background color kernel patches were written about 2.5 years ago and floated on the upstream mailing list, but since no opensource userspace materialized, we never actually merged them. However the corresponding IGT test did get merged and has basically been dead code ever since.
A couple years later we may finally be getting closer to landing the kernel patches (there's some interest in this functionality now from both the ChromeOS and Weston camps), so lets update the IGT test to match the latest proposed ABI, and to remove some of the cruft from the original test that wouldn't actually work.
It's worth noting that we don't seem to be able to test this feature with CRC's. Originally we wanted to draw a color into a plane's FB (with Cairo) and then compare the CRC to turning off all planes and just setting the CRTC background to the same color. However the precision and rounding of the color components causes the CRC's to come out differently, even though the end result is visually identical. So at the moment this test is mainly useful for visual inspection in interactive mode.
v2:
- Swap red and blue ordering in property value to reflect change in v2 of kernel series.
--- lib/igt_kms.c | 2 +- tests/kms_crtc_background_color.c | 221 ++++++++++++++++++++------------------ 2 files changed, 120 insertions(+), 103 deletions(-)
lib/igt_kms.c +1 -1
@@ -180,7 +180,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = { };const char *const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS ] = { - [IGT_CRTC_BACKGROUND ] ="background_color" , + [IGT_CRTC_BACKGROUND ] ="BACKGROUND_COLOR" , [IGT_CRTC_CTM ] ="CTM" , [IGT_CRTC_GAMMA_LUT ] ="GAMMA_LUT" , [IGT_CRTC_GAMMA_LUT_SIZE ] ="GAMMA_LUT_SIZE" ,
tests/kms_crtc_background_color.c +119 -102
283 lines not on this page · raw message
Signature · 6 lines
2.14.4 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for CRTC background color (rev2)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: CRTC background color (rev2)
URL : https://patchwork.freedesktop.org/series/50834/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 99a0ae2cbae8 drm/i915: Force background color to black for gen9+ a25e43dadb92 drm: Add CRTC background color property (v2) -:146: WARNING:BOOL_BITFIELD: Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32> #146: FILE: include/drm/drm_crtc.h:175: + bool bgcolor_changed : 1;
-:214: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #214: FILE: include/uapi/drm/drm_mode.h:912:
+#define DRM_RGBA_BLUE(c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits))
^
-:214: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'c' may be better as '(c)' to avoid precedence issues #214: FILE: include/uapi/drm/drm_mode.h:912:
+#define DRM_RGBA_BLUE(c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits))
-:214: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'numbits' may be better as '(numbits)' to avoid precedence issues #214: FILE: include/uapi/drm/drm_mode.h:912:
+#define DRM_RGBA_BLUE(c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits))
-:215: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #215: FILE: include/uapi/drm/drm_mode.h:913:
+#define DRM_RGBA_GREEN(c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits))
^
-:215: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #215: FILE: include/uapi/drm/drm_mode.h:913:
+#define DRM_RGBA_GREEN(c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits))
^
-:215: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'c' may be better as '(c)' to avoid precedence issues #215: FILE: include/uapi/drm/drm_mode.h:913:
+#define DRM_RGBA_GREEN(c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits))
-:215: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'numbits' may be better as '(numbits)' to avoid precedence issues #215: FILE: include/uapi/drm/drm_mode.h:913:
+#define DRM_RGBA_GREEN(c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits))
-:216: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #216: FILE: include/uapi/drm/drm_mode.h:914:
+#define DRM_RGBA_RED(c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits))
^
-:216: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #216: FILE: include/uapi/drm/drm_mode.h:914:
+#define DRM_RGBA_RED(c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits))
^
-:216: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'c' may be better as '(c)' to avoid precedence issues #216: FILE: include/uapi/drm/drm_mode.h:914:
+#define DRM_RGBA_RED(c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits))
-:216: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'numbits' may be better as '(numbits)' to avoid precedence issues #216: FILE: include/uapi/drm/drm_mode.h:914:
+#define DRM_RGBA_RED(c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits))
-:217: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #217: FILE: include/uapi/drm/drm_mode.h:915:
+#define DRM_RGBA_ALPHA(c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits))
^
-:217: CHECK:SPACING: spaces preferred around that '-' (ctx:VxV) #217: FILE: include/uapi/drm/drm_mode.h:915:
+#define DRM_RGBA_ALPHA(c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits))
^
-:217: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'c' may be better as '(c)' to avoid precedence issues #217: FILE: include/uapi/drm/drm_mode.h:915:
+#define DRM_RGBA_ALPHA(c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits))
-:217: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'numbits' may be better as '(numbits)' to avoid precedence issues #217: FILE: include/uapi/drm/drm_mode.h:915:
+#define DRM_RGBA_ALPHA(c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits))
total: 0 errors, 1 warnings, 15 checks, 143 lines checked 470dfe72d6c8 drm/i915/gen9+: Add support for pipe background color (v2)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [igt-dev] [Intel-gfx] [PATCH i-g-t v2] tests/kms_crtc_background_color: overhaul for latest ABI proposal (v2)
In reply to Matt RoperQuoted 8 lines · Matt Roper
It's worth noting that we don't seem to be able to test this feature with CRC's. Originally we wanted to draw a color into a plane's FB (with Cairo) and then compare the CRC to turning off all planes and just setting the CRTC background to the same color. However the precision and rounding of the color components causes the CRC's to come out differently, even though the end result is visually identical. So at the moment this test is mainly useful for visual inspection in interactive mode.
Hey Matt,
Out of curiosity, are the CRCs different only when with 16bpc? Or with 8bpc too?
Thanks,
-
Lionel
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [Intel-gfx] [PATCH i-g-t v2] tests/kms_crtc_background_color: overhaul for latest ABI proposal (v2)
Quoted 9 lines · Lionel Landwerlin
Quoted 8 lines · Matt Roper
It's worth noting that we don't seem to be able to test this feature with CRC's. Originally we wanted to draw a color into a plane's FB (with Cairo) and then compare the CRC to turning off all planes and just setting the CRTC background to the same color. However the precision and rounding of the color components causes the CRC's to come out differently, even though the end result is visually identical. So at the moment this test is mainly useful for visual inspection in interactive mode.
Quoted 3 lines
Hey Matt,
Out of curiosity, are the CRCs different only when with 16bpc? Or with 8bpc too?
Both 8 and 16 give different CRC's. I suspect it's because cairo handles the color values (which get passed as double) slightly differently internally, although I haven't ruled out a slight inaccuracy on the hardware side. Given the alpha problems on gen9/gen10, it wouldn't surprise me if it turns out that our hardware is also treating a 10bpc component of 0x3ff as 0.999 rather than 1.0.
Matt
Quoted 8 lines
Thanks,
-
Lionel
Signature · 9 lines
Matt Roper Graphics Software Engineer IoTG Platform Enabling & Development Intel Corporation (916) 356-2795 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI✓ Fi.CI.BAT: success for CRTC background color (rev2)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: CRTC background color (rev2)
URL : https://patchwork.freedesktop.org/series/50834/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_5133 -> Patchwork_10819 =
== Summary - SUCCESS ==
No regressions found.
External URL: https://patchwork.freedesktop.org/api/1.0/series/50834/revisions/2/mbox/
== Known issues ==
Here are the changes found in Patchwork_10819 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_ctx_create@basic-files:
fi-bsw-n3050: PASS -> FAIL (fdo#108656)
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-byt-clapper: PASS -> FAIL (fdo#107362, fdo#103191)
==== Possible fixes ====
igt@drv_selftest@live_hangcheck:
fi-bwr-2160: DMESG-FAIL (fdo#108735) -> PASS
igt@kms_frontbuffer_tracking@basic:
fi-hsw-peppy: DMESG-WARN (fdo#102614) -> PASS
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
fi-byt-clapper: FAIL (fdo#107362, fdo#103191) -> PASS fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#108656 https://bugs.freedesktop.org/show_bug.cgi?id=108656
fdo#108735 https://bugs.freedesktop.org/show_bug.cgi?id=108735
== Participating hosts (53 -> 44) ==
Missing (9): fi-kbl-soraka fi-ilk-m540 fi-icl-u fi-hsw-4200u fi-byt-squawks fi-icl-u2 fi-bsw-cyan fi-ctg-p8600 fi-blb-e6850
== Build changes ==
* Linux: CI_DRM_5133 -> Patchwork_10819
CI_DRM_5133: 5c71926a1834348a68951622a950de0355b73450 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_10819: 470dfe72d6c81515372d60ce69beb8107a6724c6 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
470dfe72d6c8 drm/i915/gen9+: Add support for pipe background color (v2) a25e43dadb92 drm: Add CRTC background color property (v2) 99a0ae2cbae8 drm/i915: Force background color to black for gen9+
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10819/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for tests/kms_crtc_background_color: overhaul for latest ABI proposal (v2)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: tests/kms_crtc_background_color: overhaul for latest ABI proposal (v2)
URL : https://patchwork.freedesktop.org/series/52456/
State : success
== Summary ==
= CI Bug Log - changes from IGT_4714 -> IGTPW_2058 =
== Summary - WARNING ==
Minor unknown changes coming with IGTPW_2058 need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_2058, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/52456/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_2058:
=== IGT changes ===
==== Warnings ====
igt@kms_chamelium@hdmi-hpd-fast:
fi-icl-u2: SKIP -> PASS +3
igt@kms_flip@basic-flip-vs-modeset:
fi-kbl-x1275: SKIP -> PASS +36
igt@prime_vgem@basic-fence-flip:
fi-cfl-s3: SKIP -> PASS== Known issues ==
Here are the changes found in IGTPW_2058 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@drv_selftest@live_contexts:
fi-icl-u: NOTRUN -> DMESG-FAIL (fdo#108569)
igt@kms_chamelium@common-hpd-after-suspend:
fi-icl-u2: SKIP -> DMESG-FAIL (fdo#108070, fdo#103375, fdo#107732)
igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic:
fi-icl-u2: PASS -> DMESG-WARN (fdo#107732)
==== Possible fixes ====
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-byt-clapper: FAIL (fdo#107362, fdo#103191) -> PASS
==== Warnings ====
igt@drv_selftest@live_contexts:
fi-icl-u2: INCOMPLETE (fdo#108315) -> DMESG-FAIL (fdo#108569) fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107732 https://bugs.freedesktop.org/show_bug.cgi?id=107732
fdo#108070 https://bugs.freedesktop.org/show_bug.cgi?id=108070
fdo#108315 https://bugs.freedesktop.org/show_bug.cgi?id=108315
fdo#108569 https://bugs.freedesktop.org/show_bug.cgi?id=108569
== Participating hosts (53 -> 46) ==
Additional (1): fi-icl-u
Missing (8): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-snb-2520m fi-ctg-p8600 fi-blb-e6850
== Build changes ==
* IGT: IGT_4714 -> IGTPW_2058
CI_DRM_5106: 852b9329fbb6ea8bdbb3dac78328aae73d919305 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2058: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2058/
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2058/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.IGT: failure for tests/kms_crtc_background_color: overhaul for latest ABI proposal (v2)
In reply to Matt Roper== Series Details ==
== Series Details ==
Series: tests/kms_crtc_background_color: overhaul for latest ABI proposal (v2)
URL : https://patchwork.freedesktop.org/series/52456/
State : failure
== Summary ==
= CI Bug Log - changes from IGT_4714_full -> IGTPW_2058_full =
== Summary - FAILURE ==
Serious unknown changes coming with IGTPW_2058_full absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_2058_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/52456/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_2058_full:
=== IGT changes ===
==== Possible regressions ====
igt@gem_exec_reuse@baggage:
shard-apl: PASS -> DMESG-WARN== Known issues ==
Here are the changes found in IGTPW_2058_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
shard-kbl: NOTRUN -> DMESG-WARN (fdo#107956) +1
igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-a:
shard-apl: PASS -> DMESG-WARN (fdo#107956)
igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-c:
shard-glk: NOTRUN -> DMESG-WARN (fdo#107956) +1
igt@kms_color@pipe-c-legacy-gamma:
shard-apl: PASS -> FAIL (fdo#104782)
igt@kms_cursor_crc@cursor-128x128-random:
shard-apl: PASS -> FAIL (fdo#103232) +5
igt@kms_cursor_crc@cursor-256x256-dpms:
shard-glk: PASS -> FAIL (fdo#103232)
igt@kms_cursor_crc@cursor-256x256-random:
shard-glk: NOTRUN -> FAIL (fdo#103232) +3
igt@kms_cursor_crc@cursor-256x256-suspend:
shard-apl: PASS -> FAIL (fdo#103191, fdo#103232)
igt@kms_cursor_crc@cursor-64x64-onscreen:
shard-kbl: PASS -> FAIL (fdo#103232) +3
igt@kms_cursor_legacy@cursorb-vs-flipb-toggle:
shard-glk: PASS -> DMESG-WARN (fdo#105763, fdo#106538)
igt@kms_fbcon_fbt@fbc-suspend:
shard-snb: PASS -> INCOMPLETE (fdo#105411)
igt@kms_flip@2x-flip-vs-expired-vblank:
shard-glk: PASS -> FAIL (fdo#105363)
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
shard-glk: NOTRUN -> FAIL (fdo#103167)
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-gtt:
shard-apl: PASS -> FAIL (fdo#103167) +3
shard-kbl: PASS -> FAIL (fdo#103167) +1
igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-move:
shard-glk: PASS -> FAIL (fdo#103167) +4
igt@kms_plane@plane-position-covered-pipe-a-planes:
shard-glk: NOTRUN -> FAIL (fdo#103166) +1
igt@kms_plane@plane-position-covered-pipe-c-planes:
shard-apl: PASS -> FAIL (fdo#103166) +4
igt@kms_plane_alpha_blend@pipe-c-alpha-transparant-fb:
shard-glk: NOTRUN -> FAIL (fdo#108145) +7
igt@kms_properties@connector-properties-atomic:
shard-glk: NOTRUN -> FAIL (fdo#108642)
shard-hsw: NOTRUN -> FAIL (fdo#108642)
igt@kms_setmode@basic:
shard-apl: PASS -> FAIL (fdo#99912)
igt@kms_vblank@invalid:
shard-apl: PASS -> INCOMPLETE (fdo#103927) +1
==== Possible fixes ====
igt@drv_suspend@forcewake:
shard-kbl: INCOMPLETE (fdo#103665) -> PASS
igt@drv_suspend@shrink:
shard-snb: INCOMPLETE (fdo#105411, fdo#106886) -> PASS
igt@gem_ppgtt@blt-vs-render-ctx0:
shard-kbl: INCOMPLETE (fdo#103665, fdo#106023, fdo#106887) -> PASS
igt@kms_busy@extended-modeset-hang-newfb-render-b:
shard-hsw: DMESG-WARN (fdo#107956) -> PASS
igt@kms_cursor_crc@cursor-128x42-sliding:
shard-kbl: FAIL (fdo#103232) -> PASS +3
shard-apl: FAIL (fdo#103232) -> PASS +1
igt@kms_cursor_crc@cursor-256x85-random:
shard-glk: FAIL (fdo#103232) -> PASS +2
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-pwrite:
shard-apl: FAIL (fdo#103167) -> PASS +1
igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-blt:
shard-glk: FAIL (fdo#103167) -> PASS +3
igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
shard-apl: FAIL (fdo#103166) -> PASS
igt@kms_plane_multiple@atomic-pipe-b-tiling-yf:
shard-kbl: FAIL (fdo#103166) -> PASS
igt@kms_universal_plane@universal-plane-pipe-a-functional:
shard-glk: FAIL (fdo#103166) -> PASS +3
igt@kms_vblank@pipe-a-query-busy:
shard-snb: INCOMPLETE (fdo#105411) -> PASS
igt@perf_pmu@busy-start-vcs0:
shard-apl: DMESG-WARN (fdo#105602, fdo#103558) -> PASS
==== Warnings ====
igt@kms_content_protection@atomic:
shard-kbl: DMESG-FAIL (fdo#108550) -> FAIL (fdo#108597) fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
fdo#104782 https://bugs.freedesktop.org/show_bug.cgi?id=104782
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#105763 https://bugs.freedesktop.org/show_bug.cgi?id=105763
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106538 https://bugs.freedesktop.org/show_bug.cgi?id=106538
fdo#106886 https://bugs.freedesktop.org/show_bug.cgi?id=106886
fdo#106887 https://bugs.freedesktop.org/show_bug.cgi?id=106887
fdo#107956 https://bugs.freedesktop.org/show_bug.cgi?id=107956
fdo#108145 https://bugs.freedesktop.org/show_bug.cgi?id=108145
fdo#108550 https://bugs.freedesktop.org/show_bug.cgi?id=108550
fdo#108597 https://bugs.freedesktop.org/show_bug.cgi?id=108597
fdo#108642 https://bugs.freedesktop.org/show_bug.cgi?id=108642
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
== Participating hosts (6 -> 5) ==
Missing (1): shard-skl
== Build changes ==
* IGT: IGT_4714 -> IGTPW_2058
CI_DRM_5106: 852b9329fbb6ea8bdbb3dac78328aae73d919305 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_2058: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2058/
IGT_4714: cab148ca3ec904a94d0cd43476cf7e1f8663f906 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2058/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [PATCH v2 2/3] drm: Add CRTC background color property (v2)
In reply to Matt RoperQuoted 26 lines · Matt Roper
Some display controllers can be programmed to present non-black colors for pixels not covered by any plane (or pixels covered by the transparent regions of higher planes). Compositors that want a UI with a solid color background can potentially save memory bandwidth by setting the CRTC background property and using smaller planes to display the rest of the content.
To avoid confusion between different ways of encoding RGB data, we define a standard 64-bit format that should be used for this property's value. Helper functions and macros are provided to generate and dissect values in this standard format with varying component precision values.
v2:
- Swap internal representation's blue and red bits to make it easier to read if printed out. (Ville)
- Document bgcolor property indrm_blend.c. (Sean Paul)
- s/background_color/bgcolor/ for consistency between property name and value storage field. (Sean Paul)
- Add a convenience function to attach property to a given crtc.Cc Ville Syrjälä <[email protected]>Cc Sean Paul <[email protected]>Signed-off-by Matt Roper <[email protected]>
Quoted 10 lines
--- drivers/gpu/drm/drm_atomic_state_helper.c | 1 + drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_blend.c | 21 ++++++++++++++++++--- drivers/gpu/drm/drm_mode_config.c | 6 ++++++ include/drm/drm_blend.h | 1 + include/drm/drm_crtc.h | 17 +++++++++++++++++ include/drm/drm_mode_config.h | 5 +++++ include/uapi/drm/drm_mode.h | 26 ++++++++++++++++++++++++++ 8 files changed, 79 insertions(+), 3 deletions(-)
/snip
Quoted 23 lines
include/uapi/drm/drm_mode.h +15
-0@@ -888,6 +888,32 @@ struct drm_mode_revoke_lease {__u32 lessee_id; }; +/* +* Put RGBA values into a standard 64-bit representation that can be used +* for ioctl parameters, inter-driver commmunication, etc. If the component +* values being provided contain less than 16 bits of precision, they'll +* be shifted into the most significant bits. +*/ +static inline __u64 +drm_rgba (__u8 bpc,__u16 red,__u16 green,__u16 blue,__u16 alpha) +{ +int msb_shift =16 - bpc; + +return (__u64 )alpha << msb_shift <<48 | + (__u64 )red << msb_shift <<32 | + (__u64 )green << msb_shift <<16 | + (__u64 )blue << msb_shift;
include/uapi/drm/drm_mode.h struct drm_mode_revoke_lease { · line 915
Quoted 10 lines
include/uapi/drm/drm_mode.h +10
-0+} + +/* +* Extract the specified number of bits of a specific color component from a +* standard 64-bit RGBA value. +*/ +#define DRM_RGBA_BLUE (c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits)) +#define DRM_RGBA_GREEN (c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits)) +#define DRM_RGBA_RED (c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits)) +#define DRM_RGBA_ALPHA (c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits))
#define DRM_RGBA_COMP(c, shift, numbits) \
(__u16)(((c) & 0xFFFFull << (shift)) >> (32 - ((shift) + 16 - (numbits)))#define DRM_RGBA_BLUE(c, numbits) DRM_RGBA_COMP(c, 0, numbits) #define DRM_RGBA_GREEN(c, numbits) DRM_RGBA_COMP(c, 16, numbits)
#define DRM_RGBA_RED(c, numbits) DRM_RGBA_COMP(c, 32, numbits)
#define DRM_RGBA_ALPHA(c, numbits) DRM_RGBA_COMP(c, 48, numbits)
With that,
Quoted 7 lines
include/uapi/drm/drm_mode.h +1
-0+#if defined(__cplusplus) }#endif Signature · 1 line
2.14.4
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/3] drm: Add CRTC background color property (v2)
In reply to Matt RoperQuoted 42 lines · Matt Roper
Some display controllers can be programmed to present non-black colors for pixels not covered by any plane (or pixels covered by the transparent regions of higher planes). Compositors that want a UI with a solid color background can potentially save memory bandwidth by setting the CRTC background property and using smaller planes to display the rest of the content.
To avoid confusion between different ways of encoding RGB data, we define a standard 64-bit format that should be used for this property's value. Helper functions and macros are provided to generate and dissect values in this standard format with varying component precision values.
v2:
- Swap internal representation's blue and red bits to make it easier to read if printed out. (Ville)
- Document bgcolor property indrm_blend.c. (Sean Paul)
- s/background_color/bgcolor/ for consistency between property name and value storage field. (Sean Paul)
- Add a convenience function to attach property to a given crtc.Cc Ville Syrjälä <[email protected]>Cc Sean Paul <[email protected]>Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/drm_atomic_state_helper.c | 1 + drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_blend.c | 21 ++++++++++++++++++--- drivers/gpu/drm/drm_mode_config.c | 6 ++++++ include/drm/drm_blend.h | 1 + include/drm/drm_crtc.h | 17 +++++++++++++++++ include/drm/drm_mode_config.h | 5 +++++ include/uapi/drm/drm_mode.h | 26 ++++++++++++++++++++++++++ 8 files changed, 79 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_atomic_state_helper.c +0
-0
drivers/gpu/drm/drm_atomic_state_helper.c void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, · line 104
Quoted 4 lines
drivers/gpu/drm/drm_atomic_state_helper.c +1
-0@@ -101,6 +101,7 @@ void __drm_atomic_helper_crtc_duplicate_state(struct drm_crtc *crtc, state->planes_changed = false; state->connectors_changed = false; state->color_mgmt_changed = false; + state->bgcolor_changed = false;
Wondering a bit about the granulairty of these flags. Is bgcolor important enough to warrant its own flag, or should it just be part of color_mgmt_changed for example?
color_mgmt_changed is rather heavy though as it would force LUT reprogramming, so I've been thinking that it should perhaps be split into separate gamma_lut_changed/degamma_lut_changed/other_color_stuff_changed flags.
Anyways, just thinking out loud here. We can combine some of these flags later if we start to accumulate too many.
Quoted 153 lines
drivers/gpu/drm/drm_atomic_state_helper.c +0
-0state->zpos_changed = false; state->commit =NULL ; state->event =NULL ;drivers/gpu/drm/drm_atomic_uapi.c +5
-0@@ -467,6 +467,9 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,return -EFAULT ;set_out_fence_for_crtc (state->state, crtc, fence_ptr); + }else if (property == config->bgcolor_property) { + state->bgcolor = val; + state->bgcolor_changed = true; }else if (crtc->funcs->atomic_set_property) {return crtc->funcs->atomic_set_property (crtc, state, property, val); }else {@@ -499,6 +502,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc, *val = (state->gamma_lut) ? state->gamma_lut->base.id :0 ; else if (property == config->prop_out_fence_ptr) *val = 0; + else if (property == config->bgcolor_property) + *val = state->bgcolor; else if (crtc->funcs->atomic_get_property) return crtc->funcs->atomic_get_property(crtc, state, property, val); elsedrivers/gpu/drm/drm_blend.c +18
-3@@ -175,9 +175,16 @@* plane does not expose the "alpha" property, then this is * assumed to be 1.0 * -* Note that all the property extensions described here apply either to the -* plane or the CRTC (e.g. for the background color, which currently is not -* exposed and assumed to be black). +* The property extensions described above all apply to the plane. Drivers +* may also expose the following crtc property extension: +* +* bgcolor: +* Background color is setup with drm_crtc_add_bgcolor_property(). It +* controls the RGB color of a full-screen, fully-opaque layer that exists +* below all planes. This color will be used for pixels not covered by +* any plane and may also be blended with plane contents as allowed by a +* plane's alpha values. The background color defaults to black, and is +* assumed to be black for drivers that do not expose this property. */ /** @@ -593,3 +600,11 @@ int drm_plane_create_blend_mode_property(struct drm_plane *plane,return 0 ; }EXPORT_SYMBOL (drm_plane_create_blend_mode_property); + +void drm_crtc_add_bgcolor_property (struct drm_crtc *crtc) +{ +drm_object_attach_property (&crtc->base, + crtc->dev->mode_config.bgcolor_property, +drm_rgba (16 ,0 ,0 ,0 ,0xffff )); +} +EXPORT_SYMBOL (drm_crtc_add_bgcolor_property);drivers/gpu/drm/drm_mode_config.c +6
-0@@ -352,6 +352,12 @@ static int drm_mode_create_standard_properties(struct drm_device *dev)return -ENOMEM ; dev->mode_config.modifiers_property = prop; + prop =drm_property_create_range (dev,0 ,"BACKGROUND_COLOR" , +0 ,GENMASK_ULL (63 ,0 )); +if (!prop) +return -ENOMEM ; + dev->mode_config.bgcolor_property = prop; +return 0 ; }include/drm/drm_blend.h +1
-0@@ -58,4 +58,5 @@ int drm_atomic_normalize_zpos(struct drm_device *dev, struct drm_atomic_state *state);int drm_plane_create_blend_mode_property (struct drm_plane *plane,unsigned int supported_modes); +void drm_crtc_add_bgcolor_property (struct drm_crtc *crtc);#endif include/drm/drm_crtc.h +17
-0@@ -168,6 +168,11 @@ struct drm_crtc_state {* drivers to steer the atomic commit control flow. */ bool color_mgmt_changed : 1; +/** +* @bgcolor_changed: Background color value has changed. Used by +* drivers to steer the atomic commit control flow. +*/ + bool bgcolor_changed : 1;/** * @no_vblank: @@ -274,6 +279,18 @@ struct drm_crtc_state {*/ struct drm_property_blob *gamma_lut; +/** +* @bgcolor: +* +* RGB value representing the pipe's background color. The background +* color (aka "canvas color") of a pipe is the color that will be used +* for pixels not covered by a plane, or covered by transparent pixels +* of a plane. The value here should be built via drm_rgba(); +* individual color components can be extracted with desired precision +* via the DRM_RGBA_*() macros. +*/ +u64 bgcolor; +/** * @target_vblank: * include/drm/drm_mode_config.h +5
-0@@ -813,6 +813,11 @@ struct drm_mode_config {*/ struct drm_property *writeback_out_fence_ptr_property; +/** +* @bgcolor_property: RGBA background color for CRTC. +*/ +struct drm_property *bgcolor_property; +/* dumb ioctl parameters */ uint32_t preferred_depth, prefer_shadow;include/uapi/drm/drm_mode.h +5
-0@@ -888,6 +888,32 @@ struct drm_mode_revoke_lease {__u32 lessee_id; }; +/* +* Put RGBA values into a standard 64-bit representation that can be used +* for ioctl parameters, inter-driver commmunication, etc. If the component +* values being provided contain less than 16 bits of precision, they'll +* be shifted into the most significant bits.
include/uapi/drm/drm_mode.h struct drm_mode_revoke_lease { · line 905
Quoted 10 lines
include/uapi/drm/drm_mode.h +10
-0+*/ +static inline __u64 +drm_rgba (__u8 bpc,__u16 red,__u16 green,__u16 blue,__u16 alpha) +{ +int msb_shift =16 - bpc; + +return (__u64 )alpha << msb_shift <<48 | + (__u64 )red << msb_shift <<32 | + (__u64 )green << msb_shift <<16 | + (__u64 )blue << msb_shift;
So the value is now ARGB but everything still says RGBA?
Quoted 16 lines
include/uapi/drm/drm_mode.h +11
-0+} + +/* +* Extract the specified number of bits of a specific color component from a +* standard 64-bit RGBA value. +*/ +#define DRM_RGBA_BLUE (c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits)) +#define DRM_RGBA_GREEN (c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits)) +#define DRM_RGBA_RED (c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits)) +#define DRM_RGBA_ALPHA (c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits)) +#if defined(__cplusplus) }#endif Signature · 1 line
2.14.4
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/3] drm/i915: Force background color to black for gen9+
In reply to Matt RoperQuoted 21 lines · Matt Roper
We don't yet allow userspace to control the CRTC background color, but we should manually program the color to black to ensure the BIOS didn't leave us with some other color. We should also set the pipe gamma and pipe CSC bits so that the background color goes through the same color management transformations that a plane with black pixels would.
Cc Ville Syrjälä <[email protected]>Signed-off-by Matt Roper <[email protected]>---
We may want to land this patch before the rest of the series since it's still valuable even without the new ABI the rest of the series adds.drivers/gpu/drm/i915/i915_reg.h | 6 ++++++ drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0
drivers/gpu/drm/i915/i915_reg.h enum { · line 5669
Quoted 8 lines
drivers/gpu/drm/i915/i915_reg.h +5
-0@@ -5662,6 +5662,12 @@ enum {#define PIPEMISC_DITHER_TYPE_SP (0 << 2)#define PIPEMISC (pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A) +/* Skylake+ pipe bottom (background) color */ +#define _SKL_CANVAS_A 0x70034 +#define SKL_CANVAS_GAMMA_ENABLE (1 << 31) +#define SKL_CANVAS_CSC_ENABLE (1 << 30) +#define SKL_CANVAS (pipe) _MMIO_PIPE2(pipe, _SKL_CANVAS_A)
Didn't the spec call this BOTTOM_COLOR or something like that?
Quoted 42 lines
drivers/gpu/drm/i915/i915_reg.h +1
-0+#define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)#define PIPEB_LINE_COMPARE_INT_EN (1 << 29)#define PIPEB_HLINE_INT_EN (1 << 28)drivers/gpu/drm/i915/intel_display.c +18
-0@@ -3868,6 +3868,15 @@ static void intel_update_pipe_config(const struct intel_crtc_state *old_crtc_staelse if (old_crtc_state->pch_pfit.enabled)ironlake_pfit_disable (old_crtc_state); } + +/* +* We don't (yet) allow userspace to control the pipe background color, +* so force it to black, but apply pipe gamma and CSC so that its +* handling will match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE |SKL_CANVAS_CSC_ENABLE ); }static void intel_fdi_normal_train (struct intel_crtc *crtc)@@ -15356,6 +15365,15 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, plane->base.type != DRM_PLANE_TYPE_PRIMARY)intel_plane_disable_noatomic (crtc, plane); } + +/* +* Disable any background color set by the BIOS, but enable the +* gamma and CSC to match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE | +SKL_CANVAS_CSC_ENABLE ); }/* Adjust the state of the output pipe according to whether we Signature · 1 line
2.14.4
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 2/3] drm: Add CRTC background color property (v2)
In reply to Ville SyrjäläQuoted 1 line · Ville Syrjälä
On Tue, Nov 13, 2018 at 03:21:48PM -0800, Matt Roper wrote:
...
Quoted 10 lines
Quoted 10 lines
include/uapi/drm/drm_mode.h +9
-0+/* +* Put RGBA values into a standard 64-bit representation that can be used +* for ioctl parameters, inter-driver commmunication, etc. If the component +* values being provided contain less than 16 bits of precision, they'll +* be shifted into the most significant bits. +*/ +static inline __u64 +drm_rgba (__u8 bpc,__u16 red,__u16 green,__u16 blue,__u16 alpha) +{
Quoted 8 lines
include/uapi/drm/drm_mode.h struct drm_mode_revoke_lease { · line 905
Quoted 6 lines
include/uapi/drm/drm_mode.h +6
-0+int msb_shift =16 - bpc; + +return (__u64 )alpha << msb_shift <<48 | + (__u64 )red << msb_shift <<32 | + (__u64 )green << msb_shift <<16 | + (__u64 )blue << msb_shift;So the value is now ARGB but everything still says RGBA?
Well, the general idea was that you're providing four color components and you're not supposed to be looking behind the curtain at the internal representation (which may not match any given platform's hardware ordering). If everyone uses the helpers here to pack/unpack the components, then that avoids accidental differences in interpretation between different platforms.
But I'm fine with changing the names; I'll do that when I incorporate Sean's suggestion.
Matt
Quoted 21 lines
Quoted 17 lines
include/uapi/drm/drm_mode.h +11
-0+} + +/* +* Extract the specified number of bits of a specific color component from a +* standard 64-bit RGBA value. +*/ +#define DRM_RGBA_BLUE (c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits)) +#define DRM_RGBA_GREEN (c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits)) +#define DRM_RGBA_RED (c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits)) +#define DRM_RGBA_ALPHA (c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits)) +#if defined(__cplusplus) }#endif Signature · 1 line
2.14.4Signature · 2 lines
Ville Syrjälä Intel
Signature · 9 lines
Matt Roper Graphics Software Engineer IoTG Platform Enabling & Development Intel Corporation (916) 356-2795 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 1/3] drm/i915: Force background color to black for gen9+
In reply to Ville SyrjäläQuoted 25 lines · Ville Syrjälä
Quoted 24 lines · Matt Roper
We don't yet allow userspace to control the CRTC background color, but we should manually program the color to black to ensure the BIOS didn't leave us with some other color. We should also set the pipe gamma and pipe CSC bits so that the background color goes through the same color management transformations that a plane with black pixels would.
Cc Ville Syrjälä <[email protected]>Signed-off-by Matt Roper <[email protected]>---
We may want to land this patch before the rest of the series since it's still valuable even without the new ABI the rest of the series adds.drivers/gpu/drm/i915/i915_reg.h | 6 ++++++ drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -5662,6 +5662,12 @@ enum {#define PIPEMISC_DITHER_TYPE_SP (0 << 2)#define PIPEMISC (pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A)
Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h enum { · line 5669
Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5
-0+/* Skylake+ pipe bottom (background) color */ +#define _SKL_CANVAS_A 0x70034 +#define SKL_CANVAS_GAMMA_ENABLE (1 << 31) +#define SKL_CANVAS_CSC_ENABLE (1 << 30) +#define SKL_CANVAS (pipe) _MMIO_PIPE2(pipe, _SKL_CANVAS_A)Didn't the spec call this
BOTTOM_COLORor something like that?
The register definition is called BOTTOM_COLOR, but other areas of the spec refer to this as either "background color" or "canvas color." We already have a CHV_CANVAS register that I believe provides the same functionality for CHV (although I can't find details for the bit layout in the spec), so I decided to just keep this name consistent with that one.
Matt
Quoted 47 lines
Quoted 43 lines
drivers/gpu/drm/i915/i915_reg.h +1
-0+#define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)#define PIPEB_LINE_COMPARE_INT_EN (1 << 29)#define PIPEB_HLINE_INT_EN (1 << 28)drivers/gpu/drm/i915/intel_display.c +18
-0@@ -3868,6 +3868,15 @@ static void intel_update_pipe_config(const struct intel_crtc_state *old_crtc_staelse if (old_crtc_state->pch_pfit.enabled)ironlake_pfit_disable (old_crtc_state); } + +/* +* We don't (yet) allow userspace to control the pipe background color, +* so force it to black, but apply pipe gamma and CSC so that its +* handling will match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE |SKL_CANVAS_CSC_ENABLE ); }static void intel_fdi_normal_train (struct intel_crtc *crtc)@@ -15356,6 +15365,15 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, plane->base.type != DRM_PLANE_TYPE_PRIMARY)intel_plane_disable_noatomic (crtc, plane); } + +/* +* Disable any background color set by the BIOS, but enable the +* gamma and CSC to match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE | +SKL_CANVAS_CSC_ENABLE ); }/* Adjust the state of the output pipe according to whether we Signature · 1 line
2.14.4Signature · 2 lines
Ville Syrjälä Intel
Signature · 9 lines
Matt Roper Graphics Software Engineer IoTG Platform Enabling & Development Intel Corporation (916) 356-2795 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 1/3] drm/i915: Force background color to black for gen9+
Quoted 34 lines · Matt Roper
Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Matt Roper
We don't yet allow userspace to control the CRTC background color, but we should manually program the color to black to ensure the BIOS didn't leave us with some other color. We should also set the pipe gamma and pipe CSC bits so that the background color goes through the same color management transformations that a plane with black pixels would.
Cc Ville Syrjälä <[email protected]>Signed-off-by Matt Roper <[email protected]>---
We may want to land this patch before the rest of the series since it's still valuable even without the new ABI the rest of the series adds.drivers/gpu/drm/i915/i915_reg.h | 6 ++++++ drivers/gpu/drm/i915/intel_display.c | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -5662,6 +5662,12 @@ enum {#define PIPEMISC_DITHER_TYPE_SP (0 << 2)#define PIPEMISC (pipe) _MMIO_PIPE2(pipe, _PIPE_MISC_A)Quoted 7 lines
drivers/gpu/drm/i915/i915_reg.h enum { · line 5669
Quoted 5 lines
drivers/gpu/drm/i915/i915_reg.h +5
-0+/* Skylake+ pipe bottom (background) color */ +#define _SKL_CANVAS_A 0x70034 +#define SKL_CANVAS_GAMMA_ENABLE (1 << 31) +#define SKL_CANVAS_CSC_ENABLE (1 << 30) +#define SKL_CANVAS (pipe) _MMIO_PIPE2(pipe, _SKL_CANVAS_A)Didn't the spec call this
BOTTOM_COLORor something like that?
Quoted 6 lines
The register definition is called
BOTTOM_COLOR, but other areas of the spec refer to this as either "background color" or "canvas color." We already have aCHV_CANVASregister that I believe provides the same functionality for CHV (although I can't find details for the bit layout in the spec), so I decided to just keep this name consistent with that one.
While CHV_CANVAS does provide simiar functionality (actually just the color, not the gamma/csc control) it is still a different register. IMO better to stick to the naming used in the spec.
Quoted 58 lines
Matt
Quoted 47 lines
Quoted 43 lines
drivers/gpu/drm/i915/i915_reg.h +1
-0+#define VLV_DPFLIPSTAT _MMIO(VLV_DISPLAY_BASE + 0x70028)#define PIPEB_LINE_COMPARE_INT_EN (1 << 29)#define PIPEB_HLINE_INT_EN (1 << 28)drivers/gpu/drm/i915/intel_display.c +18
-0@@ -3868,6 +3868,15 @@ static void intel_update_pipe_config(const struct intel_crtc_state *old_crtc_staelse if (old_crtc_state->pch_pfit.enabled)ironlake_pfit_disable (old_crtc_state); } + +/* +* We don't (yet) allow userspace to control the pipe background color, +* so force it to black, but apply pipe gamma and CSC so that its +* handling will match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE |SKL_CANVAS_CSC_ENABLE ); }static void intel_fdi_normal_train (struct intel_crtc *crtc)@@ -15356,6 +15365,15 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc, plane->base.type != DRM_PLANE_TYPE_PRIMARY)intel_plane_disable_noatomic (crtc, plane); } + +/* +* Disable any background color set by the BIOS, but enable the +* gamma and CSC to match how we program our planes. +*/ +if (INTEL_GEN (dev_priv) >=9 ) +I915_WRITE (SKL_CANVAS (crtc->pipe), +SKL_CANVAS_GAMMA_ENABLE | +SKL_CANVAS_CSC_ENABLE ); }/* Adjust the state of the output pipe according to whether we Signature · 1 line
2.14.4Signature · 2 lines
Ville Syrjälä IntelSignature · 5 lines
Matt Roper Graphics Software Engineer IoTG Platform Enabling & Development Intel Corporation (916) 356-2795
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 3/3] drm/i915/gen9+: Add support for pipe background color (v2)
In reply to Matt RoperQuoted 48 lines · Matt Roper
Gen9+ platforms allow CRTC's to be programmed with a background/canvas color below the programmable planes. Let's expose this for use by compositors.
v2:
- Split out bgcolor sanitization and programming of csc/gamma bits to a separate patch that we can land before the ABI changes are ready to go in. (Ville)
- Change a temporary variable name to be more consistent with other similar functions. (Ville)
- Change register name toSKL_CANVASfor consistency with theCHV_CANVASregister.Cc Ville Syrjälä <[email protected]>Signed-off-by Matt Roper <[email protected]>--- drivers/gpu/drm/i915/i915_debugfs.c | 9 +++++++++ drivers/gpu/drm/i915/intel_display.c | 35 ++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/i915_debugfs.c +9
-0@@ -3254,6 +3254,15 @@ static int i915_display_info(struct seq_file *m, void *unused)intel_plane_info (m, crtc); } +if (INTEL_GEN (dev_priv) >=9 && pipe_config->base.active) { +uint64_t background = pipe_config->base.bgcolor; + +seq_printf (m,"\tbackground color (10bpc): r=%x g=%x b=%x\n" , +DRM_RGBA_RED (background,10 ), +DRM_RGBA_GREEN (background,10 ), +DRM_RGBA_BLUE (background,10 )); + } +seq_printf (m,"\tunderrun reporting: cpu=%s pch=%s \n" ,yesno (!crtc->cpu_fifo_underrun_disabled),yesno (!crtc->pch_fifo_underrun_disabled));drivers/gpu/drm/i915/intel_display.c +0
-0
drivers/gpu/drm/i915/intel_display.c void intel_finish_reset(struct drm_i915_private *dev_priv) · line 3837
Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1
-0@@ -3834,6 +3834,27 @@ void intel_finish_reset(struct drm_i915_private *dev_priv)clear_bit (I915_RESET_MODESET , &dev_priv->gpu_error.flags); } +static void skl_update_background_color (const struct intel_crtc_state *cstate)
s/cstate/crtc_state/ please
Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +8
-0+{ +struct intel_crtc *crtc =to_intel_crtc (cstate->base.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +uint64_t propval = cstate->base.bgcolor; +uint32_t tmp; + +/* Hardware is programmed with 10 bits of precision */ + tmp =DRM_RGBA_RED (propval,10 ) <<20
drivers/gpu/drm/i915/intel_display.c void intel_finish_reset(struct drm_i915_private *dev_priv) · line 3855
Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10
-0+ | DRM_RGBA_GREEN(propval, 10) << 10 + |DRM_RGBA_BLUE (propval,10 ); + +/* +* Set CSC and gamma for bottom color to ensure background pixels +* receive the same color transformations as plane content. +*/ + tmp |=SKL_CANVAS_CSC_ENABLE |SKL_CANVAS_GAMMA_ENABLE ; + +I915_WRITE_FW (SKL_CANVAS (crtc->pipe), tmp);
Why _FW?
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/3] drm: Add CRTC background color property (v2)
In reply to Sean PaulQuoted 69 lines · Sean Paul
Quoted 26 lines · Matt Roper
Some display controllers can be programmed to present non-black colors for pixels not covered by any plane (or pixels covered by the transparent regions of higher planes). Compositors that want a UI with a solid color background can potentially save memory bandwidth by setting the CRTC background property and using smaller planes to display the rest of the content.
To avoid confusion between different ways of encoding RGB data, we define a standard 64-bit format that should be used for this property's value. Helper functions and macros are provided to generate and dissect values in this standard format with varying component precision values.
v2:
- Swap internal representation's blue and red bits to make it easier to read if printed out. (Ville)
- Document bgcolor property indrm_blend.c. (Sean Paul)
- s/background_color/bgcolor/ for consistency between property name and value storage field. (Sean Paul)
- Add a convenience function to attach property to a given crtc.Cc Ville Syrjälä <[email protected]>Cc Sean Paul <[email protected]>Signed-off-by Matt Roper <[email protected]>Quoted 10 lines
--- drivers/gpu/drm/drm_atomic_state_helper.c | 1 + drivers/gpu/drm/drm_atomic_uapi.c | 5 +++++ drivers/gpu/drm/drm_blend.c | 21 ++++++++++++++++++--- drivers/gpu/drm/drm_mode_config.c | 6 ++++++ include/drm/drm_blend.h | 1 + include/drm/drm_crtc.h | 17 +++++++++++++++++ include/drm/drm_mode_config.h | 5 +++++ include/uapi/drm/drm_mode.h | 26 ++++++++++++++++++++++++++ 8 files changed, 79 insertions(+), 3 deletions(-)/snip
Quoted 29 lines
include/uapi/drm/drm_mode.h +21
-0@@ -888,6 +888,32 @@ struct drm_mode_revoke_lease {__u32 lessee_id; }; +/* +* Put RGBA values into a standard 64-bit representation that can be used +* for ioctl parameters, inter-driver commmunication, etc. If the component +* values being provided contain less than 16 bits of precision, they'll +* be shifted into the most significant bits. +*/ +static inline __u64 +drm_rgba (__u8 bpc,__u16 red,__u16 green,__u16 blue,__u16 alpha) +{ +int msb_shift =16 - bpc; + +return (__u64 )alpha << msb_shift <<48 | + (__u64 )red << msb_shift <<32 | + (__u64 )green << msb_shift <<16 | + (__u64 )blue << msb_shift; +} + +/* +* Extract the specified number of bits of a specific color component from a +* standard 64-bit RGBA value. +*/
Quoted 8 lines
include/uapi/drm/drm_mode.h struct drm_mode_revoke_lease { · line 915
Quoted 4 lines
include/uapi/drm/drm_mode.h +4
-0+#define DRM_RGBA_BLUE (c, numbits) (__u16)((c & 0xFFFFull) >> (16-numbits)) +#define DRM_RGBA_GREEN (c, numbits) (__u16)((c & 0xFFFFull<<16) >> (32-numbits)) +#define DRM_RGBA_RED (c, numbits) (__u16)((c & 0xFFFFull<<32) >> (48-numbits)) +#define DRM_RGBA_ALPHA (c, numbits) (__u16)((c & 0xFFFFull<<48) >> (64-numbits))#define DRM_RGBA_COMP(c, shift, numbits) \ (__u16)(((c) & 0xFFFFull << (shift)) >> (32 - ((shift) + 16 - (numbits)))
I think this should just be
#define DRM_RGBA_COMP(c, shift, numbits) \
(__u16)(((c) & 0xFFFFull << (shift)) >> ((shift) + 16 - (numbits)))right? I.e., right shift the same amount as the left shift, plus an additional (16-numbits) to account for the lower precision requested.
Matt
Quoted 23 lines
#define
DRM_RGBA_BLUE(c, numbits)DRM_RGBA_COMP(c, 0, numbits)#defineDRM_RGBA_GREEN(c, numbits)DRM_RGBA_COMP(c, 16, numbits)
#defineDRM_RGBA_RED(c, numbits)DRM_RGBA_COMP(c, 32, numbits)
#defineDRM_RGBA_ALPHA(c, numbits)DRM_RGBA_COMP(c, 48, numbits)With that,
Reviewed-by Sean Paul <[email protected]>Quoted 7 lines
include/uapi/drm/drm_mode.h +1
-0+#if defined(__cplusplus) }#endif Signature · 1 line
2.14.4Signature · 1 line
Sean Paul, Software Engineer, Google / Chromium OS
Signature · 9 lines
Matt Roper Graphics Software Engineer IoTG Platform Enabling & Development Intel Corporation (916) 356-2795 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel