Pull drm fixes from Dave Airlie: "A varied bunch of fixes, one for an API regression with connectors. Otherwise amdgpu and i915 have a bunch of varied fixes, the shrinker ones being the most important" * tag 'drm-fixes-for-v4.12-rc7' of git://people.freedesktop.org/~airlied/linux: drm: Fix GETCONNECTOR regression drm/radeon: add a quirk for Toshiba Satellite L20-183 drm/radeon: add a PX quirk for another K53TK variant drm/amdgpu: adjust default display clock drm/amdgpu/atom: fix ps allocation size for EnableDispPowerGating drm/amdgpu: add Polaris12 DID drm/i915: Don't enable backlight at setup time. drm/i915: Plumb the correct acquire ctx into intel_crtc_disable_noatomic() drm/i915: Fix deadlock witha the pipe A quirk during resume drm/i915: Remove __GFP_NORETRY from our buffer allocator drm/i915: Encourage our shrinker more when our shmemfs allocations fails drm/i915: Differentiate between sw write location into ring and last hw read
Unified · Split
| @@ -693,6 +693,10 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev) · 692 unmodified lines | ||
| 693 | 693 | DRM_INFO("Changing default dispclk from %dMhz to 600Mhz\n", |
| 694 | 694 | adev->clock.default_dispclk / 100); |
| 695 | 695 | adev->clock.default_dispclk = 60000; |
| 696 | + } else if (adev->clock.default_dispclk <= 60000) { | |
| 697 | + DRM_INFO("Changing default dispclk from %dMhz to 625Mhz\n", | |
| 698 | + adev->clock.default_dispclk / 100); | |
| 699 | + adev->clock.default_dispclk = 62500; | |
| 696 | 700 | } |
| 697 | 701 | adev->clock.dp_extclk = |
| 698 | 702 | le16_to_cpu(firmware_info->info_21.usUniphyDPModeExtClkFreq); |
| @@ -449,6 +449,7 @@ static const struct pci_device_id pciidlist[] = { · 448 unmodified lines | ||
| 449 | 449 | {0x1002, 0x6986, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 450 | 450 | {0x1002, 0x6987, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 451 | 451 | {0x1002, 0x6995, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 452 | + {0x1002, 0x6997, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, | |
| 452 | 453 | {0x1002, 0x699F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_POLARIS12}, |
| 453 | 454 | /* Vega 10 */ |
| 454 | 455 | {0x1002, 0x6860, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_VEGA10|AMD_EXP_HW_SUPPORT}, |
| @@ -165,7 +165,7 @@ void amdgpu_atombios_crtc_powergate(struct drm_crtc *crtc, int state) · 164 unmodified lines | ||
| 165 | 165 | struct drm_device *dev = crtc->dev; |
| 166 | 166 | struct amdgpu_device *adev = dev->dev_private; |
| 167 | 167 | int index = GetIndexIntoMasterTable(COMMAND, EnableDispPowerGating); |
| 168 | − ENABLE_DISP_POWER_GATING_PARAMETERS_V2_1 args; | |
| 168 | + ENABLE_DISP_POWER_GATING_PS_ALLOCATION args; | |
| 169 | 169 | |
| 170 | 170 | memset(&args, 0, sizeof(args)); |
| 171 | 171 | |
| @@ -178,7 +178,7 @@ void amdgpu_atombios_crtc_powergate(struct drm_crtc *crtc, int state) · 6 unmodified lines | ||
| 178 | 178 | void amdgpu_atombios_crtc_powergate_init(struct amdgpu_device *adev) |
| 179 | 179 | { |
| 180 | 180 | int index = GetIndexIntoMasterTable(COMMAND, EnableDispPowerGating); |
| 181 | − ENABLE_DISP_POWER_GATING_PARAMETERS_V2_1 args; | |
| 181 | + ENABLE_DISP_POWER_GATING_PS_ALLOCATION args; | |
| 182 | 182 | |
| 183 | 183 | memset(&args, 0, sizeof(args)); |
| 184 | 184 | |
| @@ -1229,21 +1229,6 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 1228 unmodified lines | ||
| 1229 | 1229 | if (!connector) |
| 1230 | 1230 | return -ENOENT; |
| 1231 | 1231 | |
| 1232 | − drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | |
| 1233 | − encoder = drm_connector_get_encoder(connector); | |
| 1234 | − if (encoder) | |
| 1235 | − out_resp->encoder_id = encoder->base.id; | |
| 1236 | − else | |
| 1237 | − out_resp->encoder_id = 0; | |
| 1238 | − | |
| 1239 | − ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic, | |
| 1240 | − (uint32_t __user *)(unsigned long)(out_resp->props_ptr), | |
| 1241 | − (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr), | |
| 1242 | − &out_resp->count_props); | |
| 1243 | − drm_modeset_unlock(&dev->mode_config.connection_mutex); | |
| 1244 | − if (ret) | |
| 1245 | − goto out_unref; | |
| 1246 | − | |
| 1247 | 1232 | for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) |
| 1248 | 1233 | if (connector->encoder_ids[i] != 0) |
| 1249 | 1234 | encoders_count++; |
| @@ -1256,7 +1241,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 6 unmodified lines | ||
| 1256 | 1241 | if (put_user(connector->encoder_ids[i], |
| 1257 | 1242 | encoder_ptr + copied)) { |
| 1258 | 1243 | ret = -EFAULT; |
| 1259 | − goto out_unref; | |
| 1244 | + goto out; | |
| 1260 | 1245 | } |
| 1261 | 1246 | copied++; |
| 1262 | 1247 | } |
| @@ -1300,15 +1285,32 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, · 37 unmodified lines | ||
| 1300 | 1285 | if (copy_to_user(mode_ptr + copied, |
| 1301 | 1286 | &u_mode, sizeof(u_mode))) { |
| 1302 | 1287 | ret = -EFAULT; |
| 1288 | + mutex_unlock(&dev->mode_config.mutex); | |
| 1289 | + | |
| 1303 | 1290 | goto out; |
| 1304 | 1291 | } |
| 1305 | 1292 | copied++; |
| 1306 | 1293 | } |
| 1307 | 1294 | } |
| 1308 | 1295 | out_resp->count_modes = mode_count; |
| 1309 | −out: | |
| 1310 | 1296 | mutex_unlock(&dev->mode_config.mutex); |
| 1311 | −out_unref: | |
| 1297 | + | |
| 1298 | + drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); | |
| 1299 | + encoder = drm_connector_get_encoder(connector); | |
| 1300 | + if (encoder) | |
| 1301 | + out_resp->encoder_id = encoder->base.id; | |
| 1302 | + else | |
| 1303 | + out_resp->encoder_id = 0; | |
| 1304 | + | |
| 1305 | + /* Only grab properties after probing, to make sure EDID and other | |
| 1306 | + * properties reflect the latest status. */ | |
| 1307 | + ret = drm_mode_object_get_properties(&connector->base, file_priv->atomic, | |
| 1308 | + (uint32_t __user *)(unsigned long)(out_resp->props_ptr), | |
| 1309 | + (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr), | |
| 1310 | + &out_resp->count_props); | |
| 1311 | + drm_modeset_unlock(&dev->mode_config.connection_mutex); | |
| 1312 | + | |
| 1313 | +out: | |
| 1312 | 1314 | drm_connector_put(connector); |
| 1313 | 1315 | |
| 1314 | 1316 | return ret; |
| @@ -2285,8 +2285,8 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) · 2284 unmodified lines | ||
| 2285 | 2285 | struct page *page; |
| 2286 | 2286 | unsigned long last_pfn = 0; /* suppress gcc warning */ |
| 2287 | 2287 | unsigned int max_segment; |
| 2288 | + gfp_t noreclaim; | |
| 2288 | 2289 | int ret; |
| 2289 | − gfp_t gfp; | |
| 2290 | 2290 | |
| 2291 | 2291 | /* Assert that the object is not currently in any GPU domain. As it |
| 2292 | 2292 | * wasn't in the GTT, there shouldn't be any way it could have been in |
| @@ -2315,22 +2315,31 @@ rebuild_st: · 22 unmodified lines | ||
| 2315 | 2315 | * Fail silently without starting the shrinker |
| 2316 | 2316 | */ |
| 2317 | 2317 | mapping = obj->base.filp->f_mapping; |
| 2318 | − gfp = mapping_gfp_constraint(mapping, ~(__GFP_IO | __GFP_RECLAIM)); | |
| 2319 | − gfp |= __GFP_NORETRY | __GFP_NOWARN; | |
| 2318 | + noreclaim = mapping_gfp_constraint(mapping, | |
| 2319 | + ~(__GFP_IO | __GFP_RECLAIM)); | |
| 2320 | + noreclaim |= __GFP_NORETRY | __GFP_NOWARN; | |
| 2321 | + | |
| 2320 | 2322 | sg = st->sgl; |
| 2321 | 2323 | st->nents = 0; |
| 2322 | 2324 | for (i = 0; i < page_count; i++) { |
| 2323 | − page = shmem_read_mapping_page_gfp(mapping, i, gfp); | |
| 2324 | − if (unlikely(IS_ERR(page))) { | |
| 2325 | − i915_gem_shrink(dev_priv, | |
| 2326 | − page_count, | |
| 2327 | − I915_SHRINK_BOUND | | |
| 2328 | − I915_SHRINK_UNBOUND | | |
| 2329 | − I915_SHRINK_PURGEABLE); | |
| 2325 | + const unsigned int shrink[] = { | |
| 2326 | + I915_SHRINK_BOUND | I915_SHRINK_UNBOUND | I915_SHRINK_PURGEABLE, | |
| 2327 | + 0, | |
| 2328 | + }, *s = shrink; | |
| 2329 | + gfp_t gfp = noreclaim; | |
| 2330 | + | |
| 2331 | + do { | |
| 2330 | 2332 | page = shmem_read_mapping_page_gfp(mapping, i, gfp); |
| 2331 | − } | |
| 2332 | − if (unlikely(IS_ERR(page))) { | |
| 2333 | − gfp_t reclaim; | |
| 2333 | + if (likely(!IS_ERR(page))) | |
| 2334 | + break; | |
| 2335 | + | |
| 2336 | + if (!*s) { | |
| 2337 | + ret = PTR_ERR(page); | |
| 2338 | + goto err_sg; | |
| 2339 | + } | |
| 2340 | + | |
| 2341 | + i915_gem_shrink(dev_priv, 2 * page_count, *s++); | |
| 2342 | + cond_resched(); | |
| 2334 | 2343 | |
| 2335 | 2344 | /* We've tried hard to allocate the memory by reaping |
| 2336 | 2345 | * our own buffer, now let the real VM do its job and |
| @@ -2340,15 +2349,26 @@ rebuild_st: · 3 unmodified lines | ||
| 2340 | 2349 | * defer the oom here by reporting the ENOMEM back |
| 2341 | 2350 | * to userspace. |
| 2342 | 2351 | */ |
| 2343 | − reclaim = mapping_gfp_mask(mapping); | |
| 2344 | − reclaim |= __GFP_NORETRY; /* reclaim, but no oom */ | |
| 2345 | − | |
| 2346 | − page = shmem_read_mapping_page_gfp(mapping, i, reclaim); | |
| 2347 | − if (IS_ERR(page)) { | |
| 2348 | − ret = PTR_ERR(page); | |
| 2349 | − goto err_sg; | |
| 2352 | + if (!*s) { | |
| 2353 | + /* reclaim and warn, but no oom */ | |
| 2354 | + gfp = mapping_gfp_mask(mapping); | |
| 2355 | + | |
| 2356 | + /* Our bo are always dirty and so we require | |
| 2357 | + * kswapd to reclaim our pages (direct reclaim | |
| 2358 | + * does not effectively begin pageout of our | |
| 2359 | + * buffers on its own). However, direct reclaim | |
| 2360 | + * only waits for kswapd when under allocation | |
| 2361 | + * congestion. So as a result __GFP_RECLAIM is | |
| 2362 | + * unreliable and fails to actually reclaim our | |
| 2363 | + * dirty pages -- unless you try over and over | |
| 2364 | + * again with !__GFP_NORETRY. However, we still | |
| 2365 | + * want to fail this allocation rather than | |
| 2366 | + * trigger the out-of-memory killer and for | |
| 2367 | + * this we want the future __GFP_MAYFAIL. | |
| 2368 | + */ | |
| 2350 | 2369 | } |
| 2351 | − } | |
| 2370 | + } while (1); | |
| 2371 | + | |
| 2352 | 2372 | if (!i || |
| 2353 | 2373 | sg->length >= max_segment || |
| 2354 | 2374 | page_to_pfn(page) != last_pfn + 1) { |
| @@ -4222,6 +4242,7 @@ i915_gem_object_create(struct drm_i915_private *dev_priv, u64 size) · 1867 unmodified lines | ||
| 4222 | 4242 | |
| 4223 | 4243 | mapping = obj->base.filp->f_mapping; |
| 4224 | 4244 | mapping_set_gfp_mask(mapping, mask); |
| 4245 | + GEM_BUG_ON(!(mapping_gfp_mask(mapping) & __GFP_RECLAIM)); | |
| 4225 | 4246 | |
| 4226 | 4247 | i915_gem_object_init(obj, &i915_gem_object_ops); |
| 4227 | 4248 | |
| @@ -623,7 +623,7 @@ i915_gem_request_alloc(struct intel_engine_cs *engine, · 622 unmodified lines | ||
| 623 | 623 | * GPU processing the request, we never over-estimate the |
| 624 | 624 | * position of the head. |
| 625 | 625 | */ |
| 626 | − req->head = req->ring->tail; | |
| 626 | + req->head = req->ring->emit; | |
| 627 | 627 | |
| 628 | 628 | /* Check that we didn't interrupt ourselves with a new request */ |
| 629 | 629 | GEM_BUG_ON(req->timeline->seqno != req->fence.seqno); |
| @@ -480,9 +480,7 @@ static void guc_wq_item_append(struct i915_guc_client *client, · 479 unmodified lines | ||
| 480 | 480 | GEM_BUG_ON(freespace < wqi_size); |
| 481 | 481 | |
| 482 | 482 | /* The GuC firmware wants the tail index in QWords, not bytes */ |
| 483 | − tail = rq->tail; | |
| 484 | − assert_ring_tail_valid(rq->ring, rq->tail); | |
| 485 | − tail >>= 3; | |
| 483 | + tail = intel_ring_set_tail(rq->ring, rq->tail) >> 3; | |
| 486 | 484 | GEM_BUG_ON(tail > WQ_RING_TAIL_MAX); |
| 487 | 485 | |
| 488 | 486 | /* For now workqueue item is 4 DWs; workqueue buffer is 2 pages. So we |
| @@ -120,7 +120,8 @@ static void intel_crtc_init_scalers(struct intel_crtc *crtc, · 119 unmodified lines | ||
| 120 | 120 | static void skylake_pfit_enable(struct intel_crtc *crtc); |
| 121 | 121 | static void ironlake_pfit_disable(struct intel_crtc *crtc, bool force); |
| 122 | 122 | static void ironlake_pfit_enable(struct intel_crtc *crtc); |
| 123 | −static void intel_modeset_setup_hw_state(struct drm_device *dev); | |
| 123 | +static void intel_modeset_setup_hw_state(struct drm_device *dev, | |
| 124 | + struct drm_modeset_acquire_ctx *ctx); | |
| 124 | 125 | static void intel_pre_disable_primary_noatomic(struct drm_crtc *crtc); |
| 125 | 126 | |
| 126 | 127 | struct intel_limit { |
| @@ -3449,7 +3450,7 @@ __intel_display_resume(struct drm_device *dev, · 3322 unmodified lines | ||
| 3449 | 3450 | struct drm_crtc *crtc; |
| 3450 | 3451 | int i, ret; |
| 3451 | 3452 | |
| 3452 | − intel_modeset_setup_hw_state(dev); | |
| 3453 | + intel_modeset_setup_hw_state(dev, ctx); | |
| 3453 | 3454 | i915_redisable_vga(to_i915(dev)); |
| 3454 | 3455 | |
| 3455 | 3456 | if (!state) |
| @@ -5825,7 +5826,8 @@ static void i9xx_crtc_disable(struct intel_crtc_state *old_crtc_state, · 2369 unmodified lines | ||
| 5825 | 5826 | intel_update_watermarks(intel_crtc); |
| 5826 | 5827 | } |
| 5827 | 5828 | |
| 5828 | −static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) | |
| 5829 | +static void intel_crtc_disable_noatomic(struct drm_crtc *crtc, | |
| 5830 | + struct drm_modeset_acquire_ctx *ctx) | |
| 5829 | 5831 | { |
| 5830 | 5832 | struct intel_encoder *encoder; |
| 5831 | 5833 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
| @@ -5855,7 +5857,7 @@ static void intel_crtc_disable_noatomic(struct drm_crtc *crtc) · 23 unmodified lines | ||
| 5855 | 5857 | return; |
| 5856 | 5858 | } |
| 5857 | 5859 | |
| 5858 | − state->acquire_ctx = crtc->dev->mode_config.acquire_ctx; | |
| 5860 | + state->acquire_ctx = ctx; | |
| 5859 | 5861 | |
| 5860 | 5862 | /* Everything's already locked, -EDEADLK can't happen. */ |
| 5861 | 5863 | crtc_state = intel_atomic_get_crtc_state(state, intel_crtc); |
| @@ -15030,7 +15032,7 @@ int intel_modeset_init(struct drm_device *dev) · 9168 unmodified lines | ||
| 15030 | 15032 | intel_setup_outputs(dev_priv); |
| 15031 | 15033 | |
| 15032 | 15034 | drm_modeset_lock_all(dev); |
| 15033 | − intel_modeset_setup_hw_state(dev); | |
| 15035 | + intel_modeset_setup_hw_state(dev, dev->mode_config.acquire_ctx); | |
| 15034 | 15036 | drm_modeset_unlock_all(dev); |
| 15035 | 15037 | |
| 15036 | 15038 | for_each_intel_crtc(dev, crtc) { |
| @@ -15067,13 +15069,13 @@ int intel_modeset_init(struct drm_device *dev) · 30 unmodified lines | ||
| 15067 | 15069 | return 0; |
| 15068 | 15070 | } |
| 15069 | 15071 | |
| 15070 | −static void intel_enable_pipe_a(struct drm_device *dev) | |
| 15072 | +static void intel_enable_pipe_a(struct drm_device *dev, | |
| 15073 | + struct drm_modeset_acquire_ctx *ctx) | |
| 15071 | 15074 | { |
| 15072 | 15075 | struct intel_connector *connector; |
| 15073 | 15076 | struct drm_connector_list_iter conn_iter; |
| 15074 | 15077 | struct drm_connector *crt = NULL; |
| 15075 | 15078 | struct intel_load_detect_pipe load_detect_temp; |
| 15076 | − struct drm_modeset_acquire_ctx *ctx = dev->mode_config.acquire_ctx; | |
| 15077 | 15079 | int ret; |
| 15078 | 15080 | |
| 15079 | 15081 | /* We can't just switch on the pipe A, we need to set things up with a |
| @@ -15145,7 +15147,8 @@ static bool has_pch_trancoder(struct drm_i915_private *dev_priv, · 65 unmodified lines | ||
| 15145 | 15147 | (HAS_PCH_LPT_H(dev_priv) && pch_transcoder == TRANSCODER_A); |
| 15146 | 15148 | } |
| 15147 | 15149 | |
| 15148 | −static void intel_sanitize_crtc(struct intel_crtc *crtc) | |
| 15150 | +static void intel_sanitize_crtc(struct intel_crtc *crtc, | |
| 15151 | + struct drm_modeset_acquire_ctx *ctx) | |
| 15149 | 15152 | { |
| 15150 | 15153 | struct drm_device *dev = crtc->base.dev; |
| 15151 | 15154 | struct drm_i915_private *dev_priv = to_i915(dev); |
| @@ -15191,7 +15194,7 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) · 39 unmodified lines | ||
| 15191 | 15194 | plane = crtc->plane; |
| 15192 | 15195 | crtc->base.primary->state->visible = true; |
| 15193 | 15196 | crtc->plane = !plane; |
| 15194 | − intel_crtc_disable_noatomic(&crtc->base); | |
| 15197 | + intel_crtc_disable_noatomic(&crtc->base, ctx); | |
| 15195 | 15198 | crtc->plane = plane; |
| 15196 | 15199 | } |
| 15197 | 15200 | |
| @@ -15201,13 +15204,13 @@ static void intel_sanitize_crtc(struct intel_crtc *crtc) · 3 unmodified lines | ||
| 15201 | 15204 | * resume. Force-enable the pipe to fix this, the update_dpms |
| 15202 | 15205 | * call below we restore the pipe to the right state, but leave |
| 15203 | 15206 | * the required bits on. */ |
| 15204 | − intel_enable_pipe_a(dev); | |
| 15207 | + intel_enable_pipe_a(dev, ctx); | |
| 15205 | 15208 | } |
| 15206 | 15209 | |
| 15207 | 15210 | /* Adjust the state of the output pipe according to whether we |
| 15208 | 15211 | * have active connectors/encoders. */ |
| 15209 | 15212 | if (crtc->active && !intel_crtc_has_encoders(crtc)) |
| 15210 | − intel_crtc_disable_noatomic(&crtc->base); | |
| 15213 | + intel_crtc_disable_noatomic(&crtc->base, ctx); | |
| 15211 | 15214 | |
| 15212 | 15215 | if (crtc->active || HAS_GMCH_DISPLAY(dev_priv)) { |
| 15213 | 15216 | /* |
| @@ -15505,7 +15508,8 @@ get_encoder_power_domains(struct drm_i915_private *dev_priv) · 291 unmodified lines | ||
| 15505 | 15508 | * and sanitizes it to the current state |
| 15506 | 15509 | */ |
| 15507 | 15510 | static void |
| 15508 | −intel_modeset_setup_hw_state(struct drm_device *dev) | |
| 15511 | +intel_modeset_setup_hw_state(struct drm_device *dev, | |
| 15512 | + struct drm_modeset_acquire_ctx *ctx) | |
| 15509 | 15513 | { |
| 15510 | 15514 | struct drm_i915_private *dev_priv = to_i915(dev); |
| 15511 | 15515 | enum pipe pipe; |
| @@ -15525,7 +15529,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev) · 13 unmodified lines | ||
| 15525 | 15529 | for_each_pipe(dev_priv, pipe) { |
| 15526 | 15530 | crtc = intel_get_crtc_for_pipe(dev_priv, pipe); |
| 15527 | 15531 | |
| 15528 | − intel_sanitize_crtc(crtc); | |
| 15532 | + intel_sanitize_crtc(crtc, ctx); | |
| 15529 | 15533 | intel_dump_pipe_config(crtc, crtc->config, |
| 15530 | 15534 | "[setup_hw_state]"); |
| 15531 | 15535 | } |
| @@ -119,8 +119,6 @@ static int intel_dp_aux_setup_backlight(struct intel_connector *connector, · 118 unmodified lines | ||
| 119 | 119 | struct intel_dp *intel_dp = enc_to_intel_dp(&connector->encoder->base); |
| 120 | 120 | struct intel_panel *panel = &connector->panel; |
| 121 | 121 | |
| 122 | − intel_dp_aux_enable_backlight(connector); | |
| 123 | − | |
| 124 | 122 | if (intel_dp->edp_dpcd[2] & DP_EDP_BACKLIGHT_BRIGHTNESS_BYTE_COUNT) |
| 125 | 123 | panel->backlight.max = 0xFFFF; |
| 126 | 124 | else |
| @@ -326,8 +326,7 @@ static u64 execlists_update_context(struct drm_i915_gem_request *rq) · 325 unmodified lines | ||
| 326 | 326 | rq->ctx->ppgtt ?: rq->i915->mm.aliasing_ppgtt; |
| 327 | 327 | u32 *reg_state = ce->lrc_reg_state; |
| 328 | 328 | |
| 329 | − assert_ring_tail_valid(rq->ring, rq->tail); | |
| 330 | − reg_state[CTX_RING_TAIL+1] = rq->tail; | |
| 329 | + reg_state[CTX_RING_TAIL+1] = intel_ring_set_tail(rq->ring, rq->tail); | |
| 331 | 330 | |
| 332 | 331 | /* True 32b PPGTT with dynamic page allocation: update PDP |
| 333 | 332 | * registers and point the unallocated PDPs to scratch page. |
| @@ -2036,8 +2035,7 @@ void intel_lr_context_resume(struct drm_i915_private *dev_priv) · 1702 unmodified lines | ||
| 2036 | 2035 | ce->state->obj->mm.dirty = true; |
| 2037 | 2036 | i915_gem_object_unpin_map(ce->state->obj); |
| 2038 | 2037 | |
| 2039 | − ce->ring->head = ce->ring->tail = 0; | |
| 2040 | − intel_ring_update_space(ce->ring); | |
| 2038 | + intel_ring_reset(ce->ring, 0); | |
| 2041 | 2039 | } |
| 2042 | 2040 | } |
| 2043 | 2041 | } |
| @@ -49,7 +49,7 @@ static int __intel_ring_space(int head, int tail, int size) · 48 unmodified lines | ||
| 49 | 49 | |
| 50 | 50 | void intel_ring_update_space(struct intel_ring *ring) |
| 51 | 51 | { |
| 52 | − ring->space = __intel_ring_space(ring->head, ring->tail, ring->size); | |
| 52 | + ring->space = __intel_ring_space(ring->head, ring->emit, ring->size); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | static int |
| @@ -774,8 +774,8 @@ static void i9xx_submit_request(struct drm_i915_gem_request *request) · 718 unmodified lines | ||
| 774 | 774 | |
| 775 | 775 | i915_gem_request_submit(request); |
| 776 | 776 | |
| 777 | − assert_ring_tail_valid(request->ring, request->tail); | |
| 778 | − I915_WRITE_TAIL(request->engine, request->tail); | |
| 777 | + I915_WRITE_TAIL(request->engine, | |
| 778 | + intel_ring_set_tail(request->ring, request->tail)); | |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | static void i9xx_emit_breadcrumb(struct drm_i915_gem_request *req, u32 *cs) |
| @@ -1316,11 +1316,23 @@ err: · 534 unmodified lines | ||
| 1316 | 1316 | return PTR_ERR(addr); |
| 1317 | 1317 | } |
| 1318 | 1318 | |
| 1319 | +void intel_ring_reset(struct intel_ring *ring, u32 tail) | |
| 1320 | +{ | |
| 1321 | + GEM_BUG_ON(!list_empty(&ring->request_list)); | |
| 1322 | + ring->tail = tail; | |
| 1323 | + ring->head = tail; | |
| 1324 | + ring->emit = tail; | |
| 1325 | + intel_ring_update_space(ring); | |
| 1326 | +} | |
| 1327 | + | |
| 1319 | 1328 | void intel_ring_unpin(struct intel_ring *ring) |
| 1320 | 1329 | { |
| 1321 | 1330 | GEM_BUG_ON(!ring->vma); |
| 1322 | 1331 | GEM_BUG_ON(!ring->vaddr); |
| 1323 | 1332 | |
| 1333 | + /* Discard any unused bytes beyond that submitted to hw. */ | |
| 1334 | + intel_ring_reset(ring, ring->tail); | |
| 1335 | + | |
| 1324 | 1336 | if (i915_vma_is_map_and_fenceable(ring->vma)) |
| 1325 | 1337 | i915_vma_unpin_iomap(ring->vma); |
| 1326 | 1338 | else |
| @@ -1562,8 +1574,9 @@ void intel_legacy_submission_resume(struct drm_i915_private *dev_priv) · 235 unmodified lines | ||
| 1562 | 1574 | struct intel_engine_cs *engine; |
| 1563 | 1575 | enum intel_engine_id id; |
| 1564 | 1576 | |
| 1577 | + /* Restart from the beginning of the rings for convenience */ | |
| 1565 | 1578 | for_each_engine(engine, dev_priv, id) |
| 1566 | − engine->buffer->head = engine->buffer->tail; | |
| 1579 | + intel_ring_reset(engine->buffer, 0); | |
| 1567 | 1580 | } |
| 1568 | 1581 | |
| 1569 | 1582 | static int ring_request_alloc(struct drm_i915_gem_request *request) |
| @@ -1616,7 +1629,7 @@ static int wait_for_space(struct drm_i915_gem_request *req, int bytes) · 46 unmodified lines | ||
| 1616 | 1629 | unsigned space; |
| 1617 | 1630 | |
| 1618 | 1631 | /* Would completion of this request free enough space? */ |
| 1619 | − space = __intel_ring_space(target->postfix, ring->tail, | |
| 1632 | + space = __intel_ring_space(target->postfix, ring->emit, | |
| 1620 | 1633 | ring->size); |
| 1621 | 1634 | if (space >= bytes) |
| 1622 | 1635 | break; |
| @@ -1641,8 +1654,8 @@ static int wait_for_space(struct drm_i915_gem_request *req, int bytes) · 18 unmodified lines | ||
| 1641 | 1654 | u32 *intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) |
| 1642 | 1655 | { |
| 1643 | 1656 | struct intel_ring *ring = req->ring; |
| 1644 | − int remain_actual = ring->size - ring->tail; | |
| 1645 | − int remain_usable = ring->effective_size - ring->tail; | |
| 1657 | + int remain_actual = ring->size - ring->emit; | |
| 1658 | + int remain_usable = ring->effective_size - ring->emit; | |
| 1646 | 1659 | int bytes = num_dwords * sizeof(u32); |
| 1647 | 1660 | int total_bytes, wait_bytes; |
| 1648 | 1661 | bool need_wrap = false; |
| @@ -1678,17 +1691,17 @@ u32 *intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) · 29 unmodified lines | ||
| 1678 | 1691 | |
| 1679 | 1692 | if (unlikely(need_wrap)) { |
| 1680 | 1693 | GEM_BUG_ON(remain_actual > ring->space); |
| 1681 | − GEM_BUG_ON(ring->tail + remain_actual > ring->size); | |
| 1694 | + GEM_BUG_ON(ring->emit + remain_actual > ring->size); | |
| 1682 | 1695 | |
| 1683 | 1696 | /* Fill the tail with MI_NOOP */ |
| 1684 | − memset(ring->vaddr + ring->tail, 0, remain_actual); | |
| 1685 | − ring->tail = 0; | |
| 1697 | + memset(ring->vaddr + ring->emit, 0, remain_actual); | |
| 1698 | + ring->emit = 0; | |
| 1686 | 1699 | ring->space -= remain_actual; |
| 1687 | 1700 | } |
| 1688 | 1701 | |
| 1689 | − GEM_BUG_ON(ring->tail > ring->size - bytes); | |
| 1690 | − cs = ring->vaddr + ring->tail; | |
| 1691 | − ring->tail += bytes; | |
| 1702 | + GEM_BUG_ON(ring->emit > ring->size - bytes); | |
| 1703 | + cs = ring->vaddr + ring->emit; | |
| 1704 | + ring->emit += bytes; | |
| 1692 | 1705 | ring->space -= bytes; |
| 1693 | 1706 | GEM_BUG_ON(ring->space < 0); |
| 1694 | 1707 | |
| @@ -1699,7 +1712,7 @@ u32 *intel_ring_begin(struct drm_i915_gem_request *req, int num_dwords) · 4 unmodified lines | ||
| 1699 | 1712 | int intel_ring_cacheline_align(struct drm_i915_gem_request *req) |
| 1700 | 1713 | { |
| 1701 | 1714 | int num_dwords = |
| 1702 | − (req->ring->tail & (CACHELINE_BYTES - 1)) / sizeof(uint32_t); | |
| 1715 | + (req->ring->emit & (CACHELINE_BYTES - 1)) / sizeof(uint32_t); | |
| 1703 | 1716 | u32 *cs; |
| 1704 | 1717 | |
| 1705 | 1718 | if (num_dwords == 0) |
| @@ -145,6 +145,7 @@ struct intel_ring { · 144 unmodified lines | ||
| 145 | 145 | |
| 146 | 146 | u32 head; |
| 147 | 147 | u32 tail; |
| 148 | + u32 emit; | |
| 148 | 149 | |
| 149 | 150 | int space; |
| 150 | 151 | int size; |
| @@ -488,6 +489,8 @@ intel_write_status_page(struct intel_engine_cs *engine, int reg, u32 value) · 337 unmodified lines | ||
| 488 | 489 | struct intel_ring * |
| 489 | 490 | intel_engine_create_ring(struct intel_engine_cs *engine, int size); |
| 490 | 491 | int intel_ring_pin(struct intel_ring *ring, unsigned int offset_bias); |
| 492 | +void intel_ring_reset(struct intel_ring *ring, u32 tail); | |
| 493 | +void intel_ring_update_space(struct intel_ring *ring); | |
| 491 | 494 | void intel_ring_unpin(struct intel_ring *ring); |
| 492 | 495 | void intel_ring_free(struct intel_ring *ring); |
| 493 | 496 | |
| @@ -511,7 +514,7 @@ intel_ring_advance(struct drm_i915_gem_request *req, u32 *cs) · 17 unmodified lines | ||
| 511 | 514 | * reserved for the command packet (i.e. the value passed to |
| 512 | 515 | * intel_ring_begin()). |
| 513 | 516 | */ |
| 514 | − GEM_BUG_ON((req->ring->vaddr + req->ring->tail) != cs); | |
| 517 | + GEM_BUG_ON((req->ring->vaddr + req->ring->emit) != cs); | |
| 515 | 518 | } |
| 516 | 519 | |
| 517 | 520 | static inline u32 |
| @@ -540,7 +543,19 @@ assert_ring_tail_valid(const struct intel_ring *ring, unsigned int tail) · 22 unmodified lines | ||
| 540 | 543 | GEM_BUG_ON(tail >= ring->size); |
| 541 | 544 | } |
| 542 | 545 | |
| 543 | −void intel_ring_update_space(struct intel_ring *ring); | |
| 546 | +static inline unsigned int | |
| 547 | +intel_ring_set_tail(struct intel_ring *ring, unsigned int tail) | |
| 548 | +{ | |
| 549 | + /* Whilst writes to the tail are strictly order, there is no | |
| 550 | + * serialisation between readers and the writers. The tail may be | |
| 551 | + * read by i915_gem_request_retire() just as it is being updated | |
| 552 | + * by execlists, as although the breadcrumb is complete, the context | |
| 553 | + * switch hasn't been seen. | |
| 554 | + */ | |
| 555 | + assert_ring_tail_valid(ring, tail); | |
| 556 | + ring->tail = tail; | |
| 557 | + return tail; | |
| 558 | +} | |
| 544 | 559 | |
| 545 | 560 | void intel_engine_init_global_seqno(struct intel_engine_cs *engine, u32 seqno); |
| 546 | 561 | |
| @@ -3393,6 +3393,13 @@ void radeon_combios_asic_init(struct drm_device *dev) · 3392 unmodified lines | ||
| 3393 | 3393 | rdev->pdev->subsystem_vendor == 0x103c && |
| 3394 | 3394 | rdev->pdev->subsystem_device == 0x280a) |
| 3395 | 3395 | return; |
| 3396 | + /* quirk for rs4xx Toshiba Sattellite L20-183 latop to make it resume | |
| 3397 | + * - it hangs on resume inside the dynclk 1 table. | |
| 3398 | + */ | |
| 3399 | + if (rdev->family == CHIP_RS400 && | |
| 3400 | + rdev->pdev->subsystem_vendor == 0x1179 && | |
| 3401 | + rdev->pdev->subsystem_device == 0xff31) | |
| 3402 | + return; | |
| 3396 | 3403 | |
| 3397 | 3404 | /* DYN CLK 1 */ |
| 3398 | 3405 | table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE); |
| @@ -136,6 +136,10 @@ static struct radeon_px_quirk radeon_px_quirk_list[] = { · 135 unmodified lines | ||
| 136 | 136 | * https://bugzilla.kernel.org/show_bug.cgi?id=51381 |
| 137 | 137 | */ |
| 138 | 138 | { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, |
| 139 | + /* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU | |
| 140 | + * https://bugs.freedesktop.org/show_bug.cgi?id=101491 | |
| 141 | + */ | |
| 142 | + { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX }, | |
| 139 | 143 | /* macbook pro 8.2 */ |
| 140 | 144 | { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, |
| 141 | 145 | { 0, 0, 0, 0, 0 }, |