Skip to content

Commit

Permalink
Merge remote branch 'intel/drm-intel-fixes' of ../drm-next into drm-c…
Browse files Browse the repository at this point in the history
…ore-next

* 'intel/drm-intel-fixes' of ../drm-next:
  Revert "drm/i915: Don't save/restore hardware status page address register"
  drm/i915: Avoid unmapping pages from a NULL address space
  drm/i915: Fix use after free within tracepoint
  drm/i915: Restore missing command flush before interrupt on BLT ring
  drm/i915: Disable pagefaults along execbuffer relocation fast path
  drm/i915: Fix computation of pitch for dumb bo creator
  drm/i915: report correct render clock frequencies on SNB
  drm/i915/dp: Correct the order of deletion for ghost eDP devices
  drm/i915: Fix tiling corruption from pipelined fencing
  drm/i915: Re-enable self-refresh
  drm/i915: Prevent racy removal of request from client list
  drm/i915: skip redundant operations whilst enabling pipes and planes
  drm/i915: Remove surplus POSTING_READs before wait_for_vblank
  • Loading branch information
Dave Airlie committed Mar 24, 2011
2 parents 64146f8 + f0c8602 commit 2d370f5
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 127 deletions.
8 changes: 4 additions & 4 deletions drivers/gpu/drm/i915/i915_debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)
seq_printf(m, "Render p-state limit: %d\n",
rp_state_limits & 0xff);
seq_printf(m, "CAGF: %dMHz\n", ((rpstat & GEN6_CAGF_MASK) >>
GEN6_CAGF_SHIFT) * 100);
GEN6_CAGF_SHIFT) * 50);
seq_printf(m, "RP CUR UP EI: %dus\n", rpupei &
GEN6_CURICONT_MASK);
seq_printf(m, "RP CUR UP: %dus\n", rpcurup &
Expand All @@ -908,15 +908,15 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused)

max_freq = (rp_state_cap & 0xff0000) >> 16;
seq_printf(m, "Lowest (RPN) frequency: %dMHz\n",
max_freq * 100);
max_freq * 50);

max_freq = (rp_state_cap & 0xff00) >> 8;
seq_printf(m, "Nominal (RP1) frequency: %dMHz\n",
max_freq * 100);
max_freq * 50);

max_freq = rp_state_cap & 0xff;
seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n",
max_freq * 100);
max_freq * 50);

