Re: [Intel-gfx] [RFC v2 02/22] drm: Add Enhanced Gamma and color lut range attributes
On Wed, 3 Nov 2021 11:08:13 -0400 Harry Wentland wrote: > On 2021-09-06 17:38, Uma Shankar wrote: > > Existing LUT precision structure is having only 16 bit > > precision. This is not enough for upcoming enhanced hardwares > > and advance usecases like HDR processing. Hence added a new > > structure with 32 bit precision values. > > > > This also defines a new structure to define color lut ranges, > > along with related macro definitions and enums. This will help > > describe multi segmented lut ranges in the hardware. > > > > Signed-off-by: Uma Shankar > > --- > > include/uapi/drm/drm_mode.h | 58 + > > 1 file changed, 58 insertions(+) > > > > diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h > > index 90c55383f1ee..1079794c86c3 100644 > > --- a/include/uapi/drm/drm_mode.h > > +++ b/include/uapi/drm/drm_mode.h > > @@ -903,6 +903,64 @@ struct hdr_output_metadata { > > }; > > }; > > > > +/* > > + * DRM_MODE_LUT_GAMMA|DRM_MODE_LUT_DEGAMMA is legal and means the LUT > > + * can be used for either purpose, but not simultaneously. To expose > > + * modes that support gamma and degamma simultaneously the gamma mode > > + * must declare distinct DRM_MODE_LUT_GAMMA and DRM_MODE_LUT_DEGAMMA > > + * ranges. > > + */ > > +/* LUT is for gamma (after CTM) */ > > +#define DRM_MODE_LUT_GAMMA BIT(0) > > +/* LUT is for degamma (before CTM) */ > > +#define DRM_MODE_LUT_DEGAMMA BIT(1) > > +/* linearly interpolate between the points */ > > +#define DRM_MODE_LUT_INTERPOLATE BIT(2) > > +/* > > + * the last value of the previous range is the > > + * first value of the current range. > > + */ > > +#define DRM_MODE_LUT_REUSE_LAST BIT(3) > > +/* the curve must be non-decreasing */ > > +#define DRM_MODE_LUT_NON_DECREASING BIT(4) > > +/* the curve is reflected across origin for negative inputs */ > > +#define DRM_MODE_LUT_REFLECT_NEGATIVE BIT(5) > > +/* the same curve (red) is used for blue and green channels as well */ > > +#define DRM_MODE_LUT_SINGLE_CHANNEL BIT(6) > > + > > +struct drm_color_lut_range { > > + /* DRM_MODE_LUT_* */ > > + __u32 flags; > > + /* number of points on the curve */ > > + __u16 count; > > + /* input/output bits per component */ > > + __u8 input_bpc, output_bpc; > > + /* input start/end values */ > > + __s32 start, end; > > + /* output min/max values */ > > + __s32 min, max; > > +}; > > + > > +enum lut_type { > > + LUT_TYPE_DEGAMMA = 0, > > + LUT_TYPE_GAMMA = 1, > > +}; > > + > > +/* > > + * Creating 64 bit palette entries for better data > > + * precision. This will be required for HDR and > > + * similar color processing usecases. > > + */ > > +struct drm_color_lut_ext { > > + /* > > +* Data is U32.32 fixed point format. > > +*/ > > + __u64 red; > > + __u64 green; > > + __u64 blue; > > + __u64 reserved; > > +}; > > I've been drawing out examples of drm_color_lut_range defined PWLs > and understand a bit better what you and Ville are trying to accomplish > with it. It actually makes a lot of sense and would allow for a generic > way to populate different PWL definitions with a generic function. > > But I still have some key questions that either are not answered in these > patch sets or that I somehow overlooked. > > Can you explain how the U32.32 fixed point format relates to the input_bpc > and output_bpc in drm_color_lut_range, as we as to the pixel coming in from > the framebuffer. > > E.g. if we have ARGB2101010 what happens to a 0x3ff red value (assuming alpha > is non-multiplied)? > > If the drm_color_lut_range segments are defined with input_bpc of 24 bpc will > 0x3ff be zero-expanded to 24-bit? Is the 24 bpc an integer? I.e. would our > 3xff > be interpreted as 0x3ff << (24-10)? > > Assuming the output_bpc is 16 bpc and the programmed LUT makes this 1-to-1 > would > the output value be 0x3ff << (16-10)? > > On AMD HW the pipe-internal format is a custom floating point format. We could > probably express that in terms of input/output_bpc and do the translation in > our > driver between that and the internal floating point format, depending on the > framebuffer format, but there is the added complication of the magnitude of > the > pixel data and correlating HDR with SDR planes. > > E.g. any SDR data would map from 0.0 to 1.0 floating point, while HDR content > would > map from 0.0 to some value larger than 1.0. I don't (yet) have a clear > picture how > to represent that with the drm_color_lut_range definition. Hi Harry, I think you just would not. Conceptually an SDR plane gets its very own LUT that converts the FB [0.0, 1.0] range to any appropriate [a >= 0.0, b <= 1.0] range in HDR. This is purely conceptual, in the terms of the abstract KMS color pipeline, where [0.0, 1.0] is always the full dynamic range at any point of the pipeline, meaning it is relative to its placement in the pipeline. If you want to use values >1.0 in hw, you can do so under the hood. At lea
Re: [Intel-gfx] [PATCH v2 2/2] drm/i915/uapi: Add query for hwconfig table
John Harrison writes: > On 11/3/2021 14:38, Jordan Justen wrote: >> So, i915 wants to wash it's hands completely of the format? There is >> obviously a difference between hardware features and a blob coming from >> closed source software. (Which i915 just happens to be passing along.) >> The hardware is a lot more difficult to change... > Actually, no. The table is not "coming from closed source software". The > table is defined by hardware specs. It is a table of hardware specific > values. So, guc literally reads this info from the hardware verbatim? Then gives it to i915 so i915 can give it to UMDs? Otherwise, it seems like a table in software. Anyway... >> It seems like these details should be dropped from the i915 patch commit >> message since i915 wants nothing to do with it. > Sure. Can remove comments. Obviously not what should be done, but apparently all i915 is willing to do. >> I would think it'd be preferable for i915 to stand behind the basic blob >> format as is (even if the keys/values can't be defined), and make a new >> query item if the closed source software changes the format. > Close source software is not allowed to change the format because closed > source software has no say in defining the format. So, why can't i915 define this extremely simple (apparently unchangeable) blob format, and thereby guarantee that it will have to insulate UMDs if the format changes by making a different query item? It ought to be made painful for everyone if this blob format changes. Hopefully the format will basically never change. (Even if new keys/values might be added.) Further, it seems there is an implication that the keys will always be backward compatible. Is that true, and if so, how can there be harm in i915 enumerating the "known" ones? >> Of course, it'd be even better if i915 could define some keys/values as >> well. (Or if a spec could be released to help document / tie down the >> format.) > See the corresponding IGT test that details all the currently defined keys. i915 can't/won't say anything about it, but look at this unmerged IGT test? In the next sentence you'll say, but don't count on that because IGT really has no control over it. :) > The attribute ids are defined in a hardware spec. Which spec? >>> Unfortunately, it is not one that is currently public. We are pushing >>> the relevant people to get it included in the public bspec / HRM. It is >>> a slow process :(. >>> >> Right. I take it no progress has been made in the 1.5 months since you >> posted this, so it'll probably finally be documented 6~12 months after >> hardware is available? :) Apparently all the data for this spec is "available" (in an unmerged IGT patch), but am I correct in assuming that no actual spec timeframe is defined? -Jordan
Re: [Intel-gfx] [PATCH 01/13] drm/connector: Add define for HDMI 1.4 Maximum Pixel Rate
Hi Ville, On Wed, Nov 03, 2021 at 08:05:16PM +0200, Ville Syrjälä wrote: > On Wed, Nov 03, 2021 at 01:02:11PM +0200, Ville Syrjälä wrote: > > On Tue, Nov 02, 2021 at 03:59:32PM +0100, Maxime Ripard wrote: > > > --- a/drivers/gpu/drm/drm_edid.c > > > +++ b/drivers/gpu/drm/drm_edid.c > > > @@ -4966,7 +4966,7 @@ static void drm_parse_hdmi_forum_vsdb(struct > > > drm_connector *connector, > > > u32 max_tmds_clock = hf_vsdb[5] * 5000; > > > struct drm_scdc *scdc = &hdmi->scdc; > > > > > > - if (max_tmds_clock > 34) { > > > + if (max_tmds_clock > DRM_HDMI_14_MAX_TMDS_CLK_KHZ) { > > > display->max_tmds_clock = max_tmds_clock; > > > DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n", > > > display->max_tmds_clock); > > > diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c > > > b/drivers/gpu/drm/i915/display/intel_hdmi.c > > > index d2e61f6c6e08..0666203d52b7 100644 > > > --- a/drivers/gpu/drm/i915/display/intel_hdmi.c > > > +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c > > > @@ -2226,7 +2226,7 @@ int intel_hdmi_compute_config(struct intel_encoder > > > *encoder, > > > if (scdc->scrambling.low_rates) > > > pipe_config->hdmi_scrambling = true; > > > > > > - if (pipe_config->port_clock > 34) { > > > + if (pipe_config->port_clock > DRM_HDMI_14_MAX_TMDS_CLK_KHZ) { > > > pipe_config->hdmi_scrambling = true; > > > pipe_config->hdmi_high_tmds_clock_ratio = true; > > > } > > > > All of that is HDMI 2.0 stuff. So this just makes it all super > > confusing IMO. Nak. > > So reading throgh HDMI 1.4 again it does specify 340 MHz as some kind > of upper limit for the physical cable. But nowhere else is that number > really mentioned AFAICS. HDMI 2.0 does talk quite a bit about the 340 > Mcsc limit in various places. > > I wonder what people would think of a couple of helpers like: > - drm_hdmi_{can,must}_use_scrambling() > - drm_hdmi_is_high_tmds_clock_ratio() > or something along those lines? At least with those the code would > read decently and I wouldn't have to wonder what this HDMI 1.4 TMDS > clock limit really is. Patch 2 introduces something along those lines. It doesn't cover everything though, we're using this define in vc4 to limit the available modes in mode_valid on HDMI controllers not 4k-capable We could probably do better on the name, but I still believe a define like this would be valuable. Maxime signature.asc Description: PGP signature
Re: [Intel-gfx] [PATCH 8/8] drm/amdgpu: add drm buddy support to amdgpu
On 04/11/2021 07:34, Christian König wrote: Am 03.11.21 um 20:25 schrieb Matthew Auld: On 25/10/2021 14:00, Arunpravin wrote: - Remove drm_mm references and replace with drm buddy functionalities - Add res cursor support for drm buddy Signed-off-by: Arunpravin + spin_lock(&mgr->lock); + r = drm_buddy_alloc(mm, (uint64_t)place->fpfn << PAGE_SHIFT, + (uint64_t)lpfn << PAGE_SHIFT, + (uint64_t)n_pages << PAGE_SHIFT, + min_page_size, &node->blocks, + node->flags); Is spinlock + GFP_KERNEL allowed? Nope it isn't, but does that function really calls kmalloc()? It calls kmem_cache_zalloc(..., GFP_KERNEL) Christian. + spin_unlock(&mgr->lock); + + if (unlikely(r)) + goto error_free_blocks; + pages_left -= pages; ++i; if (pages > pages_left) pages = pages_left; } - spin_unlock(&mgr->lock); + + /* Free unused pages for contiguous allocation */ + if (place->flags & TTM_PL_FLAG_CONTIGUOUS) { + uint64_t actual_size = (uint64_t)node->base.num_pages << PAGE_SHIFT; + + r = drm_buddy_free_unused_pages(mm, + actual_size, + &node->blocks); Needs some locking.
Re: [Intel-gfx] [PATCH 10/10] drm/i915: Add privacy-screen support (v3)
Hi, On 11/4/21 00:16, Rajat Jain wrote: > Hello Hans, > > Thanks a lot for working on this diligently and getting almost all of > it finally merged! > > On Wed, Oct 13, 2021 at 2:59 PM Ville Syrjälä > wrote: >> >> On Tue, Oct 05, 2021 at 10:23:22PM +0200, Hans de Goede wrote: >>> Add support for eDP panels with a built-in privacy screen using the >>> new drm_privacy_screen class. >>> >>> Changes in v3: >>> - Move drm_privacy_screen_get() call to intel_ddi_init_dp_connector() >>> >>> Changes in v2: >>> - Call drm_connector_update_privacy_screen() from >>> intel_enable_ddi_dp() / intel_ddi_update_pipe_dp() instead of adding a >>> for_each_new_connector_in_state() loop to intel_atomic_commit_tail() >>> - Move the probe-deferral check to the intel_modeset_probe_defer() helper >>> >>> Signed-off-by: Hans de Goede >>> --- >>> drivers/gpu/drm/i915/display/intel_atomic.c | 1 + >>> drivers/gpu/drm/i915/display/intel_ddi.c | 16 >>> drivers/gpu/drm/i915/display/intel_display.c | 10 ++ >>> 3 files changed, 27 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c >>> b/drivers/gpu/drm/i915/display/intel_atomic.c >>> index b4e7ac51aa31..a62550711e98 100644 >>> --- a/drivers/gpu/drm/i915/display/intel_atomic.c >>> +++ b/drivers/gpu/drm/i915/display/intel_atomic.c >>> @@ -139,6 +139,7 @@ int intel_digital_connector_atomic_check(struct >>> drm_connector *conn, >>> new_conn_state->base.picture_aspect_ratio != >>> old_conn_state->base.picture_aspect_ratio || >>> new_conn_state->base.content_type != >>> old_conn_state->base.content_type || >>> new_conn_state->base.scaling_mode != >>> old_conn_state->base.scaling_mode || >>> + new_conn_state->base.privacy_screen_sw_state != >>> old_conn_state->base.privacy_screen_sw_state || >>> !drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) >>> crtc_state->mode_changed = true; >>> >>> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c >>> b/drivers/gpu/drm/i915/display/intel_ddi.c >>> index 0d4cf7fa8720..272714e07cc6 100644 >>> --- a/drivers/gpu/drm/i915/display/intel_ddi.c >>> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c >>> @@ -25,6 +25,7 @@ >>> * >>> */ >>> >>> +#include >>> #include >>> >>> #include "i915_drv.h" >>> @@ -2946,6 +2947,7 @@ static void intel_enable_ddi_dp(struct >>> intel_atomic_state *state, >>> if (port == PORT_A && DISPLAY_VER(dev_priv) < 9) >>> intel_dp_stop_link_train(intel_dp, crtc_state); >>> >>> + drm_connector_update_privacy_screen(conn_state); >>> intel_edp_backlight_on(crtc_state, conn_state); >>> >>> if (!dig_port->lspcon.active || dig_port->dp.has_hdmi_sink) >>> @@ -3161,6 +3163,7 @@ static void intel_ddi_update_pipe_dp(struct >>> intel_atomic_state *state, >>> intel_drrs_update(intel_dp, crtc_state); >>> >>> intel_backlight_update(state, encoder, crtc_state, conn_state); >>> + drm_connector_update_privacy_screen(conn_state); >>> } >>> >>> void intel_ddi_update_pipe(struct intel_atomic_state *state, >>> @@ -3979,6 +3982,19 @@ intel_ddi_init_dp_connector(struct >>> intel_digital_port *dig_port) >>> return NULL; >>> } >>> >>> + if (dig_port->base.type == INTEL_OUTPUT_EDP) { >> >> Connector type check would be a bit more consistent with what this is >> about I think. But there's is 1:1 correspondence with the encoder type >> for eDP so not a particularly important point. >> >> Reviewed-by: Ville Syrjälä > > I see only 8 out of 10 patches in this series were applied to drm-tip. > I'm curious if there is any reason for which the last 2 patches were > not applied: > > [Patch 9/10]: drm/i915: Add intel_modeset_probe_defer() helper > [Patch 10/10]: drm/i915: Add privacy-screen support (v3) > > I look forward to getting them merged so that I can use them. The main-parts of the patch-set were merged through drm-misc-next, the 2 i915 patches had a conflict there since the series was based on drm-tip and some of the surrounding i915 code had some small changes in drm-intel-next which was not in drm-misc-next yet. Once drm-intel-next merges in recent drm-misc-next changes (after the merge window closes) I will push the remaining 2 patches through drm-intel-next and then everything will be in drm-tip and on its way to 5.17 . Regards, Hans >>> + struct drm_device *dev = dig_port->base.base.dev; >>> + struct drm_privacy_screen *privacy_screen; >>> + >>> + privacy_screen = drm_privacy_screen_get(dev->dev, NULL); >>> + if (!IS_ERR(privacy_screen)) { >>> + >>> drm_connector_attach_privacy_screen_provider(&connector->base, >>> + >>> privacy_screen); >>> + } else if (PTR_ERR(privacy_screen) != -ENODEV) { >>> + drm_warn(dev, "Error getting privacy-screen\n"); >>>
Re: [Intel-gfx] [PATCH i-g-t 1/8] tests/i915/gem_exec_capture: Remove pointless assert
On 03/11/2021 18:44, John Harrison wrote: On 11/3/2021 06:50, Tvrtko Ursulin wrote: On 22/10/2021 00:40, john.c.harri...@intel.com wrote: From: John Harrison The 'many' test ended with an 'assert(count)', presumably meaning to ensure that some objects were actually captured. However, 'count' is the number of objects created not how many were captured. Plus, there is already a 'require(count > 1)' at the start and count is invarient so the final assert is basically pointless. General concensus appears to be that the test should not fail irrespective of how many blobs are captured as low memory situations could cause the capture to be abbreviated. So just remove the pointless assert completely. Hm the test appears to be using intel_get_avail_ram_mb() to size the working set. Suggesting problems with low memory situations should not apply unless bugs. In which case would a better fix be improving the sizing logic and changing the assert to igt_assert(blobs)? After fixing the sysfs read code to cope with large files, I don't ever see abbreviated captures any more. However, other reviewers objected to asserting anything at all about the final count (whether full size, zero or whatever) on the grounds that low memory issues *might* still occur. And some in quite blunt language as I recall. If you think different, feel free to start your own patch set. Do you have a link so I can understand the discussion? Because from the top of my head I can't imagine what were the objections, I mean what is the point of keeping the test but not asserting at the end at least something was captured? Regards, Tvrtko
Re: [Intel-gfx] [PATCH v2 2/2] drm/i915/uapi: Add query for hwconfig table
On 04/11/2021 01:49, John Harrison wrote: On 11/3/2021 14:38, Jordan Justen wrote: John Harrison writes: On 11/1/2021 08:39, Jordan Justen wrote: writes: From: Rodrigo Vivi GuC contains a consolidated table with a bunch of information about the current device. Previously, this information was spread and hardcoded to all the components including GuC, i915 and various UMDs. The goal here is to consolidate the data into GuC in a way that all interested components can grab the very latest and synchronized information using a simple query. As per most of the other queries, this one can be called twice. Once with item.length=0 to determine the exact buffer size, then allocate the user memory and call it again for to retrieve the table data. For example: struct drm_i915_query_item item = { .query_id = DRM_I915_QUERY_HWCONCFIG_TABLE; }; query.items_ptr = (int64_t) &item; query.num_items = 1; ioctl(fd, DRM_IOCTL_I915_QUERY, query, sizeof(query)); if (item.length <= 0) return -ENOENT; data = malloc(item.length); item.data_ptr = (int64_t) &data; ioctl(fd, DRM_IOCTL_I915_QUERY, query, sizeof(query)); // Parse the data as appropriate... The returned array is a simple and flexible KLV (Key/Length/Value) formatted table. For example, it could be just: enum device_attr { ATTR_SOME_VALUE = 0, ATTR_SOME_MASK = 1, }; static const u32 hwconfig[] = { ATTR_SOME_VALUE, 1, // Value Length in DWords 8, // Value ATTR_SOME_MASK, 3, 0x00, 0x, 0xFF00, }; Seems simple enough, so why doesn't i915 define the format of the returned hwconfig blob in i915_drm.h? Because the definition is nothing to do with i915. This table comes from the hardware spec. It is not defined by the KMD and it is not currently used by the KMD. So there is no reason for the KMD to be creating structures for it in the same way that the KMD does not document, define, struct, etc. every other feature of the hardware that the UMDs might use. So, i915 wants to wash it's hands completely of the format? There is obviously a difference between hardware features and a blob coming from closed source software. (Which i915 just happens to be passing along.) The hardware is a lot more difficult to change... Actually, no. The table is not "coming from closed source software". The table is defined by hardware specs. It is a table of hardware specific values. It is not being invented by the GuC just for fun or as a way to subvert the universe into the realms of closed source software. As per KMD, GuC is merely passing the table through. The table is only supported on newer hardware platforms and all GuC does is provide a mechanism for the KMD to retrieve it because the KMD cannot access it directly. The table contents are defined by hardware architects same as all the other aspects of the hardware. It seems like these details should be dropped from the i915 patch commit message since i915 wants nothing to do with it. Sure. Can remove comments. I would think it'd be preferable for i915 to stand behind the basic blob format as is (even if the keys/values can't be defined), and make a new query item if the closed source software changes the format. Close source software is not allowed to change the format because closed source software has no say in defining the format. The format is officially defined as being fixed in the spec. New key values can be added to the key enumeration but existing values cannot be deprecated and re-purposed. The table must be stable across all OSs and all platforms. No software can arbitrarily decide to change it. Of course, it'd be even better if i915 could define some keys/values as well. (Or if a spec could be released to help document / tie down the format.) See the corresponding IGT test that details all the currently defined keys. struct drm_i915_hwconfig { uint32_t key; uint32_t length; uint32_t values[]; }; It sounds like the kernel depends on the closed source guc being loaded to return this information. Is that right? Will i915 also become dependent on some of this data such that it won't be able to initialize without the firmware being loaded? At the moment, the KMD does not use the table at all. We merely provide a mechanism for the UMDs to retrieve it from the hardware. In terms of future direction, that is something you need to take up with the hardware architects. Why do you keep saying hardware, when only software is involved? See above - because the table is defined by hardware. No software, closed or open, has any say in the specification of the table. The values in the table might be defined by hardware, but the table itself definitely isn't. Like Jordan tried to explain, because this is a software interface, it changes more often than HW. Now testing doesn't just invol
[Intel-gfx] [PATCH v5 0/2] drm/i915: Failsafe migration blits
This patch series introduces failsafe migration blits. The reason for this seemingly strange concept is that if the initial clearing or readback of LMEM fails for some reason[1], and we then set up either GPU- or CPU ptes to the allocated LMEM, we can expose old contents from other clients. So after each migration blit to LMEM, attach a dma-fence callback that checks the migration fence error value and if it's an error, performs a memcpy blit, instead. Patch 1 splits out the TTM move code into separate files Patch 2 implements the failsafe blits and related self-tests [1] There are at least two ways we could trigger exposure of uninitialized LMEM assuming the migration blits themselves never trigger a gpu hang. a) A gpu operation preceding a pipelined eviction blit resets and sets the error fence to -EIO, and the error is propagated across the TTM manager to the clear / swapin blit of a newly allocated TTM resource. It aborts and leaves the memory uninitialized. b) Something wedges the GT while a migration blit is submitted. It ends up never executed and TTM can fault user-space cpu-ptes into uninitialized memory. v3: - Style fixes in second patch (Matthew Auld) v4: - More style fixes in second patch (Matthew Auld) v5: - Fix an issue where we might end up waiting for a fence that would never signal. Thomas Hellström (2): drm/i915/ttm: Reorganize the ttm move code drm/i915/ttm: Failsafe migration blits drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 328 ++- drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 35 ++ drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 522 ++ drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h | 43 ++ .../drm/i915/gem/selftests/i915_gem_migrate.c | 24 +- 6 files changed, 672 insertions(+), 281 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h -- 2.31.1
[Intel-gfx] [PATCH v5 1/2] drm/i915/ttm: Reorganize the ttm move code
We are about to introduce failsafe- and asynchronous migration and ttm moves. This will add complexity and code to the TTM move code so it makes sense to split it out to a separate file to make the i915 TTM code easer to digest. Split the i915 TTM move code out and since we will have to change the name of the gpu_binds_iomem() and cpu_maps_iomem() functions anyway, we alter the name of gpu_binds_iomem() to i915_ttm_gtt_binds_lmem() which is more reflecting what it is used for. With this we also add some more documentation. Otherwise there should be no functional change. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/Makefile| 1 + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 328 +++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 35 ++ drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 308 + drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h | 38 +++ 5 files changed, 430 insertions(+), 280 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 467872cca027..7d0d0b814670 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -154,6 +154,7 @@ gem-y += \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ gem/i915_gem_ttm.o \ + gem/i915_gem_ttm_move.o \ gem/i915_gem_ttm_pm.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \ diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index 6a05369e2705..6369fb9b2455 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -14,13 +14,9 @@ #include "gem/i915_gem_object.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_ttm.h" +#include "gem/i915_gem_ttm_move.h" #include "gem/i915_gem_ttm_pm.h" - -#include "gt/intel_engine_pm.h" -#include "gt/intel_gt.h" -#include "gt/intel_migrate.h" - #define I915_TTM_PRIO_PURGE 0 #define I915_TTM_PRIO_NO_PAGES 1 #define I915_TTM_PRIO_HAS_PAGES 2 @@ -108,28 +104,6 @@ static int i915_ttm_err_to_gem(int err) return err; } -static bool gpu_binds_iomem(struct ttm_resource *mem) -{ - return mem->mem_type != TTM_PL_SYSTEM; -} - -static bool cpu_maps_iomem(struct ttm_resource *mem) -{ - /* Once / if we support GGTT, this is also false for cached ttm_tts */ - return mem->mem_type != TTM_PL_SYSTEM; -} - -static enum i915_cache_level -i915_ttm_cache_level(struct drm_i915_private *i915, struct ttm_resource *res, -struct ttm_tt *ttm) -{ - return ((HAS_LLC(i915) || HAS_SNOOP(i915)) && !gpu_binds_iomem(res) && - ttm->caching == ttm_cached) ? I915_CACHE_LLC : - I915_CACHE_NONE; -} - -static void i915_ttm_adjust_lru(struct drm_i915_gem_object *obj); - static enum ttm_caching i915_ttm_select_tt_caching(const struct drm_i915_gem_object *obj) { @@ -370,23 +344,14 @@ static void i915_ttm_evict_flags(struct ttm_buffer_object *bo, *placement = i915_sys_placement; } -static int i915_ttm_move_notify(struct ttm_buffer_object *bo) -{ - struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo); - int ret; - - ret = i915_gem_object_unbind(obj, I915_GEM_OBJECT_UNBIND_ACTIVE); - if (ret) - return ret; - - ret = __i915_gem_object_put_pages(obj); - if (ret) - return ret; - - return 0; -} - -static void i915_ttm_free_cached_io_rsgt(struct drm_i915_gem_object *obj) +/** + * i915_ttm_free_cached_io_rsgt - Free object cached LMEM information + * @obj: The GEM object + * This function frees any LMEM-related information that is cached on + * the object. For example the radix tree for fast page lookup and the + * cached refcounted sg-table + */ +void i915_ttm_free_cached_io_rsgt(struct drm_i915_gem_object *obj) { struct radix_tree_iter iter; void __rcu **slot; @@ -403,56 +368,16 @@ static void i915_ttm_free_cached_io_rsgt(struct drm_i915_gem_object *obj) obj->ttm.cached_io_rsgt = NULL; } -static void -i915_ttm_adjust_domains_after_move(struct drm_i915_gem_object *obj) -{ - struct ttm_buffer_object *bo = i915_gem_to_ttm(obj); - - if (cpu_maps_iomem(bo->resource) || bo->ttm->caching != ttm_cached) { - obj->write_domain = I915_GEM_DOMAIN_WC; - obj->read_domains = I915_GEM_DOMAIN_WC; - } else { - obj->write_domain = I915_GEM_DOMAIN_CPU; - obj->read_domains = I915_GEM_DOMAIN_CPU; - } -} - -static void i915_ttm_adjust_gem_after_move(struct drm_i915_gem_object *obj) -{ - struct ttm_buffer_object *bo = i915_gem_to_ttm(obj); - unsigned int cache_level; - unsigned int i; - - /* -* If object was moved to an allowable region, update the object -
[Intel-gfx] [PATCH v5 2/2] drm/i915/ttm: Failsafe migration blits
If the initial fill blit or copy blit of an object fails, the old content of the data might be exposed and read as soon as either CPU- or GPU PTEs are set up to point at the pages. Intercept the blit fence with an async callback that checks the blit fence for errors and if there are errors performs an async cpu blit instead. If there is a failure to allocate the async dma_fence_work, allocate it on the stack and sync wait for the blit to complete. Add selftests that simulate gpu blit failures and failure to allocate the async dma_fence_work. A previous version of this pach used dma_fence_work, now that's opencoded which adds more code but might lower the latency somewhat in the common non-error case. v3: - Style fixes (Matthew Auld) v4: - Use "#if IS_ENABLED()" instead of #ifdef (Matthew Auld) v5: - Fix an issue where we, if the dependency was already signaled, might end up waiting for a memcpy fence that would never signal. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 324 +++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h | 5 + .../drm/i915/gem/selftests/i915_gem_migrate.c | 24 +- 3 files changed, 297 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c index 0ed6b7f2b95f..e9b1c23cacc0 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c @@ -18,6 +18,29 @@ #include "gt/intel_gt.h" #include "gt/intel_migrate.h" +/** + * DOC: Selftest failure modes for failsafe migration: + * + * For fail_gpu_migration, the gpu blit scheduled is always a clear blit + * rather than a copy blit, and then we force the failure paths as if + * the blit fence returned an error. + * + * For fail_work_allocation we fail the kmalloc of the async worker, we + * sync the gpu blit. If it then fails, or fail_gpu_migration is set to + * true, then a memcpy operation is performed sync. + */ +#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) +static bool fail_gpu_migration; +static bool fail_work_allocation; + +void i915_ttm_migrate_set_failure_modes(bool gpu_migration, + bool work_allocation) +{ + fail_gpu_migration = gpu_migration; + fail_work_allocation = work_allocation; +} +#endif + static enum i915_cache_level i915_ttm_cache_level(struct drm_i915_private *i915, struct ttm_resource *res, struct ttm_tt *ttm) @@ -129,11 +152,11 @@ int i915_ttm_move_notify(struct ttm_buffer_object *bo) return 0; } -static int i915_ttm_accel_move(struct ttm_buffer_object *bo, - bool clear, - struct ttm_resource *dst_mem, - struct ttm_tt *dst_ttm, - struct sg_table *dst_st) +static struct dma_fence *i915_ttm_accel_move(struct ttm_buffer_object *bo, +bool clear, +struct ttm_resource *dst_mem, +struct ttm_tt *dst_ttm, +struct sg_table *dst_st) { struct drm_i915_private *i915 = container_of(bo->bdev, typeof(*i915), bdev); @@ -144,30 +167,29 @@ static int i915_ttm_accel_move(struct ttm_buffer_object *bo, int ret; if (!i915->gt.migrate.context || intel_gt_is_wedged(&i915->gt)) - return -EINVAL; + return ERR_PTR(-EINVAL); + + /* With fail_gpu_migration, we always perform a GPU clear. */ + if (I915_SELFTEST_ONLY(fail_gpu_migration)) + clear = true; dst_level = i915_ttm_cache_level(i915, dst_mem, dst_ttm); if (clear) { - if (bo->type == ttm_bo_type_kernel) - return -EINVAL; + if (bo->type == ttm_bo_type_kernel && + !I915_SELFTEST_ONLY(fail_gpu_migration)) + return ERR_PTR(-EINVAL); intel_engine_pm_get(i915->gt.migrate.context->engine); ret = intel_context_migrate_clear(i915->gt.migrate.context, NULL, dst_st->sgl, dst_level, i915_ttm_gtt_binds_lmem(dst_mem), 0, &rq); - - if (!ret && rq) { - i915_request_wait(rq, 0, MAX_SCHEDULE_TIMEOUT); - i915_request_put(rq); - } - intel_engine_pm_put(i915->gt.migrate.context->engine); } else { struct i915_refct_sgt *src_rsgt = i915_ttm_resource_get_st(obj, bo->resource); if (IS_ERR(src_rsgt)) - return PTR_ERR(src_rsgt); +
[Intel-gfx] [PATCH v6 0/2] drm/i915: Failsafe migration blits
This patch series introduces failsafe migration blits. The reason for this seemingly strange concept is that if the initial clearing or readback of LMEM fails for some reason[1], and we then set up either GPU- or CPU ptes to the allocated LMEM, we can expose old contents from other clients. So after each migration blit to LMEM, attach a dma-fence callback that checks the migration fence error value and if it's an error, performs a memcpy blit, instead. Patch 1 splits out the TTM move code into separate files Patch 2 implements the failsafe blits and related self-tests [1] There are at least two ways we could trigger exposure of uninitialized LMEM assuming the migration blits themselves never trigger a gpu hang. a) A gpu operation preceding a pipelined eviction blit resets and sets the error fence to -EIO, and the error is propagated across the TTM manager to the clear / swapin blit of a newly allocated TTM resource. It aborts and leaves the memory uninitialized. b) Something wedges the GT while a migration blit is submitted. It ends up never executed and TTM can fault user-space cpu-ptes into uninitialized memory. v3: - Style fixes in second patch (Matthew Auld) v4: - More style fixes in second patch (Matthew Auld) v5: - Fix an issue where we might end up waiting for a fence that would never signal. v6: - Fix a missing call to i915_ttm_memcpy_release() (Matthew Auld) Thomas Hellström (2): drm/i915/ttm: Reorganize the ttm move code drm/i915/ttm: Failsafe migration blits drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 328 ++- drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 35 ++ drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 523 ++ drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h | 43 ++ .../drm/i915/gem/selftests/i915_gem_migrate.c | 24 +- 6 files changed, 673 insertions(+), 281 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h -- 2.31.1
[Intel-gfx] [PATCH v6 2/2] drm/i915/ttm: Failsafe migration blits
If the initial fill blit or copy blit of an object fails, the old content of the data might be exposed and read as soon as either CPU- or GPU PTEs are set up to point at the pages. Intercept the blit fence with an async callback that checks the blit fence for errors and if there are errors performs an async cpu blit instead. If there is a failure to allocate the async dma_fence_work, allocate it on the stack and sync wait for the blit to complete. Add selftests that simulate gpu blit failures and failure to allocate the async dma_fence_work. A previous version of this pach used dma_fence_work, now that's opencoded which adds more code but might lower the latency somewhat in the common non-error case. v3: - Style fixes (Matthew Auld) v4: - Use "#if IS_ENABLED()" instead of #ifdef (Matthew Auld) v5: - Fix an issue where we, if the dependency was already signaled, might end up waiting for a memcpy fence that would never signal. v6: - Add a missing i915_ttm_memcpy_release() (Matthew Auld) Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 325 +++--- drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h | 5 + .../drm/i915/gem/selftests/i915_gem_migrate.c | 24 +- 3 files changed, 298 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c index 0ed6b7f2b95f..ef22d4ed66ad 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c @@ -18,6 +18,29 @@ #include "gt/intel_gt.h" #include "gt/intel_migrate.h" +/** + * DOC: Selftest failure modes for failsafe migration: + * + * For fail_gpu_migration, the gpu blit scheduled is always a clear blit + * rather than a copy blit, and then we force the failure paths as if + * the blit fence returned an error. + * + * For fail_work_allocation we fail the kmalloc of the async worker, we + * sync the gpu blit. If it then fails, or fail_gpu_migration is set to + * true, then a memcpy operation is performed sync. + */ +#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST) +static bool fail_gpu_migration; +static bool fail_work_allocation; + +void i915_ttm_migrate_set_failure_modes(bool gpu_migration, + bool work_allocation) +{ + fail_gpu_migration = gpu_migration; + fail_work_allocation = work_allocation; +} +#endif + static enum i915_cache_level i915_ttm_cache_level(struct drm_i915_private *i915, struct ttm_resource *res, struct ttm_tt *ttm) @@ -129,11 +152,11 @@ int i915_ttm_move_notify(struct ttm_buffer_object *bo) return 0; } -static int i915_ttm_accel_move(struct ttm_buffer_object *bo, - bool clear, - struct ttm_resource *dst_mem, - struct ttm_tt *dst_ttm, - struct sg_table *dst_st) +static struct dma_fence *i915_ttm_accel_move(struct ttm_buffer_object *bo, +bool clear, +struct ttm_resource *dst_mem, +struct ttm_tt *dst_ttm, +struct sg_table *dst_st) { struct drm_i915_private *i915 = container_of(bo->bdev, typeof(*i915), bdev); @@ -144,30 +167,29 @@ static int i915_ttm_accel_move(struct ttm_buffer_object *bo, int ret; if (!i915->gt.migrate.context || intel_gt_is_wedged(&i915->gt)) - return -EINVAL; + return ERR_PTR(-EINVAL); + + /* With fail_gpu_migration, we always perform a GPU clear. */ + if (I915_SELFTEST_ONLY(fail_gpu_migration)) + clear = true; dst_level = i915_ttm_cache_level(i915, dst_mem, dst_ttm); if (clear) { - if (bo->type == ttm_bo_type_kernel) - return -EINVAL; + if (bo->type == ttm_bo_type_kernel && + !I915_SELFTEST_ONLY(fail_gpu_migration)) + return ERR_PTR(-EINVAL); intel_engine_pm_get(i915->gt.migrate.context->engine); ret = intel_context_migrate_clear(i915->gt.migrate.context, NULL, dst_st->sgl, dst_level, i915_ttm_gtt_binds_lmem(dst_mem), 0, &rq); - - if (!ret && rq) { - i915_request_wait(rq, 0, MAX_SCHEDULE_TIMEOUT); - i915_request_put(rq); - } - intel_engine_pm_put(i915->gt.migrate.context->engine); } else { struct i915_refct_sgt *src_rsgt = i915_ttm_resource_get_st(obj, bo->resource); if (IS_ERR(src_rsgt)) -
[Intel-gfx] [PATCH v6 1/2] drm/i915/ttm: Reorganize the ttm move code
We are about to introduce failsafe- and asynchronous migration and ttm moves. This will add complexity and code to the TTM move code so it makes sense to split it out to a separate file to make the i915 TTM code easer to digest. Split the i915 TTM move code out and since we will have to change the name of the gpu_binds_iomem() and cpu_maps_iomem() functions anyway, we alter the name of gpu_binds_iomem() to i915_ttm_gtt_binds_lmem() which is more reflecting what it is used for. With this we also add some more documentation. Otherwise there should be no functional change. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Auld --- drivers/gpu/drm/i915/Makefile| 1 + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 328 +++ drivers/gpu/drm/i915/gem/i915_gem_ttm.h | 35 ++ drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c | 308 + drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h | 38 +++ 5 files changed, 430 insertions(+), 280 deletions(-) create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.c create mode 100644 drivers/gpu/drm/i915/gem/i915_gem_ttm_move.h diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 467872cca027..7d0d0b814670 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile @@ -154,6 +154,7 @@ gem-y += \ gem/i915_gem_throttle.o \ gem/i915_gem_tiling.o \ gem/i915_gem_ttm.o \ + gem/i915_gem_ttm_move.o \ gem/i915_gem_ttm_pm.o \ gem/i915_gem_userptr.o \ gem/i915_gem_wait.o \ diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c index 6a05369e2705..6369fb9b2455 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c @@ -14,13 +14,9 @@ #include "gem/i915_gem_object.h" #include "gem/i915_gem_region.h" #include "gem/i915_gem_ttm.h" +#include "gem/i915_gem_ttm_move.h" #include "gem/i915_gem_ttm_pm.h" - -#include "gt/intel_engine_pm.h" -#include "gt/intel_gt.h" -#include "gt/intel_migrate.h" - #define I915_TTM_PRIO_PURGE 0 #define I915_TTM_PRIO_NO_PAGES 1 #define I915_TTM_PRIO_HAS_PAGES 2 @@ -108,28 +104,6 @@ static int i915_ttm_err_to_gem(int err) return err; } -static bool gpu_binds_iomem(struct ttm_resource *mem) -{ - return mem->mem_type != TTM_PL_SYSTEM; -} - -static bool cpu_maps_iomem(struct ttm_resource *mem) -{ - /* Once / if we support GGTT, this is also false for cached ttm_tts */ - return mem->mem_type != TTM_PL_SYSTEM; -} - -static enum i915_cache_level -i915_ttm_cache_level(struct drm_i915_private *i915, struct ttm_resource *res, -struct ttm_tt *ttm) -{ - return ((HAS_LLC(i915) || HAS_SNOOP(i915)) && !gpu_binds_iomem(res) && - ttm->caching == ttm_cached) ? I915_CACHE_LLC : - I915_CACHE_NONE; -} - -static void i915_ttm_adjust_lru(struct drm_i915_gem_object *obj); - static enum ttm_caching i915_ttm_select_tt_caching(const struct drm_i915_gem_object *obj) { @@ -370,23 +344,14 @@ static void i915_ttm_evict_flags(struct ttm_buffer_object *bo, *placement = i915_sys_placement; } -static int i915_ttm_move_notify(struct ttm_buffer_object *bo) -{ - struct drm_i915_gem_object *obj = i915_ttm_to_gem(bo); - int ret; - - ret = i915_gem_object_unbind(obj, I915_GEM_OBJECT_UNBIND_ACTIVE); - if (ret) - return ret; - - ret = __i915_gem_object_put_pages(obj); - if (ret) - return ret; - - return 0; -} - -static void i915_ttm_free_cached_io_rsgt(struct drm_i915_gem_object *obj) +/** + * i915_ttm_free_cached_io_rsgt - Free object cached LMEM information + * @obj: The GEM object + * This function frees any LMEM-related information that is cached on + * the object. For example the radix tree for fast page lookup and the + * cached refcounted sg-table + */ +void i915_ttm_free_cached_io_rsgt(struct drm_i915_gem_object *obj) { struct radix_tree_iter iter; void __rcu **slot; @@ -403,56 +368,16 @@ static void i915_ttm_free_cached_io_rsgt(struct drm_i915_gem_object *obj) obj->ttm.cached_io_rsgt = NULL; } -static void -i915_ttm_adjust_domains_after_move(struct drm_i915_gem_object *obj) -{ - struct ttm_buffer_object *bo = i915_gem_to_ttm(obj); - - if (cpu_maps_iomem(bo->resource) || bo->ttm->caching != ttm_cached) { - obj->write_domain = I915_GEM_DOMAIN_WC; - obj->read_domains = I915_GEM_DOMAIN_WC; - } else { - obj->write_domain = I915_GEM_DOMAIN_CPU; - obj->read_domains = I915_GEM_DOMAIN_CPU; - } -} - -static void i915_ttm_adjust_gem_after_move(struct drm_i915_gem_object *obj) -{ - struct ttm_buffer_object *bo = i915_gem_to_ttm(obj); - unsigned int cache_level; - unsigned int i; - - /* -* If object was moved to an allowable region, update the object -
[Intel-gfx] [PATCH] kernel/locking: Use a pointer in ww_mutex_trylock().
mutex_acquire_nest() expects a pointer, pass the pointer. Fixes: 12235da8c80a1 ("kernel/locking: Add context to ww_mutex_trylock()") Signed-off-by: Sebastian Andrzej Siewior --- Not sure why I haven't seen this earlier… kernel/locking/ww_rt_mutex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/locking/ww_rt_mutex.c b/kernel/locking/ww_rt_mutex.c index 0e00205cf467a..d1473c624105c 100644 --- a/kernel/locking/ww_rt_mutex.c +++ b/kernel/locking/ww_rt_mutex.c @@ -26,7 +26,7 @@ int ww_mutex_trylock(struct ww_mutex *lock, struct ww_acquire_ctx *ww_ctx) if (__rt_mutex_trylock(&rtm->rtmutex)) { ww_mutex_set_context_fastpath(lock, ww_ctx); - mutex_acquire_nest(&rtm->dep_map, 0, 1, ww_ctx->dep_map, _RET_IP_); + mutex_acquire_nest(&rtm->dep_map, 0, 1, &ww_ctx->dep_map, _RET_IP_); return 1; } -- 2.33.1
Re: [Intel-gfx] [PATCH 02/29] drm/i915/gvt: integrate into the main Makefile
Quoting Christoph Hellwig (2021-11-02 09:05:34) > Remove the separately included Makefile and just use the relative > reference from the main i915 Makefile as for source files in other > subdirectories. The thinking behind the split is to avoid any merge conflicts as the gvt/ subdirectory is handled through separate pull request flow and are note part of drm-tip. The other subdirectories are part of drm-intel-next/drm-intel-gt-next and are part of drm-tip. So I would rather still see the Makefile live in gvt/ directory. Regards, Joonas > Signed-off-by: Christoph Hellwig > --- > drivers/gpu/drm/i915/Makefile | 29 - > drivers/gpu/drm/i915/gvt/Makefile | 9 - > drivers/gpu/drm/i915/gvt/trace.h | 2 +- > 3 files changed, 25 insertions(+), 15 deletions(-) > delete mode 100644 drivers/gpu/drm/i915/gvt/Makefile > > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile > index 335ba9f43d8f7..63523032eea26 100644 > --- a/drivers/gpu/drm/i915/Makefile > +++ b/drivers/gpu/drm/i915/Makefile > @@ -295,11 +295,30 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \ > > # virtual gpu code > i915-y += i915_vgpu.o > - > -ifeq ($(CONFIG_DRM_I915_GVT),y) > -i915-y += intel_gvt.o > -include $(src)/gvt/Makefile > -endif > +i915-$(CONFIG_DRM_I915_GVT) += \ > + intel_gvt.o \ > + gvt/gvt.o \ > + gvt/aperture_gm.o \ > + gvt/handlers.o \ > + gvt/vgpu.o \ > + gvt/trace_points.o \ > + gvt/firmware.o \ > + gvt/interrupt.o \ > + gvt/gtt.o \ > + gvt/cfg_space.o \ > + gvt/opregion.o \ > + gvt/mmio.o \ > + gvt/display.o \ > + gvt/edid.o \ > + gvt/execlist.o \ > + gvt/scheduler.o \ > + gvt/sched_policy.o \ > + gvt/mmio_context.o \ > + gvt/cmd_parser.o \ > + gvt/debugfs.o \ > + gvt/fb_decoder.o \ > + gvt/dmabuf.o \ > + gvt/page_track.o > > obj-$(CONFIG_DRM_I915) += i915.o > obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o > diff --git a/drivers/gpu/drm/i915/gvt/Makefile > b/drivers/gpu/drm/i915/gvt/Makefile > deleted file mode 100644 > index ea8324abc784a..0 > --- a/drivers/gpu/drm/i915/gvt/Makefile > +++ /dev/null > @@ -1,9 +0,0 @@ > -# SPDX-License-Identifier: GPL-2.0 > -GVT_DIR := gvt > -GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o > firmware.o \ > - interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \ > - execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o > debugfs.o \ > - fb_decoder.o dmabuf.o page_track.o > - > -ccflags-y += -I $(srctree)/$(src) -I > $(srctree)/$(src)/$(GVT_DIR)/ > -i915-y += $(addprefix $(GVT_DIR)/, > $(GVT_SOURCE)) > diff --git a/drivers/gpu/drm/i915/gvt/trace.h > b/drivers/gpu/drm/i915/gvt/trace.h > index 6d787750d279f..348f57f8301db 100644 > --- a/drivers/gpu/drm/i915/gvt/trace.h > +++ b/drivers/gpu/drm/i915/gvt/trace.h > @@ -379,5 +379,5 @@ TRACE_EVENT(render_mmio, > #undef TRACE_INCLUDE_PATH > #define TRACE_INCLUDE_PATH . > #undef TRACE_INCLUDE_FILE > -#define TRACE_INCLUDE_FILE trace > +#define TRACE_INCLUDE_FILE gvt/trace > #include > -- > 2.30.2 >
Re: [Intel-gfx] [PATCH 06/29] drm/i915/gvt: move the gvt code into kvmgt.ko
+ Thomas, Maarten and Matt (Also, Zhi and Zhenyu, please see down) Quoting Christoph Hellwig (2021-11-02 09:05:38) > Instead of having an option to build the gvt code into the main i915 > module, just move it into the kvmgt.ko module. This only requires > a new struct with three entries that the KVMGT modules needs to register > with the main i915 module, and a proper list of GVT-enabled devices > instead of global device pointer. > > Signed-off-by: Christoph Hellwig > +/* > + * Exported here so that the exports only get created when GVT support is > + * actually enabled. > + */ > +EXPORT_SYMBOL_NS_GPL(i915_gem_object_alloc, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_object_create_shmem, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_object_init, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_object_ggtt_pin_ww, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_object_pin_map, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_object_set_to_cpu_domain, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(__i915_gem_object_flush_map, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(__i915_gem_object_set_pages, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_gtt_insert, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_prime_export, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_init, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_backoff, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_fini, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_ppgtt_create, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_request_add, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_request_create, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_request_wait, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_reserve_fence, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_unreserve_fence, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_vm_release, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(i915_vma_move_to_active, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(intel_context_create, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(__intel_context_do_pin, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(__intel_context_do_unpin, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(intel_ring_begin, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_get, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_put_unchecked, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_for_reg, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_get, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_put, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(shmem_pin_map, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(shmem_unpin_map, I915_GVT); > +EXPORT_SYMBOL_NS_GPL(__px_dma, I915_GVT); This is where the module conversion got stuck last time. Conditionally exporting is kind of a partial remedy. Previously the intention for the rewrite was to define a clear interface between the two modules which would be well defined enough that we could avoid frequent clashes and hopefully get GVT into drm-tip, too. The absolute minimum requirement is not to have any of the double underscore symbols in this list. As that convention is specifically used to mark functions which are expected to have reduced error checking because of the exact point they are being called from. With that done we should be where we can enable the exports by default and modprobe would be all that is required. I think Zhenyu and Zhi took an AR back in time to see how small they could shrink this list. Would we have some followup patches available to shrink this interface? Also, the golden MMIO state capture remains something that leaks the hypervisor state into the guests. For example the fact which bug W/A are applied in hypervisor, and I would rather have that code path isolated before enabling by default. Regards, Joonas
[Intel-gfx] [PATCH] drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
Some selftests assume that nothing will attempt to grab these bitlocks while they are held by the selftests. With GuC, for example, that is not true because the hanging workloads may cause the GuC code to attempt to grab them for a global reset, and that may cause it to end up sleeping on the bit never waking up. Regardless whether that will be the final solution for GuC, use clear_and_wake_up_bit() pending a more thorough investigation on how this should be handled moving forward. Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 8 drivers/gpu/drm/i915/selftests/igt_reset.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c index 7e2d99dd012d..8590419be4c6 100644 --- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c +++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c @@ -528,7 +528,7 @@ static int igt_reset_nop_engine(void *arg) break; } } while (time_before(jiffies, end_time)); - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable(engine); pr_info("%s(%s): %d resets\n", __func__, engine->name, count); @@ -679,7 +679,7 @@ static int igt_reset_fail_engine(void *arg) out: pr_info("%s(%s): %d resets\n", __func__, engine->name, count); skip: - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable(engine); intel_context_put(ce); @@ -824,7 +824,7 @@ static int __igt_reset_engine(struct intel_gt *gt, bool active) if (err) break; } while (time_before(jiffies, end_time)); - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable(engine); pr_info("%s: Completed %lu %s resets\n", engine->name, count, active ? "active" : "idle"); @@ -1165,7 +1165,7 @@ static int __igt_reset_engines(struct intel_gt *gt, if (err) break; } while (time_before(jiffies, end_time)); - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable_no_pm(engine); pr_info("i915_reset_engine(%s:%s): %lu resets\n", diff --git a/drivers/gpu/drm/i915/selftests/igt_reset.c b/drivers/gpu/drm/i915/selftests/igt_reset.c index 9f8590b868a9..a2838c65f8a5 100644 --- a/drivers/gpu/drm/i915/selftests/igt_reset.c +++ b/drivers/gpu/drm/i915/selftests/igt_reset.c @@ -36,7 +36,7 @@ void igt_global_reset_unlock(struct intel_gt *gt) enum intel_engine_id id; for_each_engine(engine, gt, id) - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); clear_bit(I915_RESET_BACKOFF, >->reset.flags); wake_up_all(>->reset.queue); -- 2.31.1
Re: [Intel-gfx] refactor the i915 GVT support and move to the modern mdev API v2
Hi Zhenyu and Zhi, Can you have somebody from the GVT team to review the patches that are fully contained in gvt/ ? I also started discussion on patch 6 which is about defining the interface between the modules. I remember there is prior work to shrink the interface. Do you have links to such patches? The minimal we should do is to eliminate the double underscore prefixed functions. But I would prefer to have the symbol exports by default so that we can enable the functionality just by loading the module. Regards, Joonas Quoting Christoph Hellwig (2021-11-02 09:05:32) > Hi all, > > the GVT code in the i915 is a bit of a mess right now due to strange > abstractions and lots of indirect calls. This series refactors various > bits to clean that up. The main user visible change is that almost all > of the GVT code moves out of the main i915 driver and into the kvmgt > module. > > Tested on my Thinkpad with a Kaby Lake CPU and integrated graphics. > > Git tree: > > git://git.infradead.org/users/hch/misc.git i915-gvt > > Gitweb: > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/i915-gvt > > Changes since v1: > - rebased on Linux 5.15 > - allow the kvmgvt module to be loaded at any time and thus solve >the deadlock when both i915 amd kvmgvt are modular > - include the conversion to the modern mdev API > > Note that I do expect to rebased this again against 5.16-rc1 once > released, but I'd like to get this out for review ASAP. > > Diffstat: > b/drivers/gpu/drm/i915/Kconfig | 33 > b/drivers/gpu/drm/i915/Makefile | 31 > b/drivers/gpu/drm/i915/gvt/cfg_space.c | 89 -- > b/drivers/gpu/drm/i915/gvt/cmd_parser.c |4 > b/drivers/gpu/drm/i915/gvt/dmabuf.c | 36 - > b/drivers/gpu/drm/i915/gvt/execlist.c | 12 > b/drivers/gpu/drm/i915/gvt/gtt.c| 55 + > b/drivers/gpu/drm/i915/gvt/gvt.h| 125 ++- > b/drivers/gpu/drm/i915/gvt/interrupt.c | 38 + > b/drivers/gpu/drm/i915/gvt/kvmgt.c | 1099 > +++- > b/drivers/gpu/drm/i915/gvt/mmio.c |4 > b/drivers/gpu/drm/i915/gvt/opregion.c | 148 > b/drivers/gpu/drm/i915/gvt/page_track.c |8 > b/drivers/gpu/drm/i915/gvt/scheduler.c | 37 - > b/drivers/gpu/drm/i915/gvt/trace.h |2 > b/drivers/gpu/drm/i915/gvt/vgpu.c | 22 > b/drivers/gpu/drm/i915/i915_drv.c |7 > b/drivers/gpu/drm/i915/i915_drv.h |1 > b/drivers/gpu/drm/i915/i915_trace.h |1 > b/drivers/gpu/drm/i915/intel_gvt.c | 162 +++- > b/drivers/gpu/drm/i915/intel_gvt.h | 17 > drivers/gpu/drm/i915/gvt/Makefile |9 > drivers/gpu/drm/i915/gvt/gvt.c | 340 - > drivers/gpu/drm/i915/gvt/hypercall.h| 82 -- > drivers/gpu/drm/i915/gvt/mpt.h | 400 --- > 25 files changed, 929 insertions(+), 1833 deletions(-)
Re: [Intel-gfx] [PATCH v3] drm/i915/display: Exit PSR when doing async flips
On Tue, Nov 02, 2021 at 12:32:14PM -0700, José Roberto de Souza wrote: > Changing the buffer in the middle of the scanout then entering an > period of flip idleness will cause part of the previous buffer being > diplayed to user when PSR is enabled. > > So here disabling PSR and scheduling activation during the next > sync flip. > > The async flip check that we had in PSR compute is not executed at > every flip so it was not doing anything useful and is also being > dropped here. > > v2: > - scheduling the PSR work in _intel_psr_post_plane_update() > > v3: > - only re enabling PSR when doing a sync flip > > Cc: Karthik B S > Cc: Vandita Kulkarni > Cc: Ville Syrjälä > Cc: Rodrigo Vivi > Signed-off-by: José Roberto de Souza > --- > drivers/gpu/drm/i915/display/intel_psr.c | 37 ++-- > 1 file changed, 21 insertions(+), 16 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c > b/drivers/gpu/drm/i915/display/intel_psr.c > index 9d589d471e335..b8fac53d57df1 100644 > --- a/drivers/gpu/drm/i915/display/intel_psr.c > +++ b/drivers/gpu/drm/i915/display/intel_psr.c > @@ -731,12 +731,6 @@ static bool intel_psr2_sel_fetch_config_valid(struct > intel_dp *intel_dp, > return false; > } > > - if (crtc_state->uapi.async_flip) { > - drm_dbg_kms(&dev_priv->drm, > - "PSR2 sel fetch not enabled, async flip enabled\n"); > - return false; > - } > - > /* Wa_14010254185 Wa_14010103792 */ > if (IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_C0)) { > drm_dbg_kms(&dev_priv->drm, > @@ -1780,36 +1774,47 @@ void intel_psr_pre_plane_update(struct > intel_atomic_state *state, > if (psr->enabled && needs_to_disable) > intel_psr_disable_locked(intel_dp); > > + if (psr->enabled && crtc_state->uapi.async_flip) > + intel_psr_exit(intel_dp); > + > mutex_unlock(&psr->lock); > } > } > > static void _intel_psr_post_plane_update(const struct intel_atomic_state > *state, > - const struct intel_crtc_state > *crtc_state) > + const struct intel_crtc_state > *old_crtc_state, > + const struct intel_crtc_state > *new_crtc_state) Might make sense to change this to match how psr_pre_plane_update() works these days. > { > struct drm_i915_private *dev_priv = to_i915(state->base.dev); > struct intel_encoder *encoder; > > - if (!crtc_state->has_psr) > + if (!new_crtc_state->has_psr) > return; > > for_each_intel_encoder_mask_with_psr(state->base.dev, encoder, > - crtc_state->uapi.encoder_mask) { > + new_crtc_state->uapi.encoder_mask) > { > struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > struct intel_psr *psr = &intel_dp->psr; > > mutex_lock(&psr->lock); > > - drm_WARN_ON(&dev_priv->drm, psr->enabled && > !crtc_state->active_planes); > + drm_WARN_ON(&dev_priv->drm, psr->enabled && > + !new_crtc_state->active_planes); > > /* Only enable if there is active planes */ > - if (!psr->enabled && crtc_state->active_planes) > - intel_psr_enable_locked(intel_dp, crtc_state); > + if (!psr->enabled && new_crtc_state->active_planes) > + intel_psr_enable_locked(intel_dp, new_crtc_state); What prevents this guy from activating PSR while we're doing an async flip? > > /* Force a PSR exit when enabling CRC to avoid CRC timeouts */ > - if (crtc_state->crc_enabled && psr->enabled) > + if (new_crtc_state->crc_enabled && psr->enabled) > psr_force_hw_tracking_exit(intel_dp); > > + /* Only re enabling PSR when doing a sync flip */ > + if (psr->enabled && !psr->active && > + old_crtc_state->uapi.async_flip && > + !new_crtc_state->uapi.async_flip) > + schedule_work(&intel_dp->psr.work); > + > mutex_unlock(&psr->lock); > } > } > @@ -1817,15 +1822,15 @@ static void _intel_psr_post_plane_update(const struct > intel_atomic_state *state, > void intel_psr_post_plane_update(const struct intel_atomic_state *state) > { > struct drm_i915_private *dev_priv = to_i915(state->base.dev); > - struct intel_crtc_state *crtc_state; > + struct intel_crtc_state *old_crtc_state, *new_crtc_state; > struct intel_crtc *crtc; > int i; > > if (!HAS_PSR(dev_priv)) > return; > > - for_each_new_intel_crtc_in_state(state, crtc, crtc_state, i) > - _intel_psr_post_plane_update(state, crtc_state); > + for_each_oldnew_intel_crtc
[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Failsafe migration blits (rev7)
== Series Details == Series: drm/i915: Failsafe migration blits (rev7) URL : https://patchwork.freedesktop.org/series/95617/ State : warning == Summary == $ dim checkpatch origin/drm-tip 7fdc5097e400 drm/i915/ttm: Reorganize the ttm move code -:511: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #511: new file mode 100644 total: 0 errors, 1 warnings, 0 checks, 807 lines checked ddd7a78265a3 drm/i915/ttm: Failsafe migration blits
[Intel-gfx] [PATCH 01/17] drm/i915/fbc: Exract snb_fbc_program_fence()
From: Ville Syrjälä We have two identical copies of the snb+ system agent CPU fence programming code. Extract into a helper. Also there's no real point in insisting that we program 0 into DPFC_CPU_FENCE_OFFSET when the fence is disabled. So just always stick the computed Y offset there whether or not the fence is actually used or not. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 39 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 834eb4cc7c10..6bd952a37901 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -307,6 +307,18 @@ static void intel_fbc_recompress(struct drm_i915_private *dev_priv) i8xx_fbc_recompress(dev_priv); } +static void snb_fbc_program_fence(struct drm_i915_private *i915) +{ + const struct intel_fbc_reg_params *params = &i915->fbc.params; + u32 ctl = 0; + + if (params->fence_id >= 0) + ctl = SNB_CPU_FENCE_ENABLE | params->fence_id; + + intel_de_write(i915, SNB_DPFC_CTL_SA, ctl); + intel_de_write(i915, DPFC_CPU_FENCE_OFFSET, params->fence_y_offset); +} + static void ilk_fbc_activate(struct drm_i915_private *dev_priv) { struct intel_fbc_reg_params *params = &dev_priv->fbc.params; @@ -320,19 +332,11 @@ static void ilk_fbc_activate(struct drm_i915_private *dev_priv) dpfc_ctl |= DPFC_CTL_FENCE_EN; if (IS_IRONLAKE(dev_priv)) dpfc_ctl |= params->fence_id; - if (IS_SANDYBRIDGE(dev_priv)) { - intel_de_write(dev_priv, SNB_DPFC_CTL_SA, - SNB_CPU_FENCE_ENABLE | params->fence_id); - intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, - params->fence_y_offset); - } - } else { - if (IS_SANDYBRIDGE(dev_priv)) { - intel_de_write(dev_priv, SNB_DPFC_CTL_SA, 0); - intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, 0); - } } + if (IS_SANDYBRIDGE(dev_priv)) + snb_fbc_program_fence(dev_priv); + intel_de_write(dev_priv, ILK_DPFC_FENCE_YOFF, params->fence_y_offset); /* enable it... */ @@ -389,20 +393,15 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) dpfc_ctl |= g4x_dpfc_ctl_limit(dev_priv); - if (params->fence_id >= 0) { + if (params->fence_id >= 0) dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; - intel_de_write(dev_priv, SNB_DPFC_CTL_SA, - SNB_CPU_FENCE_ENABLE | params->fence_id); - intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, - params->fence_y_offset); - } else if (dev_priv->ggtt.num_fences) { - intel_de_write(dev_priv, SNB_DPFC_CTL_SA, 0); - intel_de_write(dev_priv, DPFC_CPU_FENCE_OFFSET, 0); - } if (dev_priv->fbc.false_color) dpfc_ctl |= FBC_CTL_FALSE_COLOR; + if (dev_priv->ggtt.num_fences) + snb_fbc_program_fence(dev_priv); + intel_de_write(dev_priv, ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); } -- 2.32.0
[Intel-gfx] [PATCH 02/17] drm/i915/fbc: Extract {skl, glk}_fbc_program_cfb_stride()
From: Ville Syrjälä Declutter gen7_fbc_activate() by sucking the override stride programming stuff into helpers. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 53 +++- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 6bd952a37901..c95a32f1985a 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -360,32 +360,45 @@ static bool ilk_fbc_is_active(struct drm_i915_private *dev_priv) return intel_de_read(dev_priv, ILK_DPFC_CONTROL) & DPFC_CTL_EN; } +static void glk_fbc_program_cfb_stride(struct drm_i915_private *i915) +{ + struct intel_fbc *fbc = &i915->fbc; + const struct intel_fbc_reg_params *params = &fbc->params; + u32 val = 0; + + if (params->override_cfb_stride) + val |= FBC_STRIDE_OVERRIDE | + FBC_STRIDE(params->override_cfb_stride / fbc->limit); + + intel_de_write(i915, GLK_FBC_STRIDE, val); +} + +static void skl_fbc_program_cfb_stride(struct drm_i915_private *i915) +{ + struct intel_fbc *fbc = &i915->fbc; + const struct intel_fbc_reg_params *params = &fbc->params; + u32 val = 0; + + /* Display WA #0529: skl, kbl, bxt. */ + if (params->override_cfb_stride) + val |= CHICKEN_FBC_STRIDE_OVERRIDE | + CHICKEN_FBC_STRIDE(params->override_cfb_stride / fbc->limit); + + intel_de_rmw(i915, CHICKEN_MISC_4, +CHICKEN_FBC_STRIDE_OVERRIDE | +CHICKEN_FBC_STRIDE_MASK, val); +} + static void gen7_fbc_activate(struct drm_i915_private *dev_priv) { struct intel_fbc *fbc = &dev_priv->fbc; const struct intel_fbc_reg_params *params = &fbc->params; u32 dpfc_ctl; - if (DISPLAY_VER(dev_priv) >= 10) { - u32 val = 0; - - if (params->override_cfb_stride) - val |= FBC_STRIDE_OVERRIDE | - FBC_STRIDE(params->override_cfb_stride / fbc->limit); - - intel_de_write(dev_priv, GLK_FBC_STRIDE, val); - } else if (DISPLAY_VER(dev_priv) == 9) { - u32 val = 0; - - /* Display WA #0529: skl, kbl, bxt. */ - if (params->override_cfb_stride) - val |= CHICKEN_FBC_STRIDE_OVERRIDE | - CHICKEN_FBC_STRIDE(params->override_cfb_stride / fbc->limit); - - intel_de_rmw(dev_priv, CHICKEN_MISC_4, -CHICKEN_FBC_STRIDE_OVERRIDE | -CHICKEN_FBC_STRIDE_MASK, val); - } + if (DISPLAY_VER(dev_priv) >= 10) + glk_fbc_program_cfb_stride(dev_priv); + else if (DISPLAY_VER(dev_priv) == 9) + skl_fbc_program_cfb_stride(dev_priv); dpfc_ctl = 0; if (IS_IVYBRIDGE(dev_priv)) -- 2.32.0
[Intel-gfx] [PATCH 00/17] drm/i915/fbc: Prep work for multiple FBC instances
From: Ville Syrjälä Bunch of refactoring and cleanups, mainly as prep work for introducing multiple FBC instances in the future. Ville Syrjälä (17): drm/i915/fbc: Exract snb_fbc_program_fence() drm/i915/fbc: Extract {skl,glk}_fbc_program_cfb_stride() drm/i915/fbc: Just use params->fence_y_offset always drm/i915/fbc: Introduce intel_fbc_is_compressing() drm/i915/fbc: Extract helpers to compute FBC control register values drm/i915/fbc: Introduce intel_fbc_funcs drm/i915/fbc: Introduce .nuke() vfunc drm/i915/fbc: s/gen7/ivb/ drm/i915/fbc: Introduce .program_cfb() vfunc drm/i915/fbc: Introduce intel_fbc_set_false_color() drm/i915/fbc: Nuke BDW_FBC_COMP_SEG_MASK drm/i915/fbc: Clean up all register defines drm/i915/fbc: Finish polishing FBC1 registers drm/i915: Relocate FBC_LLC_READ_CTRL drm/i915/fbc: s/dev_priv/i915/ drm/i915/fbc: Start passing around intel_fbc drm/1915/fbc: Replace plane->has_fbc with a pointer to the fbc instance drivers/gpu/drm/i915/display/i9xx_plane.c | 10 +- drivers/gpu/drm/i915/display/intel_display.c | 4 +- .../drm/i915/display/intel_display_debugfs.c | 43 +- .../drm/i915/display/intel_display_types.h| 4 +- drivers/gpu/drm/i915/display/intel_fbc.c | 996 ++ drivers/gpu/drm/i915/display/intel_fbc.h | 11 +- .../drm/i915/display/intel_fifo_underrun.c| 2 +- .../drm/i915/display/skl_universal_plane.c| 10 +- drivers/gpu/drm/i915/i915_drv.h | 4 + drivers/gpu/drm/i915/i915_reg.h | 154 +-- drivers/gpu/drm/i915/intel_pm.c | 16 +- 11 files changed, 695 insertions(+), 559 deletions(-) -- 2.32.0
[Intel-gfx] [PATCH 03/17] drm/i915/fbc: Just use params->fence_y_offset always
From: Ville Syrjälä No need to tiptoe around programming DPFC_FENCE_YOFF with params->fence_y_offset vs. 0. If the fence is not enabled it doesn't even matter what we program here. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index c95a32f1985a..8f51af2b4ebc 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -235,13 +235,11 @@ static void g4x_fbc_activate(struct drm_i915_private *dev_priv) dpfc_ctl |= g4x_dpfc_ctl_limit(dev_priv); - if (params->fence_id >= 0) { + if (params->fence_id >= 0) dpfc_ctl |= DPFC_CTL_FENCE_EN | params->fence_id; - intel_de_write(dev_priv, DPFC_FENCE_YOFF, - params->fence_y_offset); - } else { - intel_de_write(dev_priv, DPFC_FENCE_YOFF, 0); - } + + intel_de_write(dev_priv, DPFC_FENCE_YOFF, + params->fence_y_offset); /* enable it... */ intel_de_write(dev_priv, DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); -- 2.32.0
[Intel-gfx] [PATCH 04/17] drm/i915/fbc: Introduce intel_fbc_is_compressing()
From: Ville Syrjälä Move the direct FBC status register reads from the debugfs code behind an abstract api. Signed-off-by: Ville Syrjälä --- .../drm/i915/display/intel_display_debugfs.c | 23 +++- drivers/gpu/drm/i915/display/intel_fbc.c | 36 +++ drivers/gpu/drm/i915/display/intel_fbc.h | 1 + 3 files changed, 41 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index d7d6dde518a3..19bc148e168c 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -52,27 +52,12 @@ static int i915_fbc_status(struct seq_file *m, void *unused) wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); mutex_lock(&fbc->lock); - if (intel_fbc_is_active(dev_priv)) + if (intel_fbc_is_active(dev_priv)) { seq_puts(m, "FBC enabled\n"); - else + seq_printf(m, "Compressing: %s\n", + yesno(intel_fbc_is_compressing(dev_priv))); + } else { seq_printf(m, "FBC disabled: %s\n", fbc->no_fbc_reason); - - if (intel_fbc_is_active(dev_priv)) { - u32 mask; - - if (DISPLAY_VER(dev_priv) >= 8) - mask = intel_de_read(dev_priv, IVB_FBC_STATUS2) & BDW_FBC_COMP_SEG_MASK; - else if (DISPLAY_VER(dev_priv) >= 7) - mask = intel_de_read(dev_priv, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; - else if (DISPLAY_VER(dev_priv) >= 5) - mask = intel_de_read(dev_priv, ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK; - else if (IS_G4X(dev_priv)) - mask = intel_de_read(dev_priv, DPFC_STATUS) & DPFC_COMP_SEG_MASK; - else - mask = intel_de_read(dev_priv, FBC_STATUS) & - (FBC_STAT_COMPRESSING | FBC_STAT_COMPRESSED); - - seq_printf(m, "Compressing: %s\n", yesno(mask)); } mutex_unlock(&fbc->lock); diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 8f51af2b4ebc..4d7b156e46db 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -211,6 +211,12 @@ static bool i8xx_fbc_is_active(struct drm_i915_private *dev_priv) return intel_de_read(dev_priv, FBC_CONTROL) & FBC_CTL_EN; } +static bool i8xx_fbc_is_compressing(struct drm_i915_private *i915) +{ + return intel_de_read(i915, FBC_STATUS) & + (FBC_STAT_COMPRESSING | FBC_STAT_COMPRESSED); +} + static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) { switch (i915->fbc.limit) { @@ -262,6 +268,11 @@ static bool g4x_fbc_is_active(struct drm_i915_private *dev_priv) return intel_de_read(dev_priv, DPFC_CONTROL) & DPFC_CTL_EN; } +static bool g4x_fbc_is_compressing(struct drm_i915_private *i915) +{ + return intel_de_read(i915, DPFC_STATUS) & DPFC_COMP_SEG_MASK; +} + static void i8xx_fbc_recompress(struct drm_i915_private *dev_priv) { struct intel_fbc_reg_params *params = &dev_priv->fbc.params; @@ -358,6 +369,11 @@ static bool ilk_fbc_is_active(struct drm_i915_private *dev_priv) return intel_de_read(dev_priv, ILK_DPFC_CONTROL) & DPFC_CTL_EN; } +static bool ilk_fbc_is_compressing(struct drm_i915_private *i915) +{ + return intel_de_read(i915, ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK; +} + static void glk_fbc_program_cfb_stride(struct drm_i915_private *i915) { struct intel_fbc *fbc = &i915->fbc; @@ -416,6 +432,14 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) intel_de_write(dev_priv, ILK_DPFC_CONTROL, dpfc_ctl | DPFC_CTL_EN); } +static bool gen7_fbc_is_compressing(struct drm_i915_private *i915) +{ + if (DISPLAY_VER(i915) >= 8) + return intel_de_read(i915, IVB_FBC_STATUS2) & BDW_FBC_COMP_SEG_MASK; + else + return intel_de_read(i915, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; +} + static bool intel_fbc_hw_is_active(struct drm_i915_private *dev_priv) { if (DISPLAY_VER(dev_priv) >= 5) @@ -461,6 +485,18 @@ static void intel_fbc_hw_deactivate(struct drm_i915_private *dev_priv) i8xx_fbc_deactivate(dev_priv); } +bool intel_fbc_is_compressing(struct drm_i915_private *i915) +{ + if (DISPLAY_VER(i915) >= 7) + return gen7_fbc_is_compressing(i915); + else if (DISPLAY_VER(i915) >= 5) + return ilk_fbc_is_compressing(i915); + else if (IS_G4X(i915)) + return g4x_fbc_is_compressing(i915); + else + return i8xx_fbc_is_compressing(i915); +} + /** * intel_fbc_is_active - Is FBC active? * @dev_priv: i915 device instance diff --git a/drivers/gpu/drm/i915/display/intel_fbc.h b/drivers/gpu/drm/i915/display
[Intel-gfx] [PATCH 05/17] drm/i915/fbc: Extract helpers to compute FBC control register values
From: Ville Syrjälä Declutter the *_fbc_activate() functions by pulling all the control register value computations into helpers. I left the enable bit in *_fbc_activate() in the hopes of maybe using the helpers in the *_fbc_deactivate() paths as well instead of the current rmw approach. That won't be possible at least quite yet since we clobber the fbc->params before deactivating FBC so we could end up changing some of the values live, which given FBC's lack of/poor double buffering would likely not go so well. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 162 +-- 1 file changed, 94 insertions(+), 68 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 4d7b156e46db..fbb96f6aaacd 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -142,6 +142,48 @@ static unsigned int intel_fbc_cfb_size(struct drm_i915_private *dev_priv, return lines * intel_fbc_cfb_stride(dev_priv, cache); } +static u32 i8xx_fbc_ctl(struct drm_i915_private *i915) +{ + struct intel_fbc *fbc = &i915->fbc; + const struct intel_fbc_reg_params *params = &fbc->params; + unsigned int cfb_stride; + u32 fbc_ctl; + + cfb_stride = params->cfb_stride / fbc->limit; + + /* FBC_CTL wants 32B or 64B units */ + if (DISPLAY_VER(i915) == 2) + cfb_stride = (cfb_stride / 32) - 1; + else + cfb_stride = (cfb_stride / 64) - 1; + + fbc_ctl = FBC_CTL_PERIODIC | + FBC_CTL_INTERVAL(params->interval) | + FBC_CTL_STRIDE(cfb_stride); + + if (IS_I945GM(i915)) + fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ + + if (params->fence_id >= 0) + fbc_ctl |= FBC_CTL_FENCENO(params->fence_id); + + return fbc_ctl; +} + +static u32 i965_fbc_ctl2(struct drm_i915_private *i915) +{ + const struct intel_fbc_reg_params *params = &i915->fbc.params; + u32 fbc_ctl2; + + fbc_ctl2 = FBC_CTL_FENCE_DBL | FBC_CTL_IDLE_IMM | + FBC_CTL_PLANE(params->crtc.i9xx_plane); + + if (params->fence_id >= 0) + fbc_ctl2 |= FBC_CTL_CPU_FENCE; + + return fbc_ctl2; +} + static void i8xx_fbc_deactivate(struct drm_i915_private *dev_priv) { u32 fbc_ctl; @@ -166,44 +208,21 @@ static void i8xx_fbc_activate(struct drm_i915_private *dev_priv) { struct intel_fbc *fbc = &dev_priv->fbc; const struct intel_fbc_reg_params *params = &fbc->params; - int cfb_pitch; int i; - u32 fbc_ctl; - - cfb_pitch = params->cfb_stride / fbc->limit; - - /* FBC_CTL wants 32B or 64B units */ - if (DISPLAY_VER(dev_priv) == 2) - cfb_pitch = (cfb_pitch / 32) - 1; - else - cfb_pitch = (cfb_pitch / 64) - 1; /* Clear old tags */ for (i = 0; i < (FBC_LL_SIZE / 32) + 1; i++) intel_de_write(dev_priv, FBC_TAG(i), 0); if (DISPLAY_VER(dev_priv) == 4) { - u32 fbc_ctl2; - - /* Set it up... */ - fbc_ctl2 = FBC_CTL_FENCE_DBL | FBC_CTL_IDLE_IMM; - fbc_ctl2 |= FBC_CTL_PLANE(params->crtc.i9xx_plane); - if (params->fence_id >= 0) - fbc_ctl2 |= FBC_CTL_CPU_FENCE; - intel_de_write(dev_priv, FBC_CONTROL2, fbc_ctl2); + intel_de_write(dev_priv, FBC_CONTROL2, + i965_fbc_ctl2(dev_priv)); intel_de_write(dev_priv, FBC_FENCE_OFF, params->fence_y_offset); } - /* enable it... */ - fbc_ctl = FBC_CTL_INTERVAL(params->interval); - fbc_ctl |= FBC_CTL_EN | FBC_CTL_PERIODIC; - if (IS_I945GM(dev_priv)) - fbc_ctl |= FBC_CTL_C3_IDLE; /* 945 needs special SR handling */ - fbc_ctl |= FBC_CTL_STRIDE(cfb_pitch & 0xff); - if (params->fence_id >= 0) - fbc_ctl |= FBC_CTL_FENCENO(params->fence_id); - intel_de_write(dev_priv, FBC_CONTROL, fbc_ctl); + intel_de_write(dev_priv, FBC_CONTROL, + FBC_CTL_EN | i8xx_fbc_ctl(dev_priv)); } static bool i8xx_fbc_is_active(struct drm_i915_private *dev_priv) @@ -232,23 +251,36 @@ static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) } } +static u32 g4x_dpfc_ctl(struct drm_i915_private *i915) +{ + const struct intel_fbc_reg_params *params = &i915->fbc.params; + u32 dpfc_ctl; + + dpfc_ctl = g4x_dpfc_ctl_limit(i915) | + DPFC_CTL_PLANE(params->crtc.i9xx_plane); + + if (IS_G4X(i915)) + dpfc_ctl |= DPFC_SR_EN; + + if (params->fence_id >= 0) { + dpfc_ctl |= DPFC_CTL_FENCE_EN; + + if (DISPLAY_VER(i915) < 6) + dpfc_ctl |= params->fence_id; + } + + return dpfc_ctl; +} + static
[Intel-gfx] [PATCH 07/17] drm/i915/fbc: Introduce .nuke() vfunc
From: Ville Syrjälä Eliminate yet another if-ladder by adding .nuke() vfunc. We also rename all *_recompress() stuff to *_nuke() since that's the terminology the spec uses. Also "recompress" is a bit confusing by perhaps implying that this triggers an immediate recompression. Depending on the hardware that may definitely not be the case, and in general we don't specifically know when the hardware decides to compress. So all we do is "nuke" the current compressed framebuffer and leave it up to the hardware to recompress later if it so chooses. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 145 +-- 1 file changed, 84 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index a2e09b6d21c7..be89404840d2 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -53,6 +53,7 @@ struct intel_fbc_funcs { void (*deactivate)(struct drm_i915_private *i915); bool (*is_active)(struct drm_i915_private *i915); bool (*is_compressing)(struct drm_i915_private *i915); + void (*nuke)(struct drm_i915_private *i915); }; /* @@ -243,11 +244,42 @@ static bool i8xx_fbc_is_compressing(struct drm_i915_private *i915) (FBC_STAT_COMPRESSING | FBC_STAT_COMPRESSED); } +static void i8xx_fbc_nuke(struct drm_i915_private *dev_priv) +{ + struct intel_fbc_reg_params *params = &dev_priv->fbc.params; + enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane; + + spin_lock_irq(&dev_priv->uncore.lock); + intel_de_write_fw(dev_priv, DSPADDR(i9xx_plane), + intel_de_read_fw(dev_priv, DSPADDR(i9xx_plane))); + spin_unlock_irq(&dev_priv->uncore.lock); +} + static const struct intel_fbc_funcs i8xx_fbc_funcs = { .activate = i8xx_fbc_activate, .deactivate = i8xx_fbc_deactivate, .is_active = i8xx_fbc_is_active, .is_compressing = i8xx_fbc_is_compressing, + .nuke = i8xx_fbc_nuke, +}; + +static void i965_fbc_nuke(struct drm_i915_private *dev_priv) +{ + struct intel_fbc_reg_params *params = &dev_priv->fbc.params; + enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane; + + spin_lock_irq(&dev_priv->uncore.lock); + intel_de_write_fw(dev_priv, DSPSURF(i9xx_plane), + intel_de_read_fw(dev_priv, DSPSURF(i9xx_plane))); + spin_unlock_irq(&dev_priv->uncore.lock); +} + +static const struct intel_fbc_funcs i965_fbc_funcs = { + .activate = i8xx_fbc_activate, + .deactivate = i8xx_fbc_deactivate, + .is_active = i8xx_fbc_is_active, + .is_compressing = i8xx_fbc_is_compressing, + .nuke = i965_fbc_nuke, }; static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) @@ -324,70 +356,13 @@ static const struct intel_fbc_funcs g4x_fbc_funcs = { .deactivate = g4x_fbc_deactivate, .is_active = g4x_fbc_is_active, .is_compressing = g4x_fbc_is_compressing, + .nuke = i965_fbc_nuke, }; -static void i8xx_fbc_recompress(struct drm_i915_private *dev_priv) -{ - struct intel_fbc_reg_params *params = &dev_priv->fbc.params; - enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane; - - spin_lock_irq(&dev_priv->uncore.lock); - intel_de_write_fw(dev_priv, DSPADDR(i9xx_plane), - intel_de_read_fw(dev_priv, DSPADDR(i9xx_plane))); - spin_unlock_irq(&dev_priv->uncore.lock); -} - -static void i965_fbc_recompress(struct drm_i915_private *dev_priv) -{ - struct intel_fbc_reg_params *params = &dev_priv->fbc.params; - enum i9xx_plane_id i9xx_plane = params->crtc.i9xx_plane; - - spin_lock_irq(&dev_priv->uncore.lock); - intel_de_write_fw(dev_priv, DSPSURF(i9xx_plane), - intel_de_read_fw(dev_priv, DSPSURF(i9xx_plane))); - spin_unlock_irq(&dev_priv->uncore.lock); -} - -/* This function forces a CFB recompression through the nuke operation. */ -static void snb_fbc_recompress(struct drm_i915_private *dev_priv) -{ - intel_de_write(dev_priv, MSG_FBC_REND_STATE, FBC_REND_NUKE); - intel_de_posting_read(dev_priv, MSG_FBC_REND_STATE); -} - -static void intel_fbc_recompress(struct drm_i915_private *dev_priv) -{ - struct intel_fbc *fbc = &dev_priv->fbc; - - trace_intel_fbc_nuke(fbc->crtc); - - if (DISPLAY_VER(dev_priv) >= 6) - snb_fbc_recompress(dev_priv); - else if (DISPLAY_VER(dev_priv) >= 4) - i965_fbc_recompress(dev_priv); - else - i8xx_fbc_recompress(dev_priv); -} - -static void snb_fbc_program_fence(struct drm_i915_private *i915) -{ - const struct intel_fbc_reg_params *params = &i915->fbc.params; - u32 ctl = 0; - - if (params->fence_id >= 0) - ctl = SNB_CPU_FENCE_ENABLE | params->fence_id; - - intel_de_write(i915, SNB_DPFC_CTL_SA, ctl); - intel_de
[Intel-gfx] [PATCH 08/17] drm/i915/fbc: s/gen7/ivb/
From: Ville Syrjälä "gen7" in display code is not really sensible. We shall call these things "ivb". Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index be89404840d2..1df5a08d3457 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -462,7 +462,7 @@ static void skl_fbc_program_cfb_stride(struct drm_i915_private *i915) CHICKEN_FBC_STRIDE_MASK, val); } -static u32 gen7_dpfc_ctl(struct drm_i915_private *i915) +static u32 ivb_dpfc_ctl(struct drm_i915_private *i915) { const struct intel_fbc_reg_params *params = &i915->fbc.params; u32 dpfc_ctl; @@ -481,7 +481,7 @@ static u32 gen7_dpfc_ctl(struct drm_i915_private *i915) return dpfc_ctl; } -static void gen7_fbc_activate(struct drm_i915_private *dev_priv) +static void ivb_fbc_activate(struct drm_i915_private *dev_priv) { if (DISPLAY_VER(dev_priv) >= 10) glk_fbc_program_cfb_stride(dev_priv); @@ -492,10 +492,10 @@ static void gen7_fbc_activate(struct drm_i915_private *dev_priv) snb_fbc_program_fence(dev_priv); intel_de_write(dev_priv, ILK_DPFC_CONTROL, - DPFC_CTL_EN | gen7_dpfc_ctl(dev_priv)); + DPFC_CTL_EN | ivb_dpfc_ctl(dev_priv)); } -static bool gen7_fbc_is_compressing(struct drm_i915_private *i915) +static bool ivb_fbc_is_compressing(struct drm_i915_private *i915) { if (DISPLAY_VER(i915) >= 8) return intel_de_read(i915, IVB_FBC_STATUS2) & BDW_FBC_COMP_SEG_MASK; @@ -503,11 +503,11 @@ static bool gen7_fbc_is_compressing(struct drm_i915_private *i915) return intel_de_read(i915, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; } -static const struct intel_fbc_funcs gen7_fbc_funcs = { - .activate = gen7_fbc_activate, +static const struct intel_fbc_funcs ivb_fbc_funcs = { + .activate = ivb_fbc_activate, .deactivate = ilk_fbc_deactivate, .is_active = ilk_fbc_is_active, - .is_compressing = gen7_fbc_is_compressing, + .is_compressing = ivb_fbc_is_compressing, .nuke = snb_fbc_nuke, }; @@ -1685,7 +1685,7 @@ void intel_fbc_init(struct drm_i915_private *dev_priv) } if (DISPLAY_VER(dev_priv) >= 7) - fbc->funcs = &gen7_fbc_funcs; + fbc->funcs = &ivb_fbc_funcs; else if (DISPLAY_VER(dev_priv) == 6) fbc->funcs = &snb_fbc_funcs; else if (DISPLAY_VER(dev_priv) == 5) -- 2.32.0
[Intel-gfx] [PATCH 06/17] drm/i915/fbc: Introduce intel_fbc_funcs
From: Ville Syrjälä Replace the "if-ladders everywhere" approach with vfuncs. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 80 +++- drivers/gpu/drm/i915/i915_drv.h | 3 + 2 files changed, 55 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index fbb96f6aaacd..a2e09b6d21c7 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -48,6 +48,13 @@ #include "intel_fbc.h" #include "intel_frontbuffer.h" +struct intel_fbc_funcs { + void (*activate)(struct drm_i915_private *i915); + void (*deactivate)(struct drm_i915_private *i915); + bool (*is_active)(struct drm_i915_private *i915); + bool (*is_compressing)(struct drm_i915_private *i915); +}; + /* * For SKL+, the plane source size used by the hardware is based on the value we * write to the PLANE_SIZE register. For BDW-, the hardware looks at the value @@ -236,6 +243,13 @@ static bool i8xx_fbc_is_compressing(struct drm_i915_private *i915) (FBC_STAT_COMPRESSING | FBC_STAT_COMPRESSED); } +static const struct intel_fbc_funcs i8xx_fbc_funcs = { + .activate = i8xx_fbc_activate, + .deactivate = i8xx_fbc_deactivate, + .is_active = i8xx_fbc_is_active, + .is_compressing = i8xx_fbc_is_compressing, +}; + static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) { switch (i915->fbc.limit) { @@ -305,6 +319,13 @@ static bool g4x_fbc_is_compressing(struct drm_i915_private *i915) return intel_de_read(i915, DPFC_STATUS) & DPFC_COMP_SEG_MASK; } +static const struct intel_fbc_funcs g4x_fbc_funcs = { + .activate = g4x_fbc_activate, + .deactivate = g4x_fbc_deactivate, + .is_active = g4x_fbc_is_active, + .is_compressing = g4x_fbc_is_compressing, +}; + static void i8xx_fbc_recompress(struct drm_i915_private *dev_priv) { struct intel_fbc_reg_params *params = &dev_priv->fbc.params; @@ -396,6 +417,13 @@ static bool ilk_fbc_is_compressing(struct drm_i915_private *i915) return intel_de_read(i915, ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK; } +static const struct intel_fbc_funcs ilk_fbc_funcs = { + .activate = ilk_fbc_activate, + .deactivate = ilk_fbc_deactivate, + .is_active = ilk_fbc_is_active, + .is_compressing = ilk_fbc_is_compressing, +}; + static void glk_fbc_program_cfb_stride(struct drm_i915_private *i915) { struct intel_fbc *fbc = &i915->fbc; @@ -466,14 +494,18 @@ static bool gen7_fbc_is_compressing(struct drm_i915_private *i915) return intel_de_read(i915, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; } +static const struct intel_fbc_funcs gen7_fbc_funcs = { + .activate = gen7_fbc_activate, + .deactivate = ilk_fbc_deactivate, + .is_active = ilk_fbc_is_active, + .is_compressing = gen7_fbc_is_compressing, +}; + static bool intel_fbc_hw_is_active(struct drm_i915_private *dev_priv) { - if (DISPLAY_VER(dev_priv) >= 5) - return ilk_fbc_is_active(dev_priv); - else if (IS_GM45(dev_priv)) - return g4x_fbc_is_active(dev_priv); - else - return i8xx_fbc_is_active(dev_priv); + struct intel_fbc *fbc = &dev_priv->fbc; + + return fbc->funcs->is_active(dev_priv); } static void intel_fbc_hw_activate(struct drm_i915_private *dev_priv) @@ -485,14 +517,7 @@ static void intel_fbc_hw_activate(struct drm_i915_private *dev_priv) fbc->active = true; fbc->activated = true; - if (DISPLAY_VER(dev_priv) >= 7) - gen7_fbc_activate(dev_priv); - else if (DISPLAY_VER(dev_priv) >= 5) - ilk_fbc_activate(dev_priv); - else if (IS_GM45(dev_priv)) - g4x_fbc_activate(dev_priv); - else - i8xx_fbc_activate(dev_priv); + fbc->funcs->activate(dev_priv); } static void intel_fbc_hw_deactivate(struct drm_i915_private *dev_priv) @@ -503,24 +528,14 @@ static void intel_fbc_hw_deactivate(struct drm_i915_private *dev_priv) fbc->active = false; - if (DISPLAY_VER(dev_priv) >= 5) - ilk_fbc_deactivate(dev_priv); - else if (IS_GM45(dev_priv)) - g4x_fbc_deactivate(dev_priv); - else - i8xx_fbc_deactivate(dev_priv); + fbc->funcs->deactivate(dev_priv); } bool intel_fbc_is_compressing(struct drm_i915_private *i915) { - if (DISPLAY_VER(i915) >= 7) - return gen7_fbc_is_compressing(i915); - else if (DISPLAY_VER(i915) >= 5) - return ilk_fbc_is_compressing(i915); - else if (IS_G4X(i915)) - return g4x_fbc_is_compressing(i915); - else - return i8xx_fbc_is_compressing(i915); + struct intel_fbc *fbc = &i915->fbc; + + return fbc->funcs->is_compressing(i915); } /** @@ -1650,6 +1665,15 @@
[Intel-gfx] [PATCH 09/17] drm/i915/fbc: Introduce .program_cfb() vfunc
From: Ville Syrjälä Eliminate the last if-ladder by pulling the CFB/LLB programming into a vfunc as well. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 56 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 1df5a08d3457..0cbd0e302320 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -54,6 +54,7 @@ struct intel_fbc_funcs { bool (*is_active)(struct drm_i915_private *i915); bool (*is_compressing)(struct drm_i915_private *i915); void (*nuke)(struct drm_i915_private *i915); + void (*program_cfb)(struct drm_i915_private *i915); }; /* @@ -255,12 +256,28 @@ static void i8xx_fbc_nuke(struct drm_i915_private *dev_priv) spin_unlock_irq(&dev_priv->uncore.lock); } +static void i8xx_fbc_program_cfb(struct drm_i915_private *i915) +{ + struct intel_fbc *fbc = &i915->fbc; + + GEM_BUG_ON(range_overflows_end_t(u64, i915->dsm.start, +fbc->compressed_fb.start, U32_MAX)); + GEM_BUG_ON(range_overflows_end_t(u64, i915->dsm.start, +fbc->compressed_llb.start, U32_MAX)); + + intel_de_write(i915, FBC_CFB_BASE, + i915->dsm.start + fbc->compressed_fb.start); + intel_de_write(i915, FBC_LL_BASE, + i915->dsm.start + fbc->compressed_llb.start); +} + static const struct intel_fbc_funcs i8xx_fbc_funcs = { .activate = i8xx_fbc_activate, .deactivate = i8xx_fbc_deactivate, .is_active = i8xx_fbc_is_active, .is_compressing = i8xx_fbc_is_compressing, .nuke = i8xx_fbc_nuke, + .program_cfb = i8xx_fbc_program_cfb, }; static void i965_fbc_nuke(struct drm_i915_private *dev_priv) @@ -280,6 +297,7 @@ static const struct intel_fbc_funcs i965_fbc_funcs = { .is_active = i8xx_fbc_is_active, .is_compressing = i8xx_fbc_is_compressing, .nuke = i965_fbc_nuke, + .program_cfb = i8xx_fbc_program_cfb, }; static u32 g4x_dpfc_ctl_limit(struct drm_i915_private *i915) @@ -351,12 +369,20 @@ static bool g4x_fbc_is_compressing(struct drm_i915_private *i915) return intel_de_read(i915, DPFC_STATUS) & DPFC_COMP_SEG_MASK; } +static void g4x_fbc_program_cfb(struct drm_i915_private *i915) +{ + struct intel_fbc *fbc = &i915->fbc; + + intel_de_write(i915, DPFC_CB_BASE, fbc->compressed_fb.start); +} + static const struct intel_fbc_funcs g4x_fbc_funcs = { .activate = g4x_fbc_activate, .deactivate = g4x_fbc_deactivate, .is_active = g4x_fbc_is_active, .is_compressing = g4x_fbc_is_compressing, .nuke = i965_fbc_nuke, + .program_cfb = g4x_fbc_program_cfb, }; static void ilk_fbc_activate(struct drm_i915_private *dev_priv) @@ -392,12 +418,20 @@ static bool ilk_fbc_is_compressing(struct drm_i915_private *i915) return intel_de_read(i915, ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK; } +static void ilk_fbc_program_cfb(struct drm_i915_private *i915) +{ + struct intel_fbc *fbc = &i915->fbc; + + intel_de_write(i915, ILK_DPFC_CB_BASE, fbc->compressed_fb.start); +} + static const struct intel_fbc_funcs ilk_fbc_funcs = { .activate = ilk_fbc_activate, .deactivate = ilk_fbc_deactivate, .is_active = ilk_fbc_is_active, .is_compressing = ilk_fbc_is_compressing, .nuke = i965_fbc_nuke, + .program_cfb = ilk_fbc_program_cfb, }; static void snb_fbc_program_fence(struct drm_i915_private *i915) @@ -431,6 +465,7 @@ static const struct intel_fbc_funcs snb_fbc_funcs = { .is_active = ilk_fbc_is_active, .is_compressing = ilk_fbc_is_compressing, .nuke = snb_fbc_nuke, + .program_cfb = ilk_fbc_program_cfb, }; static void glk_fbc_program_cfb_stride(struct drm_i915_private *i915) @@ -509,6 +544,7 @@ static const struct intel_fbc_funcs ivb_fbc_funcs = { .is_active = ilk_fbc_is_active, .is_compressing = ivb_fbc_is_compressing, .nuke = snb_fbc_nuke, + .program_cfb = ilk_fbc_program_cfb, }; static bool intel_fbc_hw_is_active(struct drm_i915_private *dev_priv) @@ -704,25 +740,7 @@ static void intel_fbc_program_cfb(struct drm_i915_private *dev_priv) { struct intel_fbc *fbc = &dev_priv->fbc; - if (DISPLAY_VER(dev_priv) >= 5) { - intel_de_write(dev_priv, ILK_DPFC_CB_BASE, - fbc->compressed_fb.start); - } else if (IS_GM45(dev_priv)) { - intel_de_write(dev_priv, DPFC_CB_BASE, - fbc->compressed_fb.start); - } else { - GEM_BUG_ON(range_overflows_end_t(u64, dev_priv->dsm.start, -fbc->compressed_fb.start, -U32
[Intel-gfx] [PATCH 10/17] drm/i915/fbc: Introduce intel_fbc_set_false_color()
From: Ville Syrjälä Pull the direct FBC register frobbing out from the debugfs code into the fbc code. Also add a vfunc for this so we don't need extra platforms checks. Signed-off-by: Ville Syrjälä --- .../drm/i915/display/intel_display_debugfs.c | 18 + drivers/gpu/drm/i915/display/intel_fbc.c | 27 +++ drivers/gpu/drm/i915/display/intel_fbc.h | 2 ++ 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index 19bc148e168c..1a9210739727 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -70,9 +70,6 @@ static int i915_fbc_false_color_get(void *data, u64 *val) { struct drm_i915_private *dev_priv = data; - if (DISPLAY_VER(dev_priv) < 7 || !HAS_FBC(dev_priv)) - return -ENODEV; - *val = dev_priv->fbc.false_color; return 0; @@ -81,21 +78,8 @@ static int i915_fbc_false_color_get(void *data, u64 *val) static int i915_fbc_false_color_set(void *data, u64 val) { struct drm_i915_private *dev_priv = data; - u32 reg; - if (DISPLAY_VER(dev_priv) < 7 || !HAS_FBC(dev_priv)) - return -ENODEV; - - mutex_lock(&dev_priv->fbc.lock); - - reg = intel_de_read(dev_priv, ILK_DPFC_CONTROL); - dev_priv->fbc.false_color = val; - - intel_de_write(dev_priv, ILK_DPFC_CONTROL, - val ? (reg | FBC_CTL_FALSE_COLOR) : (reg & ~FBC_CTL_FALSE_COLOR)); - - mutex_unlock(&dev_priv->fbc.lock); - return 0; + return intel_fbc_set_false_color(dev_priv, val); } DEFINE_SIMPLE_ATTRIBUTE(i915_fbc_false_color_fops, diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 0cbd0e302320..b13a776cb3dc 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -55,6 +55,7 @@ struct intel_fbc_funcs { bool (*is_compressing)(struct drm_i915_private *i915); void (*nuke)(struct drm_i915_private *i915); void (*program_cfb)(struct drm_i915_private *i915); + void (*set_false_color)(struct drm_i915_private *i915, bool enable); }; /* @@ -538,6 +539,13 @@ static bool ivb_fbc_is_compressing(struct drm_i915_private *i915) return intel_de_read(i915, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; } +static void ivb_fbc_set_false_color(struct drm_i915_private *i915, + bool enable) +{ + intel_de_rmw(i915, ILK_DPFC_CONTROL, +FBC_CTL_FALSE_COLOR, enable ? FBC_CTL_FALSE_COLOR : 0); +} + static const struct intel_fbc_funcs ivb_fbc_funcs = { .activate = ivb_fbc_activate, .deactivate = ilk_fbc_deactivate, @@ -545,6 +553,7 @@ static const struct intel_fbc_funcs ivb_fbc_funcs = { .is_compressing = ivb_fbc_is_compressing, .nuke = snb_fbc_nuke, .program_cfb = ilk_fbc_program_cfb, + .set_false_color = ivb_fbc_set_false_color, }; static bool intel_fbc_hw_is_active(struct drm_i915_private *dev_priv) @@ -593,6 +602,24 @@ static void intel_fbc_nuke(struct drm_i915_private *i915) fbc->funcs->nuke(i915); } +int intel_fbc_set_false_color(struct drm_i915_private *i915, bool enable) +{ + struct intel_fbc *fbc = &i915->fbc; + + if (!fbc->funcs || !fbc->funcs->set_false_color) + return -ENODEV; + + mutex_lock(&fbc->lock); + + fbc->false_color = enable; + + fbc->funcs->set_false_color(i915, enable); + + mutex_unlock(&fbc->lock); + + return 0; +} + /** * intel_fbc_is_active - Is FBC active? * @dev_priv: i915 device instance diff --git a/drivers/gpu/drm/i915/display/intel_fbc.h b/drivers/gpu/drm/i915/display/intel_fbc.h index b2c9e441edbd..4d1f2a76ccb4 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.h +++ b/drivers/gpu/drm/i915/display/intel_fbc.h @@ -37,5 +37,7 @@ void intel_fbc_flush(struct drm_i915_private *dev_priv, void intel_fbc_cleanup_cfb(struct drm_i915_private *dev_priv); void intel_fbc_handle_fifo_underrun_irq(struct drm_i915_private *dev_priv); int intel_fbc_reset_underrun(struct drm_i915_private *dev_priv); +int intel_fbc_set_false_color(struct drm_i915_private *i915, + bool enable); #endif /* __INTEL_FBC_H__ */ -- 2.32.0
[Intel-gfx] [PATCH 11/17] drm/i915/fbc: Nuke BDW_FBC_COMP_SEG_MASK
From: Ville Syrjälä Just use a same mask for ivb/hsw as for bdw+. The extra bit in the bdw mask is mbz on ivb/hsw anyway so this is just pointless complexity. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 5 + drivers/gpu/drm/i915/i915_reg.h | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index b13a776cb3dc..1193e86690e5 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -533,10 +533,7 @@ static void ivb_fbc_activate(struct drm_i915_private *dev_priv) static bool ivb_fbc_is_compressing(struct drm_i915_private *i915) { - if (DISPLAY_VER(i915) >= 8) - return intel_de_read(i915, IVB_FBC_STATUS2) & BDW_FBC_COMP_SEG_MASK; - else - return intel_de_read(i915, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; + return intel_de_read(i915, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; } static void ivb_fbc_set_false_color(struct drm_i915_private *i915, diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index b456920555b7..1e99fe8dc253 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3382,8 +3382,7 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) #define ILK_DPFC_STATUS_MMIO(0x43210) #define ILK_DPFC_COMP_SEG_MASK0x7ff #define IVB_FBC_STATUS2_MMIO(0x43214) -#define IVB_FBC_COMP_SEG_MASK 0x7ff -#define BDW_FBC_COMP_SEG_MASK 0xfff +#define IVB_FBC_COMP_SEG_MASK 0xfff #define ILK_DPFC_FENCE_YOFF_MMIO(0x43218) #define ILK_DPFC_CHICKEN _MMIO(0x43224) #define ILK_DPFC_DISABLE_DUMMY0 (1 << 8) -- 2.32.0
[Intel-gfx] [PATCH 12/17] drm/i915/fbc: Clean up all register defines
From: Ville Syrjälä The FBC register defines are a mess: - namespace changes between DPFC_, FBC_, and some platform specific prefix at a whim - ilk+ reuses most g4x bits but still has some separate bit defines elsewhere - it's not clear from the defines that the bit defines are shared So let's clean it up: - both g4x and ilk register share the same defines now - only defines which conflict have a _PLATFORM suffix, everyone else just gets comments to indicate which platforms do what - namespace is consistent DPFC_ now - SNB system agent fence registers also get a consistent namespace - REG_BIT() & co. for everything Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 24 +++ drivers/gpu/drm/i915/i915_reg.h | 85 drivers/gpu/drm/i915/intel_pm.c | 14 ++-- 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 1193e86690e5..1c9ada22b4de 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -322,16 +322,16 @@ static u32 g4x_dpfc_ctl(struct drm_i915_private *i915) u32 dpfc_ctl; dpfc_ctl = g4x_dpfc_ctl_limit(i915) | - DPFC_CTL_PLANE(params->crtc.i9xx_plane); + DPFC_CTL_PLANE_G4X(params->crtc.i9xx_plane); if (IS_G4X(i915)) - dpfc_ctl |= DPFC_SR_EN; + dpfc_ctl |= DPFC_CTL_SR_EN; if (params->fence_id >= 0) { - dpfc_ctl |= DPFC_CTL_FENCE_EN; + dpfc_ctl |= DPFC_CTL_FENCE_EN_G4X; if (DISPLAY_VER(i915) < 6) - dpfc_ctl |= params->fence_id; + dpfc_ctl |= DPFC_CTL_FENCENO(params->fence_id); } return dpfc_ctl; @@ -416,7 +416,7 @@ static bool ilk_fbc_is_active(struct drm_i915_private *dev_priv) static bool ilk_fbc_is_compressing(struct drm_i915_private *i915) { - return intel_de_read(i915, ILK_DPFC_STATUS) & ILK_DPFC_COMP_SEG_MASK; + return intel_de_read(i915, ILK_DPFC_STATUS) & DPFC_COMP_SEG_MASK; } static void ilk_fbc_program_cfb(struct drm_i915_private *i915) @@ -441,10 +441,10 @@ static void snb_fbc_program_fence(struct drm_i915_private *i915) u32 ctl = 0; if (params->fence_id >= 0) - ctl = SNB_CPU_FENCE_ENABLE | params->fence_id; + ctl = SNB_DPFC_FENCE_EN | SNB_DPFC_FENCENO(params->fence_id); intel_de_write(i915, SNB_DPFC_CTL_SA, ctl); - intel_de_write(i915, DPFC_CPU_FENCE_OFFSET, params->fence_y_offset); + intel_de_write(i915, SNB_DPFC_CPU_FENCE_OFFSET, params->fence_y_offset); } static void snb_fbc_activate(struct drm_i915_private *dev_priv) @@ -506,13 +506,13 @@ static u32 ivb_dpfc_ctl(struct drm_i915_private *i915) dpfc_ctl = g4x_dpfc_ctl_limit(i915); if (IS_IVYBRIDGE(i915)) - dpfc_ctl |= IVB_DPFC_CTL_PLANE(params->crtc.i9xx_plane); + dpfc_ctl |= DPFC_CTL_PLANE_IVB(params->crtc.i9xx_plane); if (params->fence_id >= 0) - dpfc_ctl |= IVB_DPFC_CTL_FENCE_EN; + dpfc_ctl |= DPFC_CTL_FENCE_EN_IVB; if (i915->fbc.false_color) - dpfc_ctl |= FBC_CTL_FALSE_COLOR; + dpfc_ctl |= DPFC_CTL_FALSE_COLOR; return dpfc_ctl; } @@ -533,14 +533,14 @@ static void ivb_fbc_activate(struct drm_i915_private *dev_priv) static bool ivb_fbc_is_compressing(struct drm_i915_private *i915) { - return intel_de_read(i915, IVB_FBC_STATUS2) & IVB_FBC_COMP_SEG_MASK; + return intel_de_read(i915, ILK_DPFC_STATUS2) & DPFC_COMP_SEG_MASK_IVB; } static void ivb_fbc_set_false_color(struct drm_i915_private *i915, bool enable) { intel_de_rmw(i915, ILK_DPFC_CONTROL, -FBC_CTL_FALSE_COLOR, enable ? FBC_CTL_FALSE_COLOR : 0); +DPFC_CTL_FALSE_COLOR, enable ? DPFC_CTL_FALSE_COLOR : 0); } static const struct intel_fbc_funcs ivb_fbc_funcs = { diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 1e99fe8dc253..d937958e7a6b 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3345,56 +3345,55 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) /* Framebuffer compression for GM45+ */ #define DPFC_CB_BASE _MMIO(0x3200) +#define ILK_DPFC_CB_BASE _MMIO(0x43200) #define DPFC_CONTROL _MMIO(0x3208) -#define DPFC_CTL_EN (1 << 31) -#define DPFC_CTL_PLANE(plane)((plane) << 30) -#define IVB_DPFC_CTL_PLANE(plane)((plane) << 29) -#define DPFC_CTL_FENCE_EN(1 << 29) -#define IVB_DPFC_CTL_FENCE_EN(1 << 28) -#define DPFC_CTL_PERSISTENT_MODE (1 << 25) -#define DPFC_SR_EN (1 << 10) -#define DPFC_CTL_LIMIT_1X(0 << 6) -#define DPFC_CTL_LIMIT_2X(1 << 6) -#define D
[Intel-gfx] [PATCH 13/17] drm/i915/fbc: Finish polishing FBC1 registers
From: Ville Syrjälä Switch all the FBC1 registers over to REG_BTT()/etc. And while at it add a few more registers/bits that escaped the net previously. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 2 +- drivers/gpu/drm/i915/i915_reg.h | 62 ++-- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 1c9ada22b4de..888ee814e8bb 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -189,7 +189,7 @@ static u32 i965_fbc_ctl2(struct drm_i915_private *i915) FBC_CTL_PLANE(params->crtc.i9xx_plane); if (params->fence_id >= 0) - fbc_ctl2 |= FBC_CTL_CPU_FENCE; + fbc_ctl2 |= FBC_CTL_CPU_FENCE_EN; return fbc_ctl2; } diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index d937958e7a6b..3463853e4a6d 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -3309,34 +3309,44 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) #define FBC_CFB_BASE _MMIO(0x3200) /* 4k page aligned */ #define FBC_LL_BASE_MMIO(0x3204) /* 4k page aligned */ #define FBC_CONTROL_MMIO(0x3208) -#define FBC_CTL_EN REG_BIT(31) -#define FBC_CTL_PERIODIC REG_BIT(30) -#define FBC_CTL_INTERVAL_MASKREG_GENMASK(29, 16) -#define FBC_CTL_INTERVAL(x) REG_FIELD_PREP(FBC_CTL_INTERVAL_MASK, (x)) -#define FBC_CTL_STOP_ON_MOD REG_BIT(15) -#define FBC_CTL_UNCOMPRESSIBLE REG_BIT(14) /* i915+ */ -#define FBC_CTL_C3_IDLE REG_BIT(13) /* i945gm */ -#define FBC_CTL_STRIDE_MASK REG_GENMASK(12, 5) -#define FBC_CTL_STRIDE(x)REG_FIELD_PREP(FBC_CTL_STRIDE_MASK, (x)) -#define FBC_CTL_FENCENO_MASK REG_GENMASK(3, 0) -#define FBC_CTL_FENCENO(x) REG_FIELD_PREP(FBC_CTL_FENCENO_MASK, (x)) +#define FBC_CTL_EN REG_BIT(31) +#define FBC_CTL_PERIODIC REG_BIT(30) +#define FBC_CTL_INTERVAL_MASKREG_GENMASK(29, 16) +#define FBC_CTL_INTERVAL(x) REG_FIELD_PREP(FBC_CTL_INTERVAL_MASK, (x)) +#define FBC_CTL_STOP_ON_MOD REG_BIT(15) +#define FBC_CTL_UNCOMPRESSIBLE REG_BIT(14) /* i915+ */ +#define FBC_CTL_C3_IDLE REG_BIT(13) /* i945gm only */ +#define FBC_CTL_STRIDE_MASK REG_GENMASK(12, 5) +#define FBC_CTL_STRIDE(x)REG_FIELD_PREP(FBC_CTL_STRIDE_MASK, (x)) +#define FBC_CTL_FENCENO_MASK REG_GENMASK(3, 0) +#define FBC_CTL_FENCENO(x) REG_FIELD_PREP(FBC_CTL_FENCENO_MASK, (x)) #define FBC_COMMAND_MMIO(0x320c) -#define FBC_CMD_COMPRESS (1 << 0) +#define FBC_CMD_COMPRESS REG_BIT(0) #define FBC_STATUS _MMIO(0x3210) -#define FBC_STAT_COMPRESSING (1 << 31) -#define FBC_STAT_COMPRESSED (1 << 30) -#define FBC_STAT_MODIFIED(1 << 29) -#define FBC_STAT_CURRENT_LINE_SHIFT (0) -#define FBC_CONTROL2 _MMIO(0x3214) -#define FBC_CTL_FENCE_DBL(0 << 4) -#define FBC_CTL_IDLE_IMM (0 << 2) -#define FBC_CTL_IDLE_FULL(1 << 2) -#define FBC_CTL_IDLE_LINE(2 << 2) -#define FBC_CTL_IDLE_DEBUG (3 << 2) -#define FBC_CTL_CPU_FENCE(1 << 1) -#define FBC_CTL_PLANE(plane) ((plane) << 0) -#define FBC_FENCE_OFF _MMIO(0x3218) /* BSpec typo has 321Bh */ -#define FBC_TAG(i) _MMIO(0x3300 + (i) * 4) +#define FBC_STAT_COMPRESSING REG_BIT(31) +#define FBC_STAT_COMPRESSED REG_BIT(30) +#define FBC_STAT_MODIFIEDREG_BIT(29) +#define FBC_STAT_CURRENT_LINE_MASK REG_GENMASK(10, 0) +#define FBC_CONTROL2 _MMIO(0x3214) /* i965gm only */ +#define FBC_CTL_FENCE_DBLREG_BIT(4) +#define FBC_CTL_IDLE_MASKREG_GENMASK(3, 2) +#define FBC_CTL_IDLE_IMM REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 0) +#define FBC_CTL_IDLE_FULLREG_FIELD_PREP(FBC_CTL_IDLE_MASK, 1) +#define FBC_CTL_IDLE_LINEREG_FIELD_PREP(FBC_CTL_IDLE_MASK, 2) +#define FBC_CTL_IDLE_DEBUG REG_FIELD_PREP(FBC_CTL_IDLE_MASK, 3) +#define FBC_CTL_CPU_FENCE_EN REG_BIT(1) +#define FBC_CTL_PLANE_MASK REG_GENMASK(1, 0) +#define FBC_CTL_PLANE(i9xx_plane)REG_FIELD_PREP(FBC_CTL_PLANE_MASK, (i9xx_plane)) +#define FBC_FENCE_OFF _MMIO(0x3218) /* i965gm only, BSpec typo has 321Bh */ +#define FBC_MOD_NUM_MMIO(0x3220) /* i965gm only */ +#define FBC_MOD_NUM_MASK REG_GENMASK(31, 1) +#define FBC_MOD_NUM_VALIDREG_BIT(0) +#define FBC_TAG(i) _MMIO(0x3300 + (i) * 4) /* 49 reisters */ +#define FBC_TAG_MASK REG_GENMASK(1, 0) /* 16 tags per register */ +#define FBC_TAG_MODIFIED REG_FIELD_PREP(FBC_TAG_MASK, 0) +#define FBC_TAG_UNCOMPRESSED REG_FIELD_PREP(FBC_TAG_MASK, 1) +#define FBC
[Intel-gfx] [PATCH 14/17] drm/i915: Relocate FBC_LLC_READ_CTRL
From: Ville Syrjälä In the case of FBC_LLC_READ_CTRL the "FBC" stands for frame buffer _caching_, not frame buffer compression. Move the register definition out from the middle of the frame buffer compression register definitions. Let's just stick it somewhere with similar looking register offsets. And while at it switch it over to REG_BIT(). Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/i915_reg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 3463853e4a6d..07d6cf76c389 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h @@ -371,6 +371,9 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) #define VLV_G3DCTL _MMIO(0x9024) #define VLV_GSCKGCTL _MMIO(0x9028) +#define FBC_LLC_READ_CTRL _MMIO(0x9044) +#define FBC_LLC_FULLY_OPEN REG_BIT(30) + #define GEN6_MBCTL _MMIO(0x0907c) #define GEN6_MBCTL_ENABLE_BOOT_FETCH (1 << 4) #define GEN6_MBCTL_CTX_FETCH_NEEDED (1 << 3) @@ -3350,9 +3353,6 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg) #define FBC_LL_SIZE(1536) -#define FBC_LLC_READ_CTRL _MMIO(0x9044) -#define FBC_LLC_FULLY_OPEN (1 << 30) - /* Framebuffer compression for GM45+ */ #define DPFC_CB_BASE _MMIO(0x3200) #define ILK_DPFC_CB_BASE _MMIO(0x43200) -- 2.32.0
[Intel-gfx] [PATCH 15/17] drm/i915/fbc: s/dev_priv/i915/
From: Ville Syrjälä Rename 'dev_priv' to 'i915' to match modern style. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_fbc.c | 526 +++ 1 file changed, 263 insertions(+), 263 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index 888ee814e8bb..ea3968001c4b 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -139,17 +139,17 @@ static unsigned int intel_fbc_cfb_stride(struct drm_i915_private *i915, return stride; } -static unsigned int intel_fbc_cfb_size(struct drm_i915_private *dev_priv, +static unsigned int intel_fbc_cfb_size(struct drm_i915_private *i915, const struct intel_fbc_state_cache *cache) { int lines = cache->plane.src_h; - if (DISPLAY_VER(dev_priv) == 7) + if (DISPLAY_VER(i915) == 7) lines = min(lines, 2048); - else if (DISPLAY_VER(dev_priv) >= 8) + else if (DISPLAY_VER(i915) >= 8) lines = min(lines, 2560); - return lines * intel_fbc_cfb_stride(dev_priv, cache); + return lines * intel_fbc_cfb_stride(i915, cache); } static u32 i8xx_fbc_ctl(struct drm_i915_private *i915) @@ -194,50 +194,50 @@ static u32 i965_fbc_ctl2(struct drm_i915_private *i915) return fbc_ctl2; } -static void i8xx_fbc_deactivate(struct drm_i915_private *dev_priv) +static void i8xx_fbc_deactivate(struct drm_i915_private *i915) { u32 fbc_ctl; /* Disable compression */ - fbc_ctl = intel_de_read(dev_priv, FBC_CONTROL); + fbc_ctl = intel_de_read(i915, FBC_CONTROL); if ((fbc_ctl & FBC_CTL_EN) == 0) return; fbc_ctl &= ~FBC_CTL_EN; - intel_de_write(dev_priv, FBC_CONTROL, fbc_ctl); + intel_de_write(i915, FBC_CONTROL, fbc_ctl); /* Wait for compressing bit to clear */ - if (intel_de_wait_for_clear(dev_priv, FBC_STATUS, + if (intel_de_wait_for_clear(i915, FBC_STATUS, FBC_STAT_COMPRESSING, 10)) { - drm_dbg_kms(&dev_priv->drm, "FBC idle timed out\n"); + drm_dbg_kms(&i915->drm, "FBC idle timed out\n"); return; } } -static void i8xx_fbc_activate(struct drm_i915_private *dev_priv) +static void i8xx_fbc_activate(struct drm_i915_private *i915) { - struct intel_fbc *fbc = &dev_priv->fbc; + struct intel_fbc *fbc = &i915->fbc; const struct intel_fbc_reg_params *params = &fbc->params; int i; /* Clear old tags */ for (i = 0; i < (FBC_LL_SIZE / 32) + 1; i++) - intel_de_write(dev_priv, FBC_TAG(i), 0); + intel_de_write(i915, FBC_TAG(i), 0); - if (DISPLAY_VER(dev_priv) == 4) { - intel_de_write(dev_priv, FBC_CONTROL2, - i965_fbc_ctl2(dev_priv)); - intel_de_write(dev_priv, FBC_FENCE_OFF, + if (DISPLAY_VER(i915) == 4) { + intel_de_write(i915, FBC_CONTROL2, + i965_fbc_ctl2(i915)); + intel_de_write(i915, FBC_FENCE_OFF, params->fence_y_offset); } - intel_de_write(dev_priv, FBC_CONTROL, - FBC_CTL_EN | i8xx_fbc_ctl(dev_priv)); + intel_de_write(i915, FBC_CONTROL, + FBC_CTL_EN | i8xx_fbc_ctl(i915)); } -static bool i8xx_fbc_is_active(struct drm_i915_private *dev_priv) +static bool i8xx_fbc_is_active(struct drm_i915_private *i915) { - return intel_de_read(dev_priv, FBC_CONTROL) & FBC_CTL_EN; + return intel_de_read(i915, FBC_CONTROL) & FBC_CTL_EN; } static bool i8xx_fbc_is_compressing(struct drm_i915_private *i915) @@ -337,32 +337,32 @@ static u32 g4x_dpfc_ctl(struct drm_i915_private *i915) return dpfc_ctl; } -static void g4x_fbc_activate(struct drm_i915_private *dev_priv) +static void g4x_fbc_activate(struct drm_i915_private *i915) { - const struct intel_fbc_reg_params *params = &dev_priv->fbc.params; + const struct intel_fbc_reg_params *params = &i915->fbc.params; - intel_de_write(dev_priv, DPFC_FENCE_YOFF, + intel_de_write(i915, DPFC_FENCE_YOFF, params->fence_y_offset); - intel_de_write(dev_priv, DPFC_CONTROL, - DPFC_CTL_EN | g4x_dpfc_ctl(dev_priv)); + intel_de_write(i915, DPFC_CONTROL, + DPFC_CTL_EN | g4x_dpfc_ctl(i915)); } -static void g4x_fbc_deactivate(struct drm_i915_private *dev_priv) +static void g4x_fbc_deactivate(struct drm_i915_private *i915) { u32 dpfc_ctl; /* Disable compression */ - dpfc_ctl = intel_de_read(dev_priv, DPFC_CONTROL); + dpfc_ctl = intel_de_read(i915, DPFC_CONTROL); if (dpfc_ctl & DPFC_CTL_EN) { dpfc_ctl &= ~DPFC_CTL_EN; - intel_de_write(dev_priv
[Intel-gfx] [PATCH 16/17] drm/i915/fbc: Start passing around intel_fbc
From: Ville Syrjälä In preparation for multiple FBC instances start passing around intel_fbc pointers rather than i915 pointers. And once there are multiple of these we can't rely on container_of() to get back to the i915, so we toss in a fbc->i915 pointer already. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 2 +- .../drm/i915/display/intel_display_debugfs.c | 8 +- drivers/gpu/drm/i915/display/intel_fbc.c | 379 +- drivers/gpu/drm/i915/display/intel_fbc.h | 14 +- .../drm/i915/display/intel_fifo_underrun.c| 2 +- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_pm.c | 2 +- 7 files changed, 200 insertions(+), 208 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 29392dfc46c8..3be82f075655 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -10837,7 +10837,7 @@ void intel_modeset_driver_remove_noirq(struct drm_i915_private *i915) destroy_workqueue(i915->flip_wq); destroy_workqueue(i915->modeset_wq); - intel_fbc_cleanup_cfb(i915); + intel_fbc_cleanup(i915); } /* part #3: call after gem init */ diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index 1a9210739727..3f5a5e1b1c41 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -52,10 +52,10 @@ static int i915_fbc_status(struct seq_file *m, void *unused) wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm); mutex_lock(&fbc->lock); - if (intel_fbc_is_active(dev_priv)) { + if (intel_fbc_is_active(fbc)) { seq_puts(m, "FBC enabled\n"); seq_printf(m, "Compressing: %s\n", - yesno(intel_fbc_is_compressing(dev_priv))); + yesno(intel_fbc_is_compressing(fbc))); } else { seq_printf(m, "FBC disabled: %s\n", fbc->no_fbc_reason); } @@ -79,7 +79,7 @@ static int i915_fbc_false_color_set(void *data, u64 val) { struct drm_i915_private *dev_priv = data; - return intel_fbc_set_false_color(dev_priv, val); + return intel_fbc_set_false_color(&dev_priv->fbc, val); } DEFINE_SIMPLE_ATTRIBUTE(i915_fbc_false_color_fops, @@ -2063,7 +2063,7 @@ i915_fifo_underrun_reset_write(struct file *filp, return ret; } - ret = intel_fbc_reset_underrun(dev_priv); + ret = intel_fbc_reset_underrun(&dev_priv->fbc); if (ret) return ret; diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index ea3968001c4b..e8235d55e76a 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -49,13 +49,13 @@ #include "intel_frontbuffer.h" struct intel_fbc_funcs { - void (*activate)(struct drm_i915_private *i915); - void (*deactivate)(struct drm_i915_private *i915); - bool (*is_active)(struct drm_i915_private *i915); - bool (*is_compressing)(struct drm_i915_private *i915); - void (*nuke)(struct drm_i915_private *i915); - void (*program_cfb)(struct drm_i915_private *i915); - void (*set_false_color)(struct drm_i915_private *i915, bool enable); + void (*activate)(struct intel_fbc *fbc); + void (*deactivate)(struct intel_fbc *fbc); + bool (*is_active)(struct intel_fbc *fbc); + bool (*is_compressing)(struct intel_fbc *fbc); + void (*nuke)(struct intel_fbc *fbc); + void (*program_cfb)(struct intel_fbc *fbc); + void (*set_false_color)(struct intel_fbc *fbc, bool enable); }; /* @@ -94,9 +94,10 @@ static unsigned int _intel_fbc_cfb_stride(const struct intel_fbc_state_cache *ca } /* minimum acceptable cfb stride in bytes, assuming 1:1 compression limit */ -static unsigned int skl_fbc_min_cfb_stride(struct drm_i915_private *i915, +static unsigned int skl_fbc_min_cfb_stride(struct intel_fbc *fbc, const struct intel_fbc_state_cache *cache) { + struct drm_i915_private *i915 = fbc->i915; unsigned int limit = 4; /* 1:4 compression limit is the worst case */ unsigned int cpp = 4; /* FBC always 4 bytes per pixel */ unsigned int height = 4; /* FBC segment is 4 lines */ @@ -123,9 +124,10 @@ static unsigned int skl_fbc_min_cfb_stride(struct drm_i915_private *i915, } /* properly aligned cfb stride in bytes, assuming 1:1 compression limit */ -static unsigned int intel_fbc_cfb_stride(struct drm_i915_private *i915, +static unsigned int intel_fbc_cfb_stride(struct intel_fbc *fbc, const struct intel_fbc_state_cache *cache) { + struct drm_i915_private *i915 =
[Intel-gfx] [PATCH 17/17] drm/1915/fbc: Replace plane->has_fbc with a pointer to the fbc instance
From: Ville Syrjälä With multiple fbc instances we need to find the right one for each plane. Rather than going looking for the right instance every time let's just replace the has_fbc boolean with a pointer that gets us there straight away. Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/i9xx_plane.c | 10 drivers/gpu/drm/i915/display/intel_display.c | 2 +- .../drm/i915/display/intel_display_types.h| 4 +++- drivers/gpu/drm/i915/display/intel_fbc.c | 24 +-- .../drm/i915/display/skl_universal_plane.c| 10 5 files changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/i915/display/i9xx_plane.c b/drivers/gpu/drm/i915/display/i9xx_plane.c index c8722771aa40..8a59fd0fd2ca 100644 --- a/drivers/gpu/drm/i915/display/i9xx_plane.c +++ b/drivers/gpu/drm/i915/display/i9xx_plane.c @@ -774,12 +774,10 @@ intel_primary_plane_create(struct drm_i915_private *dev_priv, enum pipe pipe) plane->id = PLANE_PRIMARY; plane->frontbuffer_bit = INTEL_FRONTBUFFER(pipe, plane->id); - plane->has_fbc = i9xx_plane_has_fbc(dev_priv, plane->i9xx_plane); - if (plane->has_fbc) { - struct intel_fbc *fbc = &dev_priv->fbc; - - fbc->possible_framebuffer_bits |= plane->frontbuffer_bit; - } + if (i9xx_plane_has_fbc(dev_priv, plane->i9xx_plane)) + plane->fbc = &dev_priv->fbc; + if (plane->fbc) + plane->fbc->possible_framebuffer_bits |= plane->frontbuffer_bit; if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) { formats = vlv_primary_formats; diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 3be82f075655..8118e65ec732 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -645,7 +645,7 @@ bool intel_plane_uses_fence(const struct intel_plane_state *plane_state) struct drm_i915_private *dev_priv = to_i915(plane->base.dev); return DISPLAY_VER(dev_priv) < 4 || - (plane->has_fbc && + (plane->fbc && plane_state->view.gtt.type == I915_GGTT_VIEW_NORMAL); } diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index a174b0b83640..aa75aac9 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -49,6 +49,7 @@ struct drm_printer; struct __intel_global_objs_state; struct intel_ddi_buf_trans; +struct intel_fbc; /* * Display related stuff @@ -1331,7 +1332,6 @@ struct intel_plane { enum i9xx_plane_id i9xx_plane; enum plane_id id; enum pipe pipe; - bool has_fbc; bool need_async_flip_disable_wa; u32 frontbuffer_bit; @@ -1339,6 +1339,8 @@ struct intel_plane { u32 base, cntl, size; } cursor; + struct intel_fbc *fbc; + /* * NOTE: Do not place new plane state fields here (e.g., when adding * new plane properties). New runtime state should now be placed in diff --git a/drivers/gpu/drm/i915/display/intel_fbc.c b/drivers/gpu/drm/i915/display/intel_fbc.c index e8235d55e76a..a7e0f79ceb63 100644 --- a/drivers/gpu/drm/i915/display/intel_fbc.c +++ b/drivers/gpu/drm/i915/display/intel_fbc.c @@ -1217,11 +1217,11 @@ bool intel_fbc_pre_update(struct intel_atomic_state *state, const struct intel_plane_state *plane_state = intel_atomic_get_new_plane_state(state, plane); struct drm_i915_private *i915 = to_i915(crtc->base.dev); - struct intel_fbc *fbc = &i915->fbc; + struct intel_fbc *fbc = plane->fbc; const char *reason = "update pending"; bool need_vblank_wait = false; - if (!plane->has_fbc || !plane_state) + if (!fbc || !plane_state) return need_vblank_wait; mutex_lock(&fbc->lock); @@ -1309,13 +1309,12 @@ static void __intel_fbc_post_update(struct intel_crtc *crtc) void intel_fbc_post_update(struct intel_atomic_state *state, struct intel_crtc *crtc) { - struct drm_i915_private *i915 = to_i915(crtc->base.dev); struct intel_plane *plane = to_intel_plane(crtc->base.primary); const struct intel_plane_state *plane_state = intel_atomic_get_new_plane_state(state, plane); - struct intel_fbc *fbc = &i915->fbc; + struct intel_fbc *fbc = plane->fbc; - if (!plane->has_fbc || !plane_state) + if (!fbc || !plane_state) return; mutex_lock(&fbc->lock); @@ -1419,7 +1418,7 @@ void intel_fbc_choose_crtc(struct drm_i915_private *i915, struct intel_crtc_state *crtc_state; struct intel_crtc *crtc = to_intel_crtc(plane_state->hw.crtc); - if (!plane->has_fbc) + if (plane->fb
Re: [Intel-gfx] refactor the i915 GVT support and move to the modern mdev API v2
Hi Joonas and Christoph: We were testing the patch series since Monday and planning to reply after we get the test result. Mostly, we are concerned about patch 6 and how it would affect the test result. Patch 6 changes the timing of loading GVT-g. According to the discussion in the last email, this will break our design of golden MMIO snapshot. Also moving GVT-g code into kvmgt.ko requires the discussion of defining and shrinking the interfaces between i915 and kvmgt. I guess the ideal way to take Christoph's patch is: 1) We have to figure out how to deal with golden MMIO snapshot. It's a little bit hard to take the re-factor patch before settling this down. In the previous discussion, we would like to find a way to do the snapshot in intel_gvt.c 2) Shrink and refine the exported interfaces because of moving the code into kvmgt.ko 3) Get patches reviewed and merged. For 1) I was thinking to separated the MMIO handler table from handlers.c and let it build different data structures depends on where it got referenced. 2) That's might require some more discussion. Is it possible to separate the refactor part from the using new mdev API stuff? So that the design opens in the re-factor patches wouldn’t block the process of mdev API improvement? Thanks, Zhi. -Original Message- From: Joonas Lahtinen Sent: Thursday, November 4, 2021 2:59 PM To: Christoph Hellwig ; Jani Nikula ; Vivi, Rodrigo ; Zhenyu Wang ; Wang, Zhi A Cc: Jason Gunthorpe ; intel-gfx@lists.freedesktop.org; intel-gvt-...@lists.freedesktop.org; dri-de...@lists.freedesktop.org; linux-ker...@vger.kernel.org Subject: Re: refactor the i915 GVT support and move to the modern mdev API v2 Hi Zhenyu and Zhi, Can you have somebody from the GVT team to review the patches that are fully contained in gvt/ ? I also started discussion on patch 6 which is about defining the interface between the modules. I remember there is prior work to shrink the interface. Do you have links to such patches? The minimal we should do is to eliminate the double underscore prefixed functions. But I would prefer to have the symbol exports by default so that we can enable the functionality just by loading the module. Regards, Joonas Quoting Christoph Hellwig (2021-11-02 09:05:32) > Hi all, > > the GVT code in the i915 is a bit of a mess right now due to strange > abstractions and lots of indirect calls. This series refactors > various bits to clean that up. The main user visible change is that > almost all of the GVT code moves out of the main i915 driver and into > the kvmgt module. > > Tested on my Thinkpad with a Kaby Lake CPU and integrated graphics. > > Git tree: > > git://git.infradead.org/users/hch/misc.git i915-gvt > > Gitweb: > > > http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/i915-g > vt > > Changes since v1: > - rebased on Linux 5.15 > - allow the kvmgvt module to be loaded at any time and thus solve >the deadlock when both i915 amd kvmgvt are modular > - include the conversion to the modern mdev API > > Note that I do expect to rebased this again against 5.16-rc1 once > released, but I'd like to get this out for review ASAP. > > Diffstat: > b/drivers/gpu/drm/i915/Kconfig | 33 > b/drivers/gpu/drm/i915/Makefile | 31 > b/drivers/gpu/drm/i915/gvt/cfg_space.c | 89 -- > b/drivers/gpu/drm/i915/gvt/cmd_parser.c |4 > b/drivers/gpu/drm/i915/gvt/dmabuf.c | 36 - > b/drivers/gpu/drm/i915/gvt/execlist.c | 12 > b/drivers/gpu/drm/i915/gvt/gtt.c| 55 + > b/drivers/gpu/drm/i915/gvt/gvt.h| 125 ++- > b/drivers/gpu/drm/i915/gvt/interrupt.c | 38 + > b/drivers/gpu/drm/i915/gvt/kvmgt.c | 1099 > +++- > b/drivers/gpu/drm/i915/gvt/mmio.c |4 > b/drivers/gpu/drm/i915/gvt/opregion.c | 148 > b/drivers/gpu/drm/i915/gvt/page_track.c |8 > b/drivers/gpu/drm/i915/gvt/scheduler.c | 37 - > b/drivers/gpu/drm/i915/gvt/trace.h |2 > b/drivers/gpu/drm/i915/gvt/vgpu.c | 22 > b/drivers/gpu/drm/i915/i915_drv.c |7 > b/drivers/gpu/drm/i915/i915_drv.h |1 > b/drivers/gpu/drm/i915/i915_trace.h |1 > b/drivers/gpu/drm/i915/intel_gvt.c | 162 +++- > b/drivers/gpu/drm/i915/intel_gvt.h | 17 > drivers/gpu/drm/i915/gvt/Makefile |9 > drivers/gpu/drm/i915/gvt/gvt.c | 340 - > drivers/gpu/drm/i915/gvt/hypercall.h| 82 -- > drivers/gpu/drm/i915/gvt/mpt.h | 400 --- > 25 files changed, 929 insertions(+), 1833 deletions(-)
[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Failsafe migration blits (rev7)
== Series Details == Series: drm/i915: Failsafe migration blits (rev7) URL : https://patchwork.freedesktop.org/series/95617/ State : success == Summary == CI Bug Log - changes from CI_DRM_10840 -> Patchwork_21515 Summary --- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/index.html Participating hosts (40 -> 37) -- Additional (2): fi-icl-u2 fi-pnv-d510 Missing(5): bat-dg1-6 fi-tgl-u2 bat-dg1-5 fi-bsw-cyan bat-adlp-4 Known issues Here are the changes found in Patchwork_21515 that come from known issues: ### IGT changes ### Issues hit * igt@amdgpu/amd_cs_nop@fork-gfx0: - fi-icl-u2: NOTRUN -> [SKIP][1] ([fdo#109315]) +17 similar issues [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-icl-u2/igt@amdgpu/amd_cs_...@fork-gfx0.html * igt@gem_huc_copy@huc-copy: - fi-icl-u2: NOTRUN -> [SKIP][2] ([i915#2190]) [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-icl-u2/igt@gem_huc_c...@huc-copy.html * igt@kms_chamelium@hdmi-edid-read: - fi-bdw-samus: NOTRUN -> [SKIP][3] ([fdo#109271] / [fdo#111827]) +8 similar issues [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-bdw-samus/igt@kms_chamel...@hdmi-edid-read.html * igt@kms_chamelium@hdmi-hpd-fast: - fi-icl-u2: NOTRUN -> [SKIP][4] ([fdo#111827]) +8 similar issues [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-icl-u2/igt@kms_chamel...@hdmi-hpd-fast.html * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy: - fi-icl-u2: NOTRUN -> [SKIP][5] ([fdo#109278]) +2 similar issues [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-icl-u2/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-legacy.html * igt@kms_force_connector_basic@force-load-detect: - fi-icl-u2: NOTRUN -> [SKIP][6] ([fdo#109285]) [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-icl-u2/igt@kms_force_connector_ba...@force-load-detect.html * igt@kms_frontbuffer_tracking@basic: - fi-cml-u2: [PASS][7] -> [DMESG-WARN][8] ([i915#4269]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html * igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d: - fi-bdw-samus: NOTRUN -> [SKIP][9] ([fdo#109271]) +29 similar issues [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-bdw-samus/igt@kms_pipe_crc_ba...@compare-crc-sanitycheck-pipe-d.html * igt@prime_vgem@basic-userptr: - fi-pnv-d510:NOTRUN -> [SKIP][10] ([fdo#109271]) +53 similar issues [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-pnv-d510/igt@prime_v...@basic-userptr.html - fi-icl-u2: NOTRUN -> [SKIP][11] ([i915#3301]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-icl-u2/igt@prime_v...@basic-userptr.html Possible fixes * igt@gem_exec_suspend@basic-s3: - fi-bdw-samus: [INCOMPLETE][12] -> [PASS][13] [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/fi-bdw-samus/igt@gem_exec_susp...@basic-s3.html [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-bdw-samus/igt@gem_exec_susp...@basic-s3.html * igt@i915_pm_rpm@basic-pci-d3-state: - fi-skl-6600u: [FAIL][14] ([i915#3239]) -> [PASS][15] [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/fi-skl-6600u/igt@i915_pm_...@basic-pci-d3-state.html [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/fi-skl-6600u/igt@i915_pm_...@basic-pci-d3-state.html [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278 [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285 [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315 [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827 [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190 [i915#3239]: https://gitlab.freedesktop.org/drm/intel/issues/3239 [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301 [i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269 Build changes - * Linux: CI_DRM_10840 -> Patchwork_21515 CI-20190529: 20190529 CI_DRM_10840: fd09f2e3683d7fa8894b24a15ab0356fdf922f6c @ git://anongit.freedesktop.org/gfx-ci/linux IGT_6273: 311a141910678cd981621d0c1beebb665137b49a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git Patchwork_21515: ddd7a78265a395acef78d45d2415be89b747dd47 @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == ddd7a78265a3 drm/i915/ttm: Failsafe migration blits 7fd
Re: [Intel-gfx] [PATCH 01/13] drm/connector: Add define for HDMI 1.4 Maximum Pixel Rate
On Thu, Nov 04, 2021 at 09:48:41AM +0100, Maxime Ripard wrote: > Hi Ville, > > On Wed, Nov 03, 2021 at 08:05:16PM +0200, Ville Syrjälä wrote: > > On Wed, Nov 03, 2021 at 01:02:11PM +0200, Ville Syrjälä wrote: > > > On Tue, Nov 02, 2021 at 03:59:32PM +0100, Maxime Ripard wrote: > > > > --- a/drivers/gpu/drm/drm_edid.c > > > > +++ b/drivers/gpu/drm/drm_edid.c > > > > @@ -4966,7 +4966,7 @@ static void drm_parse_hdmi_forum_vsdb(struct > > > > drm_connector *connector, > > > > u32 max_tmds_clock = hf_vsdb[5] * 5000; > > > > struct drm_scdc *scdc = &hdmi->scdc; > > > > > > > > - if (max_tmds_clock > 34) { > > > > + if (max_tmds_clock > DRM_HDMI_14_MAX_TMDS_CLK_KHZ) { > > > > display->max_tmds_clock = max_tmds_clock; > > > > DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d > > > > kHz\n", > > > > display->max_tmds_clock); > > > > diff --git a/drivers/gpu/drm/i915/display/intel_hdmi.c > > > > b/drivers/gpu/drm/i915/display/intel_hdmi.c > > > > index d2e61f6c6e08..0666203d52b7 100644 > > > > --- a/drivers/gpu/drm/i915/display/intel_hdmi.c > > > > +++ b/drivers/gpu/drm/i915/display/intel_hdmi.c > > > > @@ -2226,7 +2226,7 @@ int intel_hdmi_compute_config(struct > > > > intel_encoder *encoder, > > > > if (scdc->scrambling.low_rates) > > > > pipe_config->hdmi_scrambling = true; > > > > > > > > - if (pipe_config->port_clock > 34) { > > > > + if (pipe_config->port_clock > > > > > DRM_HDMI_14_MAX_TMDS_CLK_KHZ) { > > > > pipe_config->hdmi_scrambling = true; > > > > pipe_config->hdmi_high_tmds_clock_ratio = true; > > > > } > > > > > > All of that is HDMI 2.0 stuff. So this just makes it all super > > > confusing IMO. Nak. > > > > So reading throgh HDMI 1.4 again it does specify 340 MHz as some kind > > of upper limit for the physical cable. But nowhere else is that number > > really mentioned AFAICS. HDMI 2.0 does talk quite a bit about the 340 > > Mcsc limit in various places. > > > > I wonder what people would think of a couple of helpers like: > > - drm_hdmi_{can,must}_use_scrambling() > > - drm_hdmi_is_high_tmds_clock_ratio() > > or something along those lines? At least with those the code would > > read decently and I wouldn't have to wonder what this HDMI 1.4 TMDS > > clock limit really is. > > Patch 2 introduces something along those lines. > > It doesn't cover everything though, we're using this define in vc4 to > limit the available modes in mode_valid on HDMI controllers not > 4k-capable I wouldn't want to use this kind of define for those kinds of checks anyway. If the hardware has specific limits in what kind of clocks it can generate (or what it was validated for) IMO you should spell those out explicitly instead of assuming they happen to match some standard defined max value. -- Ville Syrjälä Intel
[Intel-gfx] ✓ Fi.CI.BAT: success for kernel/locking: Add context to ww_mutex_trylock. (rev5)
== Series Details == Series: kernel/locking: Add context to ww_mutex_trylock. (rev5) URL : https://patchwork.freedesktop.org/series/94437/ State : success == Summary == CI Bug Log - changes from CI_DRM_10840 -> Patchwork_21516 Summary --- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/index.html Participating hosts (40 -> 35) -- Additional (1): fi-icl-u2 Missing(6): bat-dg1-6 fi-tgl-u2 bat-dg1-5 fi-bsw-cyan bat-adlp-4 fi-bdw-samus Known issues Here are the changes found in Patchwork_21516 that come from known issues: ### IGT changes ### Issues hit * igt@amdgpu/amd_cs_nop@fork-gfx0: - fi-icl-u2: NOTRUN -> [SKIP][1] ([fdo#109315]) +17 similar issues [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/fi-icl-u2/igt@amdgpu/amd_cs_...@fork-gfx0.html * igt@gem_huc_copy@huc-copy: - fi-icl-u2: NOTRUN -> [SKIP][2] ([i915#2190]) [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/fi-icl-u2/igt@gem_huc_c...@huc-copy.html * igt@kms_chamelium@hdmi-hpd-fast: - fi-icl-u2: NOTRUN -> [SKIP][3] ([fdo#111827]) +8 similar issues [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/fi-icl-u2/igt@kms_chamel...@hdmi-hpd-fast.html * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy: - fi-icl-u2: NOTRUN -> [SKIP][4] ([fdo#109278]) +2 similar issues [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/fi-icl-u2/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-legacy.html * igt@kms_force_connector_basic@force-load-detect: - fi-icl-u2: NOTRUN -> [SKIP][5] ([fdo#109285]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/fi-icl-u2/igt@kms_force_connector_ba...@force-load-detect.html * igt@prime_vgem@basic-userptr: - fi-icl-u2: NOTRUN -> [SKIP][6] ([i915#3301]) [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/fi-icl-u2/igt@prime_v...@basic-userptr.html Possible fixes * igt@i915_pm_rpm@basic-pci-d3-state: - fi-skl-6600u: [FAIL][7] ([i915#3239]) -> [PASS][8] [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/fi-skl-6600u/igt@i915_pm_...@basic-pci-d3-state.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/fi-skl-6600u/igt@i915_pm_...@basic-pci-d3-state.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278 [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285 [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315 [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827 [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190 [i915#3239]: https://gitlab.freedesktop.org/drm/intel/issues/3239 [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301 [i915#3303]: https://gitlab.freedesktop.org/drm/intel/issues/3303 Build changes - * Linux: CI_DRM_10840 -> Patchwork_21516 CI-20190529: 20190529 CI_DRM_10840: fd09f2e3683d7fa8894b24a15ab0356fdf922f6c @ git://anongit.freedesktop.org/gfx-ci/linux IGT_6273: 311a141910678cd981621d0c1beebb665137b49a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git Patchwork_21516: 0525c745cec9e2339e8ea1fae2fb86d0f92b4cdc @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == 0525c745cec9 kernel/locking: Use a pointer in ww_mutex_trylock(). == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/index.html
Re: [Intel-gfx] [PATCH] drm/i915/pmu: Fix synchronization of PMU callback with reset
On Wed, Nov 03, 2021 at 03:47:08PM -0700, Umesh Nerlige Ramappa wrote: > Since the PMU callback runs in irq context, it synchronizes with gt > reset using the reset count. We could run into a case where the PMU > callback could read the reset count before it is updated. This has a > potential of corrupting the busyness stats. > > In addition to the reset count, check if the reset bit is set before > capturing busyness. > > In addition save the previous stats only if you intend to update them. > > Signed-off-by: Umesh Nerlige Ramappa Reviewed-by: Matthew Brost > --- > drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 12 > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > index 5cc49c0b3889..d83ade77ca07 100644 > --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c > @@ -1183,6 +1183,7 @@ static ktime_t guc_engine_busyness(struct > intel_engine_cs *engine, ktime_t *now) > u64 total, gt_stamp_saved; > unsigned long flags; > u32 reset_count; > + bool in_reset; > > spin_lock_irqsave(&guc->timestamp.lock, flags); > > @@ -1191,7 +1192,9 @@ static ktime_t guc_engine_busyness(struct > intel_engine_cs *engine, ktime_t *now) >* engine busyness from GuC, so we just use the driver stored >* copy of busyness. Synchronize with gt reset using reset_count. >*/ > - reset_count = i915_reset_count(gpu_error); > + rcu_read_lock(); > + in_reset = test_bit(I915_RESET_BACKOFF, >->reset.flags); > + rcu_read_unlock(); > > *now = ktime_get(); > > @@ -1201,9 +1204,10 @@ static ktime_t guc_engine_busyness(struct > intel_engine_cs *engine, ktime_t *now) >* start_gt_clk is derived from GuC state. To get a consistent >* view of activity, we query the GuC state only if gt is awake. >*/ > - stats_saved = *stats; > - gt_stamp_saved = guc->timestamp.gt_stamp; > - if (intel_gt_pm_get_if_awake(gt)) { > + if (intel_gt_pm_get_if_awake(gt) && !in_reset) { > + stats_saved = *stats; > + gt_stamp_saved = guc->timestamp.gt_stamp; > + reset_count = i915_reset_count(gpu_error); > guc_update_engine_gt_clks(engine); > guc_update_pm_timestamp(guc, engine, now); > intel_gt_pm_put_async(gt); > -- > 2.20.1 >
Re: [Intel-gfx] [PATCH] drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
On Thu, Nov 04, 2021 at 01:58:44PM +0100, Thomas Hellström wrote: > Some selftests assume that nothing will attempt to grab these bitlocks > while they are held by the selftests. With GuC, for example, that is > not true because the hanging workloads may cause the GuC code to attempt > to grab them for a global reset, and that may cause it to end up > sleeping on the bit never waking up. Regardless whether that will be > the final solution for GuC, use clear_and_wake_up_bit() pending a more > thorough investigation on how this should be handled moving forward. > > Signed-off-by: Thomas Hellström This series will also fix the CI crash: https://patchwork.freedesktop.org/series/96406/ Regardless of the above series this one looks correct and needed. With that: Reviewed-by: Matthew Brost > --- > drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 8 > drivers/gpu/drm/i915/selftests/igt_reset.c | 2 +- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c > b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c > index 7e2d99dd012d..8590419be4c6 100644 > --- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c > +++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c > @@ -528,7 +528,7 @@ static int igt_reset_nop_engine(void *arg) > break; > } > } while (time_before(jiffies, end_time)); > - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); > + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); > st_engine_heartbeat_enable(engine); > > pr_info("%s(%s): %d resets\n", __func__, engine->name, count); > @@ -679,7 +679,7 @@ static int igt_reset_fail_engine(void *arg) > out: > pr_info("%s(%s): %d resets\n", __func__, engine->name, count); > skip: > - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); > + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); > st_engine_heartbeat_enable(engine); > intel_context_put(ce); > > @@ -824,7 +824,7 @@ static int __igt_reset_engine(struct intel_gt *gt, bool > active) > if (err) > break; > } while (time_before(jiffies, end_time)); > - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); > + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); > st_engine_heartbeat_enable(engine); > pr_info("%s: Completed %lu %s resets\n", > engine->name, count, active ? "active" : "idle"); > @@ -1165,7 +1165,7 @@ static int __igt_reset_engines(struct intel_gt *gt, > if (err) > break; > } while (time_before(jiffies, end_time)); > - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); > + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); > st_engine_heartbeat_enable_no_pm(engine); > > pr_info("i915_reset_engine(%s:%s): %lu resets\n", > diff --git a/drivers/gpu/drm/i915/selftests/igt_reset.c > b/drivers/gpu/drm/i915/selftests/igt_reset.c > index 9f8590b868a9..a2838c65f8a5 100644 > --- a/drivers/gpu/drm/i915/selftests/igt_reset.c > +++ b/drivers/gpu/drm/i915/selftests/igt_reset.c > @@ -36,7 +36,7 @@ void igt_global_reset_unlock(struct intel_gt *gt) > enum intel_engine_id id; > > for_each_engine(engine, gt, id) > - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); > + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); > > clear_bit(I915_RESET_BACKOFF, >->reset.flags); > wake_up_all(>->reset.queue); > -- > 2.31.1 >
[Intel-gfx] [PATCH v2 0/2] Cleanups for the nomodeset kernel command line parameter logic
There is a lot of historical baggage on this parameter. It is defined in the vgacon driver as nomodeset, but its set function is called text_mode() and the value queried with a function named vgacon_text_force(). All this implies that it's about forcing text mode for VGA, yet it is not used in neither vgacon nor other console driver. The only users for these are DRM drivers, that check for the vgacon_text_force() return value to determine whether the driver should be loaded or not. That makes it quite confusing to read the code, because the variables and function names don't reflect what they actually do and also are not in the same subsystem as the drivers that make use of them. This patch-set attempts to cleanup the code by moving the nomodseset param to the DRM subsystem and do some renaming to make their intention clearer. There is also another aspect that could be improved, and is the fact that drivers are checking for the nomodeset being set as an indication if have to be loaded. But there may be other reasons why this could be the case, so it is better to encapsulate the logic in a separate function to make clear what's about. This is a v2 of the patches, that address the issues pointed out by Thomas Zimmermann and Jani Nikula in v1: https://lore.kernel.org/lkml/5b4e4534-4786-d231-e331-78fdb5d84...@redhat.com/T/ Patch #1 adds a drm_drv_enabled() function that could be used by drivers to check if these could be enabled, instead of just using vgacon_text_force(). Patch #2 moves the nomodeset logic to the DRM subsystem and renames the functions and variables to better explain what these actually do. Changes in v2: - Squash patch to add drm_drv_enabled() and make drivers use it. - Make the drivers changes before moving nomodeset logic to DRM. - Make drm_drv_enabled() return an errno and -ENODEV if nomodeset. - Remove debug and error messages in drivers. - Conditionally build drm_nomodeset.o if CONFIG_VGA_CONSOLE is set. - Squash patches to move nomodeset logic to DRM and do the renaming. - Name the function drm_check_modeset() and make it return -ENODEV. Javier Martinez Canillas (2): drm: Add a drm_drv_enabled() to check if drivers should be enabled drm: Move nomodeset kernel parameter to the DRM subsystem drivers/gpu/drm/Makefile| 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 +++- drivers/gpu/drm/ast/ast_drv.c | 8 +--- drivers/gpu/drm/drm_drv.c | 21 drivers/gpu/drm/drm_nomodeset.c | 26 + drivers/gpu/drm/i915/i915_module.c | 8 +--- drivers/gpu/drm/mgag200/mgag200_drv.c | 8 +--- drivers/gpu/drm/nouveau/nouveau_drm.c | 6 -- drivers/gpu/drm/qxl/qxl_drv.c | 8 +--- drivers/gpu/drm/radeon/radeon_drv.c | 7 --- drivers/gpu/drm/tiny/bochs.c| 8 +--- drivers/gpu/drm/tiny/cirrus.c | 9 ++--- drivers/gpu/drm/vboxvideo/vbox_drv.c| 10 +- drivers/gpu/drm/virtio/virtgpu_drv.c| 6 +++--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 6 +++--- drivers/video/console/vgacon.c | 21 include/drm/drm_drv.h | 1 + include/drm/drm_mode_config.h | 6 ++ include/linux/console.h | 6 -- 19 files changed, 109 insertions(+), 66 deletions(-) create mode 100644 drivers/gpu/drm/drm_nomodeset.c -- 2.33.1
[Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
Some DRM drivers check the vgacon_text_force() function return value as an indication on whether they should be allowed to be enabled or not. This function returns true if the nomodeset kernel command line parameter was set. But there may be other conditions besides this to determine if a driver should be enabled. Let's add a drm_drv_enabled() helper function to encapsulate that logic so can be later extended if needed, without having to modify all the drivers. Also, while being there do some cleanup. The vgacon_text_force() function is guarded by CONFIG_VGA_CONSOLE and there's no need for callers to do it. Suggested-by: Thomas Zimmermann Signed-off-by: Javier Martinez Canillas --- Changes in v2: - Squash patch to add drm_drv_enabled() and make drivers use it. - Make the drivers changes before moving nomodeset logic to DRM. - Make drm_drv_enabled() return an errno and -ENODEV if nomodeset. - Remove debug and error messages in drivers. drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 +++ drivers/gpu/drm/ast/ast_drv.c | 7 +-- drivers/gpu/drm/drm_drv.c | 20 drivers/gpu/drm/i915/i915_module.c | 6 +- drivers/gpu/drm/mgag200/mgag200_drv.c | 7 +-- drivers/gpu/drm/nouveau/nouveau_drm.c | 5 - drivers/gpu/drm/qxl/qxl_drv.c | 7 +-- drivers/gpu/drm/radeon/radeon_drv.c | 6 -- drivers/gpu/drm/tiny/bochs.c| 7 +-- drivers/gpu/drm/tiny/cirrus.c | 8 ++-- drivers/gpu/drm/vboxvideo/vbox_drv.c| 9 + drivers/gpu/drm/virtio/virtgpu_drv.c| 5 +++-- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 +++-- include/drm/drm_drv.h | 1 + 14 files changed, 74 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index c718fb5f3f8a..7fde40d06181 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -2514,10 +2514,9 @@ static int __init amdgpu_init(void) { int r; - if (vgacon_text_force()) { - DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n"); - return -EINVAL; - } + r = drm_drv_enabled(&amdgpu_kms_driver) + if (r) + return r; r = amdgpu_sync_init(); if (r) diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index 86d5cd7b6318..802063279b86 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -233,8 +233,11 @@ static struct pci_driver ast_pci_driver = { static int __init ast_init(void) { - if (vgacon_text_force() && ast_modeset == -1) - return -EINVAL; + int ret; + + ret = drm_drv_enabled(&ast_driver); + if (ret && ast_modeset == -1) + return ret; if (ast_modeset == 0) return -EINVAL; diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 8214a0b1ab7f..3fb567d62881 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -975,6 +975,26 @@ int drm_dev_set_unique(struct drm_device *dev, const char *name) } EXPORT_SYMBOL(drm_dev_set_unique); +/** + * drm_drv_enabled - Checks if a DRM driver can be enabled + * @driver: DRM driver to check + * + * Checks whether a DRM driver can be enabled or not. This may be the case + * if the "nomodeset" kernel command line parameter is used. + * + * Return: 0 on success or a negative error code on failure. + */ +int drm_drv_enabled(const struct drm_driver *driver) +{ + if (vgacon_text_force()) { + DRM_INFO("%s driver is disabled\n", driver->name); + return -ENODEV; + } + + return 0; +} +EXPORT_SYMBOL(drm_drv_enabled); + /* * DRM Core * The DRM core module initializes all global DRM objects and makes them diff --git a/drivers/gpu/drm/i915/i915_module.c b/drivers/gpu/drm/i915/i915_module.c index ab2295dd4500..45cb3e540eff 100644 --- a/drivers/gpu/drm/i915/i915_module.c +++ b/drivers/gpu/drm/i915/i915_module.c @@ -18,9 +18,12 @@ #include "i915_selftest.h" #include "i915_vma.h" +static const struct drm_driver driver; + static int i915_check_nomodeset(void) { bool use_kms = true; + int ret; /* * Enable KMS by default, unless explicitly overriden by @@ -31,7 +34,8 @@ static int i915_check_nomodeset(void) if (i915_modparams.modeset == 0) use_kms = false; - if (vgacon_text_force() && i915_modparams.modeset == -1) + ret = drm_drv_enabled(&driver); + if (ret && i915_modparams.modeset == -1) use_kms = false; if (!use_kms) { diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 6b9243713b3c..2a581094ba2b 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@ -378,8 +378,11 @@ static struct pci_driver mgag
[Intel-gfx] [PATCH v2 2/2] drm: Move nomodeset kernel parameter to the DRM subsystem
The "nomodeset" kernel cmdline parameter is handled by the vgacon driver but the exported vgacon_text_force() symbol is only used by DRM drivers. It makes much more sense for the parameter logic to be in the subsystem of the drivers that are making use of it. Let's move the vgacon_text_force() function and related logic to the DRM subsystem. While doing that, rename the function to drm_check_modeset() which better reflects what the function is really used to test for. Suggested-by: Daniel Vetter Signed-off-by: Javier Martinez Canillas --- Changes in v2: - Conditionally build drm_nomodeset.o if CONFIG_VGA_CONSOLE is set. - Squash patches to move nomodeset logic to DRM and do the renaming. - Name the function drm_check_modeset() and make it return -ENODEV. drivers/gpu/drm/Makefile| 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 1 - drivers/gpu/drm/ast/ast_drv.c | 1 - drivers/gpu/drm/drm_drv.c | 9 + drivers/gpu/drm/drm_nomodeset.c | 26 + drivers/gpu/drm/i915/i915_module.c | 2 -- drivers/gpu/drm/mgag200/mgag200_drv.c | 1 - drivers/gpu/drm/nouveau/nouveau_drm.c | 1 - drivers/gpu/drm/qxl/qxl_drv.c | 1 - drivers/gpu/drm/radeon/radeon_drv.c | 1 - drivers/gpu/drm/tiny/bochs.c| 1 - drivers/gpu/drm/tiny/cirrus.c | 1 - drivers/gpu/drm/vboxvideo/vbox_drv.c| 1 - drivers/gpu/drm/virtio/virtgpu_drv.c| 1 - drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 1 - drivers/video/console/vgacon.c | 21 include/drm/drm_mode_config.h | 6 ++ include/linux/console.h | 6 -- 18 files changed, 39 insertions(+), 44 deletions(-) create mode 100644 drivers/gpu/drm/drm_nomodeset.c diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 1c41156deb5f..c74810c285af 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -33,6 +33,8 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += drm_privacy_screen.o drm_privacy_screen_x86. obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o +obj-$(CONFIG_VGA_CONSOLE) += drm_nomodeset.o + drm_cma_helper-y := drm_gem_cma_helper.o obj-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_cma_helper.o diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 7fde40d06181..b4b6993861e6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -31,7 +31,6 @@ #include "amdgpu_drv.h" #include -#include #include #include #include diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c index 802063279b86..6222082c3082 100644 --- a/drivers/gpu/drm/ast/ast_drv.c +++ b/drivers/gpu/drm/ast/ast_drv.c @@ -26,7 +26,6 @@ * Authors: Dave Airlie */ -#include #include #include diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 3fb567d62881..80b85b8ea776 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -986,12 +986,13 @@ EXPORT_SYMBOL(drm_dev_set_unique); */ int drm_drv_enabled(const struct drm_driver *driver) { - if (vgacon_text_force()) { + int ret; + + ret = drm_check_modeset(); + if (ret) DRM_INFO("%s driver is disabled\n", driver->name); - return -ENODEV; - } - return 0; + return ret; } EXPORT_SYMBOL(drm_drv_enabled); diff --git a/drivers/gpu/drm/drm_nomodeset.c b/drivers/gpu/drm/drm_nomodeset.c new file mode 100644 index ..6683e396d2c5 --- /dev/null +++ b/drivers/gpu/drm/drm_nomodeset.c @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include +#include + +static bool drm_nomodeset; + +int drm_check_modeset(void) +{ + return drm_nomodeset ? -ENODEV : 0; +} +EXPORT_SYMBOL(drm_check_modeset); + +static int __init disable_modeset(char *str) +{ + drm_nomodeset = true; + + pr_warn("You have booted with nomodeset. This means your GPU drivers are DISABLED\n"); + pr_warn("Any video related functionality will be severely degraded, and you may not even be able to suspend the system properly\n"); + pr_warn("Unless you actually understand what nomodeset does, you should reboot without enabling it\n"); + + return 1; +} + +/* Disable kernel modesetting */ +__setup("nomodeset", disable_modeset); diff --git a/drivers/gpu/drm/i915/i915_module.c b/drivers/gpu/drm/i915/i915_module.c index 45cb3e540eff..c890c1ca20c4 100644 --- a/drivers/gpu/drm/i915/i915_module.c +++ b/drivers/gpu/drm/i915/i915_module.c @@ -4,8 +4,6 @@ * Copyright © 2021 Intel Corporation */ -#include - #include "gem/i915_gem_context.h" #include "gem/i915_gem_object.h" #include "i915_active.h" diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c index 2a581094ba2b..8e000cac11ba 100644 --- a/drivers/gpu/drm/mgag200/mgag200_drv.c +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c @@
[Intel-gfx] [PATCH v3 1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private
With an anonymous struct, this can be pure hierarchical organization without code changes. We'll follow up with adding a name to the sub-struct separately. Cc: Dave Airlie Reviewed-by: Ville Syrjälä Reviewed-by: Lucas De Marchi Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/i915_drv.h | 43 + 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index e967cd08f23e..c1c4bd754921 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -993,9 +993,6 @@ struct drm_i915_private { /* Display internal color functions */ const struct intel_color_funcs *color_funcs; - /* Display internal audio functions */ - const struct intel_audio_funcs *audio_funcs; - /* Display CDCLK functions */ const struct intel_cdclk_funcs *cdclk_funcs; @@ -1082,17 +1079,6 @@ struct drm_i915_private { struct drm_property *broadcast_rgb_property; struct drm_property *force_audio_property; - /* hda/i915 audio component */ - struct i915_audio_component *audio_component; - bool audio_component_registered; - /** -* av_mutex - mutex for audio/video sync -* -*/ - struct mutex av_mutex; - int audio_power_refcount; - u32 audio_freq_cntrl; - u32 fdi_rx_config; /* Shadow for DISPLAY_PHY_CONTROL which can't be safely read */ @@ -1225,14 +1211,29 @@ struct drm_i915_private { bool ipc_enabled; - /* Used to save the pipe-to-encoder mapping for audio */ - struct intel_encoder *av_enc_map[I915_MAX_PIPES]; - - /* necessary resource sharing with HDMI LPE audio driver. */ struct { - struct platform_device *platdev; - int irq; - } lpe_audio; + /* Display internal audio functions */ + const struct intel_audio_funcs *audio_funcs; + + /* hda/i915 audio component */ + struct i915_audio_component *audio_component; + bool audio_component_registered; + /** +* av_mutex - mutex for audio/video sync +*/ + struct mutex av_mutex; + int audio_power_refcount; + u32 audio_freq_cntrl; + + /* Used to save the pipe-to-encoder mapping for audio */ + struct intel_encoder *av_enc_map[I915_MAX_PIPES]; + + /* necessary resource sharing with HDMI LPE audio driver. */ + struct { + struct platform_device *platdev; + int irq; + } lpe_audio; + }; struct i915_pmu pmu; -- 2.30.2
[Intel-gfx] [PATCH v3 2/6] drm/i915/audio: name the audio sub-struct in drm_i915_private
Add name to the audio sub-struct in drm_i915_private, and remove the tautologies and other inconsistencies in the member names. v2: Call the mutex member mutex, not lock. (Ville) Cc: Dave Airlie Reviewed-by: Ville Syrjälä Reviewed-by: Lucas De Marchi Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_audio.c| 90 +-- .../gpu/drm/i915/display/intel_lpe_audio.c| 42 - drivers/gpu/drm/i915/i915_drv.c | 2 +- drivers/gpu/drm/i915/i915_drv.h | 22 +++-- 4 files changed, 77 insertions(+), 79 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c index a96523f1b052..6088304f82df 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.c +++ b/drivers/gpu/drm/i915/display/intel_audio.c @@ -388,7 +388,7 @@ hsw_dp_audio_config_update(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); - struct i915_audio_component *acomp = dev_priv->audio_component; + struct i915_audio_component *acomp = dev_priv->audio.component; enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; enum port port = encoder->port; const struct dp_aud_n_m *nm; @@ -436,7 +436,7 @@ hsw_hdmi_audio_config_update(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); - struct i915_audio_component *acomp = dev_priv->audio_component; + struct i915_audio_component *acomp = dev_priv->audio.component; enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; enum port port = encoder->port; int n, rate; @@ -494,7 +494,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder, drm_dbg_kms(&dev_priv->drm, "Disable audio codec on transcoder %s\n", transcoder_name(cpu_transcoder)); - mutex_lock(&dev_priv->av_mutex); + mutex_lock(&dev_priv->audio.mutex); /* Disable timestamps */ tmp = intel_de_read(dev_priv, HSW_AUD_CFG(cpu_transcoder)); @@ -512,7 +512,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder, tmp &= ~AUDIO_OUTPUT_ENABLE(cpu_transcoder); intel_de_write(dev_priv, HSW_AUD_PIN_ELD_CP_VLD, tmp); - mutex_unlock(&dev_priv->av_mutex); + mutex_unlock(&dev_priv->audio.mutex); } static unsigned int calc_hblank_early_prog(struct intel_encoder *encoder, @@ -641,7 +641,7 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder, "Enable audio codec on transcoder %s, %u bytes ELD\n", transcoder_name(cpu_transcoder), drm_eld_size(eld)); - mutex_lock(&dev_priv->av_mutex); + mutex_lock(&dev_priv->audio.mutex); /* Enable Audio WA for 4k DSC usecases */ if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP)) @@ -679,7 +679,7 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder, /* Enable timestamps */ hsw_audio_config_update(encoder, crtc_state); - mutex_unlock(&dev_priv->av_mutex); + mutex_unlock(&dev_priv->audio.mutex); } static void ilk_audio_codec_disable(struct intel_encoder *encoder, @@ -826,7 +826,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, const struct drm_connector_state *conn_state) { struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); - struct i915_audio_component *acomp = dev_priv->audio_component; + struct i915_audio_component *acomp = dev_priv->audio.component; struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc); struct drm_connector *connector = conn_state->connector; const struct drm_display_mode *adjusted_mode = @@ -848,17 +848,17 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2; - if (dev_priv->audio_funcs) - dev_priv->audio_funcs->audio_codec_enable(encoder, + if (dev_priv->audio.funcs) + dev_priv->audio.funcs->audio_codec_enable(encoder, crtc_state, conn_state); - mutex_lock(&dev_priv->av_mutex); + mutex_lock(&dev_priv->audio.mutex); encoder->audio_connector = connector; /* referred in audio callbacks */ - dev_priv->av_enc_map[pipe] = encoder; - mutex_unlock(&dev_priv->av_mutex); + dev_priv->audio.encoder_map[pipe] = encoder; + mutex_unlock(&dev_priv->audio.mutex); if (acomp && acomp->base.audio_ops && acomp->base.audio_ops->pin_eld_notify) { @@ -888,20 +888,20 @@ void intel_audio_codec_disable(s
[Intel-gfx] [PATCH v3 3/6] drm/i915/audio: define the audio struct separately from drm_i915_private
Add a standalone definition of struct intel_audio_private, and note that all of it is private to intel_audio.c. v2: Rebase Cc: Dave Airlie Reviewed-by: Ville Syrjälä Reviewed-by: Lucas De Marchi Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/i915_drv.h | 45 ++--- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b55ada4c2840..418c952bbf42 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -826,6 +826,29 @@ struct i915_selftest_stash { struct ida mock_region_instances; }; +/* intel_audio.c private */ +struct intel_audio_private { + /* Display internal audio functions */ + const struct intel_audio_funcs *funcs; + + /* hda/i915 audio component */ + struct i915_audio_component *component; + bool component_registered; + /* mutex for audio/video sync */ + struct mutex mutex; + int power_refcount; + u32 freq_cntrl; + + /* Used to save the pipe-to-encoder mapping for audio */ + struct intel_encoder *encoder_map[I915_MAX_PIPES]; + + /* necessary resource sharing with HDMI LPE audio driver. */ + struct { + struct platform_device *platdev; + int irq; + } lpe; +}; + struct drm_i915_private { struct drm_device drm; @@ -1211,27 +1234,7 @@ struct drm_i915_private { bool ipc_enabled; - struct { - /* Display internal audio functions */ - const struct intel_audio_funcs *funcs; - - /* hda/i915 audio component */ - struct i915_audio_component *component; - bool component_registered; - /* mutex for audio/video sync */ - struct mutex mutex; - int power_refcount; - u32 freq_cntrl; - - /* Used to save the pipe-to-encoder mapping for audio */ - struct intel_encoder *encoder_map[I915_MAX_PIPES]; - - /* necessary resource sharing with HDMI LPE audio driver. */ - struct { - struct platform_device *platdev; - int irq; - } lpe; - } audio; + struct intel_audio_private audio; struct i915_pmu pmu; -- 2.30.2
[Intel-gfx] [PATCH v3 4/6] drm/i915/audio: move intel_audio_funcs internal to intel_audio.c
It's all internal to intel_audio.c. Cc: Dave Airlie Reviewed-by: Ville Syrjälä Reviewed-by: Lucas De Marchi Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_audio.c | 9 + drivers/gpu/drm/i915/i915_drv.h| 10 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c index 6088304f82df..24e76657d561 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.c +++ b/drivers/gpu/drm/i915/display/intel_audio.c @@ -62,6 +62,15 @@ * struct &i915_audio_component_audio_ops @audio_ops is called from i915 driver. */ +struct intel_audio_funcs { + void (*audio_codec_enable)(struct intel_encoder *encoder, + const struct intel_crtc_state *crtc_state, + const struct drm_connector_state *conn_state); + void (*audio_codec_disable)(struct intel_encoder *encoder, + const struct intel_crtc_state *old_crtc_state, + const struct drm_connector_state *old_conn_state); +}; + /* DP N/M table */ #define LC_810M81 #define LC_540M54 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 418c952bbf42..94840af45750 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -362,15 +362,6 @@ struct intel_color_funcs { void (*read_luts)(struct intel_crtc_state *crtc_state); }; -struct intel_audio_funcs { - void (*audio_codec_enable)(struct intel_encoder *encoder, - const struct intel_crtc_state *crtc_state, - const struct drm_connector_state *conn_state); - void (*audio_codec_disable)(struct intel_encoder *encoder, - const struct intel_crtc_state *old_crtc_state, - const struct drm_connector_state *old_conn_state); -}; - struct intel_cdclk_funcs { void (*get_cdclk)(struct drm_i915_private *dev_priv, struct intel_cdclk_config *cdclk_config); @@ -827,6 +818,7 @@ struct i915_selftest_stash { }; /* intel_audio.c private */ +struct intel_audio_funcs; struct intel_audio_private { /* Display internal audio functions */ const struct intel_audio_funcs *funcs; -- 2.30.2
[Intel-gfx] [PATCH v3 5/6] drm/i915/audio: clean up LPE audio init/cleanup calls
Unify audio init/cleanup paths wrt LPE audio, and base the logic on the return values from LPE audio calls. Move the platform device check on cleanup to intel_lpe_audio.c, thereby limiting all audio.lpe substruct access to that file. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_audio.c | 14 -- drivers/gpu/drm/i915/display/intel_lpe_audio.c | 6 -- drivers/gpu/drm/i915/display/intel_lpe_audio.h | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c index 24e76657d561..aa7037021376 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.c +++ b/drivers/gpu/drm/i915/display/intel_audio.c @@ -1403,8 +1403,10 @@ static void i915_audio_component_cleanup(struct drm_i915_private *dev_priv) */ void intel_audio_init(struct drm_i915_private *dev_priv) { - if (intel_lpe_audio_init(dev_priv) < 0) - i915_audio_component_init(dev_priv); + if (!intel_lpe_audio_init(dev_priv)) + return; + + i915_audio_component_init(dev_priv); } /** @@ -1414,8 +1416,8 @@ void intel_audio_init(struct drm_i915_private *dev_priv) */ void intel_audio_deinit(struct drm_i915_private *dev_priv) { - if ((dev_priv)->audio.lpe.platdev != NULL) - intel_lpe_audio_teardown(dev_priv); - else - i915_audio_component_cleanup(dev_priv); + if (!intel_lpe_audio_teardown(dev_priv)) + return; + + i915_audio_component_cleanup(dev_priv); } diff --git a/drivers/gpu/drm/i915/display/intel_lpe_audio.c b/drivers/gpu/drm/i915/display/intel_lpe_audio.c index 4970bf146c4a..a2984718d136 100644 --- a/drivers/gpu/drm/i915/display/intel_lpe_audio.c +++ b/drivers/gpu/drm/i915/display/intel_lpe_audio.c @@ -296,10 +296,10 @@ int intel_lpe_audio_init(struct drm_i915_private *dev_priv) * * release all the resources for LPE audio <-> i915 bridge. */ -void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) +int intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) { if (!HAS_LPE_AUDIO(dev_priv)) - return; + return -ENODEV; lpe_audio_platdev_destroy(dev_priv); @@ -307,6 +307,8 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv) dev_priv->audio.lpe.irq = -1; dev_priv->audio.lpe.platdev = NULL; + + return 0; } /** diff --git a/drivers/gpu/drm/i915/display/intel_lpe_audio.h b/drivers/gpu/drm/i915/display/intel_lpe_audio.h index f848c5038714..030874623872 100644 --- a/drivers/gpu/drm/i915/display/intel_lpe_audio.h +++ b/drivers/gpu/drm/i915/display/intel_lpe_audio.h @@ -12,8 +12,8 @@ enum pipe; enum port; struct drm_i915_private; -int intel_lpe_audio_init(struct drm_i915_private *dev_priv); -void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv); +int intel_lpe_audio_init(struct drm_i915_private *dev_priv); +int intel_lpe_audio_teardown(struct drm_i915_private *dev_priv); void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv); void intel_lpe_audio_notify(struct drm_i915_private *dev_priv, enum pipe pipe, enum port port, -- 2.30.2
[Intel-gfx] [PATCH v3 6/6] drm/i915/audio: rename intel_init_audio_hooks to intel_audio_hooks_init
Follow the filename based prefix naming. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_audio.c | 4 ++-- drivers/gpu/drm/i915/display/intel_audio.h | 2 +- drivers/gpu/drm/i915/display/intel_display.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c index aa7037021376..74d56487267c 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.c +++ b/drivers/gpu/drm/i915/display/intel_audio.c @@ -940,10 +940,10 @@ static const struct intel_audio_funcs hsw_audio_funcs = { }; /** - * intel_init_audio_hooks - Set up chip specific audio hooks + * intel_audio_hooks_init - Set up chip specific audio hooks * @dev_priv: device private */ -void intel_init_audio_hooks(struct drm_i915_private *dev_priv) +void intel_audio_hooks_init(struct drm_i915_private *dev_priv) { if (IS_G4X(dev_priv)) { dev_priv->audio.funcs = &g4x_audio_funcs; diff --git a/drivers/gpu/drm/i915/display/intel_audio.h b/drivers/gpu/drm/i915/display/intel_audio.h index dcb259dd2da7..63b22131dc45 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.h +++ b/drivers/gpu/drm/i915/display/intel_audio.h @@ -11,7 +11,7 @@ struct drm_i915_private; struct intel_crtc_state; struct intel_encoder; -void intel_init_audio_hooks(struct drm_i915_private *dev_priv); +void intel_audio_hooks_init(struct drm_i915_private *dev_priv); void intel_audio_codec_enable(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state); diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 29392dfc46c8..25c3a44ed693 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -9486,7 +9486,7 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv) return; intel_init_cdclk_hooks(dev_priv); - intel_init_audio_hooks(dev_priv); + intel_audio_hooks_init(dev_priv); intel_dpll_init_clock_hook(dev_priv); -- 2.30.2
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
On Thu, 04 Nov 2021, Javier Martinez Canillas wrote: > Some DRM drivers check the vgacon_text_force() function return value as an > indication on whether they should be allowed to be enabled or not. > > This function returns true if the nomodeset kernel command line parameter > was set. But there may be other conditions besides this to determine if a > driver should be enabled. > > Let's add a drm_drv_enabled() helper function to encapsulate that logic so > can be later extended if needed, without having to modify all the drivers. > > Also, while being there do some cleanup. The vgacon_text_force() function > is guarded by CONFIG_VGA_CONSOLE and there's no need for callers to do it. > > Suggested-by: Thomas Zimmermann > Signed-off-by: Javier Martinez Canillas > --- > > Changes in v2: > - Squash patch to add drm_drv_enabled() and make drivers use it. > - Make the drivers changes before moving nomodeset logic to DRM. > - Make drm_drv_enabled() return an errno and -ENODEV if nomodeset. > - Remove debug and error messages in drivers. > > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 7 +++ > drivers/gpu/drm/ast/ast_drv.c | 7 +-- > drivers/gpu/drm/drm_drv.c | 20 > drivers/gpu/drm/i915/i915_module.c | 6 +- > drivers/gpu/drm/mgag200/mgag200_drv.c | 7 +-- > drivers/gpu/drm/nouveau/nouveau_drm.c | 5 - > drivers/gpu/drm/qxl/qxl_drv.c | 7 +-- > drivers/gpu/drm/radeon/radeon_drv.c | 6 -- > drivers/gpu/drm/tiny/bochs.c| 7 +-- > drivers/gpu/drm/tiny/cirrus.c | 8 ++-- > drivers/gpu/drm/vboxvideo/vbox_drv.c| 9 + > drivers/gpu/drm/virtio/virtgpu_drv.c| 5 +++-- > drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 5 +++-- > include/drm/drm_drv.h | 1 + > 14 files changed, 74 insertions(+), 26 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > index c718fb5f3f8a..7fde40d06181 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > @@ -2514,10 +2514,9 @@ static int __init amdgpu_init(void) > { > int r; > > - if (vgacon_text_force()) { > - DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n"); > - return -EINVAL; > - } > + r = drm_drv_enabled(&amdgpu_kms_driver) > + if (r) > + return r; > > r = amdgpu_sync_init(); > if (r) > diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c > index 86d5cd7b6318..802063279b86 100644 > --- a/drivers/gpu/drm/ast/ast_drv.c > +++ b/drivers/gpu/drm/ast/ast_drv.c > @@ -233,8 +233,11 @@ static struct pci_driver ast_pci_driver = { > > static int __init ast_init(void) > { > - if (vgacon_text_force() && ast_modeset == -1) > - return -EINVAL; > + int ret; > + > + ret = drm_drv_enabled(&ast_driver); > + if (ret && ast_modeset == -1) > + return ret; > > if (ast_modeset == 0) > return -EINVAL; > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c > index 8214a0b1ab7f..3fb567d62881 100644 > --- a/drivers/gpu/drm/drm_drv.c > +++ b/drivers/gpu/drm/drm_drv.c > @@ -975,6 +975,26 @@ int drm_dev_set_unique(struct drm_device *dev, const > char *name) > } > EXPORT_SYMBOL(drm_dev_set_unique); > > +/** > + * drm_drv_enabled - Checks if a DRM driver can be enabled > + * @driver: DRM driver to check > + * > + * Checks whether a DRM driver can be enabled or not. This may be the case > + * if the "nomodeset" kernel command line parameter is used. > + * > + * Return: 0 on success or a negative error code on failure. > + */ > +int drm_drv_enabled(const struct drm_driver *driver) > +{ > + if (vgacon_text_force()) { > + DRM_INFO("%s driver is disabled\n", driver->name); > + return -ENODEV; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_drv_enabled); > + > /* > * DRM Core > * The DRM core module initializes all global DRM objects and makes them > diff --git a/drivers/gpu/drm/i915/i915_module.c > b/drivers/gpu/drm/i915/i915_module.c > index ab2295dd4500..45cb3e540eff 100644 > --- a/drivers/gpu/drm/i915/i915_module.c > +++ b/drivers/gpu/drm/i915/i915_module.c > @@ -18,9 +18,12 @@ > #include "i915_selftest.h" > #include "i915_vma.h" > > +static const struct drm_driver driver; > + No, this makes absolutely no sense, and will also oops on nomodeset. BR, Jani. > static int i915_check_nomodeset(void) > { > bool use_kms = true; > + int ret; > > /* >* Enable KMS by default, unless explicitly overriden by > @@ -31,7 +34,8 @@ static int i915_check_nomodeset(void) > if (i915_modparams.modeset == 0) > use_kms = false; > > - if (vgacon_text_force() && i915_modparams.modeset == -1) > + ret = drm_drv_enabled(&driver); > + if (ret && i915_modparams.modeset == -
[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
== Series Details == Series: drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks URL : https://patchwork.freedesktop.org/series/96571/ State : success == Summary == CI Bug Log - changes from CI_DRM_10840 -> Patchwork_21517 Summary --- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/index.html Participating hosts (40 -> 36) -- Additional (2): fi-icl-u2 fi-pnv-d510 Missing(6): bat-dg1-6 fi-tgl-u2 bat-dg1-5 fi-bsw-cyan bat-adlp-4 fi-bdw-samus Known issues Here are the changes found in Patchwork_21517 that come from known issues: ### IGT changes ### Issues hit * igt@gem_exec_suspend@basic-s3: - fi-tgl-1115g4: [PASS][1] -> [FAIL][2] ([i915#1888]) [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/fi-tgl-1115g4/igt@gem_exec_susp...@basic-s3.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-tgl-1115g4/igt@gem_exec_susp...@basic-s3.html * igt@gem_huc_copy@huc-copy: - fi-icl-u2: NOTRUN -> [SKIP][3] ([i915#2190]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-icl-u2/igt@gem_huc_c...@huc-copy.html * igt@i915_selftest@live@hangcheck: - fi-icl-u2: NOTRUN -> [INCOMPLETE][4] ([i915#3965]) [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-icl-u2/igt@i915_selftest@l...@hangcheck.html * igt@kms_chamelium@hdmi-hpd-fast: - fi-icl-u2: NOTRUN -> [SKIP][5] ([fdo#111827]) +8 similar issues [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-icl-u2/igt@kms_chamel...@hdmi-hpd-fast.html * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy: - fi-icl-u2: NOTRUN -> [SKIP][6] ([fdo#109278]) +2 similar issues [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-icl-u2/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-legacy.html * igt@kms_flip@basic-flip-vs-wf_vblank@b-vga1: - fi-bwr-2160:[PASS][7] -> [FAIL][8] ([i915#2122]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/fi-bwr-2160/igt@kms_flip@basic-flip-vs-wf_vbl...@b-vga1.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-bwr-2160/igt@kms_flip@basic-flip-vs-wf_vbl...@b-vga1.html * igt@kms_force_connector_basic@force-load-detect: - fi-icl-u2: NOTRUN -> [SKIP][9] ([fdo#109285]) [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-icl-u2/igt@kms_force_connector_ba...@force-load-detect.html * igt@prime_vgem@basic-userptr: - fi-pnv-d510:NOTRUN -> [SKIP][10] ([fdo#109271]) +53 similar issues [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-pnv-d510/igt@prime_v...@basic-userptr.html - fi-icl-u2: NOTRUN -> [SKIP][11] ([i915#3301]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-icl-u2/igt@prime_v...@basic-userptr.html * igt@runner@aborted: - fi-icl-u2: NOTRUN -> [FAIL][12] ([i915#3363] / [i915#4006] / [i915#4312]) [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/fi-icl-u2/igt@run...@aborted.html [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278 [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285 [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827 [i915#1888]: https://gitlab.freedesktop.org/drm/intel/issues/1888 [i915#2122]: https://gitlab.freedesktop.org/drm/intel/issues/2122 [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190 [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301 [i915#3363]: https://gitlab.freedesktop.org/drm/intel/issues/3363 [i915#3965]: https://gitlab.freedesktop.org/drm/intel/issues/3965 [i915#4006]: https://gitlab.freedesktop.org/drm/intel/issues/4006 [i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312 Build changes - * Linux: CI_DRM_10840 -> Patchwork_21517 CI-20190529: 20190529 CI_DRM_10840: fd09f2e3683d7fa8894b24a15ab0356fdf922f6c @ git://anongit.freedesktop.org/gfx-ci/linux IGT_6273: 311a141910678cd981621d0c1beebb665137b49a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git Patchwork_21517: 51014434cd35fb3ba134c9d4a718d1461c12b821 @ git://anongit.freedesktop.org/gfx-ci/linux == Linux commits == 51014434cd35 drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks == Logs == For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/index.html
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
On 11/4/21 17:24, Jani Nikula wrote: [snip] >> index ab2295dd4500..45cb3e540eff 100644 >> --- a/drivers/gpu/drm/i915/i915_module.c >> +++ b/drivers/gpu/drm/i915/i915_module.c >> @@ -18,9 +18,12 @@ >> #include "i915_selftest.h" >> #include "i915_vma.h" >> >> +static const struct drm_driver driver; >> + > > No, this makes absolutely no sense, and will also oops on nomodeset. > Ups, sorry about that. For some reason I thought that it was defined in the same compilation unit, but I noticed now that it is in i915_drv.c. > BR, > Jani. > Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat
[Intel-gfx] [PATCH v4 1/3] drm: Move drm_color_lut_check implementation internal to intel_color
From: Mark Yacoub [Why] The tests of LUT_EQUAL_CHANNELS and LUT_NON_DECREASING are currently unique to i915 driver. Freeing up the function name for the more generic LUT checks to folllow Tested on Eldrid ChromeOS (TGL). v1: Stuff the test function from DRM to intel driver. Signed-off-by: Mark Yacoub --- drivers/gpu/drm/drm_color_mgmt.c | 43 -- drivers/gpu/drm/i915/display/intel_color.c | 43 +++--- drivers/gpu/drm/i915/display/intel_color.h | 27 ++ drivers/gpu/drm/i915/i915_pci.c| 27 -- include/drm/drm_color_mgmt.h | 27 -- 5 files changed, 81 insertions(+), 86 deletions(-) diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index bb14f488c8f6c..16a07f84948f3 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -583,46 +583,3 @@ int drm_plane_create_color_properties(struct drm_plane *plane, return 0; } EXPORT_SYMBOL(drm_plane_create_color_properties); - -/** - * drm_color_lut_check - check validity of lookup table - * @lut: property blob containing LUT to check - * @tests: bitmask of tests to run - * - * Helper to check whether a userspace-provided lookup table is valid and - * satisfies hardware requirements. Drivers pass a bitmask indicating which of - * the tests in &drm_color_lut_tests should be performed. - * - * Returns 0 on success, -EINVAL on failure. - */ -int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests) -{ - const struct drm_color_lut *entry; - int i; - - if (!lut || !tests) - return 0; - - entry = lut->data; - for (i = 0; i < drm_color_lut_size(lut); i++) { - if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) { - if (entry[i].red != entry[i].blue || - entry[i].red != entry[i].green) { - DRM_DEBUG_KMS("All LUT entries must have equal r/g/b\n"); - return -EINVAL; - } - } - - if (i > 0 && tests & DRM_COLOR_LUT_NON_DECREASING) { - if (entry[i].red < entry[i - 1].red || - entry[i].green < entry[i - 1].green || - entry[i].blue < entry[i - 1].blue) { - DRM_DEBUG_KMS("LUT entries must never decrease.\n"); - return -EINVAL; - } - } - } - - return 0; -} -EXPORT_SYMBOL(drm_color_lut_check); diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c index dab892d2251ba..bde98a155c9f3 100644 --- a/drivers/gpu/drm/i915/display/intel_color.c +++ b/drivers/gpu/drm/i915/display/intel_color.c @@ -1279,13 +1279,46 @@ static int check_lut_size(const struct drm_property_blob *lut, int expected) return 0; } +static int test_luts(const struct drm_property_blob *lut, u32 tests) +{ + const struct drm_color_lut *entry; + int i; + + if (!lut || !tests) + return 0; + + entry = lut->data; + for (i = 0; i < drm_color_lut_size(lut); i++) { + if (tests & LUT_EQUAL_CHANNELS) { + if (entry[i].red != entry[i].blue || + entry[i].red != entry[i].green) { + DRM_DEBUG_KMS( + "All LUT entries must have equal r/g/b\n"); + return -EINVAL; + } + } + + if (i > 0 && tests & LUT_NON_DECREASING) { + if (entry[i].red < entry[i - 1].red || + entry[i].green < entry[i - 1].green || + entry[i].blue < entry[i - 1].blue) { + DRM_DEBUG_KMS( + "LUT entries must never decrease.\n"); + return -EINVAL; + } + } + } + + return 0; +} + static int check_luts(const struct intel_crtc_state *crtc_state) { struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); const struct drm_property_blob *gamma_lut = crtc_state->hw.gamma_lut; const struct drm_property_blob *degamma_lut = crtc_state->hw.degamma_lut; int gamma_length, degamma_length; - u32 gamma_tests, degamma_tests; + u32 gamma_channels_tests, degamma_channels_tests; /* Always allow legacy gamma LUT with no further checking. */ if (crtc_state_is_legacy_gamma(crtc_state)) @@ -1300,15 +1333,15 @@ static int check_luts(const struct intel_crtc_state *crtc_state) degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_size; gamma_length = INTEL_INFO(dev_priv)->color.gamma_lut_size; - degam
[Intel-gfx] [PATCH v4 2/3] drm: Add Gamma and Degamma LUT sizes props to drm_crtc to validate.
From: Mark Yacoub [Why] 1. drm_atomic_helper_check doesn't check for the LUT sizes of either Gamma or Degamma props in the new CRTC state, allowing any invalid size to be passed on. 2. Each driver has its own LUT size, which could also be different for legacy users. [How] 1. Create |degamma_lut_size| and |gamma_lut_size| to save the LUT sizes assigned by the driver when it's initializing its color and CTM management. 2. Create drm_atomic_helper_check_crtc which is called by drm_atomic_helper_check to check the LUT sizes saved in drm_crtc that they match the sizes in the new CRTC state. 3. As the LUT size check now happens in drm_atomic_helper_check, remove the lut check in intel_color.c Resolves: igt@kms_color@pipe-A-invalid-gamma-lut-sizes on MTK Tested on Zork (amdgpu) and Jacuzzi (mediatek), volteer (TGL) v3: 1. Check for lut pointer inside drm_check_lut_size. v2: 1. Remove the rename to a parent commit. 2. Create a drm drm_check_lut_size instead of intel only function. v1: 1. Fix typos 2. Remove the LUT size check from intel driver 3. Rename old LUT check to indicate it's a channel change Signed-off-by: Mark Yacoub --- drivers/gpu/drm/drm_atomic_helper.c| 52 ++ drivers/gpu/drm/drm_color_mgmt.c | 19 drivers/gpu/drm/i915/display/intel_color.c | 32 ++--- include/drm/drm_atomic_helper.h| 1 + include/drm/drm_color_mgmt.h | 3 ++ include/drm/drm_crtc.h | 11 + 6 files changed, 99 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index bc3487964fb5e..548e5d8221fb4 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -929,6 +929,54 @@ drm_atomic_helper_check_planes(struct drm_device *dev, } EXPORT_SYMBOL(drm_atomic_helper_check_planes); +/** + * drm_atomic_helper_check_crtcs - validate state object for CRTC changes + * @state: the driver state object + * + * Check the CRTC state object such as the Gamma/Degamma LUT sizes if the new + * state holds them. + * + * RETURNS: + * Zero for success or -errno + */ +int drm_atomic_helper_check_crtcs(struct drm_atomic_state *state) +{ + struct drm_crtc *crtc; + struct drm_crtc_state *new_crtc_state; + int i; + + for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { + if (!new_crtc_state->color_mgmt_changed) + continue; + + if (drm_check_lut_size(new_crtc_state->gamma_lut, + crtc->gamma_lut_size) || + drm_check_lut_size(new_crtc_state->gamma_lut, + crtc->gamma_size)) { + drm_dbg_state( + state->dev, + "Invalid Gamma LUT size. Expected %u/%u, got %u.\n", + crtc->gamma_lut_size, crtc->gamma_size, + drm_color_lut_size(new_crtc_state->gamma_lut)); + return -EINVAL; + } + + if (drm_check_lut_size(new_crtc_state->degamma_lut, + crtc->degamma_lut_size)) { + drm_dbg_state( + state->dev, + "Invalid Degamma LUT size. Expected %u, got %u.\n", + crtc->degamma_lut_size, + drm_color_lut_size( + new_crtc_state->degamma_lut)); + return -EINVAL; + } + } + + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_check_crtcs); + /** * drm_atomic_helper_check - validate state object * @dev: DRM device @@ -974,6 +1022,10 @@ int drm_atomic_helper_check(struct drm_device *dev, if (ret) return ret; + ret = drm_atomic_helper_check_crtcs(state); + if (ret) + return ret; + if (state->legacy_cursor_update) state->async_update = !drm_atomic_helper_async_check(dev, state); diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 16a07f84948f3..c85094223b535 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -166,6 +166,7 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, struct drm_mode_config *config = &dev->mode_config; if (degamma_lut_size) { + crtc->degamma_lut_size = degamma_lut_size; drm_object_attach_property(&crtc->base, config->degamma_lut_property, 0); drm_object_attach_property(&crtc->base, @@ -178,6 +179,7 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, config->ctm_property, 0); if (gamma_lut_size) { + crtc->ga
[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915: Failsafe migration blits (rev7)
== Series Details == Series: drm/i915: Failsafe migration blits (rev7) URL : https://patchwork.freedesktop.org/series/95617/ State : success == Summary == CI Bug Log - changes from CI_DRM_10840_full -> Patchwork_21515_full Summary --- **SUCCESS** No regressions found. Participating hosts (11 -> 11) -- No changes in participating hosts Possible new issues --- Here are the unknown changes that may have been introduced in Patchwork_21515_full: ### IGT changes ### Suppressed The following results come from untrusted machines, tests, or statuses. They do not affect the overall result. * igt@kms_big_fb@y-tiled-16bpp-rotate-0: - {shard-rkl}:[PASS][1] -> [SKIP][2] +3 similar issues [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@y-tiled-16bpp-rotate-0.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-rkl-1/igt@kms_big...@y-tiled-16bpp-rotate-0.html * igt@kms_big_fb@yf-tiled-8bpp-rotate-270: - {shard-rkl}:[SKIP][3] ([fdo#111615]) -> [SKIP][4] [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@yf-tiled-8bpp-rotate-270.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-rkl-1/igt@kms_big...@yf-tiled-8bpp-rotate-270.html * igt@kms_big_fb@yf-tiled-max-hw-stride-32bpp-rotate-180-async-flip: - {shard-rkl}:NOTRUN -> [SKIP][5] +17 similar issues [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-rkl-1/igt@kms_big...@yf-tiled-max-hw-stride-32bpp-rotate-180-async-flip.html Known issues Here are the changes found in Patchwork_21515_full that come from known issues: ### IGT changes ### Issues hit * igt@feature_discovery@psr2: - shard-iclb: NOTRUN -> [SKIP][6] ([i915#658]) [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-iclb6/igt@feature_discov...@psr2.html * igt@gem_ctx_isolation@preservation-s3@bcs0: - shard-tglb: [PASS][7] -> [INCOMPLETE][8] ([i915#456]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-tglb6/igt@gem_ctx_isolation@preservation...@bcs0.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-tglb7/igt@gem_ctx_isolation@preservation...@bcs0.html * igt@gem_ctx_shared@q-in-order: - shard-snb: NOTRUN -> [SKIP][9] ([fdo#109271]) +18 similar issues [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-snb4/igt@gem_ctx_sha...@q-in-order.html * igt@gem_exec_capture@pi@bcs0: - shard-skl: [PASS][10] -> [INCOMPLETE][11] ([i915#2369]) [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-skl8/igt@gem_exec_capture@p...@bcs0.html [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-skl7/igt@gem_exec_capture@p...@bcs0.html * igt@gem_exec_fair@basic-none@vecs0: - shard-apl: [PASS][12] -> [FAIL][13] ([i915#2842] / [i915#3468]) [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-apl1/igt@gem_exec_fair@basic-n...@vecs0.html [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-apl2/igt@gem_exec_fair@basic-n...@vecs0.html * igt@gem_exec_fair@basic-pace@vcs1: - shard-kbl: [PASS][14] -> [FAIL][15] ([i915#2842]) [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-kbl6/igt@gem_exec_fair@basic-p...@vcs1.html [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-kbl7/igt@gem_exec_fair@basic-p...@vcs1.html * igt@gem_exec_fair@basic-pace@vecs0: - shard-tglb: [PASS][16] -> [FAIL][17] ([i915#2842]) +1 similar issue [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-tglb5/igt@gem_exec_fair@basic-p...@vecs0.html [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-tglb6/igt@gem_exec_fair@basic-p...@vecs0.html * igt@gem_exec_fair@basic-throttle@rcs0: - shard-glk: [PASS][18] -> [FAIL][19] ([i915#2842]) [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-glk5/igt@gem_exec_fair@basic-throt...@rcs0.html [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-glk6/igt@gem_exec_fair@basic-throt...@rcs0.html * igt@gem_pread@exhaustion: - shard-apl: NOTRUN -> [WARN][20] ([i915#2658]) [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-apl6/igt@gem_pr...@exhaustion.html - shard-kbl: NOTRUN -> [WARN][21] ([i915#2658]) [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-kbl3/igt@gem_pr...@exhaustion.html * igt@gem_pwrite@basic-exhaustion: - shard-skl: NOTRUN -> [WARN][22] ([i915#2658]) [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21515/shard-skl2/igt@gem_pwr...@basic-exhaustion.html * igt@gem_user
Re: [Intel-gfx] [PATCH] drm/i915/pmu: Fix synchronization of PMU callback with reset
On 03/11/2021 22:47, Umesh Nerlige Ramappa wrote: Since the PMU callback runs in irq context, it synchronizes with gt reset using the reset count. We could run into a case where the PMU callback could read the reset count before it is updated. This has a potential of corrupting the busyness stats. In addition to the reset count, check if the reset bit is set before capturing busyness. In addition save the previous stats only if you intend to update them. Signed-off-by: Umesh Nerlige Ramappa --- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c index 5cc49c0b3889..d83ade77ca07 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c @@ -1183,6 +1183,7 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) u64 total, gt_stamp_saved; unsigned long flags; u32 reset_count; + bool in_reset; spin_lock_irqsave(&guc->timestamp.lock, flags); @@ -1191,7 +1192,9 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) * engine busyness from GuC, so we just use the driver stored * copy of busyness. Synchronize with gt reset using reset_count. */ - reset_count = i915_reset_count(gpu_error); + rcu_read_lock(); + in_reset = test_bit(I915_RESET_BACKOFF, >->reset.flags); + rcu_read_unlock(); I don't really understand the point of rcu_read_lock over test_bit but I guess you copied it from the trylock loop. *now = ktime_get(); @@ -1201,9 +1204,10 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) * start_gt_clk is derived from GuC state. To get a consistent * view of activity, we query the GuC state only if gt is awake. */ - stats_saved = *stats; - gt_stamp_saved = guc->timestamp.gt_stamp; - if (intel_gt_pm_get_if_awake(gt)) { + if (intel_gt_pm_get_if_awake(gt) && !in_reset) { What is the point of looking at the old value of in_reset here? Gut feeling says if there is a race this does not fix it. I did not figure out from the commit message what does "could read the reset count before it is updated" mean? I thought the point of reading the reset count twice was that you are sure there was no reset while in here, in which case it is safe to update the software copy. I don't easily see what test_bit does on top. Regards, Tvrtko + stats_saved = *stats; + gt_stamp_saved = guc->timestamp.gt_stamp; + reset_count = i915_reset_count(gpu_error); guc_update_engine_gt_clks(engine); guc_update_pm_timestamp(guc, engine, now); intel_gt_pm_put_async(gt);
Re: [Intel-gfx] [PATCH v4 1/3] drm: Move drm_color_lut_check implementation internal to intel_color
On Thu, 04 Nov 2021, Mark Yacoub wrote: > From: Mark Yacoub > > [Why] > The tests of LUT_EQUAL_CHANNELS and LUT_NON_DECREASING are currently > unique to i915 driver. > Freeing up the function name for the more generic LUT checks to folllow > > Tested on Eldrid ChromeOS (TGL). > > v1: > Stuff the test function from DRM to intel driver. > > Signed-off-by: Mark Yacoub > --- > drivers/gpu/drm/drm_color_mgmt.c | 43 -- > drivers/gpu/drm/i915/display/intel_color.c | 43 +++--- > drivers/gpu/drm/i915/display/intel_color.h | 27 ++ > drivers/gpu/drm/i915/i915_pci.c| 27 -- > include/drm/drm_color_mgmt.h | 27 -- > 5 files changed, 81 insertions(+), 86 deletions(-) > > diff --git a/drivers/gpu/drm/drm_color_mgmt.c > b/drivers/gpu/drm/drm_color_mgmt.c > index bb14f488c8f6c..16a07f84948f3 100644 > --- a/drivers/gpu/drm/drm_color_mgmt.c > +++ b/drivers/gpu/drm/drm_color_mgmt.c > @@ -583,46 +583,3 @@ int drm_plane_create_color_properties(struct drm_plane > *plane, > return 0; > } > EXPORT_SYMBOL(drm_plane_create_color_properties); > - > -/** > - * drm_color_lut_check - check validity of lookup table > - * @lut: property blob containing LUT to check > - * @tests: bitmask of tests to run > - * > - * Helper to check whether a userspace-provided lookup table is valid and > - * satisfies hardware requirements. Drivers pass a bitmask indicating which > of > - * the tests in &drm_color_lut_tests should be performed. > - * > - * Returns 0 on success, -EINVAL on failure. > - */ > -int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests) > -{ > - const struct drm_color_lut *entry; > - int i; > - > - if (!lut || !tests) > - return 0; > - > - entry = lut->data; > - for (i = 0; i < drm_color_lut_size(lut); i++) { > - if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) { > - if (entry[i].red != entry[i].blue || > - entry[i].red != entry[i].green) { > - DRM_DEBUG_KMS("All LUT entries must have equal > r/g/b\n"); > - return -EINVAL; > - } > - } > - > - if (i > 0 && tests & DRM_COLOR_LUT_NON_DECREASING) { > - if (entry[i].red < entry[i - 1].red || > - entry[i].green < entry[i - 1].green || > - entry[i].blue < entry[i - 1].blue) { > - DRM_DEBUG_KMS("LUT entries must never > decrease.\n"); > - return -EINVAL; > - } > - } > - } > - > - return 0; > -} > -EXPORT_SYMBOL(drm_color_lut_check); > diff --git a/drivers/gpu/drm/i915/display/intel_color.c > b/drivers/gpu/drm/i915/display/intel_color.c > index dab892d2251ba..bde98a155c9f3 100644 > --- a/drivers/gpu/drm/i915/display/intel_color.c > +++ b/drivers/gpu/drm/i915/display/intel_color.c > @@ -1279,13 +1279,46 @@ static int check_lut_size(const struct > drm_property_blob *lut, int expected) > return 0; > } > > +static int test_luts(const struct drm_property_blob *lut, u32 tests) > +{ > + const struct drm_color_lut *entry; > + int i; > + > + if (!lut || !tests) > + return 0; > + > + entry = lut->data; > + for (i = 0; i < drm_color_lut_size(lut); i++) { > + if (tests & LUT_EQUAL_CHANNELS) { > + if (entry[i].red != entry[i].blue || > + entry[i].red != entry[i].green) { > + DRM_DEBUG_KMS( > + "All LUT entries must have equal > r/g/b\n"); > + return -EINVAL; > + } > + } > + > + if (i > 0 && tests & LUT_NON_DECREASING) { > + if (entry[i].red < entry[i - 1].red || > + entry[i].green < entry[i - 1].green || > + entry[i].blue < entry[i - 1].blue) { > + DRM_DEBUG_KMS( > + "LUT entries must never decrease.\n"); > + return -EINVAL; > + } > + } > + } > + > + return 0; > +} > + > static int check_luts(const struct intel_crtc_state *crtc_state) > { > struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); > const struct drm_property_blob *gamma_lut = crtc_state->hw.gamma_lut; > const struct drm_property_blob *degamma_lut = > crtc_state->hw.degamma_lut; > int gamma_length, degamma_length; > - u32 gamma_tests, degamma_tests; > + u32 gamma_channels_tests, degamma_channels_tests; > > /* Always allow legacy gamma LUT with no further checking. */ > if (crtc_state_is_legacy_gamma(crtc_state)) > @@ -1300,15 +1333,15 @@ static int check_luts(const s
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
Hi Javier, On Thu, Nov 04, 2021 at 05:07:06PM +0100, Javier Martinez Canillas wrote: > Some DRM drivers check the vgacon_text_force() function return value as an > indication on whether they should be allowed to be enabled or not. > > This function returns true if the nomodeset kernel command line parameter > was set. But there may be other conditions besides this to determine if a > driver should be enabled. > > Let's add a drm_drv_enabled() helper function to encapsulate that logic so > can be later extended if needed, without having to modify all the drivers. > > Also, while being there do some cleanup. The vgacon_text_force() function > is guarded by CONFIG_VGA_CONSOLE and there's no need for callers to do it. > > Suggested-by: Thomas Zimmermann > Signed-off-by: Javier Martinez Canillas > --- > > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c > index 8214a0b1ab7f..3fb567d62881 100644 > --- a/drivers/gpu/drm/drm_drv.c > +++ b/drivers/gpu/drm/drm_drv.c > @@ -975,6 +975,26 @@ int drm_dev_set_unique(struct drm_device *dev, const > char *name) > } > EXPORT_SYMBOL(drm_dev_set_unique); > > +/** > + * drm_drv_enabled - Checks if a DRM driver can be enabled > + * @driver: DRM driver to check > + * > + * Checks whether a DRM driver can be enabled or not. This may be the case > + * if the "nomodeset" kernel command line parameter is used. > + * > + * Return: 0 on success or a negative error code on failure. > + */ > +int drm_drv_enabled(const struct drm_driver *driver) > +{ > + if (vgacon_text_force()) { > + DRM_INFO("%s driver is disabled\n", driver->name); DRM_INFO is deprecated, please do not use it in new code. Also other users had an error message and not just info - is info enough? > + return -ENODEV; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_drv_enabled); > + > /* > * DRM Core > * The DRM core module initializes all global DRM objects and makes them > diff --git a/drivers/gpu/drm/i915/i915_module.c > b/drivers/gpu/drm/i915/i915_module.c > index ab2295dd4500..45cb3e540eff 100644 > --- a/drivers/gpu/drm/i915/i915_module.c > +++ b/drivers/gpu/drm/i915/i915_module.c > @@ -18,9 +18,12 @@ > #include "i915_selftest.h" > #include "i915_vma.h" > > +static const struct drm_driver driver; Hmmm... > + > static int i915_check_nomodeset(void) > { > bool use_kms = true; > + int ret; > > /* >* Enable KMS by default, unless explicitly overriden by > @@ -31,7 +34,8 @@ static int i915_check_nomodeset(void) > if (i915_modparams.modeset == 0) > use_kms = false; > > - if (vgacon_text_force() && i915_modparams.modeset == -1) > + ret = drm_drv_enabled(&driver); You pass the local driver variable here - which looks wrong as this is not the same as the driver variable declared in another file. Maybe move the check to new function you can add to init_funcs, and locate the new function in i915_drv - so it has access to driver? Sam
Re: [Intel-gfx] [PATCH v3] drm/i915/display: Exit PSR when doing async flips
On Thu, 2021-11-04 at 16:10 +0200, Ville Syrjälä wrote: > On Tue, Nov 02, 2021 at 12:32:14PM -0700, José Roberto de Souza wrote: > > Changing the buffer in the middle of the scanout then entering an > > period of flip idleness will cause part of the previous buffer being > > diplayed to user when PSR is enabled. > > > > So here disabling PSR and scheduling activation during the next > > sync flip. > > > > The async flip check that we had in PSR compute is not executed at > > every flip so it was not doing anything useful and is also being > > dropped here. > > > > v2: > > - scheduling the PSR work in _intel_psr_post_plane_update() > > > > v3: > > - only re enabling PSR when doing a sync flip > > > > Cc: Karthik B S > > Cc: Vandita Kulkarni > > Cc: Ville Syrjälä > > Cc: Rodrigo Vivi > > Signed-off-by: José Roberto de Souza > > --- > > drivers/gpu/drm/i915/display/intel_psr.c | 37 ++-- > > 1 file changed, 21 insertions(+), 16 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/display/intel_psr.c > > b/drivers/gpu/drm/i915/display/intel_psr.c > > index 9d589d471e335..b8fac53d57df1 100644 > > --- a/drivers/gpu/drm/i915/display/intel_psr.c > > +++ b/drivers/gpu/drm/i915/display/intel_psr.c > > @@ -731,12 +731,6 @@ static bool intel_psr2_sel_fetch_config_valid(struct > > intel_dp *intel_dp, > > return false; > > } > > > > - if (crtc_state->uapi.async_flip) { > > - drm_dbg_kms(&dev_priv->drm, > > - "PSR2 sel fetch not enabled, async flip enabled\n"); > > - return false; > > - } > > - > > /* Wa_14010254185 Wa_14010103792 */ > > if (IS_TGL_DISPLAY_STEP(dev_priv, STEP_A0, STEP_C0)) { > > drm_dbg_kms(&dev_priv->drm, > > @@ -1780,36 +1774,47 @@ void intel_psr_pre_plane_update(struct > > intel_atomic_state *state, > > if (psr->enabled && needs_to_disable) > > intel_psr_disable_locked(intel_dp); > > > > + if (psr->enabled && crtc_state->uapi.async_flip) > > + intel_psr_exit(intel_dp); > > + > > mutex_unlock(&psr->lock); > > } > > } > > > > static void _intel_psr_post_plane_update(const struct intel_atomic_state > > *state, > > -const struct intel_crtc_state > > *crtc_state) > > +const struct intel_crtc_state > > *old_crtc_state, > > +const struct intel_crtc_state > > *new_crtc_state) > > Might make sense to change this to match how psr_pre_plane_update() > works these days. Will do as follow up. > > > { > > struct drm_i915_private *dev_priv = to_i915(state->base.dev); > > struct intel_encoder *encoder; > > > > - if (!crtc_state->has_psr) > > + if (!new_crtc_state->has_psr) > > return; > > > > for_each_intel_encoder_mask_with_psr(state->base.dev, encoder, > > -crtc_state->uapi.encoder_mask) { > > +new_crtc_state->uapi.encoder_mask) > > { > > struct intel_dp *intel_dp = enc_to_intel_dp(encoder); > > struct intel_psr *psr = &intel_dp->psr; > > > > mutex_lock(&psr->lock); > > > > - drm_WARN_ON(&dev_priv->drm, psr->enabled && > > !crtc_state->active_planes); > > + drm_WARN_ON(&dev_priv->drm, psr->enabled && > > + !new_crtc_state->active_planes); > > > > /* Only enable if there is active planes */ > > - if (!psr->enabled && crtc_state->active_planes) > > - intel_psr_enable_locked(intel_dp, crtc_state); > > + if (!psr->enabled && new_crtc_state->active_planes) > > + intel_psr_enable_locked(intel_dp, new_crtc_state); > > What prevents this guy from activating PSR while we're doing > an async flip? enabled != active, when doing a async flip it will set active = false but enabled will be kept on. And to change the number of active_planes it will need to do a sync flip, so we are safe. > > > > > /* Force a PSR exit when enabling CRC to avoid CRC timeouts */ > > - if (crtc_state->crc_enabled && psr->enabled) > > + if (new_crtc_state->crc_enabled && psr->enabled) > > psr_force_hw_tracking_exit(intel_dp); > > > > + /* Only re enabling PSR when doing a sync flip */ > > + if (psr->enabled && !psr->active && > > + old_crtc_state->uapi.async_flip && > > + !new_crtc_state->uapi.async_flip) > > + schedule_work(&intel_dp->psr.work); > > + > > mutex_unlock(&psr->lock); > > } > > } > > @@ -1817,15 +1822,15 @@ static void _intel_psr_post_plane_update(const > > struct intel_atomic_state *state, > > void intel_psr_post_plane_update(const struct intel_atomic_state *state) > > { > > struct drm_i915_private *dev_priv = t
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
On Thu, 04 Nov 2021, Sam Ravnborg wrote: > Hi Javier, > > On Thu, Nov 04, 2021 at 05:07:06PM +0100, Javier Martinez Canillas wrote: >> Some DRM drivers check the vgacon_text_force() function return value as an >> indication on whether they should be allowed to be enabled or not. >> >> This function returns true if the nomodeset kernel command line parameter >> was set. But there may be other conditions besides this to determine if a >> driver should be enabled. >> >> Let's add a drm_drv_enabled() helper function to encapsulate that logic so >> can be later extended if needed, without having to modify all the drivers. >> >> Also, while being there do some cleanup. The vgacon_text_force() function >> is guarded by CONFIG_VGA_CONSOLE and there's no need for callers to do it. >> >> Suggested-by: Thomas Zimmermann >> Signed-off-by: Javier Martinez Canillas >> --- >> >> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c >> index 8214a0b1ab7f..3fb567d62881 100644 >> --- a/drivers/gpu/drm/drm_drv.c >> +++ b/drivers/gpu/drm/drm_drv.c >> @@ -975,6 +975,26 @@ int drm_dev_set_unique(struct drm_device *dev, const >> char *name) >> } >> EXPORT_SYMBOL(drm_dev_set_unique); >> >> +/** >> + * drm_drv_enabled - Checks if a DRM driver can be enabled >> + * @driver: DRM driver to check >> + * >> + * Checks whether a DRM driver can be enabled or not. This may be the case >> + * if the "nomodeset" kernel command line parameter is used. >> + * >> + * Return: 0 on success or a negative error code on failure. >> + */ >> +int drm_drv_enabled(const struct drm_driver *driver) >> +{ >> +if (vgacon_text_force()) { >> +DRM_INFO("%s driver is disabled\n", driver->name); > > DRM_INFO is deprecated, please do not use it in new code. > Also other users had an error message and not just info - is info > enough? > > >> +return -ENODEV; >> +} >> + >> +return 0; >> +} >> +EXPORT_SYMBOL(drm_drv_enabled); >> + >> /* >> * DRM Core >> * The DRM core module initializes all global DRM objects and makes them >> diff --git a/drivers/gpu/drm/i915/i915_module.c >> b/drivers/gpu/drm/i915/i915_module.c >> index ab2295dd4500..45cb3e540eff 100644 >> --- a/drivers/gpu/drm/i915/i915_module.c >> +++ b/drivers/gpu/drm/i915/i915_module.c >> @@ -18,9 +18,12 @@ >> #include "i915_selftest.h" >> #include "i915_vma.h" >> >> +static const struct drm_driver driver; > Hmmm... > >> + >> static int i915_check_nomodeset(void) >> { >> bool use_kms = true; >> +int ret; >> >> /* >> * Enable KMS by default, unless explicitly overriden by >> @@ -31,7 +34,8 @@ static int i915_check_nomodeset(void) >> if (i915_modparams.modeset == 0) >> use_kms = false; >> >> -if (vgacon_text_force() && i915_modparams.modeset == -1) >> +ret = drm_drv_enabled(&driver); > > You pass the local driver variable here - which looks wrong as this is > not the same as the driver variable declared in another file. Indeed. > Maybe move the check to new function you can add to init_funcs, > and locate the new function in i915_drv - so it has access to driver? We don't really want that, though. This check is pretty much as early as it can be, and there's a ton of useless initialization that would happen if we waited until drm_driver is available. >From my POV, drm_drv_enabled() is a solution that creates a worse problem for us than it solves. BR, Jani. > > > Sam -- Jani Nikula, Intel Open Source Graphics Center
[Intel-gfx] ✓ Fi.CI.IGT: success for kernel/locking: Add context to ww_mutex_trylock. (rev5)
== Series Details == Series: kernel/locking: Add context to ww_mutex_trylock. (rev5) URL : https://patchwork.freedesktop.org/series/94437/ State : success == Summary == CI Bug Log - changes from CI_DRM_10840_full -> Patchwork_21516_full Summary --- **SUCCESS** No regressions found. Participating hosts (11 -> 11) -- No changes in participating hosts Possible new issues --- Here are the unknown changes that may have been introduced in Patchwork_21516_full: ### IGT changes ### Suppressed The following results come from untrusted machines, tests, or statuses. They do not affect the overall result. * igt@kms_big_fb@y-tiled-16bpp-rotate-90: - {shard-rkl}:[PASS][1] -> [SKIP][2] +3 similar issues [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@y-tiled-16bpp-rotate-90.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-rkl-2/igt@kms_big...@y-tiled-16bpp-rotate-90.html * igt@kms_big_fb@y-tiled-8bpp-rotate-90: - {shard-rkl}:[SKIP][3] ([fdo#111614]) -> [SKIP][4] [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@y-tiled-8bpp-rotate-90.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-rkl-2/igt@kms_big...@y-tiled-8bpp-rotate-90.html * igt@kms_big_fb@yf-tiled-64bpp-rotate-90: - {shard-rkl}:[SKIP][5] ([fdo#111615]) -> [SKIP][6] [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@yf-tiled-64bpp-rotate-90.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-rkl-2/igt@kms_big...@yf-tiled-64bpp-rotate-90.html * igt@kms_flip_tiling@flip-change-tiling: - {shard-rkl}:NOTRUN -> [SKIP][7] +15 similar issues [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-rkl-2/igt@kms_flip_til...@flip-change-tiling.html Known issues Here are the changes found in Patchwork_21516_full that come from known issues: ### IGT changes ### Issues hit * igt@gem_eio@in-flight-contexts-immediate: - shard-iclb: [PASS][8] -> [TIMEOUT][9] ([i915#3070]) [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-iclb4/igt@gem_...@in-flight-contexts-immediate.html [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-iclb8/igt@gem_...@in-flight-contexts-immediate.html * igt@gem_exec_capture@pi@bcs0: - shard-skl: [PASS][10] -> [INCOMPLETE][11] ([i915#2369]) [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-skl8/igt@gem_exec_capture@p...@bcs0.html [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-skl8/igt@gem_exec_capture@p...@bcs0.html * igt@gem_exec_fair@basic-pace-solo@rcs0: - shard-kbl: [PASS][12] -> [FAIL][13] ([i915#2842]) +1 similar issue [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-kbl3/igt@gem_exec_fair@basic-pace-s...@rcs0.html [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-kbl6/igt@gem_exec_fair@basic-pace-s...@rcs0.html * igt@gem_exec_fair@basic-pace@vecs0: - shard-tglb: [PASS][14] -> [FAIL][15] ([i915#2842]) [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-tglb5/igt@gem_exec_fair@basic-p...@vecs0.html [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-tglb5/igt@gem_exec_fair@basic-p...@vecs0.html * igt@gem_exec_fair@basic-throttle@rcs0: - shard-glk: [PASS][16] -> [FAIL][17] ([i915#2842]) [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-glk5/igt@gem_exec_fair@basic-throt...@rcs0.html [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-glk6/igt@gem_exec_fair@basic-throt...@rcs0.html * igt@gem_pread@exhaustion: - shard-apl: NOTRUN -> [WARN][18] ([i915#2658]) [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-apl4/igt@gem_pr...@exhaustion.html - shard-kbl: NOTRUN -> [WARN][19] ([i915#2658]) [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-kbl1/igt@gem_pr...@exhaustion.html * igt@gem_pwrite@basic-exhaustion: - shard-skl: NOTRUN -> [WARN][20] ([i915#2658]) [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-skl4/igt@gem_pwr...@basic-exhaustion.html * igt@gem_userptr_blits@coherency-sync: - shard-tglb: NOTRUN -> [SKIP][21] ([fdo#110542]) [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-tglb8/igt@gem_userptr_bl...@coherency-sync.html * igt@gem_userptr_blits@dmabuf-sync: - shard-kbl: NOTRUN -> [SKIP][22] ([fdo#109271] / [i915#3323]) [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21516/shard-kbl3/igt@gem_userptr_bl...@dmabuf-sync.html * igt@gem_userptr_bli
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
Hello Sam, On 11/4/21 18:57, Jani Nikula wrote: > On Thu, 04 Nov 2021, Sam Ravnborg wrote: >> Hi Javier, >> >> On Thu, Nov 04, 2021 at 05:07:06PM +0100, Javier Martinez Canillas wrote: >>> Some DRM drivers check the vgacon_text_force() function return value as an >>> indication on whether they should be allowed to be enabled or not. >>> >>> This function returns true if the nomodeset kernel command line parameter >>> was set. But there may be other conditions besides this to determine if a >>> driver should be enabled. >>> >>> Let's add a drm_drv_enabled() helper function to encapsulate that logic so >>> can be later extended if needed, without having to modify all the drivers. >>> >>> Also, while being there do some cleanup. The vgacon_text_force() function >>> is guarded by CONFIG_VGA_CONSOLE and there's no need for callers to do it. >>> >>> Suggested-by: Thomas Zimmermann >>> Signed-off-by: Javier Martinez Canillas >>> --- >>> >>> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c >>> index 8214a0b1ab7f..3fb567d62881 100644 >>> --- a/drivers/gpu/drm/drm_drv.c >>> +++ b/drivers/gpu/drm/drm_drv.c >>> @@ -975,6 +975,26 @@ int drm_dev_set_unique(struct drm_device *dev, const >>> char *name) >>> } >>> EXPORT_SYMBOL(drm_dev_set_unique); >>> >>> +/** >>> + * drm_drv_enabled - Checks if a DRM driver can be enabled >>> + * @driver: DRM driver to check >>> + * >>> + * Checks whether a DRM driver can be enabled or not. This may be the case >>> + * if the "nomodeset" kernel command line parameter is used. >>> + * >>> + * Return: 0 on success or a negative error code on failure. >>> + */ >>> +int drm_drv_enabled(const struct drm_driver *driver) >>> +{ >>> + if (vgacon_text_force()) { >>> + DRM_INFO("%s driver is disabled\n", driver->name); >> >> DRM_INFO is deprecated, please do not use it in new code. >> Also other users had an error message and not just info - is info >> enough? >> Thanks, I didn't know that. Right, they had an error but I do wonder if that was correct though. After all isn't an error but an explicit disable due "nomodeset" being set in the kernel command line. [snip] >>> >>> - if (vgacon_text_force() && i915_modparams.modeset == -1) >>> + ret = drm_drv_enabled(&driver); >> >> You pass the local driver variable here - which looks wrong as this is >> not the same as the driver variable declared in another file. > Yes, Jani mentioned it already. I got confused and thought that the driver variable was also defined in the same compilation unit... Maybe I could squash the following change? diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index b18a250e5d2e..b8f399b76363 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -89,7 +89,7 @@ #include "intel_region_ttm.h" #include "vlv_suspend.h" -static const struct drm_driver driver; +const struct drm_driver driver; static int i915_get_bridge_dev(struct drm_i915_private *dev_priv) { @@ -1777,7 +1777,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_GEM_VM_DESTROY, i915_gem_vm_destroy_ioctl, DRM_RENDER_ALLOW), }; -static const struct drm_driver driver = { +const struct drm_driver driver = { /* Don't use MTRRs here; the Xserver or userspace app should * deal with them for Intel hardware. */ diff --git a/drivers/gpu/drm/i915/i915_module.c b/drivers/gpu/drm/i915/i915_module.c index c890c1ca20c4..88f770920324 100644 --- a/drivers/gpu/drm/i915/i915_module.c +++ b/drivers/gpu/drm/i915/i915_module.c @@ -16,7 +16,7 @@ #include "i915_selftest.h" #include "i915_vma.h" -static const struct drm_driver driver; +extern const struct drm_driver driver; static int i915_check_nomodeset(void) { That should work and I actually got a laptop with an i915 and tested the change both when CONFIG_DRM_I915=m and CONFIG_DRM_I915=y is set. Another option is to declare it in i915_drv.h and not make the definition static. > Indeed. > >> Maybe move the check to new function you can add to init_funcs, >> and locate the new function in i915_drv - so it has access to driver? > > We don't really want that, though. This check is pretty much as early as > it can be, and there's a ton of useless initialization that would happen > if we waited until drm_driver is available. > Agreed. > From my POV, drm_drv_enabled() is a solution that creates a worse > problem for us than it solves. > I don't have a strong opinion on this. I could just do patch #2 without adding a level of indirection through drm_drv_enabled(). But Thomas and Daniel Vetter suggested that we should do this change before. That is, the drivers could just check if should be enabled by calling to the drm_check_modeset() function directly if people agree that encapsulating that logic in a drm_drv_enabled() is not needed. > > BR, > Jani. > Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat
[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/fbc: Prep work for multiple FBC instances
== Series Details == Series: drm/i915/fbc: Prep work for multiple FBC instances URL : https://patchwork.freedesktop.org/series/96574/ State : warning == Summary == $ dim checkpatch origin/drm-tip 7fa3e082ea85 drm/i915/fbc: Exract snb_fbc_program_fence() e1a5292108ab drm/i915/fbc: Extract {skl, glk}_fbc_program_cfb_stride() fc541fc8c2a7 drm/i915/fbc: Just use params->fence_y_offset always b1275bed2070 drm/i915/fbc: Introduce intel_fbc_is_compressing() 1390bd7243c3 drm/i915/fbc: Extract helpers to compute FBC control register values 05ce4c3071c0 drm/i915/fbc: Introduce intel_fbc_funcs 991051ec457e drm/i915/fbc: Introduce .nuke() vfunc 02c4e4bb8f9d drm/i915/fbc: s/gen7/ivb/ e55fd73632d8 drm/i915/fbc: Introduce .program_cfb() vfunc 412acd0ad146 drm/i915/fbc: Introduce intel_fbc_set_false_color() 32266e2be84c drm/i915/fbc: Nuke BDW_FBC_COMP_SEG_MASK a78d97623284 drm/i915/fbc: Clean up all register defines -:131: WARNING:LONG_LINE: line length of 101 exceeds 100 columns #131: FILE: drivers/gpu/drm/i915/i915_reg.h:3353: +#define DPFC_CTL_PLANE_G4X(i9xx_plane) REG_FIELD_PREP(DPFC_CTL_PLANE_MASK_G4X, (i9xx_plane)) -:134: WARNING:LONG_LINE: line length of 101 exceeds 100 columns #134: FILE: drivers/gpu/drm/i915/i915_reg.h:3356: +#define DPFC_CTL_PLANE_IVB(i9xx_plane) REG_FIELD_PREP(DPFC_CTL_PLANE_MASK_IVB, (i9xx_plane)) total: 0 errors, 2 warnings, 0 checks, 243 lines checked 6b0b7ff03e2c drm/i915/fbc: Finish polishing FBC1 registers c057c12826b1 drm/i915: Relocate FBC_LLC_READ_CTRL 1d79dbe56509 drm/i915/fbc: s/dev_priv/i915/ -:456: WARNING:LONG_LINE: line length of 212 exceeds 100 columns #456: FILE: drivers/gpu/drm/i915/display/intel_fbc.c:759: + drm_info_once(&i915->drm, "not enough stolen space for compressed buffer (need %d more bytes), disabling. Hint: you may be able to increase stolen memory size in the BIOS to avoid this.\n", size); total: 0 errors, 1 warnings, 0 checks, 1255 lines checked d1bb3d3caea2 drm/i915/fbc: Start passing around intel_fbc 99847819aedc drm/1915/fbc: Replace plane->has_fbc with a pointer to the fbc instance
[Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915/fbc: Prep work for multiple FBC instances
== Series Details == Series: drm/i915/fbc: Prep work for multiple FBC instances URL : https://patchwork.freedesktop.org/series/96574/ State : warning == Summary == $ make htmldocs 2>&1 > /dev/null | grep i915 ./drivers/gpu/drm/i915/display/intel_fbc.c:635: warning: Excess function parameter 'i915' description in 'intel_fbc_is_active' ./drivers/gpu/drm/i915/display/intel_fbc.c:1638: warning: Excess function parameter 'i915' description in 'intel_fbc_handle_fifo_underrun_irq' ./drivers/gpu/drm/i915/display/intel_fbc.c:635: warning: Function parameter or member 'fbc' not described in 'intel_fbc_is_active' ./drivers/gpu/drm/i915/display/intel_fbc.c:635: warning: Excess function parameter 'i915' description in 'intel_fbc_is_active' ./drivers/gpu/drm/i915/display/intel_fbc.c:1638: warning: Function parameter or member 'fbc' not described in 'intel_fbc_handle_fifo_underrun_irq' ./drivers/gpu/drm/i915/display/intel_fbc.c:1638: warning: Excess function parameter 'i915' description in 'intel_fbc_handle_fifo_underrun_irq'
[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
== Series Details == Series: drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks URL : https://patchwork.freedesktop.org/series/96571/ State : failure == Summary == CI Bug Log - changes from CI_DRM_10840_full -> Patchwork_21517_full Summary --- **FAILURE** Serious unknown changes coming with Patchwork_21517_full absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in Patchwork_21517_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI. Participating hosts (11 -> 11) -- No changes in participating hosts Possible new issues --- Here are the unknown changes that may have been introduced in Patchwork_21517_full: ### IGT changes ### Possible regressions * igt@kms_vblank@pipe-c-wait-busy: - shard-apl: NOTRUN -> [INCOMPLETE][1] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-apl2/igt@kms_vbl...@pipe-c-wait-busy.html * igt@perf_pmu@multi-client@bcs0: - shard-skl: [PASS][2] -> [FAIL][3] [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-skl2/igt@perf_pmu@multi-cli...@bcs0.html [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-skl7/igt@perf_pmu@multi-cli...@bcs0.html Suppressed The following results come from untrusted machines, tests, or statuses. They do not affect the overall result. * igt@kms_big_fb@y-tiled-16bpp-rotate-90: - {shard-rkl}:[PASS][4] -> [SKIP][5] +3 similar issues [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@y-tiled-16bpp-rotate-90.html [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-rkl-1/igt@kms_big...@y-tiled-16bpp-rotate-90.html * igt@kms_big_fb@y-tiled-8bpp-rotate-90: - {shard-rkl}:[SKIP][6] ([fdo#111614]) -> [SKIP][7] [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@y-tiled-8bpp-rotate-90.html [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-rkl-1/igt@kms_big...@y-tiled-8bpp-rotate-90.html * igt@kms_big_fb@yf-tiled-64bpp-rotate-90: - {shard-rkl}:[SKIP][8] ([fdo#111615]) -> [SKIP][9] [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-rkl-6/igt@kms_big...@yf-tiled-64bpp-rotate-90.html [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-rkl-1/igt@kms_big...@yf-tiled-64bpp-rotate-90.html * igt@kms_flip_tiling@flip-change-tiling: - {shard-rkl}:NOTRUN -> [SKIP][10] +35 similar issues [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-rkl-1/igt@kms_flip_til...@flip-change-tiling.html Known issues Here are the changes found in Patchwork_21517_full that come from known issues: ### IGT changes ### Issues hit * igt@feature_discovery@psr2: - shard-iclb: NOTRUN -> [SKIP][11] ([i915#658]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-iclb8/igt@feature_discov...@psr2.html * igt@gem_ctx_isolation@preservation-s3@bcs0: - shard-tglb: [PASS][12] -> [INCOMPLETE][13] ([i915#456]) [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-tglb6/igt@gem_ctx_isolation@preservation...@bcs0.html [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-tglb7/igt@gem_ctx_isolation@preservation...@bcs0.html * igt@gem_exec_capture@pi@rcs0: - shard-skl: [PASS][14] -> [INCOMPLETE][15] ([i915#2369]) [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-skl8/igt@gem_exec_capture@p...@rcs0.html [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-skl1/igt@gem_exec_capture@p...@rcs0.html * igt@gem_exec_fair@basic-pace@vecs0: - shard-tglb: [PASS][16] -> [FAIL][17] ([i915#2842]) [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-tglb5/igt@gem_exec_fair@basic-p...@vecs0.html [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-tglb3/igt@gem_exec_fair@basic-p...@vecs0.html * igt@gem_exec_fair@basic-throttle@rcs0: - shard-glk: [PASS][18] -> [FAIL][19] ([i915#2842]) [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10840/shard-glk5/igt@gem_exec_fair@basic-throt...@rcs0.html [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-glk8/igt@gem_exec_fair@basic-throt...@rcs0.html * igt@gem_pread@exhaustion: - shard-apl: NOTRUN -> [WARN][20] ([i915#2658]) [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/shard-apl2/igt@gem_pr...@exhaustion.html - shard-kbl: NOTRUN -> [WARN][21] ([i915#2658]) [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21517/sha
[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/fbc: Prep work for multiple FBC instances
== Series Details == Series: drm/i915/fbc: Prep work for multiple FBC instances URL : https://patchwork.freedesktop.org/series/96574/ State : success == Summary == CI Bug Log - changes from CI_DRM_10841 -> Patchwork_21518 Summary --- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/index.html Participating hosts (38 -> 35) -- Additional (2): fi-tgl-1115g4 fi-tgl-u2 Missing(5): fi-bdw-5557u bat-dg1-6 bat-dg1-5 fi-bsw-cyan bat-adlp-4 Known issues Here are the changes found in Patchwork_21518 that come from known issues: ### IGT changes ### Issues hit * igt@amdgpu/amd_basic@query-info: - fi-tgl-1115g4: NOTRUN -> [SKIP][1] ([fdo#109315]) [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@amdgpu/amd_ba...@query-info.html * igt@amdgpu/amd_cs_nop@nop-gfx0: - fi-tgl-1115g4: NOTRUN -> [SKIP][2] ([fdo#109315] / [i915#2575]) +16 similar issues [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@amdgpu/amd_cs_...@nop-gfx0.html * igt@gem_huc_copy@huc-copy: - fi-tgl-u2: NOTRUN -> [SKIP][3] ([i915#2190]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-u2/igt@gem_huc_c...@huc-copy.html - fi-tgl-1115g4: NOTRUN -> [SKIP][4] ([i915#2190]) [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@gem_huc_c...@huc-copy.html * igt@i915_pm_backlight@basic-brightness: - fi-tgl-1115g4: NOTRUN -> [SKIP][5] ([i915#1155]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@i915_pm_backli...@basic-brightness.html * igt@kms_chamelium@common-hpd-after-suspend: - fi-tgl-1115g4: NOTRUN -> [SKIP][6] ([fdo#111827]) +8 similar issues [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@kms_chamel...@common-hpd-after-suspend.html * igt@kms_chamelium@dp-hpd-fast: - fi-tgl-u2: NOTRUN -> [SKIP][7] ([fdo#109284] / [fdo#111827]) +8 similar issues [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-u2/igt@kms_chamel...@dp-hpd-fast.html * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic: - fi-tgl-u2: NOTRUN -> [SKIP][8] ([i915#4103]) +1 similar issue [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-u2/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html - fi-tgl-1115g4: NOTRUN -> [SKIP][9] ([i915#4103]) +1 similar issue [9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html * igt@kms_force_connector_basic@force-load-detect: - fi-tgl-1115g4: NOTRUN -> [SKIP][10] ([fdo#109285]) [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@kms_force_connector_ba...@force-load-detect.html - fi-tgl-u2: NOTRUN -> [SKIP][11] ([fdo#109285]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-u2/igt@kms_force_connector_ba...@force-load-detect.html * igt@kms_frontbuffer_tracking@basic: - fi-cml-u2: [PASS][12] -> [DMESG-WARN][13] ([i915#4269]) [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-cml-u2/igt@kms_frontbuffer_track...@basic.html * igt@kms_psr@primary_mmap_gtt: - fi-tgl-1115g4: NOTRUN -> [SKIP][14] ([i915#1072]) +3 similar issues [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@kms_psr@primary_mmap_gtt.html * igt@prime_vgem@basic-userptr: - fi-tgl-u2: NOTRUN -> [SKIP][15] ([i915#3301]) [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-u2/igt@prime_v...@basic-userptr.html - fi-tgl-1115g4: NOTRUN -> [SKIP][16] ([i915#3301]) [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/fi-tgl-1115g4/igt@prime_v...@basic-userptr.html [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284 [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285 [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315 [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827 [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072 [i915#1155]: https://gitlab.freedesktop.org/drm/intel/issues/1155 [i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190 [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575 [i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301 [i915#4103]: https://gitlab.freedesktop.org/drm/intel/issues/4103 [i915#4269]: https://gitlab.freedesktop.org/drm/intel/issues/4269 Build changes -
[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private
== Series Details == Series: series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private URL : https://patchwork.freedesktop.org/series/96578/ State : warning == Summary == $ dim checkpatch origin/drm-tip eaff73f1c59d drm/i915/audio: group audio under anonymous struct in drm_i915_private b71eaad880d2 drm/i915/audio: name the audio sub-struct in drm_i915_private -:325: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "audio.lpe.platdev" #325: FILE: drivers/gpu/drm/i915/display/intel_audio.c:1408: + if ((dev_priv)->audio.lpe.platdev != NULL) -:338: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "audio.lpe.platdev" #338: FILE: drivers/gpu/drm/i915/display/intel_lpe_audio.c:77: +#define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->audio.lpe.platdev != NULL) -:347: CHECK:MULTIPLE_ASSIGNMENTS: multiple assignments should be avoided #347: FILE: drivers/gpu/drm/i915/display/intel_lpe_audio.c:99: + rsc[0].start= rsc[0].end = dev_priv->audio.lpe.irq; total: 0 errors, 0 warnings, 3 checks, 441 lines checked ba85b7efe4cf drm/i915/audio: define the audio struct separately from drm_i915_private 81199ff96aa3 drm/i915/audio: move intel_audio_funcs internal to intel_audio.c 86620a390924 drm/i915/audio: clean up LPE audio init/cleanup calls 3d26d2e9512b drm/i915/audio: rename intel_init_audio_hooks to intel_audio_hooks_init
[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private
== Series Details == Series: series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private URL : https://patchwork.freedesktop.org/series/96578/ State : warning == Summary == $ dim sparse --fast origin/drm-tip Sparse version: v0.6.2 Fast mode used, each commit won't be checked separately. - +drivers/gpu/drm/i915/gt/intel_engine_stats.h:28:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:28:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:28:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:33:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:33:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:51:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:51:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:51:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:57:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_engine_stats.h:57:9: warning: trying to copy expression type 31 +drivers/gpu/drm/i915/gt/intel_reset.c:1392:5: warning: context imbalance in 'intel_gt_reset_trylock' - different lock contexts for basic block +drivers/gpu/drm/i915/i915_perf.c:1442:15: warning: memset with byte count of 16777216 +drivers/gpu/drm/i915/i915_perf.c:1496:15: warning: memset with byte count of 16777216 +./include/asm-generic/bitops/find.h:112:45: warning: shift count is negative (-262080) +./include/asm-generic/bitops/find.h:32:31: warning: shift count is negative (-262080) +./include/linux/spinlock.h:418:9: warning: context imbalance in 'fwtable_read16' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'fwtable_read32' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'fwtable_read64' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'fwtable_read8' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'fwtable_write16' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'fwtable_write32' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'fwtable_write8' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'gen6_write16' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'gen6_write32' - different lock contexts for basic block +./include/linux/spinlock.h:418:9: warning: context imbalance in 'gen6_write8' - different lock contexts for basic block
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
Hi Javier, > > >>> > >>> - if (vgacon_text_force() && i915_modparams.modeset == -1) > >>> + ret = drm_drv_enabled(&driver); > >> > >> You pass the local driver variable here - which looks wrong as this is > >> not the same as the driver variable declared in another file. > > > > Yes, Jani mentioned it already. I got confused and thought that the driver > variable was also defined in the same compilation unit... > > Maybe I could squash the following change? > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index b18a250e5d2e..b8f399b76363 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -89,7 +89,7 @@ > #include "intel_region_ttm.h" > #include "vlv_suspend.h" > > -static const struct drm_driver driver; > +const struct drm_driver driver; No, variables with such a generic name will clash. Just add a const drm_driver * i915_drm_driver(void) { return &driver; } And then use this function to access the drm_driver variable. Sam
[Intel-gfx] ✗ Fi.CI.BUILD: failure for Cleanups for the nomodeset kernel command line parameter logic (rev4)
== Series Details == Series: Cleanups for the nomodeset kernel command line parameter logic (rev4) URL : https://patchwork.freedesktop.org/series/96527/ State : failure == Summary == Applying: drm: Add a drm_drv_enabled() to check if drivers should be enabled error: sha1 information is lacking or useless (drivers/gpu/drm/i915/i915_module.c). error: could not build fake ancestor hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm: Add a drm_drv_enabled() to check if drivers should be enabled When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private
== Series Details == Series: series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private URL : https://patchwork.freedesktop.org/series/96578/ State : success == Summary == CI Bug Log - changes from CI_DRM_10841 -> Patchwork_21519 Summary --- **SUCCESS** No regressions found. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/index.html Participating hosts (38 -> 36) -- Additional (2): fi-tgl-1115g4 fi-pnv-d510 Missing(4): fi-bsw-cyan bat-adlp-4 bat-dg1-6 bat-dg1-5 Known issues Here are the changes found in Patchwork_21519 that come from known issues: ### IGT changes ### Issues hit * igt@amdgpu/amd_basic@query-info: - fi-tgl-1115g4: NOTRUN -> [SKIP][1] ([fdo#109315]) [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@amdgpu/amd_ba...@query-info.html * igt@amdgpu/amd_cs_nop@nop-gfx0: - fi-tgl-1115g4: NOTRUN -> [SKIP][2] ([fdo#109315] / [i915#2575]) +16 similar issues [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@amdgpu/amd_cs_...@nop-gfx0.html * igt@gem_exec_suspend@basic-s3: - fi-bdw-5557u: [PASS][3] -> [INCOMPLETE][4] ([i915#146]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-bdw-5557u/igt@gem_exec_susp...@basic-s3.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-bdw-5557u/igt@gem_exec_susp...@basic-s3.html * igt@gem_huc_copy@huc-copy: - fi-tgl-1115g4: NOTRUN -> [SKIP][5] ([i915#2190]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@gem_huc_c...@huc-copy.html * igt@i915_pm_backlight@basic-brightness: - fi-tgl-1115g4: NOTRUN -> [SKIP][6] ([i915#1155]) [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@i915_pm_backli...@basic-brightness.html * igt@i915_selftest@live@execlists: - fi-bsw-kefka: [PASS][7] -> [INCOMPLETE][8] ([i915#2940]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-bsw-kefka/igt@i915_selftest@l...@execlists.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-bsw-kefka/igt@i915_selftest@l...@execlists.html * igt@i915_selftest@live@hangcheck: - fi-snb-2600:[PASS][9] -> [INCOMPLETE][10] ([i915#3921]) [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-snb-2600/igt@i915_selftest@l...@hangcheck.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-snb-2600/igt@i915_selftest@l...@hangcheck.html * igt@kms_chamelium@common-hpd-after-suspend: - fi-tgl-1115g4: NOTRUN -> [SKIP][11] ([fdo#111827]) +8 similar issues [11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@kms_chamel...@common-hpd-after-suspend.html * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic: - fi-tgl-1115g4: NOTRUN -> [SKIP][12] ([i915#4103]) +1 similar issue [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html * igt@kms_force_connector_basic@force-load-detect: - fi-tgl-1115g4: NOTRUN -> [SKIP][13] ([fdo#109285]) [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@kms_force_connector_ba...@force-load-detect.html * igt@kms_psr@primary_mmap_gtt: - fi-tgl-1115g4: NOTRUN -> [SKIP][14] ([i915#1072]) +3 similar issues [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@kms_psr@primary_mmap_gtt.html * igt@prime_vgem@basic-userptr: - fi-pnv-d510:NOTRUN -> [SKIP][15] ([fdo#109271]) +53 similar issues [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-pnv-d510/igt@prime_v...@basic-userptr.html - fi-tgl-1115g4: NOTRUN -> [SKIP][16] ([i915#3301]) [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-tgl-1115g4/igt@prime_v...@basic-userptr.html * igt@runner@aborted: - fi-bsw-kefka: NOTRUN -> [FAIL][17] ([fdo#109271] / [i915#1436] / [i915#3428] / [i915#4312]) [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-bsw-kefka/igt@run...@aborted.html Possible fixes * igt@i915_selftest@live@hangcheck: - {fi-hsw-gt1}: [DMESG-WARN][18] ([i915#3303]) -> [PASS][19] [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-hsw-gt1/igt@i915_selftest@l...@hangcheck.html [19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/fi-hsw-gt1/igt@i915_selftest@l...@hangcheck.html {name}: This element is suppressed. This means it is ignored when computing the status of the difference (SUCCESS, WARNING, or FAILURE). [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271 [fdo#109285]: https://bugs.freedesktop.org/show
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
On Thu, 04 Nov 2021, Sam Ravnborg wrote: > Hi Javier, > >> >> >>> >> >>> -if (vgacon_text_force() && i915_modparams.modeset == -1) >> >>> +ret = drm_drv_enabled(&driver); >> >> >> >> You pass the local driver variable here - which looks wrong as this is >> >> not the same as the driver variable declared in another file. >> > >> >> Yes, Jani mentioned it already. I got confused and thought that the driver >> variable was also defined in the same compilation unit... >> >> Maybe I could squash the following change? >> >> diff --git a/drivers/gpu/drm/i915/i915_drv.c >> b/drivers/gpu/drm/i915/i915_drv.c >> index b18a250e5d2e..b8f399b76363 100644 >> --- a/drivers/gpu/drm/i915/i915_drv.c >> +++ b/drivers/gpu/drm/i915/i915_drv.c >> @@ -89,7 +89,7 @@ >> #include "intel_region_ttm.h" >> #include "vlv_suspend.h" >> >> -static const struct drm_driver driver; >> +const struct drm_driver driver; > No, variables with such a generic name will clash. > > Just add a > const drm_driver * i915_drm_driver(void) > { > return &driver; > } > > And then use this function to access the drm_driver variable. Agreed on the general principle of exposing interfaces over data. But... why? I'm still at a loss what problem this solves. We pass &driver to exactly one place, devm_drm_dev_alloc(), and it's neatly hidden away. BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
On Thu, 04 Nov 2021, Javier Martinez Canillas wrote: > +/** > + * drm_drv_enabled - Checks if a DRM driver can be enabled > + * @driver: DRM driver to check > + * > + * Checks whether a DRM driver can be enabled or not. This may be the case > + * if the "nomodeset" kernel command line parameter is used. > + * > + * Return: 0 on success or a negative error code on failure. > + */ > +int drm_drv_enabled(const struct drm_driver *driver) > +{ > + if (vgacon_text_force()) { > + DRM_INFO("%s driver is disabled\n", driver->name); > + return -ENODEV; > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_drv_enabled); The name implies a bool return, but it's not. if (drm_drv_enabled(...)) { /* surprise, it's disabled! */ } BR, Jani. -- Jani Nikula, Intel Open Source Graphics Center
[Intel-gfx] [PATCH v5 1/3] drm: Move drm_color_lut_check implementation internal to intel_color
From: Mark Yacoub [Why] The tests of LUT_EQUAL_CHANNELS and LUT_NON_DECREASING are currently unique to i915 driver. Freeing up the function name for the more generic LUT checks to folllow Tested on Eldrid ChromeOS (TGL). v2: 1. Convert the enum to #define. 2. Add INTEL_COLOR_ prefix. v1: Stuff the test function from DRM to intel driver. Signed-off-by: Mark Yacoub --- drivers/gpu/drm/drm_color_mgmt.c | 43 -- drivers/gpu/drm/i915/display/intel_color.c | 43 +++--- drivers/gpu/drm/i915/display/intel_color.h | 16 drivers/gpu/drm/i915/i915_pci.c| 28 -- include/drm/drm_color_mgmt.h | 27 -- 5 files changed, 71 insertions(+), 86 deletions(-) diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index bb14f488c8f6c..16a07f84948f3 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -583,46 +583,3 @@ int drm_plane_create_color_properties(struct drm_plane *plane, return 0; } EXPORT_SYMBOL(drm_plane_create_color_properties); - -/** - * drm_color_lut_check - check validity of lookup table - * @lut: property blob containing LUT to check - * @tests: bitmask of tests to run - * - * Helper to check whether a userspace-provided lookup table is valid and - * satisfies hardware requirements. Drivers pass a bitmask indicating which of - * the tests in &drm_color_lut_tests should be performed. - * - * Returns 0 on success, -EINVAL on failure. - */ -int drm_color_lut_check(const struct drm_property_blob *lut, u32 tests) -{ - const struct drm_color_lut *entry; - int i; - - if (!lut || !tests) - return 0; - - entry = lut->data; - for (i = 0; i < drm_color_lut_size(lut); i++) { - if (tests & DRM_COLOR_LUT_EQUAL_CHANNELS) { - if (entry[i].red != entry[i].blue || - entry[i].red != entry[i].green) { - DRM_DEBUG_KMS("All LUT entries must have equal r/g/b\n"); - return -EINVAL; - } - } - - if (i > 0 && tests & DRM_COLOR_LUT_NON_DECREASING) { - if (entry[i].red < entry[i - 1].red || - entry[i].green < entry[i - 1].green || - entry[i].blue < entry[i - 1].blue) { - DRM_DEBUG_KMS("LUT entries must never decrease.\n"); - return -EINVAL; - } - } - } - - return 0; -} -EXPORT_SYMBOL(drm_color_lut_check); diff --git a/drivers/gpu/drm/i915/display/intel_color.c b/drivers/gpu/drm/i915/display/intel_color.c index dab892d2251ba..1469871d21ff9 100644 --- a/drivers/gpu/drm/i915/display/intel_color.c +++ b/drivers/gpu/drm/i915/display/intel_color.c @@ -1279,13 +1279,46 @@ static int check_lut_size(const struct drm_property_blob *lut, int expected) return 0; } +static int test_luts(const struct drm_property_blob *lut, u32 tests) +{ + const struct drm_color_lut *entry; + int i; + + if (!lut || !tests) + return 0; + + entry = lut->data; + for (i = 0; i < drm_color_lut_size(lut); i++) { + if (tests & INTEL_COLOR_LUT_EQUAL_CHANNELS) { + if (entry[i].red != entry[i].blue || + entry[i].red != entry[i].green) { + DRM_DEBUG_KMS( + "All LUT entries must have equal r/g/b\n"); + return -EINVAL; + } + } + + if (i > 0 && tests & INTEL_COLOR_LUT_NON_DECREASING) { + if (entry[i].red < entry[i - 1].red || + entry[i].green < entry[i - 1].green || + entry[i].blue < entry[i - 1].blue) { + DRM_DEBUG_KMS( + "LUT entries must never decrease.\n"); + return -EINVAL; + } + } + } + + return 0; +} + static int check_luts(const struct intel_crtc_state *crtc_state) { struct drm_i915_private *dev_priv = to_i915(crtc_state->uapi.crtc->dev); const struct drm_property_blob *gamma_lut = crtc_state->hw.gamma_lut; const struct drm_property_blob *degamma_lut = crtc_state->hw.degamma_lut; int gamma_length, degamma_length; - u32 gamma_tests, degamma_tests; + u32 gamma_channels_tests, degamma_channels_tests; /* Always allow legacy gamma LUT with no further checking. */ if (crtc_state_is_legacy_gamma(crtc_state)) @@ -1300,15 +1333,15 @@ static int check_luts(const struct intel_crtc_state *crtc_state) degamma_length = INTEL_INFO(dev_priv)->color.degamma_lut_siz
[Intel-gfx] [PATCH v5 2/3] drm: Add Gamma and Degamma LUT sizes props to drm_crtc to validate.
From: Mark Yacoub [Why] 1. drm_atomic_helper_check doesn't check for the LUT sizes of either Gamma or Degamma props in the new CRTC state, allowing any invalid size to be passed on. 2. Each driver has its own LUT size, which could also be different for legacy users. [How] 1. Create |degamma_lut_size| and |gamma_lut_size| to save the LUT sizes assigned by the driver when it's initializing its color and CTM management. 2. Create drm_atomic_helper_check_crtc which is called by drm_atomic_helper_check to check the LUT sizes saved in drm_crtc that they match the sizes in the new CRTC state. 3. As the LUT size check now happens in drm_atomic_helper_check, remove the lut check in intel_color.c Resolves: igt@kms_color@pipe-A-invalid-gamma-lut-sizes on MTK Tested on Zork (amdgpu) and Jacuzzi (mediatek), volteer (TGL) v3: 1. Check for lut pointer inside drm_check_lut_size. v2: 1. Remove the rename to a parent commit. 2. Create a drm drm_check_lut_size instead of intel only function. v1: 1. Fix typos 2. Remove the LUT size check from intel driver 3. Rename old LUT check to indicate it's a channel change Signed-off-by: Mark Yacoub --- drivers/gpu/drm/drm_atomic_helper.c| 52 ++ drivers/gpu/drm/drm_color_mgmt.c | 19 drivers/gpu/drm/i915/display/intel_color.c | 32 ++--- include/drm/drm_atomic_helper.h| 1 + include/drm/drm_color_mgmt.h | 3 ++ include/drm/drm_crtc.h | 11 + 6 files changed, 99 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index bc3487964fb5e..548e5d8221fb4 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -929,6 +929,54 @@ drm_atomic_helper_check_planes(struct drm_device *dev, } EXPORT_SYMBOL(drm_atomic_helper_check_planes); +/** + * drm_atomic_helper_check_crtcs - validate state object for CRTC changes + * @state: the driver state object + * + * Check the CRTC state object such as the Gamma/Degamma LUT sizes if the new + * state holds them. + * + * RETURNS: + * Zero for success or -errno + */ +int drm_atomic_helper_check_crtcs(struct drm_atomic_state *state) +{ + struct drm_crtc *crtc; + struct drm_crtc_state *new_crtc_state; + int i; + + for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { + if (!new_crtc_state->color_mgmt_changed) + continue; + + if (drm_check_lut_size(new_crtc_state->gamma_lut, + crtc->gamma_lut_size) || + drm_check_lut_size(new_crtc_state->gamma_lut, + crtc->gamma_size)) { + drm_dbg_state( + state->dev, + "Invalid Gamma LUT size. Expected %u/%u, got %u.\n", + crtc->gamma_lut_size, crtc->gamma_size, + drm_color_lut_size(new_crtc_state->gamma_lut)); + return -EINVAL; + } + + if (drm_check_lut_size(new_crtc_state->degamma_lut, + crtc->degamma_lut_size)) { + drm_dbg_state( + state->dev, + "Invalid Degamma LUT size. Expected %u, got %u.\n", + crtc->degamma_lut_size, + drm_color_lut_size( + new_crtc_state->degamma_lut)); + return -EINVAL; + } + } + + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_check_crtcs); + /** * drm_atomic_helper_check - validate state object * @dev: DRM device @@ -974,6 +1022,10 @@ int drm_atomic_helper_check(struct drm_device *dev, if (ret) return ret; + ret = drm_atomic_helper_check_crtcs(state); + if (ret) + return ret; + if (state->legacy_cursor_update) state->async_update = !drm_atomic_helper_async_check(dev, state); diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c index 16a07f84948f3..c85094223b535 100644 --- a/drivers/gpu/drm/drm_color_mgmt.c +++ b/drivers/gpu/drm/drm_color_mgmt.c @@ -166,6 +166,7 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, struct drm_mode_config *config = &dev->mode_config; if (degamma_lut_size) { + crtc->degamma_lut_size = degamma_lut_size; drm_object_attach_property(&crtc->base, config->degamma_lut_property, 0); drm_object_attach_property(&crtc->base, @@ -178,6 +179,7 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, config->ctm_property, 0); if (gamma_lut_size) { + crtc->ga
Re: [Intel-gfx] [PATCH v2 1/2] drm: Add a drm_drv_enabled() to check if drivers should be enabled
Hello Jani, On 11/4/21 20:57, Jani Nikula wrote: > On Thu, 04 Nov 2021, Javier Martinez Canillas wrote: >> +/** >> + * drm_drv_enabled - Checks if a DRM driver can be enabled >> + * @driver: DRM driver to check >> + * >> + * Checks whether a DRM driver can be enabled or not. This may be the case >> + * if the "nomodeset" kernel command line parameter is used. >> + * >> + * Return: 0 on success or a negative error code on failure. >> + */ >> +int drm_drv_enabled(const struct drm_driver *driver) >> +{ >> +if (vgacon_text_force()) { >> +DRM_INFO("%s driver is disabled\n", driver->name); >> +return -ENODEV; >> +} >> + >> +return 0; >> +} >> +EXPORT_SYMBOL(drm_drv_enabled); > > The name implies a bool return, but it's not. > > if (drm_drv_enabled(...)) { > /* surprise, it's disabled! */ > } > It used to return a bool in v2 but Thomas suggested an int instead to have consistency on the errno code that was returned by the callers. I should probably name that function differently to avoid confusion. But I think you are correct and this change is caused too much churn for not that much benefit, specially since is unclear that there might be another condition to prevent a DRM driver to load besides nomodeset. I'll just drop this patch and post only #2 but making drivers to test using the drm_check_modeset() function (which doesn't have a name that implies a bool return). > > BR, > Jani. > > > Best regards, -- Javier Martinez Canillas Linux Engineering Red Hat
Re: [Intel-gfx] [PATCH v5 2/3] drm: Add Gamma and Degamma LUT sizes props to drm_crtc to validate.
On Thu, Nov 4, 2021 at 4:03 PM Mark Yacoub wrote: > > From: Mark Yacoub > > [Why] > 1. drm_atomic_helper_check doesn't check for the LUT sizes of either Gamma > or Degamma props in the new CRTC state, allowing any invalid size to > be passed on. > 2. Each driver has its own LUT size, which could also be different for > legacy users. > > [How] > 1. Create |degamma_lut_size| and |gamma_lut_size| to save the LUT sizes > assigned by the driver when it's initializing its color and CTM > management. > 2. Create drm_atomic_helper_check_crtc which is called by > drm_atomic_helper_check to check the LUT sizes saved in drm_crtc that > they match the sizes in the new CRTC state. > 3. As the LUT size check now happens in drm_atomic_helper_check, remove > the lut check in intel_color.c > > Resolves: igt@kms_color@pipe-A-invalid-gamma-lut-sizes on MTK > Tested on Zork (amdgpu) and Jacuzzi (mediatek), volteer (TGL) > > v3: > 1. Check for lut pointer inside drm_check_lut_size. > > v2: > 1. Remove the rename to a parent commit. > 2. Create a drm drm_check_lut_size instead of intel only function. > > v1: > 1. Fix typos > 2. Remove the LUT size check from intel driver > 3. Rename old LUT check to indicate it's a channel change > > Signed-off-by: Mark Yacoub > --- > drivers/gpu/drm/drm_atomic_helper.c| 52 ++ > drivers/gpu/drm/drm_color_mgmt.c | 19 > drivers/gpu/drm/i915/display/intel_color.c | 32 ++--- > include/drm/drm_atomic_helper.h| 1 + > include/drm/drm_color_mgmt.h | 3 ++ > include/drm/drm_crtc.h | 11 + > 6 files changed, 99 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > b/drivers/gpu/drm/drm_atomic_helper.c > index bc3487964fb5e..548e5d8221fb4 100644 > --- a/drivers/gpu/drm/drm_atomic_helper.c > +++ b/drivers/gpu/drm/drm_atomic_helper.c > @@ -929,6 +929,54 @@ drm_atomic_helper_check_planes(struct drm_device *dev, > } > EXPORT_SYMBOL(drm_atomic_helper_check_planes); > > +/** > + * drm_atomic_helper_check_crtcs - validate state object for CRTC changes > + * @state: the driver state object > + * > + * Check the CRTC state object such as the Gamma/Degamma LUT sizes if the new > + * state holds them. > + * > + * RETURNS: > + * Zero for success or -errno > + */ > +int drm_atomic_helper_check_crtcs(struct drm_atomic_state *state) > +{ > + struct drm_crtc *crtc; > + struct drm_crtc_state *new_crtc_state; > + int i; > + > + for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) { > + if (!new_crtc_state->color_mgmt_changed) > + continue; > + > + if (drm_check_lut_size(new_crtc_state->gamma_lut, > + crtc->gamma_lut_size) || > + drm_check_lut_size(new_crtc_state->gamma_lut, > + crtc->gamma_size)) { > + drm_dbg_state( > + state->dev, > + "Invalid Gamma LUT size. Expected %u/%u, got > %u.\n", > + crtc->gamma_lut_size, crtc->gamma_size, > + > drm_color_lut_size(new_crtc_state->gamma_lut)); > + return -EINVAL; > + } > + > + if (drm_check_lut_size(new_crtc_state->degamma_lut, > + crtc->degamma_lut_size)) { > + drm_dbg_state( > + state->dev, > + "Invalid Degamma LUT size. Expected %u, got > %u.\n", > + crtc->degamma_lut_size, > + drm_color_lut_size( > + new_crtc_state->degamma_lut)); > + return -EINVAL; > + } > + } > + > + return 0; > +} > +EXPORT_SYMBOL(drm_atomic_helper_check_crtcs); > + > /** > * drm_atomic_helper_check - validate state object > * @dev: DRM device > @@ -974,6 +1022,10 @@ int drm_atomic_helper_check(struct drm_device *dev, > if (ret) > return ret; > > + ret = drm_atomic_helper_check_crtcs(state); > + if (ret) > + return ret; > + > if (state->legacy_cursor_update) > state->async_update = !drm_atomic_helper_async_check(dev, > state); > > diff --git a/drivers/gpu/drm/drm_color_mgmt.c > b/drivers/gpu/drm/drm_color_mgmt.c > index 16a07f84948f3..c85094223b535 100644 > --- a/drivers/gpu/drm/drm_color_mgmt.c > +++ b/drivers/gpu/drm/drm_color_mgmt.c > @@ -166,6 +166,7 @@ void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, > struct drm_mode_config *config = &dev->mode_config; > > if (degamma_lut_size) { > + crtc->degamma_lut_size = degamma_lut_size; > drm_object_attach_property(&crtc->base, >
[Intel-gfx] [PATCH 1/2] drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
Some selftests assume that nothing will attempt to grab these bitlocks while they are held by the selftests. With GuC, for example, that is not true because the hanging workloads may cause the GuC code to attempt to grab them for a global reset, and that may cause it to end up sleeping on the bit never waking up. Regardless whether that will be the final solution for GuC, use clear_and_wake_up_bit() pending a more thorough investigation on how this should be handled moving forward. Signed-off-by: Thomas Hellström Reviewed-by: Matthew Brost --- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 8 drivers/gpu/drm/i915/selftests/igt_reset.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c index 7e2d99dd012d..8590419be4c6 100644 --- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c +++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c @@ -528,7 +528,7 @@ static int igt_reset_nop_engine(void *arg) break; } } while (time_before(jiffies, end_time)); - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable(engine); pr_info("%s(%s): %d resets\n", __func__, engine->name, count); @@ -679,7 +679,7 @@ static int igt_reset_fail_engine(void *arg) out: pr_info("%s(%s): %d resets\n", __func__, engine->name, count); skip: - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable(engine); intel_context_put(ce); @@ -824,7 +824,7 @@ static int __igt_reset_engine(struct intel_gt *gt, bool active) if (err) break; } while (time_before(jiffies, end_time)); - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable(engine); pr_info("%s: Completed %lu %s resets\n", engine->name, count, active ? "active" : "idle"); @@ -1165,7 +1165,7 @@ static int __igt_reset_engines(struct intel_gt *gt, if (err) break; } while (time_before(jiffies, end_time)); - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); st_engine_heartbeat_enable_no_pm(engine); pr_info("i915_reset_engine(%s:%s): %lu resets\n", diff --git a/drivers/gpu/drm/i915/selftests/igt_reset.c b/drivers/gpu/drm/i915/selftests/igt_reset.c index 9f8590b868a9..a2838c65f8a5 100644 --- a/drivers/gpu/drm/i915/selftests/igt_reset.c +++ b/drivers/gpu/drm/i915/selftests/igt_reset.c @@ -36,7 +36,7 @@ void igt_global_reset_unlock(struct intel_gt *gt) enum intel_engine_id id; for_each_engine(engine, gt, id) - clear_bit(I915_RESET_ENGINE + id, >->reset.flags); + clear_and_wake_up_bit(I915_RESET_ENGINE + id, >->reset.flags); clear_bit(I915_RESET_BACKOFF, >->reset.flags); wake_up_all(>->reset.queue); -- 2.31.1
[Intel-gfx] [PATCH 2/2] HAX: drm/i915/selftest: Temporarily avoid tainting the kernel on engine reset failure
Signed-off-by: Thomas Hellström --- drivers/gpu/drm/i915/gt/selftest_hangcheck.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c index 8590419be4c6..e57307f82cf0 100644 --- a/drivers/gpu/drm/i915/gt/selftest_hangcheck.c +++ b/drivers/gpu/drm/i915/gt/selftest_hangcheck.c @@ -,8 +,9 @@ static int __igt_reset_engines(struct intel_gt *gt, rq->fence.seqno, rq->context->guc_id.id); i915_request_put(rq); - GEM_TRACE_DUMP(); + /* GEM_TRACE_DUMP(); */ intel_gt_set_wedged(gt); + err = -EIO; goto restore; } -- 2.31.1
Re: [Intel-gfx] [PATCH] drm/i915/pmu: Fix synchronization of PMU callback with reset
On Thu, Nov 04, 2021 at 05:37:37PM +, Tvrtko Ursulin wrote: On 03/11/2021 22:47, Umesh Nerlige Ramappa wrote: Since the PMU callback runs in irq context, it synchronizes with gt reset using the reset count. We could run into a case where the PMU callback could read the reset count before it is updated. This has a potential of corrupting the busyness stats. In addition to the reset count, check if the reset bit is set before capturing busyness. In addition save the previous stats only if you intend to update them. Signed-off-by: Umesh Nerlige Ramappa --- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c index 5cc49c0b3889..d83ade77ca07 100644 --- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c @@ -1183,6 +1183,7 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) u64 total, gt_stamp_saved; unsigned long flags; u32 reset_count; + bool in_reset; spin_lock_irqsave(&guc->timestamp.lock, flags); @@ -1191,7 +1192,9 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) * engine busyness from GuC, so we just use the driver stored * copy of busyness. Synchronize with gt reset using reset_count. */ - reset_count = i915_reset_count(gpu_error); + rcu_read_lock(); + in_reset = test_bit(I915_RESET_BACKOFF, >->reset.flags); + rcu_read_unlock(); I don't really understand the point of rcu_read_lock over test_bit but I guess you copied it from the trylock loop. Yes, I don't see other parts of code using the lock though. I can drop it. *now = ktime_get(); @@ -1201,9 +1204,10 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) * start_gt_clk is derived from GuC state. To get a consistent * view of activity, we query the GuC state only if gt is awake. */ - stats_saved = *stats; - gt_stamp_saved = guc->timestamp.gt_stamp; - if (intel_gt_pm_get_if_awake(gt)) { + if (intel_gt_pm_get_if_awake(gt) && !in_reset) { What is the point of looking at the old value of in_reset here? Gut feeling says if there is a race this does not fix it. I did not figure out from the commit message what does "could read the reset count before it is updated" mean? I thought the point of reading the reset count twice was that you are sure there was no reset while in here, in which case it is safe to update the software copy. I don't easily see what test_bit does on top. This is what I see in the reset flow --- R1) test_and_set_bit(I915_RESET_BACKOFF, >->reset.flags) R2) atomic_inc(>->i915->gpu_error.reset_count) R3) reset prepare R4) do the HW reset The reset count is updated only once above and that's before an actual HW reset happens. PMU callback flow before this patch --- P1) read reset count P2) update stats P3) read reset count P4) if reset count changed, use old stats. if not use updated stats. I am concerned that the PMU flow could run after step (R2). Then we wrongly conclude that the count stayed the same and no HW reset happened. PMU callback flow with this patch --- This would rely on the reset_count only if a reset is not in progress. P0) test_bit for I915_RESET_BACKOFF P1) read reset count if not in reset. if in reset, use old stats P2) update stats P3) read reset count P4) if reset count changed, use old stats. if not use updated stats. Now that I think about it more, I do see one sequence that still needs fixing though - P0, R1, R2, P1 - P4. For that, I think I need to re-read the BACKOFF bit after reading the reset_count for the first time. Modified PMU callback sequence would be: -- M0) test_bit for I915_RESET_BACKOFF M1) read reset count if not in reset, if in reset, use old stats M1.1) test_bit for I915_RESET_BACKOFF. if set, use old stats. if not, use reset_count to synchronize M2) update stats M3) read reset count M4) if reset count changed, use old stats. if not use updated stats. Thanks, Umesh Regards, Tvrtko + stats_saved = *stats; + gt_stamp_saved = guc->timestamp.gt_stamp; + reset_count = i915_reset_count(gpu_error); guc_update_engine_gt_clks(engine); guc_update_pm_timestamp(guc, engine, now); intel_gt_pm_put_async(gt);
[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
== Series Details == Series: series starting with [1/2] drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks URL : https://patchwork.freedesktop.org/series/96593/ State : warning == Summary == $ dim checkpatch origin/drm-tip 5a12af63b16e drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks 26c3d3f543c5 HAX: drm/i915/selftest: Temporarily avoid tainting the kernel on engine reset failure -:11: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one total: 0 errors, 1 warnings, 0 checks, 10 lines checked
[Intel-gfx] ✓ Fi.CI.IGT: success for drm/i915/fbc: Prep work for multiple FBC instances
== Series Details == Series: drm/i915/fbc: Prep work for multiple FBC instances URL : https://patchwork.freedesktop.org/series/96574/ State : success == Summary == CI Bug Log - changes from CI_DRM_10841_full -> Patchwork_21518_full Summary --- **SUCCESS** No regressions found. Participating hosts (11 -> 11) -- No changes in participating hosts Known issues Here are the changes found in Patchwork_21518_full that come from known issues: ### CI changes ### Issues hit * boot: - shard-apl: ([PASS][1], [PASS][2], [PASS][3], [PASS][4], [PASS][5], [PASS][6], [PASS][7], [PASS][8], [PASS][9], [PASS][10], [PASS][11], [PASS][12], [PASS][13], [PASS][14], [PASS][15], [PASS][16], [PASS][17], [PASS][18], [PASS][19], [PASS][20], [PASS][21], [PASS][22], [PASS][23], [PASS][24], [PASS][25]) -> ([PASS][26], [PASS][27], [PASS][28], [PASS][29], [FAIL][30], [PASS][31], [PASS][32], [PASS][33], [PASS][34], [PASS][35], [PASS][36], [PASS][37], [PASS][38], [PASS][39], [PASS][40], [PASS][41], [PASS][42], [PASS][43], [PASS][44], [PASS][45], [PASS][46], [PASS][47], [PASS][48], [PASS][49], [PASS][50]) ([i915#4386]) [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl8/boot.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl8/boot.html [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl8/boot.html [4]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl7/boot.html [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl7/boot.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl7/boot.html [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl7/boot.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl6/boot.html [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl6/boot.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl6/boot.html [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl6/boot.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl4/boot.html [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl4/boot.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl4/boot.html [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl3/boot.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl3/boot.html [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl3/boot.html [18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl3/boot.html [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl2/boot.html [20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl2/boot.html [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl2/boot.html [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl2/boot.html [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl1/boot.html [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl1/boot.html [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-apl1/boot.html [26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl1/boot.html [27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl1/boot.html [28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl1/boot.html [29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl2/boot.html [30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl2/boot.html [31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl2/boot.html [32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl2/boot.html [33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl2/boot.html [34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl3/boot.html [35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl3/boot.html [36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl3/boot.html [37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl4/boot.html [38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl4/boot.html [39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl4/boot.html [40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl6/boot.html [41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl6/boot.html [42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl6/boot.html [43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21518/shard-apl7/boot.html [44]: https://intel-gfx-ci.01.org/tr
[Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks
== Series Details == Series: series starting with [1/2] drm/i915/selftests: Use clear_and_wake_up_bit() for the per-engine reset bitlocks URL : https://patchwork.freedesktop.org/series/96593/ State : failure == Summary == CI Bug Log - changes from CI_DRM_10841 -> Patchwork_21521 Summary --- **FAILURE** Serious unknown changes coming with Patchwork_21521 absolutely need to be verified manually. If you think the reported changes have nothing to do with the changes introduced in Patchwork_21521, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI. External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/index.html Participating hosts (38 -> 35) -- Additional (2): fi-tgl-1115g4 fi-tgl-u2 Missing(5): bat-dg1-6 bat-dg1-5 fi-bsw-cyan fi-icl-u2 bat-adlp-4 Possible new issues --- Here are the unknown changes that may have been introduced in Patchwork_21521: ### IGT changes ### Possible regressions * igt@i915_selftest@live@migrate: - fi-bsw-nick:[PASS][1] -> [DMESG-WARN][2] [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-bsw-nick/igt@i915_selftest@l...@migrate.html [2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-bsw-nick/igt@i915_selftest@l...@migrate.html Known issues Here are the changes found in Patchwork_21521 that come from known issues: ### IGT changes ### Issues hit * igt@amdgpu/amd_basic@query-info: - fi-tgl-1115g4: NOTRUN -> [SKIP][3] ([fdo#109315]) [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-1115g4/igt@amdgpu/amd_ba...@query-info.html * igt@amdgpu/amd_cs_nop@nop-gfx0: - fi-tgl-1115g4: NOTRUN -> [SKIP][4] ([fdo#109315] / [i915#2575]) +16 similar issues [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-1115g4/igt@amdgpu/amd_cs_...@nop-gfx0.html * igt@core_hotunplug@unbind-rebind: - fi-tgl-u2: NOTRUN -> [INCOMPLETE][5] ([i915#4006]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-u2/igt@core_hotunp...@unbind-rebind.html * igt@gem_huc_copy@huc-copy: - fi-tgl-u2: NOTRUN -> [SKIP][6] ([i915#2190]) [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-u2/igt@gem_huc_c...@huc-copy.html - fi-tgl-1115g4: NOTRUN -> [SKIP][7] ([i915#2190]) [7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-1115g4/igt@gem_huc_c...@huc-copy.html * igt@i915_pm_backlight@basic-brightness: - fi-tgl-1115g4: NOTRUN -> [SKIP][8] ([i915#1155]) [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-1115g4/igt@i915_pm_backli...@basic-brightness.html * igt@i915_selftest@live@active: - fi-bsw-nick:[PASS][9] -> [DMESG-FAIL][10] ([i915#2927]) [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-bsw-nick/igt@i915_selftest@l...@active.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-bsw-nick/igt@i915_selftest@l...@active.html * igt@i915_selftest@live@hangcheck: - fi-snb-2600:[PASS][11] -> [INCOMPLETE][12] ([i915#3921]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/fi-snb-2600/igt@i915_selftest@l...@hangcheck.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-snb-2600/igt@i915_selftest@l...@hangcheck.html * igt@kms_chamelium@common-hpd-after-suspend: - fi-tgl-1115g4: NOTRUN -> [SKIP][13] ([fdo#111827]) +8 similar issues [13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-1115g4/igt@kms_chamel...@common-hpd-after-suspend.html * igt@kms_chamelium@dp-hpd-fast: - fi-tgl-u2: NOTRUN -> [SKIP][14] ([fdo#109284] / [fdo#111827]) +8 similar issues [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-u2/igt@kms_chamel...@dp-hpd-fast.html * igt@kms_cursor_legacy@basic-busy-flip-before-cursor-atomic: - fi-tgl-u2: NOTRUN -> [SKIP][15] ([i915#4103]) +1 similar issue [15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-u2/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html - fi-tgl-1115g4: NOTRUN -> [SKIP][16] ([i915#4103]) +1 similar issue [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-1115g4/igt@kms_cursor_leg...@basic-busy-flip-before-cursor-atomic.html * igt@kms_force_connector_basic@force-load-detect: - fi-tgl-1115g4: NOTRUN -> [SKIP][17] ([fdo#109285]) [17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-1115g4/igt@kms_force_connector_ba...@force-load-detect.html - fi-tgl-u2: NOTRUN -> [SKIP][18] ([fdo#109285]) [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21521/fi-tgl-u2/igt@kms_force_connector_ba...@force-load-d
Re: [Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915: Update memory bandwidth formulae (rev9)
On Thu, Nov 04, 2021 at 11:43:31AM -0700, Sripada, Radhakrishna wrote: >Link: [1]File-List > > > > > >From: Patchwork >Sent: Friday, October 15, 2021 6:48 PM >To: Sripada, Radhakrishna >Cc: intel-gfx@lists.freedesktop.org >Subject: ✗ Fi.CI.IGT: failure for drm/i915: Update memory bandwidth >formulae (rev9) > > > >Patch Details > > Series: drm/i915: Update memory bandwidth formulae (rev9) > URL: [2]https://patchwork.freedesktop.org/series/95138/ > State: failure > Details: > [3]https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21357/index.html > > CI Bug Log - changes from CI_DRM_10744_full -> Patchwork_21357_full > > Summary > >FAILURE > >Serious unknown changes coming with Patchwork_21357_full absolutely need >to be >verified manually. > >If you think the reported changes have nothing to do with the changes >introduced in Patchwork_21357_full, please notify your bug team to allow >them >to document this new failure mode, which will reduce false positives in >CI. > > Possible new issues > >Here are the unknown changes that may have been introduced in >Patchwork_21357_full: > > IGT changes > > Possible regressions > > o igt@kms_bw@linear-tiling-6-displays-3840x2160p: > > o shard-tglb: NOTRUN -> [4]SKIP > >RK: This test looks flaky and has failed across multiple platforms. The >error does not indicate issue wrt bw calculations and > can be ignored. Applied to drm-intel-next. Thanks for the patch and the review. Matt > > > >Thanks, > >Radhakrishna Sripada > > Warnings > > o igt@runner@aborted: > > o shard-iclb: ([5]FAIL, [6]FAIL, [7]FAIL, [8]FAIL, [9]FAIL, [10]FAIL) > ([i915#3002] / [i915#4006]) -> ([11]FAIL, [12]FAIL, [13]FAIL, > [14]FAIL, [15]FAIL) ([i915#3002]) > > Known issues > >Here are the changes found in Patchwork_21357_full that come from known >issues: > > IGT changes > > Issues hit > > o igt@gem_create@create-massive: > > o shard-apl: NOTRUN -> [16]DMESG-WARN ([i915#3002]) > > o igt@gem_ctx_persistence@engines-hang: > > o shard-snb: NOTRUN -> [17]SKIP ([fdo#109271] / [i915#1099]) > > o igt@gem_ctx_sseu@invalid-args: > > o shard-tglb: NOTRUN -> [18]SKIP ([i915#280]) > > o igt@gem_exec_fair@basic-none-solo@rcs0: > > o shard-kbl: NOTRUN -> [19]FAIL ([i915#2842]) > > o igt@gem_exec_fair@basic-none-vip@rcs0: > > o shard-kbl: [20]PASS -> [21]FAIL ([i915#2842]) > > o igt@gem_exec_fair@basic-pace-share@rcs0: > > o shard-tglb: NOTRUN -> [22]FAIL ([i915#2842]) > > o igt@gem_exec_fair@basic-pace-solo@rcs0: > > o shard-glk: [23]PASS -> [24]FAIL ([i915#2842]) +1 similar issue > > o igt@gem_exec_params@no-bsd: > > o shard-tglb: NOTRUN -> [25]SKIP ([fdo#109283]) > > o igt@gem_pread@exhaustion: > > o shard-apl: NOTRUN -> [26]WARN ([i915#2658]) > o shard-kbl: NOTRUN -> [27]WARN ([i915#2658]) > > o igt@gem_pxp@verify-pxp-key-change-after-suspend-resume: > > o shard-tglb: NOTRUN -> [28]SKIP ([i915#4270]) > > o igt@gem_softpin@allocator-basic-reserve: > > o shard-skl: [29]PASS -> [30]DMESG-WARN ([i915#1982]) > > o igt@gem_userptr_blits@create-destroy-unsync: > > o shard-tglb: NOTRUN -> [31]SKIP ([i915#3297]) > > o igt@gem_userptr_blits@input-checking: > > o shard-skl: NOTRUN -> [32]DMESG-WARN ([i915#3002]) > > o igt@gen3_render_tiledy_blits: > > o shard-iclb: NOTRUN -> [33]SKIP ([fdo#109289]) > > o igt@gen9_exec_parse@basic-rejected: > > o shard-tglb: NOTRUN -> [34]SKIP ([i915#2856]) > > o igt@gen9_exec_parse@unaligned-access: > > o shard-iclb: NOTRUN -> [35]SKIP ([i915#2856]) > > o igt@kms_big_fb@linear-32bpp-rotate-0: > > o shard-glk: [36]PASS -> [37]DMESG-WARN ([i915#118]) > > o igt@kms_big_fb@x-tiled-16bpp-rotate-90: > > o shard-tglb: NOTRUN -> [38]SKIP ([fdo#111614]) +1 similar issue > > o igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-0-hflip: > > o shard-kbl: NOTRUN -> [39]SKIP ([fdo#109271] / [i915#3777]) +1 > similar issue > o shard-apl: NOTRUN -> [40]SKIP ([fdo#109271] / [i915#3777]) +1 > similar issue > > o igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-async-flip: > > o shard-skl: NOTRUN -> [41]FAIL ([i915#3722]) > > o igt@kms_big_fb@yf-tiled-max-hw-stride-32bpp-rotate-180-hflip: > > o shard-tglb: NOTRUN -> [42]SKIP ([fdo#111615]) > > o igt@kms_big_joiner@basic: > > o shard-iclb: NOTRUN -> [43]SKIP ([i915#2705]) > > o igt@kms_bw@linear-tiling-4-displays-3840x2160p: > > o shard-tglb: NOTRUN -> [44]FAIL ([i915#1385]) > > o igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_rc
[Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private
== Series Details == Series: series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private URL : https://patchwork.freedesktop.org/series/96578/ State : success == Summary == CI Bug Log - changes from CI_DRM_10841_full -> Patchwork_21519_full Summary --- **SUCCESS** No regressions found. Participating hosts (11 -> 11) -- No changes in participating hosts Possible new issues --- Here are the unknown changes that may have been introduced in Patchwork_21519_full: ### IGT changes ### Suppressed The following results come from untrusted machines, tests, or statuses. They do not affect the overall result. * igt@kms_fence_pin_leak: - {shard-rkl}:NOTRUN -> [SKIP][1] +1 similar issue [1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-rkl-2/igt@kms_fence_pin_leak.html Known issues Here are the changes found in Patchwork_21519_full that come from known issues: ### IGT changes ### Issues hit * igt@gem_ctx_isolation@preservation-s3@bcs0: - shard-tglb: [PASS][2] -> [INCOMPLETE][3] ([i915#456]) +1 similar issue [2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-tglb1/igt@gem_ctx_isolation@preservation...@bcs0.html [3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-tglb7/igt@gem_ctx_isolation@preservation...@bcs0.html * igt@gem_ctx_sseu@mmap-args: - shard-tglb: NOTRUN -> [SKIP][4] ([i915#280]) [4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-tglb2/igt@gem_ctx_s...@mmap-args.html * igt@gem_exec_capture@pi@rcs0: - shard-skl: [PASS][5] -> [INCOMPLETE][6] ([i915#2369]) [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-skl10/igt@gem_exec_capture@p...@rcs0.html [6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-skl8/igt@gem_exec_capture@p...@rcs0.html * igt@gem_exec_fair@basic-flow@rcs0: - shard-tglb: [PASS][7] -> [FAIL][8] ([i915#2842]) +1 similar issue [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-tglb7/igt@gem_exec_fair@basic-f...@rcs0.html [8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-tglb2/igt@gem_exec_fair@basic-f...@rcs0.html * igt@gem_exec_fair@basic-none-vip@rcs0: - shard-glk: [PASS][9] -> [FAIL][10] ([i915#2842]) [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-glk5/igt@gem_exec_fair@basic-none-...@rcs0.html [10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-glk1/igt@gem_exec_fair@basic-none-...@rcs0.html * igt@gem_exec_fair@basic-none@vcs0: - shard-kbl: [PASS][11] -> [FAIL][12] ([i915#2842]) [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-kbl6/igt@gem_exec_fair@basic-n...@vcs0.html [12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-kbl2/igt@gem_exec_fair@basic-n...@vcs0.html * igt@gem_exec_fair@basic-throttle@rcs0: - shard-iclb: [PASS][13] -> [FAIL][14] ([i915#2842]) [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-iclb1/igt@gem_exec_fair@basic-throt...@rcs0.html [14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-iclb5/igt@gem_exec_fair@basic-throt...@rcs0.html * igt@gem_exec_params@dr1-dirt: - shard-skl: [PASS][15] -> [DMESG-WARN][16] ([i915#1982]) [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-skl10/igt@gem_exec_par...@dr1-dirt.html [16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-skl8/igt@gem_exec_par...@dr1-dirt.html * igt@gem_exec_whisper@basic-fds-forked: - shard-glk: [PASS][17] -> [DMESG-WARN][18] ([i915#118]) +1 similar issue [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-glk9/igt@gem_exec_whis...@basic-fds-forked.html [18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-glk1/igt@gem_exec_whis...@basic-fds-forked.html * igt@gem_huc_copy@huc-copy: - shard-tglb: [PASS][19] -> [SKIP][20] ([i915#2190]) [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10841/shard-tglb1/igt@gem_huc_c...@huc-copy.html [20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-tglb7/igt@gem_huc_c...@huc-copy.html - shard-skl: NOTRUN -> [SKIP][21] ([fdo#109271] / [i915#2190]) [21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-skl2/igt@gem_huc_c...@huc-copy.html * igt@gem_media_vme: - shard-tglb: NOTRUN -> [SKIP][22] ([i915#284]) [22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-tglb2/igt@gem_media_vme.html * igt@gem_pread@exhaustion: - shard-kbl: NOTRUN -> [WARN][23] ([i915#2658]) [23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21519/shard-kbl3/igt
Re: [Intel-gfx] linux-next: manual merge of the char-misc tree with the drm-intel tree
Hi all, On Thu, 28 Oct 2021 18:27:53 +1100 Stephen Rothwell wrote: > > Today's linux-next merge of the char-misc tree got a conflict in: > > drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c > > between commit: > > 5740211ea442 ("drm/i915/dmabuf: fix broken build") > > from the drm-intel tree and commit: > > 16b0314aa746 ("dma-buf: move dma-buf symbols into the DMA_BUF module > namespace") > > from the char-misc tree. > > I fixed it up (see below) and can carry the fix as necessary. This > is now fixed as far as linux-next is concerned, but any non trivial > conflicts should be mentioned to your upstream maintainer when your tree > is submitted for merging. You may also want to consider cooperating > with the maintainer of the conflicting tree to minimise any particularly > complex conflicts. > > -- > Cheers, > Stephen Rothwell > > diff --cc drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c > index a45d0ec2c5b6,abb854281347.. > --- a/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c > +++ b/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c > @@@ -12,13 -13,8 +13,15 @@@ > #include "i915_gem_object.h" > #include "i915_scatterlist.h" > > +#if defined(CONFIG_X86) > +#include > +#else > +#define wbinvd_on_all_cpus() \ > +pr_warn(DRIVER_NAME ": Missing cache flush in %s\n", __func__) > +#endif > + > + MODULE_IMPORT_NS(DMA_BUF); > + > I915_SELFTEST_DECLARE(static bool force_different_devices;) > > static struct drm_i915_gem_object *dma_buf_to_obj(struct dma_buf *buf) This is now a conflict between the drm-intel tree and Linux' tree. -- Cheers, Stephen Rothwell pgp7o9FYb6kBU.pgp Description: OpenPGP digital signature
[Intel-gfx] [PATCH v4 00/14] drm/hdcp: Pull HDCP auth/exchange/check into helpers
From: Sean Paul Just me with another revision of HDCP support for msm. This v4 patch series is mostly a retread of v3 with the following changes: - rebased on Bjorn's displayport-controller register refactor - another change to the dt bindings to remove the compatible string added in v3 - updated review tags I'm missing reviews on the core, i915 patches, and the final patch. It would be fantastic to get some feedback on these before the set once again drifts too far from -tip and I need a painful rebase :-) Thank you to the reviewers for their feedback thus far! Please take a look, Sean Link: https://patchwork.freedesktop.org/series/94623/ #v1 Link: https://patchwork.freedesktop.org/series/94713/ #v2 Link: https://patchwork.freedesktop.org/series/94712/ #v3 Sean Paul (14): drm/hdcp: Add drm_hdcp_atomic_check() drm/hdcp: Avoid changing crtc state in hdcp atomic check drm/hdcp: Update property value on content type and user changes drm/hdcp: Expand HDCP helper library for enable/disable/check drm/i915/hdcp: Consolidate HDCP setup/state cache drm/i915/hdcp: Retain hdcp_capable return codes drm/i915/hdcp: Use HDCP helpers for i915 drm/msm/dpu_kms: Re-order dpu includes drm/msm/dpu: Remove useless checks in dpu_encoder drm/msm/dpu: Remove encoder->enable() hack drm/msm/dp: Re-order dp_audio_put in deinit_sub_modules dt-bindings: msm/dp: Add bindings for HDCP registers arm64: dts: qcom: sc7180: Add support for HDCP in dp-controller drm/msm: Implement HDCP 1.x using the new drm HDCP helpers .../bindings/display/msm/dp-controller.yaml |8 +- arch/arm64/boot/dts/qcom/sc7180.dtsi |8 +- drivers/gpu/drm/drm_hdcp.c| 1197 - drivers/gpu/drm/i915/display/intel_atomic.c |7 +- drivers/gpu/drm/i915/display/intel_ddi.c | 29 +- .../drm/i915/display/intel_display_debugfs.c | 11 +- .../drm/i915/display/intel_display_types.h| 58 +- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 345 ++--- drivers/gpu/drm/i915/display/intel_dp_mst.c | 17 +- drivers/gpu/drm/i915/display/intel_hdcp.c | 1011 +++--- drivers/gpu/drm/i915/display/intel_hdcp.h | 36 +- drivers/gpu/drm/i915/display/intel_hdmi.c | 256 ++-- drivers/gpu/drm/msm/Makefile |1 + drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 17 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 30 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h |2 - drivers/gpu/drm/msm/disp/dpu1/dpu_trace.h |4 - drivers/gpu/drm/msm/dp/dp_debug.c | 46 +- drivers/gpu/drm/msm/dp/dp_debug.h |6 +- drivers/gpu/drm/msm/dp/dp_display.c | 48 +- drivers/gpu/drm/msm/dp/dp_display.h |5 + drivers/gpu/drm/msm/dp/dp_drm.c | 68 +- drivers/gpu/drm/msm/dp/dp_drm.h |5 + drivers/gpu/drm/msm/dp/dp_hdcp.c | 462 +++ drivers/gpu/drm/msm/dp/dp_hdcp.h | 27 + drivers/gpu/drm/msm/dp/dp_parser.c| 20 +- drivers/gpu/drm/msm/dp/dp_parser.h|4 + drivers/gpu/drm/msm/dp/dp_reg.h | 32 +- drivers/gpu/drm/msm/msm_atomic.c | 15 + include/drm/drm_hdcp.h| 194 +++ 30 files changed, 2592 insertions(+), 1377 deletions(-) create mode 100644 drivers/gpu/drm/msm/dp/dp_hdcp.c create mode 100644 drivers/gpu/drm/msm/dp/dp_hdcp.h -- Sean Paul, Software Engineer, Google / Chromium OS
[Intel-gfx] [PATCH v4 01/14] drm/hdcp: Add drm_hdcp_atomic_check()
From: Sean Paul This patch moves the hdcp atomic check from i915 to drm_hdcp so other drivers can use it. No functional changes, just cleaned up some of the code when moving it over. Acked-by: Jani Nikula Acked-by: Jani Nikula Reviewed-by: Abhinav Kumar Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-2-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-2-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-2-s...@poorly.run #v3 Changes in v2: -None Changes in v3: -None Changes in v4: -None --- drivers/gpu/drm/drm_hdcp.c | 71 - drivers/gpu/drm/i915/display/intel_atomic.c | 4 +- drivers/gpu/drm/i915/display/intel_hdcp.c | 47 -- drivers/gpu/drm/i915/display/intel_hdcp.h | 3 - include/drm/drm_hdcp.h | 3 + 5 files changed, 75 insertions(+), 53 deletions(-) diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c index ca9b8f697202..522326b03e66 100644 --- a/drivers/gpu/drm/drm_hdcp.c +++ b/drivers/gpu/drm/drm_hdcp.c @@ -13,13 +13,14 @@ #include #include +#include +#include #include #include #include #include #include #include -#include #include "drm_internal.h" @@ -421,3 +422,71 @@ void drm_hdcp_update_content_protection(struct drm_connector *connector, dev->mode_config.content_protection_property); } EXPORT_SYMBOL(drm_hdcp_update_content_protection); + +/** + * drm_hdcp_atomic_check - Helper for drivers to call during connector->atomic_check + * + * @state: pointer to the atomic state being checked + * @connector: drm_connector on which content protection state needs an update + * + * This function can be used by display drivers to perform an atomic check on the + * hdcp state elements. If hdcp state has changed, this function will set + * mode_changed on the crtc driving the connector so it can update its hardware + * to match the hdcp state. + */ +void drm_hdcp_atomic_check(struct drm_connector *connector, + struct drm_atomic_state *state) +{ + struct drm_connector_state *new_conn_state, *old_conn_state; + struct drm_crtc_state *new_crtc_state; + u64 old_hdcp, new_hdcp; + + old_conn_state = drm_atomic_get_old_connector_state(state, connector); + old_hdcp = old_conn_state->content_protection; + + new_conn_state = drm_atomic_get_new_connector_state(state, connector); + new_hdcp = new_conn_state->content_protection; + + if (!new_conn_state->crtc) { + /* +* If the connector is being disabled with CP enabled, mark it +* desired so it's re-enabled when the connector is brought back +*/ + if (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) + new_conn_state->content_protection = + DRM_MODE_CONTENT_PROTECTION_DESIRED; + return; + } + + new_crtc_state = drm_atomic_get_new_crtc_state(state, + new_conn_state->crtc); + /* + * Fix the HDCP uapi content protection state in case of modeset. + * FIXME: As per HDCP content protection property uapi doc, an uevent() + * need to be sent if there is transition from ENABLED->DESIRED. + */ + if (drm_atomic_crtc_needs_modeset(new_crtc_state) && + (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED && +new_hdcp != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)) + new_conn_state->content_protection = + DRM_MODE_CONTENT_PROTECTION_DESIRED; + + /* +* Nothing to do if content type is unchanged and one of: +* - state didn't change +* - HDCP was activated since the last commit +* - attempting to set to desired while already enabled +*/ + if (old_hdcp == new_hdcp || + (old_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED && +new_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) || + (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED && +new_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED)) { + if (old_conn_state->hdcp_content_type == + new_conn_state->hdcp_content_type) + return; + } + + new_crtc_state->mode_changed = true; +} +EXPORT_SYMBOL(drm_hdcp_atomic_check); diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c index b4e7ac51aa31..1e306e8427ec 100644 --- a/drivers/gpu/drm/i915/display/intel_atomic.c +++ b/drivers/gpu/drm/i915/display/intel_atomic.c @@ -32,13 +32,13 @@ #include #include #include +#include #include #include "intel_atomic.h" #include "intel_cdclk.h" #include "intel_display_types.h" #include "
[Intel-gfx] [PATCH v4 02/14] drm/hdcp: Avoid changing crtc state in hdcp atomic check
From: Sean Paul Instead of forcing a modeset in the hdcp atomic check, simply return true if the content protection value is changing and let the driver decide whether a modeset is required or not. Acked-by: Jani Nikula Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-3-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-3-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-3-s...@poorly.run #v3 Changes in v2: -None Changes in v3: -None Changes in v4: -None --- drivers/gpu/drm/drm_hdcp.c | 33 +++-- drivers/gpu/drm/i915/display/intel_atomic.c | 5 ++-- include/drm/drm_hdcp.h | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c index 522326b03e66..dd8fa91c51d6 100644 --- a/drivers/gpu/drm/drm_hdcp.c +++ b/drivers/gpu/drm/drm_hdcp.c @@ -430,11 +430,14 @@ EXPORT_SYMBOL(drm_hdcp_update_content_protection); * @connector: drm_connector on which content protection state needs an update * * This function can be used by display drivers to perform an atomic check on the - * hdcp state elements. If hdcp state has changed, this function will set - * mode_changed on the crtc driving the connector so it can update its hardware - * to match the hdcp state. + * hdcp state elements. If hdcp state has changed in a manner which requires the + * driver to enable or disable content protection, this function will return + * true. + * + * Returns: + * true if the driver must enable/disable hdcp, false otherwise */ -void drm_hdcp_atomic_check(struct drm_connector *connector, +bool drm_hdcp_atomic_check(struct drm_connector *connector, struct drm_atomic_state *state) { struct drm_connector_state *new_conn_state, *old_conn_state; @@ -452,10 +455,12 @@ void drm_hdcp_atomic_check(struct drm_connector *connector, * If the connector is being disabled with CP enabled, mark it * desired so it's re-enabled when the connector is brought back */ - if (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) + if (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) { new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED; - return; + return true; + } + return false; } new_crtc_state = drm_atomic_get_new_crtc_state(state, @@ -467,9 +472,19 @@ void drm_hdcp_atomic_check(struct drm_connector *connector, */ if (drm_atomic_crtc_needs_modeset(new_crtc_state) && (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED && -new_hdcp != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)) +new_hdcp != DRM_MODE_CONTENT_PROTECTION_UNDESIRED)) { new_conn_state->content_protection = DRM_MODE_CONTENT_PROTECTION_DESIRED; + return true; + } + + /* +* Coming back from disable or changing CRTC with DESIRED state requires +* that the driver try CP enable. +*/ + if (new_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED && + new_conn_state->crtc != old_conn_state->crtc) + return true; /* * Nothing to do if content type is unchanged and one of: @@ -484,9 +499,9 @@ void drm_hdcp_atomic_check(struct drm_connector *connector, new_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED)) { if (old_conn_state->hdcp_content_type == new_conn_state->hdcp_content_type) - return; + return false; } - new_crtc_state->mode_changed = true; + return true; } EXPORT_SYMBOL(drm_hdcp_atomic_check); diff --git a/drivers/gpu/drm/i915/display/intel_atomic.c b/drivers/gpu/drm/i915/display/intel_atomic.c index 1e306e8427ec..c7b5470c40aa 100644 --- a/drivers/gpu/drm/i915/display/intel_atomic.c +++ b/drivers/gpu/drm/i915/display/intel_atomic.c @@ -122,8 +122,6 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn, to_intel_digital_connector_state(old_state); struct drm_crtc_state *crtc_state; - drm_hdcp_atomic_check(conn, state); - if (!new_state->crtc) return 0; @@ -139,7 +137,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn, new_conn_state->base.picture_aspect_ratio != old_conn_state->base.picture_aspect_ratio || new_conn_state->base.content_type != old_conn_state->base.content_type || new_conn_state->base.scaling_mode != old_conn_state->base.scaling_mode || - !drm_connector_atomic_hdr_metadata_equal(old_state, new_state)) +
[Intel-gfx] [PATCH v4 03/14] drm/hdcp: Update property value on content type and user changes
From: Sean Paul This patch updates the connector's property value in 2 cases which were previously missed: 1- Content type changes. The value should revert back to DESIRED from ENABLED in case the driver must re-authenticate the link due to the new content type. 2- Userspace sets value to DESIRED while ENABLED. In this case, the value should be reset immediately to ENABLED since the link is actively being encrypted. To accommodate these changes, I've split up the conditionals to make things a bit more clear (as much as one can with this mess of state). Acked-by: Jani Nikula Reviewed-by: Abhinav Kumar Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-4-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-4-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-4-s...@poorly.run #v3 Changes in v2: -None Changes in v3: -Fixed indentation issue identified by 0-day Changes in v4: -None --- drivers/gpu/drm/drm_hdcp.c | 26 +- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c index dd8fa91c51d6..8c851d40cd45 100644 --- a/drivers/gpu/drm/drm_hdcp.c +++ b/drivers/gpu/drm/drm_hdcp.c @@ -487,21 +487,29 @@ bool drm_hdcp_atomic_check(struct drm_connector *connector, return true; /* -* Nothing to do if content type is unchanged and one of: -* - state didn't change +* Content type changes require an HDCP disable/enable cycle. +*/ + if (new_conn_state->hdcp_content_type != old_conn_state->hdcp_content_type) { + new_conn_state->content_protection = + DRM_MODE_CONTENT_PROTECTION_DESIRED; + return true; + } + + /* +* Ignore meaningless state changes: * - HDCP was activated since the last commit -* - attempting to set to desired while already enabled +* - Attempting to set to desired while already enabled */ - if (old_hdcp == new_hdcp || - (old_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED && + if ((old_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED && new_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED) || (old_hdcp == DRM_MODE_CONTENT_PROTECTION_ENABLED && new_hdcp == DRM_MODE_CONTENT_PROTECTION_DESIRED)) { - if (old_conn_state->hdcp_content_type == - new_conn_state->hdcp_content_type) - return false; + new_conn_state->content_protection = + DRM_MODE_CONTENT_PROTECTION_ENABLED; + return false; } - return true; + /* Finally, if state changes, we need action */ + return old_hdcp != new_hdcp; } EXPORT_SYMBOL(drm_hdcp_atomic_check); -- Sean Paul, Software Engineer, Google / Chromium OS
[Intel-gfx] [PATCH v4 04/14] drm/hdcp: Expand HDCP helper library for enable/disable/check
From: Sean Paul This patch expands upon the HDCP helper library to manage HDCP enable, disable, and check. Previous to this patch, the majority of the state management and sink interaction is tucked inside the Intel driver with the understanding that once a new platform supported HDCP we could make good decisions about what should be centralized. With the addition of HDCP support for Qualcomm, it's time to migrate the protocol-specific bits of HDCP authentication, key exchange, and link checks to the HDCP helper. In terms of functionality, this migration is 1:1 with the Intel driver, however things are laid out a bit differently than with intel_hdcp.c, which is why this is a separate patch from the i915 transition to the helper. On i915, the shim vtable is used to account for HDMI vs. DP vs. DP-MST differences whereas the helper library uses a LUT to account for the register offsets and a remote read function to route the messages. On i915, storing the sink information in the source is done inline whereas now we use the new drm_hdcp_helper_funcs vtable to store and fetch information to/from source hw. Finally, instead of calling enable/disable directly from the driver, we'll leave that decision to the helper and by calling drm_hdcp_helper_atomic_commit() from the driver. All told, this will centralize the protocol and state handling in the helper, ensuring we collect all of our bugs^Wlogic in one place. Cc: Abhinav Kumar Acked-by: Jani Nikula Reviewed-by: Abhinav Kumar Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-5-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-5-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-5-s...@poorly.run #v3 Changes in v2: -Fixed set-but-unused variable identified by 0-day Changes in v3: -Fixed uninitialized variable warning identified by 0-day Changes in v4: -None --- drivers/gpu/drm/drm_hdcp.c | 1103 include/drm/drm_hdcp.h | 191 +++ 2 files changed, 1294 insertions(+) diff --git a/drivers/gpu/drm/drm_hdcp.c b/drivers/gpu/drm/drm_hdcp.c index 8c851d40cd45..2bfa07fc3fbc 100644 --- a/drivers/gpu/drm/drm_hdcp.c +++ b/drivers/gpu/drm/drm_hdcp.c @@ -6,15 +6,20 @@ * Ramalingam C */ +#include #include #include #include +#include +#include #include #include #include +#include #include #include +#include #include #include #include @@ -513,3 +518,1101 @@ bool drm_hdcp_atomic_check(struct drm_connector *connector, return old_hdcp != new_hdcp; } EXPORT_SYMBOL(drm_hdcp_atomic_check); + +struct drm_hdcp_helper_data { + struct mutex mutex; + struct mutex *driver_mutex; + + struct drm_connector *connector; + const struct drm_hdcp_helper_funcs *funcs; + + u64 value; + unsigned int enabled_type; + + struct delayed_work check_work; + struct work_struct prop_work; + + struct drm_dp_aux *aux; + const struct drm_hdcp_hdcp1_receiver_reg_lut *hdcp1_lut; +}; + +struct drm_hdcp_hdcp1_receiver_reg_lut { + unsigned int bksv; + unsigned int ri; + unsigned int aksv; + unsigned int an; + unsigned int ainfo; + unsigned int v[5]; + unsigned int bcaps; + unsigned int bcaps_mask_repeater_present; + unsigned int bstatus; +}; + +static const struct drm_hdcp_hdcp1_receiver_reg_lut drm_hdcp_hdcp1_ddc_lut = { + .bksv = DRM_HDCP_DDC_BKSV, + .ri = DRM_HDCP_DDC_RI_PRIME, + .aksv = DRM_HDCP_DDC_AKSV, + .an = DRM_HDCP_DDC_AN, + .ainfo = DRM_HDCP_DDC_AINFO, + .v = { DRM_HDCP_DDC_V_PRIME(0), DRM_HDCP_DDC_V_PRIME(1), + DRM_HDCP_DDC_V_PRIME(2), DRM_HDCP_DDC_V_PRIME(3), + DRM_HDCP_DDC_V_PRIME(4) }, + .bcaps = DRM_HDCP_DDC_BCAPS, + .bcaps_mask_repeater_present = DRM_HDCP_DDC_BCAPS_REPEATER_PRESENT, + .bstatus = DRM_HDCP_DDC_BSTATUS, +}; + +static const struct drm_hdcp_hdcp1_receiver_reg_lut drm_hdcp_hdcp1_dpcd_lut = { + .bksv = DP_AUX_HDCP_BKSV, + .ri = DP_AUX_HDCP_RI_PRIME, + .aksv = DP_AUX_HDCP_AKSV, + .an = DP_AUX_HDCP_AN, + .ainfo = DP_AUX_HDCP_AINFO, + .v = { DP_AUX_HDCP_V_PRIME(0), DP_AUX_HDCP_V_PRIME(1), + DP_AUX_HDCP_V_PRIME(2), DP_AUX_HDCP_V_PRIME(3), + DP_AUX_HDCP_V_PRIME(4) }, + .bcaps = DP_AUX_HDCP_BCAPS, + .bcaps_mask_repeater_present = DP_BCAPS_REPEATER_PRESENT, + + /* +* For some reason the HDMI and DP HDCP specs call this register +* definition by different names. In the HDMI spec, it's called BSTATUS, +* but in DP it's called BINFO. +*/ + .bstatus = DP_AUX_HDCP_BINFO, +}; + +static int drm_hdcp_remote_ddc_read(struct i2c_adapter *i2c, + unsigned int offset, u8 *value, size_t len) +{ + int ret; + u8 start = offset
[Intel-gfx] [PATCH v4 05/14] drm/i915/hdcp: Consolidate HDCP setup/state cache
From: Sean Paul Stick all of the setup for HDCP into a dedicated function. No functional change, but this will facilitate moving HDCP logic into helpers. Acked-by: Jani Nikula Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-6-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-6-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-6-s...@poorly.run #v3 Changes in v2: -None Changes in v3: -None Changes in v4: -None --- drivers/gpu/drm/i915/display/intel_hdcp.c | 52 +++ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index f12790697e2d..8fc830e38311 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -2167,6 +2167,37 @@ static enum mei_fw_tc intel_get_mei_fw_tc(enum transcoder cpu_transcoder) } } +static int +_intel_hdcp_setup(struct intel_connector *connector, + const struct intel_crtc_state *pipe_config, u8 content_type) +{ + struct drm_i915_private *dev_priv = to_i915(connector->base.dev); + struct intel_digital_port *dig_port = intel_attached_dig_port(connector); + struct intel_hdcp *hdcp = &connector->hdcp; + int ret = 0; + + if (!connector->encoder) { + drm_err(&dev_priv->drm, "[%s:%d] encoder is not initialized\n", + connector->base.name, connector->base.base.id); + return -ENODEV; + } + + hdcp->content_type = content_type; + + if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_DP_MST)) { + hdcp->cpu_transcoder = pipe_config->mst_master_transcoder; + hdcp->stream_transcoder = pipe_config->cpu_transcoder; + } else { + hdcp->cpu_transcoder = pipe_config->cpu_transcoder; + hdcp->stream_transcoder = INVALID_TRANSCODER; + } + + if (DISPLAY_VER(dev_priv) >= 12) + dig_port->hdcp_port_data.fw_tc = intel_get_mei_fw_tc(hdcp->cpu_transcoder); + + return ret; +} + static int initialize_hdcp_port_data(struct intel_connector *connector, struct intel_digital_port *dig_port, const struct intel_hdcp_shim *shim) @@ -2306,28 +2337,14 @@ int intel_hdcp_enable(struct intel_connector *connector, if (!hdcp->shim) return -ENOENT; - if (!connector->encoder) { - drm_err(&dev_priv->drm, "[%s:%d] encoder is not initialized\n", - connector->base.name, connector->base.base.id); - return -ENODEV; - } - mutex_lock(&hdcp->mutex); mutex_lock(&dig_port->hdcp_mutex); drm_WARN_ON(&dev_priv->drm, hdcp->value == DRM_MODE_CONTENT_PROTECTION_ENABLED); - hdcp->content_type = content_type; - - if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_DP_MST)) { - hdcp->cpu_transcoder = pipe_config->mst_master_transcoder; - hdcp->stream_transcoder = pipe_config->cpu_transcoder; - } else { - hdcp->cpu_transcoder = pipe_config->cpu_transcoder; - hdcp->stream_transcoder = INVALID_TRANSCODER; - } - if (DISPLAY_VER(dev_priv) >= 12) - dig_port->hdcp_port_data.fw_tc = intel_get_mei_fw_tc(hdcp->cpu_transcoder); + ret = _intel_hdcp_setup(connector, pipe_config, content_type); + if (ret) + goto out; /* * Considering that HDCP2.2 is more secure than HDCP1.4, If the setup @@ -2355,6 +2372,7 @@ int intel_hdcp_enable(struct intel_connector *connector, true); } +out: mutex_unlock(&dig_port->hdcp_mutex); mutex_unlock(&hdcp->mutex); return ret; -- Sean Paul, Software Engineer, Google / Chromium OS
[Intel-gfx] [PATCH v4 06/14] drm/i915/hdcp: Retain hdcp_capable return codes
From: Sean Paul The shim functions return error codes, but they are discarded in intel_hdcp.c. This patch plumbs the return codes through so they are properly handled. Acked-by: Jani Nikula Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-7-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-7-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-7-s...@poorly.run #v3 Changes in v2: -None Changes in v3: -None Changes in v4: -None --- .../drm/i915/display/intel_display_debugfs.c | 9 +++- drivers/gpu/drm/i915/display/intel_hdcp.c | 51 ++- drivers/gpu/drm/i915/display/intel_hdcp.h | 4 +- 3 files changed, 37 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c index d7d6dde518a3..ef3039fb1e0c 100644 --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c @@ -643,6 +643,7 @@ static void intel_panel_info(struct seq_file *m, struct intel_panel *panel) static void intel_hdcp_info(struct seq_file *m, struct intel_connector *intel_connector) { + int ret; bool hdcp_cap, hdcp2_cap; if (!intel_connector->hdcp.shim) { @@ -650,8 +651,12 @@ static void intel_hdcp_info(struct seq_file *m, goto out; } - hdcp_cap = intel_hdcp_capable(intel_connector); - hdcp2_cap = intel_hdcp2_capable(intel_connector); + ret = intel_hdcp_capable(intel_connector, &hdcp_cap); + if (ret) + hdcp_cap = false; + ret = intel_hdcp2_capable(intel_connector, &hdcp2_cap); + if (ret) + hdcp2_cap = false; if (hdcp_cap) seq_puts(m, "HDCP1.4 "); diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c index 8fc830e38311..ac05d2c6d3e7 100644 --- a/drivers/gpu/drm/i915/display/intel_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_hdcp.c @@ -153,50 +153,49 @@ int intel_hdcp_read_valid_bksv(struct intel_digital_port *dig_port, } /* Is HDCP1.4 capable on Platform and Sink */ -bool intel_hdcp_capable(struct intel_connector *connector) +int intel_hdcp_capable(struct intel_connector *connector, bool *capable) { struct intel_digital_port *dig_port = intel_attached_dig_port(connector); const struct intel_hdcp_shim *shim = connector->hdcp.shim; - bool capable = false; u8 bksv[5]; + *capable = false; + if (!shim) - return capable; + return 0; - if (shim->hdcp_capable) { - shim->hdcp_capable(dig_port, &capable); - } else { - if (!intel_hdcp_read_valid_bksv(dig_port, shim, bksv)) - capable = true; - } + if (shim->hdcp_capable) + return shim->hdcp_capable(dig_port, capable); + + if (!intel_hdcp_read_valid_bksv(dig_port, shim, bksv)) + *capable = true; - return capable; + return 0; } /* Is HDCP2.2 capable on Platform and Sink */ -bool intel_hdcp2_capable(struct intel_connector *connector) +int intel_hdcp2_capable(struct intel_connector *connector, bool *capable) { struct intel_digital_port *dig_port = intel_attached_dig_port(connector); struct drm_i915_private *dev_priv = to_i915(connector->base.dev); struct intel_hdcp *hdcp = &connector->hdcp; - bool capable = false; + + *capable = false; /* I915 support for HDCP2.2 */ if (!hdcp->hdcp2_supported) - return false; + return 0; /* MEI interface is solid */ mutex_lock(&dev_priv->hdcp_comp_mutex); if (!dev_priv->hdcp_comp_added || !dev_priv->hdcp_master) { mutex_unlock(&dev_priv->hdcp_comp_mutex); - return false; + return 0; } mutex_unlock(&dev_priv->hdcp_comp_mutex); /* Sink's capability for HDCP2.2 */ - hdcp->shim->hdcp_2_2_capable(dig_port, &capable); - - return capable; + return hdcp->shim->hdcp_2_2_capable(dig_port, capable); } static bool intel_hdcp_in_use(struct drm_i915_private *dev_priv, @@ -2332,6 +2331,7 @@ int intel_hdcp_enable(struct intel_connector *connector, struct intel_digital_port *dig_port = intel_attached_dig_port(connector); struct intel_hdcp *hdcp = &connector->hdcp; unsigned long check_link_interval = DRM_HDCP_CHECK_PERIOD_MS; + bool capable; int ret = -EINVAL; if (!hdcp->shim) @@ -2350,21 +2350,27 @@ int intel_hdcp_enable(struct intel_connector *connector, * Considering that HDCP2.2 is more secure than HDCP1.4, If the setup * is capable of HDCP2.2, it is preferred to use HDCP2.2. */ -
[Intel-gfx] [PATCH v4 07/14] drm/i915/hdcp: Use HDCP helpers for i915
From: Sean Paul Now that all of the HDCP 1.x logic has been migrated to the central HDCP helpers, use it in the i915 driver. The majority of the driver code for HDCP 1.x will live in intel_hdcp.c, however there are a few helper hooks which are connector-specific and need to be partially or fully implemented in the intel_dp_hdcp.c or intel_hdmi.c. We'll leave most of the HDCP 2.x code alone since we don't have another implementation of HDCP 2.x to use as reference for what should and should not live in the drm helpers. The helper will call the overly general enable/disable/is_capable HDCP 2.x callbacks and leave the interesting stuff for the driver. Once we have another HDCP 2.x implementation, we should do a similar migration. Acked-by: Jani Nikula Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-8-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-8-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-8-s...@poorly.run #v3 Changes in v2: -Fix mst helper function pointer reported by 0-day Changes in v3: -Add forward declaration for drm_atomic_state in intel_hdcp.h identified by 0-day Changes in v4: -None --- drivers/gpu/drm/i915/display/intel_ddi.c | 29 +- .../drm/i915/display/intel_display_debugfs.c | 6 +- .../drm/i915/display/intel_display_types.h| 58 +- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 345 +++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 17 +- drivers/gpu/drm/i915/display/intel_hdcp.c | 935 +++--- drivers/gpu/drm/i915/display/intel_hdcp.h | 31 +- drivers/gpu/drm/i915/display/intel_hdmi.c | 256 ++--- 8 files changed, 418 insertions(+), 1259 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 145d51ac43a3..bfdf586207d2 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -26,6 +26,7 @@ */ #include +#include #include "i915_drv.h" #include "intel_audio.h" @@ -3016,6 +3017,9 @@ static void intel_enable_ddi(struct intel_atomic_state *state, const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state) { + struct intel_connector *connector = to_intel_connector(conn_state->connector); + struct intel_digital_port *dig_port = enc_to_dig_port(encoder); + drm_WARN_ON(state->base.dev, crtc_state->has_pch_encoder); if (!crtc_state->bigjoiner_slave) @@ -3032,12 +3036,10 @@ static void intel_enable_ddi(struct intel_atomic_state *state, else intel_enable_ddi_dp(state, encoder, crtc_state, conn_state); - /* Enable hdcp if it's desired */ - if (conn_state->content_protection == - DRM_MODE_CONTENT_PROTECTION_DESIRED) - intel_hdcp_enable(to_intel_connector(conn_state->connector), - crtc_state, - (u8)conn_state->hdcp_content_type); + if (connector->hdcp_helper_data) + drm_hdcp_helper_atomic_commit(connector->hdcp_helper_data, + &state->base, + &dig_port->hdcp_mutex); } static void intel_disable_ddi_dp(struct intel_atomic_state *state, @@ -3088,7 +3090,13 @@ static void intel_disable_ddi(struct intel_atomic_state *state, const struct intel_crtc_state *old_crtc_state, const struct drm_connector_state *old_conn_state) { - intel_hdcp_disable(to_intel_connector(old_conn_state->connector)); + struct intel_connector *connector = to_intel_connector(old_conn_state->connector); + struct intel_digital_port *dig_port = enc_to_dig_port(encoder); + + if (connector->hdcp_helper_data) + drm_hdcp_helper_atomic_commit(connector->hdcp_helper_data, + &state->base, + &dig_port->hdcp_mutex); if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI)) intel_disable_ddi_hdmi(state, encoder, old_crtc_state, @@ -3118,13 +3126,18 @@ void intel_ddi_update_pipe(struct intel_atomic_state *state, const struct intel_crtc_state *crtc_state, const struct drm_connector_state *conn_state) { + struct intel_connector *connector = to_intel_connector(conn_state->connector); + struct intel_digital_port *dig_port = enc_to_dig_port(encoder); if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI) && !intel_encoder_is_mst(encoder)) intel_ddi_update_pipe_dp(state, encoder, crtc_state, conn_state); - intel_hdcp_update_pipe(state, encoder, crt
[Intel-gfx] [PATCH v4 08/14] drm/msm/dpu_kms: Re-order dpu includes
From: Sean Paul Make includes alphabetical in dpu_kms.c Reviewed-by: Abhinav Kumar Reviewed-by: Stephen Boyd Reviewed-by: Dmitry Baryshkov Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-9-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-9-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-9-s...@poorly.run #v3 Changes in v2: -None Changes in v3: -None Changes in v4: -None --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index a15b26428280..66b7df7daa6a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -21,14 +21,14 @@ #include "msm_gem.h" #include "disp/msm_disp_snapshot.h" -#include "dpu_kms.h" #include "dpu_core_irq.h" +#include "dpu_crtc.h" +#include "dpu_encoder.h" #include "dpu_formats.h" #include "dpu_hw_vbif.h" -#include "dpu_vbif.h" -#include "dpu_encoder.h" +#include "dpu_kms.h" #include "dpu_plane.h" -#include "dpu_crtc.h" +#include "dpu_vbif.h" #define CREATE_TRACE_POINTS #include "dpu_trace.h" -- Sean Paul, Software Engineer, Google / Chromium OS
[Intel-gfx] [PATCH v4 09/14] drm/msm/dpu: Remove useless checks in dpu_encoder
From: Sean Paul A couple more useless checks to remove in dpu_encoder. Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar Reviewed-by: Dmitry Baryshkov Signed-off-by: Sean Paul Link: https://patchwork.freedesktop.org/patch/msgid/20210913175747.47456-10-s...@poorly.run #v1 Link: https://patchwork.freedesktop.org/patch/msgid/20210915203834.1439-10-s...@poorly.run #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20211001151145.55916-10-s...@poorly.run #v3 Changes in v2: -None Changes in v3: -None Changes in v4: -None --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 12 1 file changed, 12 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index e7ee4cfb8461..cc57c615be67 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -1148,10 +1148,6 @@ static void dpu_encoder_virt_enable(struct drm_encoder *drm_enc) struct msm_drm_private *priv; struct drm_display_mode *cur_mode = NULL; - if (!drm_enc) { - DPU_ERROR("invalid encoder\n"); - return; - } dpu_enc = to_dpu_encoder_virt(drm_enc); mutex_lock(&dpu_enc->enc_lock); @@ -1197,14 +1193,6 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) struct msm_drm_private *priv; int i = 0; - if (!drm_enc) { - DPU_ERROR("invalid encoder\n"); - return; - } else if (!drm_enc->dev) { - DPU_ERROR("invalid dev\n"); - return; - } - dpu_enc = to_dpu_encoder_virt(drm_enc); DPU_DEBUG_ENC(dpu_enc, "\n"); -- Sean Paul, Software Engineer, Google / Chromium OS