Lines Matching +full:inter +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0 OR MIT
4 * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
69 header->cmd = SVGA_CMD_ESCAPE; in fill_escape()
70 header->body.nsid = SVGA_ESCAPE_NSID_VMWARE; in fill_escape()
71 header->body.size = size; in fill_escape()
77 fill_escape(&cmd->escape, sizeof(cmd->flush)); in fill_flush()
78 cmd->flush.cmdType = SVGA_ESCAPE_VMWARE_VIDEO_FLUSH; in fill_flush()
79 cmd->flush.streamId = stream_id; in fill_flush()
86 * -ERESTARTSYS if interrupted by a signal.
95 bool have_so = (dev_priv->active_display_unit != vmw_du_legacy); in vmw_overlay_send_put()
122 return -ENOMEM; in vmw_overlay_send_put()
128 fill_escape(&cmds->escape, sizeof(*items) * (num_items + 1)); in vmw_overlay_send_put()
130 cmds->header.cmdType = SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS; in vmw_overlay_send_put()
131 cmds->header.streamId = arg->stream_id; in vmw_overlay_send_put()
137 vmw_bo_get_guest_ptr(&buf->tbo, &ptr); in vmw_overlay_send_put()
138 ptr.offset += arg->offset; in vmw_overlay_send_put()
141 items[SVGA_VIDEO_FLAGS].value = arg->flags; in vmw_overlay_send_put()
143 items[SVGA_VIDEO_FORMAT].value = arg->format; in vmw_overlay_send_put()
144 items[SVGA_VIDEO_COLORKEY].value = arg->color_key; in vmw_overlay_send_put()
145 items[SVGA_VIDEO_SIZE].value = arg->size; in vmw_overlay_send_put()
146 items[SVGA_VIDEO_WIDTH].value = arg->width; in vmw_overlay_send_put()
147 items[SVGA_VIDEO_HEIGHT].value = arg->height; in vmw_overlay_send_put()
148 items[SVGA_VIDEO_SRC_X].value = arg->src.x; in vmw_overlay_send_put()
149 items[SVGA_VIDEO_SRC_Y].value = arg->src.y; in vmw_overlay_send_put()
150 items[SVGA_VIDEO_SRC_WIDTH].value = arg->src.w; in vmw_overlay_send_put()
151 items[SVGA_VIDEO_SRC_HEIGHT].value = arg->src.h; in vmw_overlay_send_put()
152 items[SVGA_VIDEO_DST_X].value = arg->dst.x; in vmw_overlay_send_put()
153 items[SVGA_VIDEO_DST_Y].value = arg->dst.y; in vmw_overlay_send_put()
154 items[SVGA_VIDEO_DST_WIDTH].value = arg->dst.w; in vmw_overlay_send_put()
155 items[SVGA_VIDEO_DST_HEIGHT].value = arg->dst.h; in vmw_overlay_send_put()
156 items[SVGA_VIDEO_PITCH_1].value = arg->pitch[0]; in vmw_overlay_send_put()
157 items[SVGA_VIDEO_PITCH_2].value = arg->pitch[1]; in vmw_overlay_send_put()
158 items[SVGA_VIDEO_PITCH_3].value = arg->pitch[2]; in vmw_overlay_send_put()
164 fill_flush(flush, arg->stream_id); in vmw_overlay_send_put()
175 * -ERESTARTSYS if interrupted by a signal.
195 if (interruptible && ret == -ERESTARTSYS) in vmw_overlay_send_stop()
201 fill_escape(&cmds->escape, sizeof(cmds->body)); in vmw_overlay_send_stop()
202 cmds->body.header.cmdType = SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS; in vmw_overlay_send_stop()
203 cmds->body.header.streamId = stream_id; in vmw_overlay_send_stop()
204 cmds->body.items[0].registerId = SVGA_VIDEO_ENABLED; in vmw_overlay_send_stop()
205 cmds->body.items[0].value = false; in vmw_overlay_send_stop()
206 fill_flush(&cmds->flush, stream_id); in vmw_overlay_send_stop()
221 bool pin, bool inter) in vmw_overlay_move_buffer() argument
224 return vmw_bo_unpin(dev_priv, buf, inter); in vmw_overlay_move_buffer()
226 if (dev_priv->active_display_unit == vmw_du_legacy) in vmw_overlay_move_buffer()
227 return vmw_bo_pin_in_vram(dev_priv, buf, inter); in vmw_overlay_move_buffer()
229 return vmw_bo_pin_in_vram_or_gmr(dev_priv, buf, inter); in vmw_overlay_move_buffer()
248 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_stop()
249 struct vmw_stream *stream = &overlay->stream[stream_id]; in vmw_overlay_stop()
253 if (!stream->buf) in vmw_overlay_stop()
257 if (!stream->paused) { in vmw_overlay_stop()
263 /* We just remove the NO_EVICT flag so no -ENOMEM */ in vmw_overlay_stop()
264 ret = vmw_overlay_move_buffer(dev_priv, stream->buf, false, in vmw_overlay_stop()
266 if (interruptible && ret == -ERESTARTSYS) in vmw_overlay_stop()
273 vmw_bo_unreference(&stream->buf); in vmw_overlay_stop()
274 stream->paused = false; in vmw_overlay_stop()
276 stream->paused = true; in vmw_overlay_stop()
288 * -ENOMEM if buffer doesn't fit in vram.
289 * -ERESTARTSYS if interrupted.
296 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_update_stream()
297 struct vmw_stream *stream = &overlay->stream[arg->stream_id]; in vmw_overlay_update_stream()
301 return -EINVAL; in vmw_overlay_update_stream()
304 stream->buf, buf, stream->paused ? "" : "not "); in vmw_overlay_update_stream()
306 if (stream->buf != buf) { in vmw_overlay_update_stream()
307 ret = vmw_overlay_stop(dev_priv, arg->stream_id, in vmw_overlay_update_stream()
311 } else if (!stream->paused) { in vmw_overlay_update_stream()
317 stream->saved = *arg; in vmw_overlay_update_stream()
325 * Might return -ENOMEM if it can't fit the buffer in vram. in vmw_overlay_update_stream()
334 * the NO_EVICT flag so this is safe from -ENOMEM. in vmw_overlay_update_stream()
341 if (stream->buf != buf) in vmw_overlay_update_stream()
342 stream->buf = vmw_bo_reference(buf); in vmw_overlay_update_stream()
343 stream->saved = *arg; in vmw_overlay_update_stream()
345 stream->paused = false; in vmw_overlay_update_stream()
359 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_resume_all()
365 mutex_lock(&overlay->mutex); in vmw_overlay_resume_all()
368 struct vmw_stream *stream = &overlay->stream[i]; in vmw_overlay_resume_all()
369 if (!stream->paused) in vmw_overlay_resume_all()
372 ret = vmw_overlay_update_stream(dev_priv, stream->buf, in vmw_overlay_resume_all()
373 &stream->saved, false); in vmw_overlay_resume_all()
379 mutex_unlock(&overlay->mutex); in vmw_overlay_resume_all()
393 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_pause_all()
399 mutex_lock(&overlay->mutex); in vmw_overlay_pause_all()
402 if (overlay->stream[i].paused) in vmw_overlay_pause_all()
409 mutex_unlock(&overlay->mutex); in vmw_overlay_pause_all()
417 return (dev_priv->overlay_priv != NULL && in vmw_overlay_available()
422 int vmw_overlay_ioctl(struct drm_device *dev, void *data, in vmw_overlay_ioctl() argument
425 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; in vmw_overlay_ioctl()
427 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_ioctl()
429 (struct drm_vmw_control_stream_arg *)data; in vmw_overlay_ioctl()
435 return -ENOSYS; in vmw_overlay_ioctl()
437 ret = vmw_user_stream_lookup(dev_priv, tfile, &arg->stream_id, &res); in vmw_overlay_ioctl()
441 mutex_lock(&overlay->mutex); in vmw_overlay_ioctl()
443 if (!arg->enabled) { in vmw_overlay_ioctl()
444 ret = vmw_overlay_stop(dev_priv, arg->stream_id, false, true); in vmw_overlay_ioctl()
448 ret = vmw_user_bo_lookup(file_priv, arg->handle, &buf); in vmw_overlay_ioctl()
457 mutex_unlock(&overlay->mutex); in vmw_overlay_ioctl()
473 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_num_free_overlays()
479 mutex_lock(&overlay->mutex); in vmw_overlay_num_free_overlays()
482 if (!overlay->stream[i].claimed) in vmw_overlay_num_free_overlays()
485 mutex_unlock(&overlay->mutex); in vmw_overlay_num_free_overlays()
492 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_claim()
496 return -ENOSYS; in vmw_overlay_claim()
498 mutex_lock(&overlay->mutex); in vmw_overlay_claim()
502 if (overlay->stream[i].claimed) in vmw_overlay_claim()
505 overlay->stream[i].claimed = true; in vmw_overlay_claim()
507 mutex_unlock(&overlay->mutex); in vmw_overlay_claim()
511 mutex_unlock(&overlay->mutex); in vmw_overlay_claim()
512 return -ESRCH; in vmw_overlay_claim()
517 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_unref()
522 return -ENOSYS; in vmw_overlay_unref()
524 mutex_lock(&overlay->mutex); in vmw_overlay_unref()
526 WARN_ON(!overlay->stream[stream_id].claimed); in vmw_overlay_unref()
528 overlay->stream[stream_id].claimed = false; in vmw_overlay_unref()
530 mutex_unlock(&overlay->mutex); in vmw_overlay_unref()
539 if (dev_priv->overlay_priv) in vmw_overlay_init()
540 return -EINVAL; in vmw_overlay_init()
544 return -ENOMEM; in vmw_overlay_init()
546 mutex_init(&overlay->mutex); in vmw_overlay_init()
548 overlay->stream[i].buf = NULL; in vmw_overlay_init()
549 overlay->stream[i].paused = false; in vmw_overlay_init()
550 overlay->stream[i].claimed = false; in vmw_overlay_init()
553 dev_priv->overlay_priv = overlay; in vmw_overlay_init()
560 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_close()
565 return -ENOSYS; in vmw_overlay_close()
568 if (overlay->stream[i].buf) { in vmw_overlay_close()
576 dev_priv->overlay_priv = NULL; in vmw_overlay_close()