__gen6_gt_force_wake_put(dev_priv);
} else {
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ typedef struct drm_i915_private {
u32 saveDSPACNTR;
u32 saveDSPBCNTR;
u32 saveDSPARB;
u32 saveHWS;
u32 savePIPEACONF;
u32 savePIPEBCONF;
u32 savePIPEASRC;
Expand Down
70 changes: 34 additions & 36 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ i915_gem_dumb_create(struct drm_file *file,
struct drm_mode_create_dumb *args)
{
/* have to work out size/pitch and return them */
args->pitch = ALIGN(args->width & ((args->bpp + 1) / 8), 64);
args->pitch = ALIGN(args->width * ((args->bpp + 7) / 8), 64);
args->size = args->pitch * args->height;
return i915_gem_create(file, dev,
args->size, &args->handle);
Expand Down Expand Up @@ -1356,9 +1356,10 @@ i915_gem_release_mmap(struct drm_i915_gem_object *obj)
if (!obj->fault_mappable)
return;

unmap_mapping_range(obj->base.dev->dev_mapping,
(loff_t)obj->base.map_list.hash.key<<PAGE_SHIFT,
obj->base.size, 1);
if (obj->base.dev->dev_mapping)
unmap_mapping_range(obj->base.dev->dev_mapping,
(loff_t)obj->base.map_list.hash.key<<PAGE_SHIFT,
obj->base.size, 1);

obj->fault_mappable = false;
}
Expand Down Expand Up @@ -1796,8 +1797,10 @@ i915_gem_request_remove_from_client(struct drm_i915_gem_request *request)
return;

spin_lock(&file_priv->mm.lock);
list_del(&request->client_list);
request->file_priv = NULL;
if (request->file_priv) {
list_del(&request->client_list);
request->file_priv = NULL;
}
spin_unlock(&file_priv->mm.lock);
}

Expand Down Expand Up @@ -2217,13 +2220,18 @@ i915_gem_flush_ring(struct intel_ring_buffer *ring,
{
int ret;

if (((invalidate_domains | flush_domains) & I915_GEM_GPU_DOMAINS) == 0)
return 0;

trace_i915_gem_ring_flush(ring, invalidate_domains, flush_domains);

ret = ring->flush(ring, invalidate_domains, flush_domains);
if (ret)
return ret;

i915_gem_process_flushing_list(ring, flush_domains);
if (flush_domains & I915_GEM_GPU_DOMAINS)
i915_gem_process_flushing_list(ring, flush_domains);

return 0;
}

Expand Down Expand Up @@ -2579,8 +2587,23 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
reg = &dev_priv->fence_regs[obj->fence_reg];
list_move_tail(&reg->lru_list, &dev_priv->mm.fence_list);

if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
pipelined = NULL;
if (obj->tiling_changed) {
ret = i915_gem_object_flush_fence(obj, pipelined);
if (ret)
return ret;

if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
pipelined = NULL;

if (pipelined) {
reg->setup_seqno =
i915_gem_next_request_seqno(pipelined);
obj->last_fenced_seqno = reg->setup_seqno;
obj->last_fenced_ring = pipelined;
}

goto update;
}

if (!pipelined) {
if (reg->setup_seqno) {
Expand All @@ -2599,31 +2622,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj,
ret = i915_gem_object_flush_fence(obj, pipelined);
if (ret)
return ret;
} else if (obj->tiling_changed) {
if (obj->fenced_gpu_access) {
if (obj->base.write_domain & I915_GEM_GPU_DOMAINS) {
ret = i915_gem_flush_ring(obj->ring,
0, obj->base.write_domain);
if (ret)
return ret;
}

obj->fenced_gpu_access = false;
}
}

if (!obj->fenced_gpu_access && !obj->last_fenced_seqno)
pipelined = NULL;
BUG_ON(!pipelined && reg->setup_seqno);

if (obj->tiling_changed) {
if (pipelined) {
reg->setup_seqno =
i915_gem_next_request_seqno(pipelined);
obj->last_fenced_seqno = reg->setup_seqno;
obj->last_fenced_ring = pipelined;
}
goto update;
}

return 0;
Expand Down Expand Up @@ -3606,6 +3604,8 @@ static void i915_gem_free_object_tail(struct drm_i915_gem_object *obj)
return;
}

trace_i915_gem_object_destroy(obj);

if (obj->base.map_list.map)
i915_gem_free_mmap_offset(obj);

Expand All @@ -3615,8 +3615,6 @@ static void i915_gem_free_object_tail(struct drm_i915_gem_object *obj)
kfree(obj->page_cpu_valid);
kfree(obj->bit_17);
kfree(obj);

trace_i915_gem_object_destroy(obj);
}

void i915_gem_free_object(struct drm_gem_object *gem_obj)
Expand Down
21 changes: 17 additions & 4 deletions drivers/gpu/drm/i915/i915_gem_execbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj,
uint32_t __iomem *reloc_entry;
void __iomem *reloc_page;

/* We can't wait for rendering with pagefaults disabled */
if (obj->active && in_atomic())
return -EFAULT;

ret = i915_gem_object_set_to_gtt_domain(obj, 1);
if (ret)
return ret;
Expand Down Expand Up @@ -440,15 +444,24 @@ i915_gem_execbuffer_relocate(struct drm_device *dev,
struct list_head *objects)
{
struct drm_i915_gem_object *obj;
int ret;

int ret = 0;

/* This is the fast path and we cannot handle a pagefault whilst
* holding the struct mutex lest the user pass in the relocations
* contained within a mmaped bo. For in such a case we, the page
* fault handler would call i915_gem_fault() and we would try to
* acquire the struct mutex again. Obviously this is bad and so
* lockdep complains vehemently.
*/
pagefault_disable();
list_for_each_entry(obj, objects, exec_list) {
ret = i915_gem_execbuffer_relocate_object(obj, eb);
if (ret)
return ret;
break;
}
pagefault_enable();

return 0;
return ret;
}

static int
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/i915/i915_suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,9 @@ int i915_save_state(struct drm_device *dev)

pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB);

/* Hardware status page */
dev_priv->saveHWS = I915_READ(HWS_PGA);

i915_save_display(dev);

/* Interrupt state */
Expand Down Expand Up @@ -842,6 +845,9 @@ int i915_restore_state(struct drm_device *dev)

pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB);

/* Hardware status page */
I915_WRITE(HWS_PGA, dev_priv->saveHWS);

i915_restore_display(dev);

/* Interrupt state */
Expand Down
39 changes: 18 additions & 21 deletions drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1516,9 +1516,10 @@ static void intel_enable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe,

reg = PIPECONF(pipe);
val = I915_READ(reg);
val |= PIPECONF_ENABLE;
I915_WRITE(reg, val);
POSTING_READ(reg);
if (val & PIPECONF_ENABLE)
return;

I915_WRITE(reg, val | PIPECONF_ENABLE);
intel_wait_for_vblank(dev_priv->dev, pipe);
}

