<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Mar 28, 2017 at 7:19 PM, Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank" data-mce-href="mailto:fziglio@redhat.com">fziglio@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000" data-mce-style="font-family: times new roman,new york,times,serif; font-size: 12pt; color: #000000;"><div><div class="h5"><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt" data-mce-style="border-left: 2px solid #1010ff; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 28, 2017 at 4:23 PM, Frediano Ziglio <span dir="ltr"><<a href="mailto:fziglio@redhat.com" target="_blank" data-mce-href="mailto:fziglio@redhat.com">fziglio@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div class="m_4332961207604316515HOEnZb"><div class="m_4332961207604316515h5">><br> > Increased size of allocation to reduce number of allocation per<br> > bitmap. Before change the procedure ignored 'alloc_size' parameter<br> > and always allocated memory chunk according to 'size' parameter.<br> > As a result, first chunk could be up to 64K and all following are<br> > limited by line size. For example, for bitmap 1280x1024 there was<br> > more than 1008 chunks allocated, for bitmap 128x1024 - 897 chunks.<br> > We change the procedure to use chunk size up to 64K (similar to first<br> > chunk). This reduces in described examples number of allocation from<br> > 1008 to 64 and 897 to 8 respectively.<br> ><br> > Signed-off-by: Yuri Benditovich <<a href="mailto:yuri.benditovich@daynix.com" target="_blank" data-mce-href="mailto:yuri.benditovich@daynix.com">yuri.benditovich@daynix.com</a>><br> > ---<br> >  qxldod/QxlDod.cpp | 2 +-<br> >  1 file changed, 1 insertion(+), 1 deletion(-)<br> ><br> > diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp<br> > index 56a4cf2..94426dd 100755<br> > --- a/qxldod/QxlDod.cpp<br> > +++ b/qxldod/QxlDod.cpp<br> > @@ -4586,7 +4586,7 @@ BOOLEAN QxlDevice::PutBytesAlign(QXLDataChunk<br> > **chunk_ptr, UINT8 **now_ptr,<br> >      UINT8 *now = *now_ptr;<br> >      UINT8 *end = *end_ptr;<br> >      size_t maxAllocSize = BITS_BUF_MAX - BITS_BUF_MAX % size;<br> > -    alloc_size = MIN(size, maxAllocSize);<br> > +    alloc_size = MIN(alloc_size, maxAllocSize);<br> >      DbgPrint(TRACE_LEVEL_VERBOSE, ("---> %s\n", __FUNCTION__));<br> ><br> >      while (size) {<br><div><br></div></div></div>As far as I can see this fix a regression introduced in 9/12 so<br> should be squashed together with 9/12.<br></blockquote><div><br></div><div>There was no regression in 9/12, see commit description</div><div>This patch forces the driver to make bigger allocations and in result we will have smaller amount of allocations per operation.</div></div></div></div></blockquote></div></div><div>Yes, you are right, there is this computation<br></div><div><br></div><div>  aligned_size = (int)MIN(alloc_size + alignment - 1, BITS_BUF_MAX);<br>  aligned_size -=  aligned_size % alignment;<br><div><br></div><div>but then the value is discarded and size is used instead.<br></div></div><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt" data-mce-style="border-left: 2px solid #1010ff; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><br> On the same subject. Why we need to split the allocations?<br> Can't we try to allocate the whole image in one chunk and<br> only if fails fall back to multiple chunks ?<br></blockquote><div><br></div><div>No, we can't do that, as maximal size of allocation from device memory in driver's code was always limited by ~64K.</div><div>So allocation were always splitted, see numbers in commit description.</div><div>I suppose there is some reason for that.</div></div></div></div></blockquote><div>Honestly knowing the server part I don't see any reasons. Maybe an history one...<span class="HOEnZb"><span data-mce-style="color: #888888;" style="color: #888888;"><br></span></span></div><div><br></div></div></div></blockquote><div>If any version of Spice server is able to work with bigger chunks, this optimization can be evaluated later.</div><div>In any case it requires non-forced allocations to be fully implemented and used ( as we can 'try' to allocate</div><div>full size chunk only if we do not block during such allocation). </div></div></div></div></blockquote><div>Was not a request to change anything but I noted that different split of the image are common,<br></div><div>from Linux driver to other layers (spice or not).<br></div><div>About spice I won't be surprised to learn that all this was a old compatibility with some<br></div><div>16 bit computation. Just to make sure that there are no reason beside previous code<br></div><div>for this WDDM DOD driver.<br></div><div><br></div><div>Frediano<br></div><div><br></div></div></body></html>