Skip to content

Commit c62098c

Browse files
committed
Merge tag 'drm-misc-fixes-2020-04-30' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
A few resources-related fixes for qxl, some doc build warnings and ioctl fixes for dma-buf, an off-by-one fix in edid, and a return code fix in DP-MST Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 6a8b55e + 6f49c25 commit c62098c

File tree

11 files changed

+39
-35
lines changed

11 files changed

+39
-35
lines changed

drivers/dma-buf/dma-buf.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ static long dma_buf_ioctl(struct file *file,
388388

389389
return ret;
390390

391-
case DMA_BUF_SET_NAME:
391+
case DMA_BUF_SET_NAME_A:
392+
case DMA_BUF_SET_NAME_B:
392393
return dma_buf_set_name(dmabuf, (const char __user *)arg);
393394

394395
default:
@@ -655,8 +656,8 @@ EXPORT_SYMBOL_GPL(dma_buf_put);
655656
* calls attach() of dma_buf_ops to allow device-specific attach functionality
656657
* @dmabuf: [in] buffer to attach device to.
657658
* @dev: [in] device to be attached.
658-
* @importer_ops [in] importer operations for the attachment
659-
* @importer_priv [in] importer private pointer for the attachment
659+
* @importer_ops: [in] importer operations for the attachment
660+
* @importer_priv: [in] importer private pointer for the attachment
660661
*
661662
* Returns struct dma_buf_attachment pointer for this attachment. Attachments
662663
* must be cleaned up by calling dma_buf_detach().

drivers/gpu/drm/drm_dp_mst_topology.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3442,8 +3442,12 @@ static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
34423442
drm_dp_queue_down_tx(mgr, txmsg);
34433443

34443444
ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
3445-
if (ret > 0 && txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3446-
ret = -EIO;
3445+
if (ret > 0) {
3446+
if (txmsg->reply.reply_type == DP_SIDEBAND_REPLY_NAK)
3447+
ret = -EIO;
3448+
else
3449+
ret = size;
3450+
}
34473451

34483452
kfree(txmsg);
34493453
fail_put:

drivers/gpu/drm/drm_edid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5111,7 +5111,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d
51115111
struct drm_display_mode *mode;
51125112
unsigned pixel_clock = (timings->pixel_clock[0] |
51135113
(timings->pixel_clock[1] << 8) |
5114-
(timings->pixel_clock[2] << 16));
5114+
(timings->pixel_clock[2] << 16)) + 1;
51155115
unsigned hactive = (timings->hactive[0] | timings->hactive[1] << 8) + 1;
51165116
unsigned hblank = (timings->hblank[0] | timings->hblank[1] << 8) + 1;
51175117
unsigned hsync = (timings->hsync[0] | (timings->hsync[1] & 0x7f) << 8) + 1;

drivers/gpu/drm/qxl/qxl_cmd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,10 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev,
480480
return ret;
481481

482482
ret = qxl_release_reserve_list(release, true);
483-
if (ret)
483+
if (ret) {
484+
qxl_release_free(qdev, release);
484485
return ret;
485-
486+
}
486487
cmd = (struct qxl_surface_cmd *)qxl_release_map(qdev, release);
487488
cmd->type = QXL_SURFACE_CMD_CREATE;
488489
cmd->flags = QXL_SURF_FLAG_KEEP_DATA;
@@ -499,8 +500,8 @@ int qxl_hw_surface_alloc(struct qxl_device *qdev,
499500
/* no need to add a release to the fence for this surface bo,
500501
since it is only released when we ask to destroy the surface
501502
and it would never signal otherwise */
502-
qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
503503
qxl_release_fence_buffer_objects(release);
504+
qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
504505

505506
surf->hw_surf_alloc = true;
506507
spin_lock(&qdev->surf_id_idr_lock);
@@ -542,9 +543,8 @@ int qxl_hw_surface_dealloc(struct qxl_device *qdev,
542543
cmd->surface_id = id;
543544
qxl_release_unmap(qdev, release, &cmd->release_info);
544545

545-
qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
546-
547546
qxl_release_fence_buffer_objects(release);
547+
qxl_push_command_ring_release(qdev, release, QXL_CMD_SURFACE, false);
548548

549549
return 0;
550550
}

drivers/gpu/drm/qxl/qxl_display.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,8 @@ static int qxl_primary_apply_cursor(struct drm_plane *plane)
510510
cmd->u.set.visible = 1;
511511
qxl_release_unmap(qdev, release, &cmd->release_info);
512512

513-
qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
514513
qxl_release_fence_buffer_objects(release);
514+
qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
515515

516516
return ret;
517517

@@ -652,8 +652,8 @@ static void qxl_cursor_atomic_update(struct drm_plane *plane,
652652
cmd->u.position.y = plane->state->crtc_y + fb->hot_y;
653653

654654
qxl_release_unmap(qdev, release, &cmd->release_info);
655-
qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
656655
qxl_release_fence_buffer_objects(release);
656+
qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
657657

658658
if (old_cursor_bo != NULL)
659659
qxl_bo_unpin(old_cursor_bo);
@@ -700,8 +700,8 @@ static void qxl_cursor_atomic_disable(struct drm_plane *plane,
700700
cmd->type = QXL_CURSOR_HIDE;
701701
qxl_release_unmap(qdev, release, &cmd->release_info);
702702

703-
qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
704703
qxl_release_fence_buffer_objects(release);
704+
qxl_push_cursor_ring_release(qdev, release, QXL_CMD_CURSOR, false);
705705
}
706706

707707
static void qxl_update_dumb_head(struct qxl_device *qdev,

drivers/gpu/drm/qxl/qxl_draw.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,10 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev,
209209
goto out_release_backoff;
210210

211211
rects = drawable_set_clipping(qdev, num_clips, clips_bo);
212-
if (!rects)
212+
if (!rects) {
213+
ret = -EINVAL;
213214
goto out_release_backoff;
214-
215+
}
215216
drawable = (struct qxl_drawable *)qxl_release_map(qdev, release);
216217

217218
drawable->clip.type = SPICE_CLIP_TYPE_RECTS;
@@ -242,8 +243,8 @@ void qxl_draw_dirty_fb(struct qxl_device *qdev,
242243
}
243244
qxl_bo_kunmap(clips_bo);
244245

245-
qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
246246
qxl_release_fence_buffer_objects(release);
247+
qxl_push_command_ring_release(qdev, release, QXL_CMD_DRAW, false);
247248

248249
out_release_backoff:
249250
if (ret)

drivers/gpu/drm/qxl/qxl_image.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ qxl_image_init_helper(struct qxl_device *qdev,
212212
break;
213213
default:
214214
DRM_ERROR("unsupported image bit depth\n");
215-
return -EINVAL; /* TODO: cleanup */
215+
qxl_bo_kunmap_atomic_page(qdev, image_bo, ptr);
216+
return -EINVAL;
216217
}
217218
image->u.bitmap.flags = QXL_BITMAP_TOP_DOWN;
218219
image->u.bitmap.x = width;

drivers/gpu/drm/qxl/qxl_ioctl.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,8 @@ static int qxl_process_single_command(struct qxl_device *qdev,
261261
apply_surf_reloc(qdev, &reloc_info[i]);
262262
}
263263

264+
qxl_release_fence_buffer_objects(release);
264265
ret = qxl_push_command_ring_release(qdev, release, cmd->type, true);
265-
if (ret)
266-
qxl_release_backoff_reserve_list(release);
267-
else
268-
qxl_release_fence_buffer_objects(release);
269266

270267
out_free_bos:
271268
out_free_release:

drivers/gpu/drm/virtio/virtgpu_kms.c

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ static void virtio_gpu_config_changed_work_func(struct work_struct *work)
5353
events_clear, &events_clear);
5454
}
5555

56-
static void virtio_gpu_context_destroy(struct virtio_gpu_device *vgdev,
57-
uint32_t ctx_id)
58-
{
59-
virtio_gpu_cmd_context_destroy(vgdev, ctx_id);
60-
virtio_gpu_notify(vgdev);
61-
ida_free(&vgdev->ctx_id_ida, ctx_id - 1);
62-
}
63-
6456
static void virtio_gpu_init_vq(struct virtio_gpu_queue *vgvq,
6557
void (*work_func)(struct work_struct *work))
6658
{
@@ -275,14 +267,17 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct drm_file *file)
275267
void virtio_gpu_driver_postclose(struct drm_device *dev, struct drm_file *file)
276268
{
277269
struct virtio_gpu_device *vgdev = dev->dev_private;
278-
struct virtio_gpu_fpriv *vfpriv;
270+
struct virtio_gpu_fpriv *vfpriv = file->driver_priv;
279271

280272
if (!vgdev->has_virgl_3d)
281273
return;
282274

283-
vfpriv = file->driver_priv;
275+
if (vfpriv->context_created) {
276+
virtio_gpu_cmd_context_destroy(vgdev, vfpriv->ctx_id);
277+
virtio_gpu_notify(vgdev);
278+
}
284279

285-
virtio_gpu_context_destroy(vgdev, vfpriv->ctx_id);
280+
ida_free(&vgdev->ctx_id_ida, vfpriv->ctx_id - 1);
286281
mutex_destroy(&vfpriv->context_lock);
287282
kfree(vfpriv);
288283
file->driver_priv = NULL;

include/linux/dma-buf.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,12 @@ struct dma_buf {
329329

330330
/**
331331
* struct dma_buf_attach_ops - importer operations for an attachment
332-
* @move_notify: [optional] notification that the DMA-buf is moving
333332
*
334333
* Attachment operations implemented by the importer.
335334
*/
336335
struct dma_buf_attach_ops {
337336
/**
338-
* @move_notify
337+
* @move_notify: [optional] notification that the DMA-buf is moving
339338
*
340339
* If this callback is provided the framework can avoid pinning the
341340
* backing store while mappings exists.

0 commit comments

Comments
 (0)