Merge tag 'drm-misc-fixes-2017-08-08' of git://anongit.freedesktop.org/git/drm-misc into drm-fixes

Core Changes:
- dma-buf: Allow multiple sync_files to wrap a single dma-fence (Chris)

Driver Changes:
- rockchip: misc fixes to vop driver from the downstream rockchip tree (Mark)
- Error path cleanups to tc358767 & host1x (Lucas & Paul, respectively)

* tag 'drm-misc-fixes-2017-08-08' of git://anongit.freedesktop.org/git/drm-misc:
  drm/rockchip: vop: report error when check resource error
  drm/rockchip: vop: round_up pitches to word align
  drm/rockchip: vop: fix NV12 video display error
  drm/rockchip: vop: fix iommu page fault when resume
  dma-buf/sync_file: Allow multiple sync_files to wrap a single dma-fence
  drm/bridge: tc358767: fix probe without attached output node
This commit is contained in:
Dave Airlie 2017-08-10 10:07:13 +10:00
commit 9157822b9d
5 changed files with 29 additions and 25 deletions

View File

@ -304,7 +304,7 @@ static int sync_file_release(struct inode *inode, struct file *file)
{ {
struct sync_file *sync_file = file->private_data; struct sync_file *sync_file = file->private_data;
if (test_bit(POLL_ENABLED, &sync_file->fence->flags)) if (test_bit(POLL_ENABLED, &sync_file->flags))
dma_fence_remove_callback(sync_file->fence, &sync_file->cb); dma_fence_remove_callback(sync_file->fence, &sync_file->cb);
dma_fence_put(sync_file->fence); dma_fence_put(sync_file->fence);
kfree(sync_file); kfree(sync_file);
@ -318,7 +318,8 @@ static unsigned int sync_file_poll(struct file *file, poll_table *wait)
poll_wait(file, &sync_file->wq, wait); poll_wait(file, &sync_file->wq, wait);
if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { if (list_empty(&sync_file->cb.node) &&
!test_and_set_bit(POLL_ENABLED, &sync_file->flags)) {
if (dma_fence_add_callback(sync_file->fence, &sync_file->cb, if (dma_fence_add_callback(sync_file->fence, &sync_file->cb,
fence_check_cb_func) < 0) fence_check_cb_func) < 0)
wake_up_all(&sync_file->wq); wake_up_all(&sync_file->wq);

View File

@ -1255,7 +1255,7 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
/* port@2 is the output port */ /* port@2 is the output port */
ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &tc->panel, NULL); ret = drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &tc->panel, NULL);
if (ret) if (ret && ret != -ENODEV)
return ret; return ret;
/* Shut down GPIO is optional */ /* Shut down GPIO is optional */

View File

@ -500,7 +500,7 @@ static void vop_line_flag_irq_disable(struct vop *vop)
static int vop_enable(struct drm_crtc *crtc) static int vop_enable(struct drm_crtc *crtc)
{ {
struct vop *vop = to_vop(crtc); struct vop *vop = to_vop(crtc);
int ret; int ret, i;
ret = pm_runtime_get_sync(vop->dev); ret = pm_runtime_get_sync(vop->dev);
if (ret < 0) { if (ret < 0) {
@ -533,6 +533,20 @@ static int vop_enable(struct drm_crtc *crtc)
} }
memcpy(vop->regs, vop->regsbak, vop->len); memcpy(vop->regs, vop->regsbak, vop->len);
/*
* We need to make sure that all windows are disabled before we
* enable the crtc. Otherwise we might try to scan from a destroyed
* buffer later.
*/
for (i = 0; i < vop->data->win_size; i++) {
struct vop_win *vop_win = &vop->win[i];
const struct vop_win_data *win = vop_win->data;
spin_lock(&vop->reg_lock);
VOP_WIN_SET(vop, win, enable, 0);
spin_unlock(&vop->reg_lock);
}
vop_cfg_done(vop); vop_cfg_done(vop);
/* /*
@ -566,28 +580,11 @@ err_put_pm_runtime:
static void vop_crtc_disable(struct drm_crtc *crtc) static void vop_crtc_disable(struct drm_crtc *crtc)
{ {
struct vop *vop = to_vop(crtc); struct vop *vop = to_vop(crtc);
int i;
WARN_ON(vop->event); WARN_ON(vop->event);
rockchip_drm_psr_deactivate(&vop->crtc); rockchip_drm_psr_deactivate(&vop->crtc);
/*
* We need to make sure that all windows are disabled before we
* disable that crtc. Otherwise we might try to scan from a destroyed
* buffer later.
*/
for (i = 0; i < vop->data->win_size; i++) {
struct vop_win *vop_win = &vop->win[i];
const struct vop_win_data *win = vop_win->data;
spin_lock(&vop->reg_lock);
VOP_WIN_SET(vop, win, enable, 0);
spin_unlock(&vop->reg_lock);
}
vop_cfg_done(vop);
drm_crtc_vblank_off(crtc); drm_crtc_vblank_off(crtc);
/* /*
@ -682,8 +679,10 @@ static int vop_plane_atomic_check(struct drm_plane *plane,
* Src.x1 can be odd when do clip, but yuv plane start point * Src.x1 can be odd when do clip, but yuv plane start point
* need align with 2 pixel. * need align with 2 pixel.
*/ */
if (is_yuv_support(fb->format->format) && ((state->src.x1 >> 16) % 2)) if (is_yuv_support(fb->format->format) && ((state->src.x1 >> 16) % 2)) {
DRM_ERROR("Invalid Source: Yuv format not support odd xpos\n");
return -EINVAL; return -EINVAL;
}
return 0; return 0;
} }
@ -764,7 +763,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
spin_lock(&vop->reg_lock); spin_lock(&vop->reg_lock);
VOP_WIN_SET(vop, win, format, format); VOP_WIN_SET(vop, win, format, format);
VOP_WIN_SET(vop, win, yrgb_vir, fb->pitches[0] >> 2); VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4));
VOP_WIN_SET(vop, win, yrgb_mst, dma_addr); VOP_WIN_SET(vop, win, yrgb_mst, dma_addr);
if (is_yuv_support(fb->format->format)) { if (is_yuv_support(fb->format->format)) {
int hsub = drm_format_horz_chroma_subsampling(fb->format->format); int hsub = drm_format_horz_chroma_subsampling(fb->format->format);
@ -778,7 +777,7 @@ static void vop_plane_atomic_update(struct drm_plane *plane,
offset += (src->y1 >> 16) * fb->pitches[1] / vsub; offset += (src->y1 >> 16) * fb->pitches[1] / vsub;
dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1]; dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1];
VOP_WIN_SET(vop, win, uv_vir, fb->pitches[1] >> 2); VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4));
VOP_WIN_SET(vop, win, uv_mst, dma_addr); VOP_WIN_SET(vop, win, uv_mst, dma_addr);
} }

View File

@ -282,6 +282,9 @@ static inline uint16_t scl_get_bili_dn_vskip(int src_h, int dst_h,
act_height = (src_h + vskiplines - 1) / vskiplines; act_height = (src_h + vskiplines - 1) / vskiplines;
if (act_height == dst_h)
return GET_SCL_FT_BILI_DN(src_h, dst_h) / vskiplines;
return GET_SCL_FT_BILI_DN(act_height, dst_h); return GET_SCL_FT_BILI_DN(act_height, dst_h);
} }

View File

@ -43,12 +43,13 @@ struct sync_file {
#endif #endif
wait_queue_head_t wq; wait_queue_head_t wq;
unsigned long flags;
struct dma_fence *fence; struct dma_fence *fence;
struct dma_fence_cb cb; struct dma_fence_cb cb;
}; };
#define POLL_ENABLED DMA_FENCE_FLAG_USER_BITS #define POLL_ENABLED 0
struct sync_file *sync_file_create(struct dma_fence *fence); struct sync_file *sync_file_create(struct dma_fence *fence);
struct dma_fence *sync_file_get_fence(int fd); struct dma_fence *sync_file_get_fence(int fd);