Lines Matching +full:inter +full:- +full:data

1 // SPDX-License-Identifier: GPL-2.0 OR MIT
4 * Copyright 2009-2014 VMware, Inc., Palo Alto, CA., USA
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
59 return dev_priv ? dev_priv->overlay_priv : NULL; in vmw_overlay()
75 header->cmd = SVGA_CMD_ESCAPE; in fill_escape()
76 header->body.nsid = SVGA_ESCAPE_NSID_VMWARE; in fill_escape()
77 header->body.size = size; in fill_escape()
83 fill_escape(&cmd->escape, sizeof(cmd->flush)); in fill_flush()
84 cmd->flush.cmdType = SVGA_ESCAPE_VMWARE_VIDEO_FLUSH; in fill_flush()
85 cmd->flush.streamId = stream_id; in fill_flush()
92 * -ERESTARTSYS if interrupted by a signal.
101 bool have_so = (dev_priv->active_display_unit == vmw_du_screen_object); in vmw_overlay_send_put()
128 return -ENOMEM; in vmw_overlay_send_put()
134 fill_escape(&cmds->escape, sizeof(*items) * (num_items + 1)); in vmw_overlay_send_put()
136 cmds->header.cmdType = SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS; in vmw_overlay_send_put()
137 cmds->header.streamId = arg->stream_id; in vmw_overlay_send_put()
143 vmw_bo_get_guest_ptr(&buf->base, &ptr); in vmw_overlay_send_put()
144 ptr.offset += arg->offset; in vmw_overlay_send_put()
147 items[SVGA_VIDEO_FLAGS].value = arg->flags; in vmw_overlay_send_put()
149 items[SVGA_VIDEO_FORMAT].value = arg->format; in vmw_overlay_send_put()
150 items[SVGA_VIDEO_COLORKEY].value = arg->color_key; in vmw_overlay_send_put()
151 items[SVGA_VIDEO_SIZE].value = arg->size; in vmw_overlay_send_put()
152 items[SVGA_VIDEO_WIDTH].value = arg->width; in vmw_overlay_send_put()
153 items[SVGA_VIDEO_HEIGHT].value = arg->height; in vmw_overlay_send_put()
154 items[SVGA_VIDEO_SRC_X].value = arg->src.x; in vmw_overlay_send_put()
155 items[SVGA_VIDEO_SRC_Y].value = arg->src.y; in vmw_overlay_send_put()
156 items[SVGA_VIDEO_SRC_WIDTH].value = arg->src.w; in vmw_overlay_send_put()
157 items[SVGA_VIDEO_SRC_HEIGHT].value = arg->src.h; in vmw_overlay_send_put()
158 items[SVGA_VIDEO_DST_X].value = arg->dst.x; in vmw_overlay_send_put()
159 items[SVGA_VIDEO_DST_Y].value = arg->dst.y; in vmw_overlay_send_put()
160 items[SVGA_VIDEO_DST_WIDTH].value = arg->dst.w; in vmw_overlay_send_put()
161 items[SVGA_VIDEO_DST_HEIGHT].value = arg->dst.h; in vmw_overlay_send_put()
162 items[SVGA_VIDEO_PITCH_1].value = arg->pitch[0]; in vmw_overlay_send_put()
163 items[SVGA_VIDEO_PITCH_2].value = arg->pitch[1]; in vmw_overlay_send_put()
164 items[SVGA_VIDEO_PITCH_3].value = arg->pitch[2]; in vmw_overlay_send_put()
170 fill_flush(flush, arg->stream_id); in vmw_overlay_send_put()
181 * -ERESTARTSYS if interrupted by a signal.
201 if (interruptible && ret == -ERESTARTSYS) in vmw_overlay_send_stop()
207 fill_escape(&cmds->escape, sizeof(cmds->body)); in vmw_overlay_send_stop()
208 cmds->body.header.cmdType = SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS; in vmw_overlay_send_stop()
209 cmds->body.header.streamId = stream_id; in vmw_overlay_send_stop()
210 cmds->body.items[0].registerId = SVGA_VIDEO_ENABLED; in vmw_overlay_send_stop()
211 cmds->body.items[0].value = false; in vmw_overlay_send_stop()
212 fill_flush(&cmds->flush, stream_id); in vmw_overlay_send_stop()
227 bool pin, bool inter) in vmw_overlay_move_buffer() argument
230 return vmw_bo_unpin(dev_priv, buf, inter); in vmw_overlay_move_buffer()
232 if (dev_priv->active_display_unit == vmw_du_legacy) in vmw_overlay_move_buffer()
233 return vmw_bo_pin_in_vram(dev_priv, buf, inter); in vmw_overlay_move_buffer()
235 return vmw_bo_pin_in_vram_or_gmr(dev_priv, buf, inter); in vmw_overlay_move_buffer()
254 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_stop()
255 struct vmw_stream *stream = &overlay->stream[stream_id]; in vmw_overlay_stop()
259 if (!stream->buf) in vmw_overlay_stop()
263 if (!stream->paused) { in vmw_overlay_stop()
269 /* We just remove the NO_EVICT flag so no -ENOMEM */ in vmw_overlay_stop()
270 ret = vmw_overlay_move_buffer(dev_priv, stream->buf, false, in vmw_overlay_stop()
272 if (interruptible && ret == -ERESTARTSYS) in vmw_overlay_stop()
279 vmw_bo_unreference(&stream->buf); in vmw_overlay_stop()
280 stream->paused = false; in vmw_overlay_stop()
282 stream->paused = true; in vmw_overlay_stop()
294 * -ENOMEM if buffer doesn't fit in vram.
295 * -ERESTARTSYS if interrupted.
302 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_update_stream()
303 struct vmw_stream *stream = &overlay->stream[arg->stream_id]; in vmw_overlay_update_stream()
307 return -EINVAL; in vmw_overlay_update_stream()
310 stream->buf, buf, stream->paused ? "" : "not "); in vmw_overlay_update_stream()
312 if (stream->buf != buf) { in vmw_overlay_update_stream()
313 ret = vmw_overlay_stop(dev_priv, arg->stream_id, in vmw_overlay_update_stream()
317 } else if (!stream->paused) { in vmw_overlay_update_stream()
323 stream->saved = *arg; in vmw_overlay_update_stream()
331 * Might return -ENOMEM if it can't fit the buffer in vram. in vmw_overlay_update_stream()
340 * the NO_EVICT flag so this is safe from -ENOMEM. in vmw_overlay_update_stream()
347 if (stream->buf != buf) in vmw_overlay_update_stream()
348 stream->buf = vmw_bo_reference(buf); in vmw_overlay_update_stream()
349 stream->saved = *arg; in vmw_overlay_update_stream()
351 stream->paused = false; in vmw_overlay_update_stream()
365 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_resume_all()
371 mutex_lock(&overlay->mutex); in vmw_overlay_resume_all()
374 struct vmw_stream *stream = &overlay->stream[i]; in vmw_overlay_resume_all()
375 if (!stream->paused) in vmw_overlay_resume_all()
378 ret = vmw_overlay_update_stream(dev_priv, stream->buf, in vmw_overlay_resume_all()
379 &stream->saved, false); in vmw_overlay_resume_all()
385 mutex_unlock(&overlay->mutex); in vmw_overlay_resume_all()
399 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_pause_all()
405 mutex_lock(&overlay->mutex); in vmw_overlay_pause_all()
408 if (overlay->stream[i].paused) in vmw_overlay_pause_all()
415 mutex_unlock(&overlay->mutex); in vmw_overlay_pause_all()
423 return (dev_priv->overlay_priv != NULL && in vmw_overlay_available()
424 ((dev_priv->fifo.capabilities & VMW_OVERLAY_CAP_MASK) == in vmw_overlay_available()
428 int vmw_overlay_ioctl(struct drm_device *dev, void *data, in vmw_overlay_ioctl() argument
431 struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; in vmw_overlay_ioctl()
433 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_ioctl()
435 (struct drm_vmw_control_stream_arg *)data; in vmw_overlay_ioctl()
441 return -ENOSYS; in vmw_overlay_ioctl()
443 ret = vmw_user_stream_lookup(dev_priv, tfile, &arg->stream_id, &res); in vmw_overlay_ioctl()
447 mutex_lock(&overlay->mutex); in vmw_overlay_ioctl()
449 if (!arg->enabled) { in vmw_overlay_ioctl()
450 ret = vmw_overlay_stop(dev_priv, arg->stream_id, false, true); in vmw_overlay_ioctl()
454 ret = vmw_user_bo_lookup(tfile, arg->handle, &buf, NULL); in vmw_overlay_ioctl()
463 mutex_unlock(&overlay->mutex); in vmw_overlay_ioctl()
479 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_num_free_overlays()
485 mutex_lock(&overlay->mutex); in vmw_overlay_num_free_overlays()
488 if (!overlay->stream[i].claimed) in vmw_overlay_num_free_overlays()
491 mutex_unlock(&overlay->mutex); in vmw_overlay_num_free_overlays()
498 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_claim()
502 return -ENOSYS; in vmw_overlay_claim()
504 mutex_lock(&overlay->mutex); in vmw_overlay_claim()
508 if (overlay->stream[i].claimed) in vmw_overlay_claim()
511 overlay->stream[i].claimed = true; in vmw_overlay_claim()
513 mutex_unlock(&overlay->mutex); in vmw_overlay_claim()
517 mutex_unlock(&overlay->mutex); in vmw_overlay_claim()
518 return -ESRCH; in vmw_overlay_claim()
523 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_unref()
528 return -ENOSYS; in vmw_overlay_unref()
530 mutex_lock(&overlay->mutex); in vmw_overlay_unref()
532 WARN_ON(!overlay->stream[stream_id].claimed); in vmw_overlay_unref()
534 overlay->stream[stream_id].claimed = false; in vmw_overlay_unref()
536 mutex_unlock(&overlay->mutex); in vmw_overlay_unref()
545 if (dev_priv->overlay_priv) in vmw_overlay_init()
546 return -EINVAL; in vmw_overlay_init()
550 return -ENOMEM; in vmw_overlay_init()
552 mutex_init(&overlay->mutex); in vmw_overlay_init()
554 overlay->stream[i].buf = NULL; in vmw_overlay_init()
555 overlay->stream[i].paused = false; in vmw_overlay_init()
556 overlay->stream[i].claimed = false; in vmw_overlay_init()
559 dev_priv->overlay_priv = overlay; in vmw_overlay_init()
566 struct vmw_overlay *overlay = dev_priv->overlay_priv; in vmw_overlay_close()
571 return -ENOSYS; in vmw_overlay_close()
574 if (overlay->stream[i].buf) { in vmw_overlay_close()
582 dev_priv->overlay_priv = NULL; in vmw_overlay_close()