37 #define VMW_MAX_NUM_STREAMS 1
102 bool have_so = dev_priv->
sou_priv ?
true :
false;
124 fifo_size =
sizeof(*cmds) +
sizeof(*flush) +
sizeof(*items) * num_items;
135 fill_escape(&
cmds->escape,
sizeof(*items) * (num_items + 1));
141 for (i = 0; i < num_items; i++)
142 items[i].registerId = i;
184 static int vmw_overlay_send_stop(
struct vmw_private *dev_priv,
201 interruptible, 3*
HZ);
208 fill_escape(&
cmds->escape,
sizeof(
cmds->body));
210 cmds->body.header.streamId = stream_id;
212 cmds->body.items[0].value =
false;
213 fill_flush(&
cmds->flush, stream_id);
226 static int vmw_overlay_move_buffer(
struct vmw_private *dev_priv,
251 static int vmw_overlay_stop(
struct vmw_private *dev_priv,
265 ret = vmw_overlay_send_stop(dev_priv, stream_id,
271 ret = vmw_overlay_move_buffer(dev_priv, stream->
buf,
false,
280 vmw_dmabuf_unreference(&stream->
buf);
298 static int vmw_overlay_update_stream(
struct vmw_private *dev_priv,
310 DRM_DEBUG(
" %s: old %p, new %p, %spaused\n", __func__,
311 stream->
buf, buf, stream->
paused ?
"" :
"not ");
313 if (stream->
buf != buf) {
314 ret = vmw_overlay_stop(dev_priv, arg->
stream_id,
315 false, interruptible);
318 }
else if (!stream->
paused) {
322 ret = vmw_overlay_send_put(dev_priv, buf, arg, interruptible);
334 ret = vmw_overlay_move_buffer(dev_priv, buf,
true, interruptible);
338 ret = vmw_overlay_send_put(dev_priv, buf, arg, interruptible);
343 BUG_ON(vmw_overlay_move_buffer(dev_priv, buf,
false,
false)
348 if (stream->
buf != buf)
349 stream->
buf = vmw_dmabuf_reference(buf);
379 ret = vmw_overlay_stop(dev_priv, i,
false,
false);
410 ret = vmw_overlay_update_stream(dev_priv, stream->
buf,
411 &stream->
saved,
false);
413 DRM_INFO(
"%s: *warning* failed to resume stream %i\n",
440 if (overlay->
stream[i].paused)
441 DRM_INFO(
"%s: *warning* stream %i already paused\n",
443 ret = vmw_overlay_stop(dev_priv, i,
true,
false);
453 struct drm_file *file_priv)
474 ret = vmw_overlay_stop(dev_priv, arg->
stream_id,
false,
true);
482 ret = vmw_overlay_update_stream(dev_priv, buf, arg,
true);
484 vmw_dmabuf_unreference(&buf);
512 if (!overlay->
stream[i].claimed)
532 if (overlay->
stream[i].claimed)
535 overlay->
stream[
i].claimed =
true;
557 vmw_overlay_stop(dev_priv, stream_id,
false,
false);
558 overlay->
stream[stream_id].claimed =
false;
574 DRM_INFO(
"hardware doesn't support overlays\n");
578 overlay = kzalloc(
sizeof(*overlay),
GFP_KERNEL);
585 overlay->
stream[
i].paused =
false;
586 overlay->
stream[
i].claimed =
false;
597 bool forgotten_buffer =
false;
604 if (overlay->
stream[i].buf) {
605 forgotten_buffer =
true;
606 vmw_overlay_stop(dev_priv, i,
false,
false);