[Spice-devel] [PATCH v2 00/30] Better encapsulation of image encoding stuff

Frediano Ziglio fziglio at redhat.com
Thu Jun 9 12:31:20 UTC 2016


Hi,
  after the discussion and tests to reduce typedef mess I realized
the code lack some proper encapsulation.
In DisplayChannel there are multiple files to handle different stuff
but all code needs to know all structures and basically include all
stuff.
Looking at code one stuff that could/should be separate is the image
encoding. There is no high level reason why to compress an image a
connection to a client is required.
So I started moving encoding fields into a structure and
encapsulating code reducing access and knowledge about image
encoding.

Results:
- dcc-encoders.c does not include or use DisplayChannel stuff;
- more structures are now defined in dcc-encoders.c;
- dcc-encoders does not use Drawable but just a Ring to store
  internal data.

Improvements (not strictly related to this patchset):
- dcc_compress_image should be moved to dcc-encoders.c;
- there is no reason dcc-encoders.h should use RedClient,
  this is just as the Glz dictionaries are bound to client;
- define a structure to store global fields like all image
  statistics;
- Glz code is still messy although more encapsulated;
- EncodersData is quite huge, could be optimized.

Changes from v1:
- EncodersData structure renamed to ImageEncoders;
- all encoders function have the image_encoders_ prefix;
- split patches that move encoder fields from part that prepare
  dcc_compress_XX to be moved;
- merged some not strictly related patches.

Frediano Ziglio (30):
  Encapsulate quic information in a new ImageEncoders structure
  Prepare to move dcc_compress_image_quic to ImageEncoders
  Move image_encoders_compress_quic to dcc-encoders.c
  Encapsulate lz information in ImageEncoders structure
  Prepare to move dcc_compress_image_lz to ImageEncoders
  Move image_encoders_compress_lz to dcc-encoders.c
  Encapsulate jpeg information in ImageEncoders structure
  Prepare to move dcc_compress_image_jpeg to ImageEncoders
  Move image_encoders_compress_jpeg to dcc-encoders.c
  Encapsulate lz4 information in ImageEncoders structure
  Prepare to move dcc_compress_image_lz4 to ImageEncoders
  Move image_encoders_compress_lz4 to dcc-encoders.c
  Encapsulate zlib information in ImageEncoders structure
  More encapsulation for dcc_encoders_free
  Move some glz fields to ImageEncoders
  Move others glz fields to dcc-encoders
  Make dcc_compress_image_glz independent to DisplayChannelClient
  Move image_encoders_compress_glz to dcc-encoders.c
  Encapsulate some data in dcc-encoders
  Encapsulate code to save glz state
  Make some function static
  Encapsulate dcc_release_glz
  Better encapsulation for dcc_compress_image_glz call
  Better encoders encapsulation
  Change RedGlzDrawable::drawable from pointer to boolean
  Use Ring instead of accessing Drawable internals
  Do not access ImageEncoders internal to lock/unlock glz encoding
  Make GlzSharedDictionary structure private in dcc-encoders.c
  Remove dependency from dcc-encoders to Drawable
  Reduce header dependency

 server/dcc-encoders.c    | 857 +++++++++++++++++++++++++++++++++++++++--------
 server/dcc-encoders.h    | 139 +++++---
 server/dcc-send.c        |   8 +-
 server/dcc.c             | 538 ++---------------------------
 server/dcc.h             |  33 +-
 server/display-channel.c |  43 +--
 server/display-channel.h |   7 -
 server/red-worker.c      |   6 +-
 8 files changed, 864 insertions(+), 767 deletions(-)

-- 
2.7.4



More information about the Spice-devel mailing list