xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Ticket #65: xpra-sendrowstride.patch

File xpra-sendrowstride.patch, 4.9 KB (added by Antoine Martin, 10 years ago)

if the feature is supported, send the rowstride with the pixel data

  • xpra/server.py

     
    161161    AVG_BATCH_DELAY = 100           #how long to batch updates for (in millis)
    162162    MAX_BATCH_DELAY = 1000
    163163
    164     def __init__(self, protocol, encoding, send_damage_sequence, mmap, mmap_size):
     164    def __init__(self, protocol, encoding, send_damage_sequence, send_rowstride, mmap, mmap_size):
    165165        self._ordinary_packets = []
    166166        self._protocol = protocol
    167167        self._encoding = encoding
     
    170170        self._damage_delayed = {}
    171171        # for managing sequence numbers:
    172172        self._send_damage_sequence = send_damage_sequence
     173        self._send_rowstride = send_rowstride
    173174        self._sequence = 0                      #increase with every Region
    174175        self._damage_packet_sequence = 0        #increase with every packet send
    175176        self.last_client_packet_sequence = -1   #the last damage_packet_sequence the client echoed back to us
     
    467468        if self._send_damage_sequence:
    468469            packet.append(self._damage_packet_sequence)
    469470            self._damage_packet_sequence += 1
     471            if self._send_rowstride:
     472                packet.append(rowstride)
    470473        return packet
    471474
    472475    def _mmap_send(self, data):
     
    11581161            self.disconnect("new valid connection received")
    11591162        self.reset_statistics()
    11601163        self.send_damage_sequence = capabilities.get("damage_sequence", False)
     1164        self.send_rowstride = self.send_damage_sequence and capabilities.get("rowstride", False)
    11611165        #if "encodings" not specified, use pre v0.0.7.26 default: rgb24
    11621166        self.encodings = capabilities.get("encodings", ["rgb24"])
    11631167        self._set_encoding(capabilities.get("encoding", None))
     
    11721176            self.mmap = mmap.mmap(f.fileno(), self.mmap_size)
    11731177            log.info("using client supplied mmap file=%s, size=%s", mmap_file, self.mmap_size)
    11741178        self._protocol = proto
    1175         self._server_source = ServerSource(self._protocol, self.encoding, self.send_damage_sequence, self.mmap, self.mmap_size)
     1179        self._server_source = ServerSource(self._protocol, self.encoding, self.send_damage_sequence, self.send_rowstride, self.mmap, self.mmap_size)
    11761180        # do screen size calculations/modifications:
    11771181        self.send_hello(capabilities)
    11781182        if "deflate" in capabilities:
  • xpra/client.py

     
    199199        #the "ClientWindow"
    200200        self._client.send_refresh_all()
    201201
    202     def draw(self, x, y, width, height, coding, img_data):
     202    def draw(self, x, y, width, height, coding, img_data, rowstride):
    203203        gc = self._backing.new_gc()
    204204        if coding == "mmap":
    205205            assert self._client.supports_mmap
     
    211211                self._client.mmap.seek(offset)
    212212                data += self._client.mmap.read(length)
    213213                data_start.value = offset+length
    214             self._backing.draw_rgb_image(gc, x, y, width, height, gtk.gdk.RGB_DITHER_NONE, data)
     214            self._backing.draw_rgb_image(gc, x, y, width, height, gtk.gdk.RGB_DITHER_NONE, data, rowstride)
    215215        elif coding == "rgb24":
    216216            assert len(img_data) == width * height * 3
    217             self._backing.draw_rgb_image(gc, x, y, width, height, gtk.gdk.RGB_DITHER_NONE, img_data)
     217            self._backing.draw_rgb_image(gc, x, y, width, height, gtk.gdk.RGB_DITHER_NONE, img_data, rowstride)
    218218        else:
    219219            loader = gtk.gdk.PixbufLoader(coding)
    220220            loader.write(img_data, len(img_data))
     
    751751        capabilities_request["desktop_size"] = [root_w, root_h]
    752752        capabilities_request["png_window_icons"] = True
    753753        capabilities_request["damage_sequence"] = True
     754        capabilities_request["rowstride"] = True
    754755        capabilities_request["ping"] = True
    755756        key_repeat = self._client_extras.get_keyboard_repeat()
    756757        if key_repeat:
     
    911912
    912913    def _process_draw(self, packet):
    913914        (id, x, y, width, height, coding, data) = packet[1:8]
    914         if len(packet)==9:
     915        packet_sequence, rowstride = None, -1
     916        if len(packet)>=9:
    915917            packet_sequence = packet[8]
    916         else:
    917             packet_sequence = None
     918        if len(packet)>=10:
     919            rowstride = int(packet[9])
    918920        window = self._id_to_window.get(id)
    919921        if not window:
    920922            return      #window is already gone!
    921         window.draw(x, y, width, height, coding, data)
     923        window.draw(x, y, width, height, coding, data, rowstride)
    922924        self.pixel_counter.append((time.time(), width*height))
    923925        if packet_sequence and self.send_damage_sequence:
    924926            self.send_now(["damage-sequence", packet_sequence])