提交 58e10eb9 编写于 作者: C Chris Wilson

Merge branch 'drm-intel-fixes' into drm-intel-next

Conflicts:
	drivers/gpu/drm/i915/i915_gem_evict.c
	drivers/gpu/drm/i915/intel_display.c
	drivers/gpu/drm/i915/intel_dp.c
...@@ -3379,6 +3379,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj, ...@@ -3379,6 +3379,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
(int) reloc->offset, (int) reloc->offset,
reloc->read_domains, reloc->read_domains,
reloc->write_domain); reloc->write_domain);
drm_gem_object_unreference(target_obj);
i915_gem_object_unpin(obj);
return -EINVAL; return -EINVAL;
} }
if (reloc->write_domain & I915_GEM_DOMAIN_CPU || if (reloc->write_domain & I915_GEM_DOMAIN_CPU ||
......
...@@ -93,7 +93,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen ...@@ -93,7 +93,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen
{ {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
struct list_head eviction_list, unwind_list; struct list_head eviction_list, unwind_list;
struct drm_i915_gem_object *obj_priv, *tmp_obj_priv; struct drm_i915_gem_object *obj_priv;
struct list_head *render_iter, *bsd_iter; struct list_head *render_iter, *bsd_iter;
int ret = 0; int ret = 0;
...@@ -175,36 +175,34 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen ...@@ -175,36 +175,34 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen
return -ENOSPC; return -ENOSPC;
found: found:
/* drm_mm doesn't allow any other other operations while
* scanning, therefore store to be evicted objects on a
* temporary list. */
INIT_LIST_HEAD(&eviction_list); INIT_LIST_HEAD(&eviction_list);
list_for_each_entry_safe(obj_priv, tmp_obj_priv, while (!list_empty(&unwind_list)) {
&unwind_list, evict_list) { obj_priv = list_first_entry(&unwind_list,
struct drm_i915_gem_object,
evict_list);
if (drm_mm_scan_remove_block(obj_priv->gtt_space)) { if (drm_mm_scan_remove_block(obj_priv->gtt_space)) {
/* drm_mm doesn't allow any other other operations while
* scanning, therefore store to be evicted objects on a
* temporary list. */
list_move(&obj_priv->evict_list, &eviction_list); list_move(&obj_priv->evict_list, &eviction_list);
} else continue;
drm_gem_object_unreference(&obj_priv->base); }
list_del(&obj_priv->evict_list);
drm_gem_object_unreference(&obj_priv->base);
} }
/* Unbinding will emit any required flushes */ /* Unbinding will emit any required flushes */
list_for_each_entry_safe(obj_priv, tmp_obj_priv, while (!list_empty(&eviction_list)) {
&eviction_list, evict_list) { obj_priv = list_first_entry(&eviction_list,
ret = i915_gem_object_unbind(&obj_priv->base); struct drm_i915_gem_object,
if (ret) evict_list);
return ret; if (ret == 0)
ret = i915_gem_object_unbind(&obj_priv->base);
list_del(&obj_priv->evict_list);
drm_gem_object_unreference(&obj_priv->base); drm_gem_object_unreference(&obj_priv->base);
} }
/* The just created free hole should be on the top of the free stack return ret;
* maintained by drm_mm, so this BUG_ON actually executes in O(1).
* Furthermore all accessed data has just recently been used, so it
* should be really fast, too. */
BUG_ON(!drm_mm_search_free(&dev_priv->mm.gtt_space, min_size,
alignment, 0));
return 0;
} }
int int
......
...@@ -2105,7 +2105,7 @@ ...@@ -2105,7 +2105,7 @@
/* Pipe A */ /* Pipe A */
#define PIPEADSL 0x70000 #define PIPEADSL 0x70000
#define DSL_LINEMASK 0x00000fff #define DSL_LINEMASK 0x00000fff
#define PIPEACONF 0x70008 #define PIPEACONF 0x70008
#define PIPECONF_ENABLE (1<<31) #define PIPECONF_ENABLE (1<<31)
#define PIPECONF_DISABLE 0 #define PIPECONF_DISABLE 0
...@@ -2162,13 +2162,14 @@ ...@@ -2162,13 +2162,14 @@
#define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */ #define PIPE_START_VBLANK_INTERRUPT_STATUS (1UL<<2) /* 965 or later */
#define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1) #define PIPE_VBLANK_INTERRUPT_STATUS (1UL<<1)
#define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0) #define PIPE_OVERLAY_UPDATED_STATUS (1UL<<0)
#define PIPE_BPC_MASK (7 << 5) /* Ironlake */ #define PIPE_BPC_MASK (7 << 5) /* Ironlake */
#define PIPE_8BPC (0 << 5) #define PIPE_8BPC (0 << 5)
#define PIPE_10BPC (1 << 5) #define PIPE_10BPC (1 << 5)
#define PIPE_6BPC (2 << 5) #define PIPE_6BPC (2 << 5)
#define PIPE_12BPC (3 << 5) #define PIPE_12BPC (3 << 5)
#define PIPECONF(pipe) _PIPE(pipe, PIPEACONF, PIPEBCONF) #define PIPECONF(pipe) _PIPE(pipe, PIPEACONF, PIPEBCONF)
#define PIPEDSL(pipe) _PIPE(pipe, PIPEADSL, PIPEBDSL)
#define DSPARB 0x70030 #define DSPARB 0x70030
#define DSPARB_CSTART_MASK (0x7f << 7) #define DSPARB_CSTART_MASK (0x7f << 7)
......
...@@ -1017,8 +1017,8 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) ...@@ -1017,8 +1017,8 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)
DRM_DEBUG_KMS("vblank wait timed out\n"); DRM_DEBUG_KMS("vblank wait timed out\n");
} }
/** /*
* intel_wait_for_vblank_off - wait for vblank after disabling a pipe * intel_wait_for_pipe_off - wait for pipe to turn off
* @dev: drm device * @dev: drm device
* @pipe: pipe to wait for * @pipe: pipe to wait for
* *
...@@ -1026,26 +1026,39 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe) ...@@ -1026,26 +1026,39 @@ void intel_wait_for_vblank(struct drm_device *dev, int pipe)
* spinning on the vblank interrupt status bit, since we won't actually * spinning on the vblank interrupt status bit, since we won't actually
* see an interrupt when the pipe is disabled. * see an interrupt when the pipe is disabled.
* *
* So this function waits for the display line value to settle (it * On Gen4 and above:
* usually ends up stopping at the start of the next frame). * wait for the pipe register state bit to turn off
*
* Otherwise:
* wait for the display line value to settle (it usually
* ends up stopping at the start of the next frame).
*
*/ */
void intel_wait_for_vblank_off(struct drm_device *dev, int pipe) void intel_wait_for_pipe_off(struct drm_device *dev, int pipe)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
int pipedsl_reg = (pipe == 0 ? PIPEADSL : PIPEBDSL);
unsigned long timeout = jiffies + msecs_to_jiffies(100); if (INTEL_INFO(dev)->gen >= 4) {
u32 last_line, line; int reg = PIPECONF(pipe);
/* Wait for the display line to settle */ /* Wait for the Pipe State to go off */
line = I915_READ(pipedsl_reg) & DSL_LINEMASK; if (wait_for((I915_READ(reg) & I965_PIPECONF_ACTIVE) == 0,
do { 100))
last_line = line; DRM_DEBUG_KMS("pipe_off wait timed out\n");
MSLEEP(5); } else {
line = I915_READ(pipedsl_reg) & DSL_LINEMASK; u32 last_line;
} while (line != last_line && time_after(timeout, jiffies)); int reg = PIPEDSL(pipe);
unsigned long timeout = jiffies + msecs_to_jiffies(100);
if (line != last_line)
DRM_DEBUG_KMS("vblank wait timed out\n"); /* Wait for the display line to settle */
do {
last_line = I915_READ(reg) & DSL_LINEMASK;
mdelay(5);
} while (((I915_READ(reg) & DSL_LINEMASK) != last_line) &&
time_after(timeout, jiffies));
if (time_after(jiffies, timeout))
DRM_DEBUG_KMS("pipe_off wait timed out\n");
}
} }
static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval) static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
...@@ -2406,7 +2419,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) ...@@ -2406,7 +2419,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
/* Wait for vblank for the disable to take effect */ /* Wait for vblank for the disable to take effect */
if (IS_GEN2(dev)) if (IS_GEN2(dev))
intel_wait_for_vblank_off(dev, pipe); intel_wait_for_vblank(dev, pipe);
} }
/* Don't disable pipe A or pipe A PLLs if needed */ /* Don't disable pipe A or pipe A PLLs if needed */
...@@ -2419,9 +2432,9 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc) ...@@ -2419,9 +2432,9 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
if (temp & PIPECONF_ENABLE) { if (temp & PIPECONF_ENABLE) {
I915_WRITE(reg, temp & ~PIPECONF_ENABLE); I915_WRITE(reg, temp & ~PIPECONF_ENABLE);
/* Wait for vblank for the disable to take effect. */ /* Wait for the pipe to turn off */
POSTING_READ(reg); POSTING_READ(reg);
intel_wait_for_vblank_off(dev, pipe); intel_wait_for_pipe_off(dev, pipe);
} }
reg = DPLL(pipe); reg = DPLL(pipe);
......
...@@ -1186,25 +1186,22 @@ intel_channel_eq_ok(struct intel_dp *intel_dp) ...@@ -1186,25 +1186,22 @@ intel_channel_eq_ok(struct intel_dp *intel_dp)
static bool static bool
intel_dp_set_link_train(struct intel_dp *intel_dp, intel_dp_set_link_train(struct intel_dp *intel_dp,
uint32_t dp_reg_value, uint32_t dp_reg_value,
uint8_t dp_train_pat, uint8_t dp_train_pat)
bool first)
{ {
struct drm_device *dev = intel_dp->base.base.dev; struct drm_device *dev = intel_dp->base.base.dev;
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc);
int ret; int ret;
I915_WRITE(intel_dp->output_reg, dp_reg_value); I915_WRITE(intel_dp->output_reg, dp_reg_value);
POSTING_READ(intel_dp->output_reg); POSTING_READ(intel_dp->output_reg);
if (first)
intel_wait_for_vblank(dev, intel_crtc->pipe);
intel_dp_aux_native_write_1(intel_dp, intel_dp_aux_native_write_1(intel_dp,
DP_TRAINING_PATTERN_SET, DP_TRAINING_PATTERN_SET,
dp_train_pat); dp_train_pat);
ret = intel_dp_aux_native_write(intel_dp, ret = intel_dp_aux_native_write(intel_dp,
DP_TRAINING_LANE0_SET, intel_dp->train_set, 4); DP_TRAINING_LANE0_SET,
intel_dp->train_set, 4);
if (ret != 4) if (ret != 4)
return false; return false;
...@@ -1216,14 +1213,20 @@ static void ...@@ -1216,14 +1213,20 @@ static void
intel_dp_start_link_train(struct intel_dp *intel_dp) intel_dp_start_link_train(struct intel_dp *intel_dp)
{ {
struct drm_device *dev = intel_dp->base.base.dev; struct drm_device *dev = intel_dp->base.base.dev;
struct drm_i915_private *dev_priv = dev->dev_private;
struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc);
int i; int i;
uint8_t voltage; uint8_t voltage;
bool clock_recovery = false; bool clock_recovery = false;
bool first = true;
int tries; int tries;
u32 reg; u32 reg;
uint32_t DP = intel_dp->DP; uint32_t DP = intel_dp->DP;
/* Enable output, wait for it to become active */
I915_WRITE(intel_dp->output_reg, intel_dp->DP);
POSTING_READ(intel_dp->output_reg);
intel_wait_for_vblank(dev, intel_crtc->pipe);
/* Write the link configuration data */ /* Write the link configuration data */
intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET, intel_dp_aux_native_write(intel_dp, DP_LINK_BW_SET,
intel_dp->link_configuration, intel_dp->link_configuration,
...@@ -1255,9 +1258,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp) ...@@ -1255,9 +1258,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
reg = DP | DP_LINK_TRAIN_PAT_1; reg = DP | DP_LINK_TRAIN_PAT_1;
if (!intel_dp_set_link_train(intel_dp, reg, if (!intel_dp_set_link_train(intel_dp, reg,
DP_TRAINING_PATTERN_1, first)) DP_TRAINING_PATTERN_1))
break; break;
first = false;
/* Set training pattern 1 */ /* Set training pattern 1 */
udelay(100); udelay(100);
...@@ -1324,8 +1326,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp) ...@@ -1324,8 +1326,7 @@ intel_dp_complete_link_train(struct intel_dp *intel_dp)
/* channel eq pattern */ /* channel eq pattern */
if (!intel_dp_set_link_train(intel_dp, reg, if (!intel_dp_set_link_train(intel_dp, reg,
DP_TRAINING_PATTERN_2, DP_TRAINING_PATTERN_2))
false))
break; break;
udelay(400); udelay(400);
......
...@@ -242,8 +242,8 @@ extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev, ...@@ -242,8 +242,8 @@ extern struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
struct drm_crtc *crtc); struct drm_crtc *crtc);
int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data, int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern void intel_wait_for_vblank_off(struct drm_device *dev, int pipe);
extern void intel_wait_for_vblank(struct drm_device *dev, int pipe); extern void intel_wait_for_vblank(struct drm_device *dev, int pipe);
extern void intel_wait_for_pipe_off(struct drm_device *dev, int pipe);
extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder, extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
struct drm_connector *connector, struct drm_connector *connector,
struct drm_display_mode *mode, struct drm_display_mode *mode,
......
...@@ -1170,7 +1170,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ...@@ -1170,7 +1170,7 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
I915_WRITE(pipeconf_reg, pipeconf & ~PIPECONF_ENABLE); I915_WRITE(pipeconf_reg, pipeconf & ~PIPECONF_ENABLE);
/* Wait for vblank for the disable to take effect. */ /* Wait for vblank for the disable to take effect. */
intel_wait_for_vblank_off(dev, intel_crtc->pipe); intel_wait_for_pipe_off(dev, intel_crtc->pipe);
/* Filter ctl must be set before TV_WIN_SIZE */ /* Filter ctl must be set before TV_WIN_SIZE */
I915_WRITE(TV_FILTER_CTL_1, TV_AUTO_SCALE); I915_WRITE(TV_FILTER_CTL_1, TV_AUTO_SCALE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册