135 DRM_INFO(
"Fifo max 0x%08x min 0x%08x cap 0x%08x\n",
200 return ((max - next_cmd) + (stop - min) <= bytes);
203 static int vmw_fifo_wait_noirq(
struct vmw_private *dev_priv,
205 unsigned long timeout)
208 unsigned long end_jiffies =
jiffies + timeout;
211 DRM_INFO(
"Fifo wait noirq.\n");
217 if (!vmw_fifo_is_full(dev_priv, bytes))
221 DRM_ERROR(
"SVGA device lockup.\n");
225 if (interruptible && signal_pending(
current)) {
232 DRM_INFO(
"Fifo noirq exit.\n");
236 static int vmw_fifo_wait(
struct vmw_private *dev_priv,
238 unsigned long timeout)
241 unsigned long irq_flags;
243 if (
likely(!vmw_fifo_is_full(dev_priv, bytes)))
248 return vmw_fifo_wait_noirq(dev_priv, bytes,
249 interruptible, timeout);
258 spin_unlock_irqrestore(&dev_priv->
irq_lock, irq_flags);
265 !vmw_fifo_is_full(dev_priv, bytes), timeout);
269 !vmw_fifo_is_full(dev_priv, bytes), timeout);
281 spin_unlock_irqrestore(&dev_priv->
irq_lock, irq_flags);
323 bool need_bounce =
false;
324 bool reserve_in_place =
false;
326 if (next_cmd >= stop) {
327 if (
likely((next_cmd + bytes < max ||
328 (next_cmd + bytes == max && stop > min))))
329 reserve_in_place =
true;
331 else if (vmw_fifo_is_full(dev_priv, bytes)) {
332 ret = vmw_fifo_wait(dev_priv, bytes,
341 if (
likely((next_cmd + bytes < stop)))
342 reserve_in_place =
true;
344 ret = vmw_fifo_wait(dev_priv, bytes,
351 if (reserve_in_place) {
352 if (reserveable || bytes <=
sizeof(
uint32_t)) {
358 return fifo_mem + (next_cmd >> 2);
385 uint32_t chunk_size = max - next_cmd;
390 if (bytes < chunk_size)
395 memcpy_toio(fifo_mem + (next_cmd >> 2), buffer, chunk_size);
396 rest = bytes - chunk_size;
398 memcpy_toio(fifo_mem + (min >> 2), buffer + (chunk_size >> 2),
411 iowrite32(*buffer++, fifo_mem + (next_cmd >> 2));
438 vmw_fifo_res_copy(fifo_state, fifo_mem,
439 next_cmd, max, min, bytes);
441 vmw_fifo_slow_copy(fifo_state, fifo_mem,
442 next_cmd, max, min, bytes);
455 next_cmd -= max -
min;
487 }
while (*seqno == 0);
502 ((
unsigned long)fm +
sizeof(
__le32));
548 DRM_ERROR(
"Out of fifo space for dummy query.\n");
553 cmd->header.size =
sizeof(
cmd->body);
559 cmd->body.guestResult.offset = bo->
offset;
561 cmd->body.guestResult.gmrId = bo->
mem.start;
562 cmd->body.guestResult.offset = 0;