Expand Down Expand Up @@ -1552,9 +1553,10 @@ static void intel_disable_pipe(struct drm_i915_private *dev_priv,

reg = PIPECONF(pipe);
val = I915_READ(reg);
val &= ~PIPECONF_ENABLE;
I915_WRITE(reg, val);
POSTING_READ(reg);
if ((val & PIPECONF_ENABLE) == 0)
return;

I915_WRITE(reg, val & ~PIPECONF_ENABLE);
intel_wait_for_pipe_off(dev_priv->dev, pipe);
}

Expand All @@ -1577,9 +1579,10 @@ static void intel_enable_plane(struct drm_i915_private *dev_priv,

reg = DSPCNTR(plane);
val = I915_READ(reg);
val |= DISPLAY_PLANE_ENABLE;
I915_WRITE(reg, val);
POSTING_READ(reg);
if (val & DISPLAY_PLANE_ENABLE)
return;

I915_WRITE(reg, val | DISPLAY_PLANE_ENABLE);
intel_wait_for_vblank(dev_priv->dev, pipe);
}

Expand Down Expand Up @@ -1610,9 +1613,10 @@ static void intel_disable_plane(struct drm_i915_private *dev_priv,

reg = DSPCNTR(plane);
val = I915_READ(reg);
val &= ~DISPLAY_PLANE_ENABLE;
I915_WRITE(reg, val);
POSTING_READ(reg);
if ((val & DISPLAY_PLANE_ENABLE) == 0)
return;

I915_WRITE(reg, val & ~DISPLAY_PLANE_ENABLE);
intel_flush_display_plane(dev_priv, plane);
intel_wait_for_vblank(dev_priv->dev, pipe);
}
Expand Down Expand Up @@ -1769,7 +1773,6 @@ static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
return;

I915_WRITE(DPFC_CONTROL, dpfc_ctl & ~DPFC_CTL_EN);
POSTING_READ(DPFC_CONTROL);
intel_wait_for_vblank(dev, intel_crtc->pipe);
}

Expand Down Expand Up @@ -1861,7 +1864,6 @@ static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval)
return;

I915_WRITE(ILK_DPFC_CONTROL, dpfc_ctl & ~DPFC_CTL_EN);
POSTING_READ(ILK_DPFC_CONTROL);
intel_wait_for_vblank(dev, intel_crtc->pipe);
}

Expand Down Expand Up @@ -3883,10 +3885,7 @@ static bool g4x_compute_srwm(struct drm_device *dev,
display, cursor);
}

static inline bool single_plane_enabled(unsigned int mask)
{
return mask && (mask & -mask) == 0;
}
#define single_plane_enabled(mask) is_power_of_2(mask)

static void g4x_update_wm(struct drm_device *dev)
{
Expand Down Expand Up @@ -5777,7 +5776,6 @@ static void intel_increase_pllclock(struct drm_crtc *crtc)

dpll &= ~DISPLAY_RATE_SELECT_FPA1;
I915_WRITE(dpll_reg, dpll);
POSTING_READ(dpll_reg);
intel_wait_for_vblank(dev, pipe);

dpll = I915_READ(dpll_reg);
Expand Down Expand Up @@ -5821,7 +5819,6 @@ static void intel_decrease_pllclock(struct drm_crtc *crtc)

dpll |= DISPLAY_RATE_SELECT_FPA1;
I915_WRITE(dpll_reg, dpll);
dpll = I915_READ(dpll_reg);
intel_wait_for_vblank(dev, pipe);
dpll = I915_READ(dpll_reg);
if (!(dpll & DISPLAY_RATE_SELECT_FPA1))
Expand Down Expand Up @@ -6933,7 +6930,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv)
DRM_ERROR("timeout waiting for pcode mailbox to finish\n");
if (pcu_mbox & (1<<31)) { /* OC supported */
max_freq = pcu_mbox & 0xff;
DRM_DEBUG_DRIVER("overclocking supported, adjusting frequency max to %dMHz\n", pcu_mbox * 100);
DRM_DEBUG_DRIVER("overclocking supported, adjusting frequency max to %dMHz\n", pcu_mbox * 50);
}

/* In units of 100MHz */
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1957,9 +1957,9 @@ intel_dp_init(struct drm_device *dev, int output_reg)
DP_NO_AUX_HANDSHAKE_LINK_TRAINING;
} else {
/* if this fails, presume the device is a ghost */
DRM_ERROR("failed to retrieve link info\n");
intel_dp_destroy(&intel_connector->base);
DRM_INFO("failed to retrieve link info, disabling eDP\n");
intel_dp_encoder_destroy(&intel_dp->base.base);
intel_dp_destroy(&intel_connector->base);
return;
}
}
Expand Down
Loading

0 comments on commit 2d370f5

Please sign in to comment.