Ever look into getting this out as straight BSD?

  Nate

On Fri, Feb 11, 2011 at 4:27 PM, Ali Saidi <ali.sa...@arm.com> wrote:
> changeset e59dac494020 in /z/repo/m5
> details: http://repo.m5sim.org/m5?cmd=changeset;node=e59dac494020
> description:
>        VNC: Add VNC server to M5
>
> diffstat:
>
>  configs/common/FSConfig.py |    1 +
>  src/base/SConscript        |    1 +
>  src/base/bitmap.cc         |   82 +++++
>  src/base/bitmap.hh         |  114 +++++++
>  src/base/compiler.hh       |    2 +
>  src/base/vnc/SConscript    |   48 +++
>  src/base/vnc/VncServer.py  |   45 ++
>  src/base/vnc/convert.cc    |  139 ++++++++
>  src/base/vnc/convert.hh    |  141 +++++++++
>  src/base/vnc/vncserver.cc  |  703 
> +++++++++++++++++++++++++++++++++++++++++++++
>  src/base/vnc/vncserver.hh  |  475 ++++++++++++++++++++++++++++++
>  11 files changed, 1751 insertions(+), 0 deletions(-)
>
> diffs (truncated from 1820 to 300 lines):
>
> diff -r 20da8e9ed59f -r e59dac494020 configs/common/FSConfig.py
> --- a/configs/common/FSConfig.py        Fri Feb 11 18:29:35 2011 -0600
> +++ b/configs/common/FSConfig.py        Fri Feb 11 18:29:35 2011 -0600
> @@ -238,6 +238,7 @@
>
>     self.intrctrl = IntrControl()
>     self.terminal = Terminal()
> +    self.vncserver = VncServer()
>     self.kernel = binary('vmlinux.arm')
>     self.boot_osflags = 'earlyprintk mem=128MB console=ttyAMA0 lpj=19988480' 
> + \
>                         ' norandmaps slram=slram0,0x8000000,+0x8000000' +     
>  \
> diff -r 20da8e9ed59f -r e59dac494020 src/base/SConscript
> --- a/src/base/SConscript       Fri Feb 11 18:29:35 2011 -0600
> +++ b/src/base/SConscript       Fri Feb 11 18:29:35 2011 -0600
> @@ -35,6 +35,7 @@
>     Source('cp_annotate.cc')
>  Source('atomicio.cc')
>  Source('bigint.cc')
> +Source('bitmap.cc')
>  Source('callback.cc')
>  Source('circlebuf.cc')
>  Source('cprintf.cc')
> diff -r 20da8e9ed59f -r e59dac494020 src/base/bitmap.cc
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/src/base/bitmap.cc        Fri Feb 11 18:29:35 2011 -0600
> @@ -0,0 +1,82 @@
> +/*
> + * Copyright (c) 2010 ARM Limited
> + * All rights reserved
> + *
> + * The license below extends only to copyright in the software and shall
> + * not be construed as granting a license to any other intellectual
> + * property including but not limited to intellectual property relating
> + * to a hardware implementation of the functionality of the software
> + * licensed hereunder.  You may use the software subject to the license
> + * terms below provided that you ensure that this notice is replicated
> + * unmodified and in its entirety in all distributions of the software,
> + * modified or unmodified, in source code or in binary form.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are
> + * met: redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer;
> + * redistributions in binary form must reproduce the above copyright
> + * notice, this list of conditions and the following disclaimer in the
> + * documentation and/or other materials provided with the distribution;
> + * neither the name of the copyright holders nor the names of its
> + * contributors may be used to endorse or promote products derived from
> + * this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * Authors: William Wang
> + *          Ali Saidi
> + */
> +
> +#include <cassert>
> +
> +#include "base/bitmap.hh"
> +#include "base/misc.hh"
> +
> +// bitmap class ctor
> +Bitmap::Bitmap(VideoConvert::Mode _mode, uint16_t w, uint16_t h, uint8_t *d)
> +    : mode(_mode), height(h), width(w), data(d),
> +    vc(mode, VideoConvert::rgb8888, width, height)
> +{
> +}
> +
> +void
> +Bitmap::write(std::ostream *bmp)
> +{
> +    assert(data);
> +
> +    // For further information see: 
> http://en.wikipedia.org/wiki/BMP_file_format
> +    Magic  magic = {{'B','M'}};
> +    Header header = {sizeof(VideoConvert::Rgb8888) * width * height , 0, 0, 
> 54};
> +    Info   info = {sizeof(Info), width, height, 1,
> +                   sizeof(VideoConvert::Rgb8888) * 8, 0,
> +                   sizeof(VideoConvert::Rgb8888) * width * height, 1, 1, 0, 
> 0};
> +
> +    bmp->write(reinterpret_cast<char*>(&magic),  sizeof(magic));
> +    bmp->write(reinterpret_cast<char*>(&header), sizeof(header));
> +    bmp->write(reinterpret_cast<char*>(&info),   sizeof(info));
> +
> +    uint8_t *tmp = vc.convert(data);
> +    uint32_t *tmp32 = (uint32_t*)tmp;
> +
> +    // BMP start store data left to right starting with the bottom row
> +    // so we need to do some creative flipping
> +    for (int i = height - 1; i >= 0; i--)
> +        for (int j = 0; j < width; j++)
> +            bmp->write((char*)&tmp32[i * width + j], sizeof(uint32_t));
> +
> +    bmp->flush();
> +
> +    delete [] tmp;
> +}
> +
> diff -r 20da8e9ed59f -r e59dac494020 src/base/bitmap.hh
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/src/base/bitmap.hh        Fri Feb 11 18:29:35 2011 -0600
> @@ -0,0 +1,114 @@
> +/*
> + * Copyright (c) 2010 ARM Limited
> + * All rights reserved
> + *
> + * The license below extends only to copyright in the software and shall
> + * not be construed as granting a license to any other intellectual
> + * property including but not limited to intellectual property relating
> + * to a hardware implementation of the functionality of the software
> + * licensed hereunder.  You may use the software subject to the license
> + * terms below provided that you ensure that this notice is replicated
> + * unmodified and in its entirety in all distributions of the software,
> + * modified or unmodified, in source code or in binary form.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are
> + * met: redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer;
> + * redistributions in binary form must reproduce the above copyright
> + * notice, this list of conditions and the following disclaimer in the
> + * documentation and/or other materials provided with the distribution;
> + * neither the name of the copyright holders nor the names of its
> + * contributors may be used to endorse or promote products derived from
> + * this software without specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * Authors: William Wang
> + *          Ali Saidi
> + */
> +#ifndef __BASE_BITMAP_HH__
> +#define __BASE_BITMAP_HH__
> +
> +#include <fstream>
> +
> +#include "base/vnc/convert.hh"
> +
> +/**
> + * @file Declaration of a class that writes a frame buffer to a bitmap
> + */
> +
> +
> +// write frame buffer into a bitmap picture
> +class  Bitmap
> +{
> +  public:
> +    /** Create a Bitmap creator that takes data in the given mode & size
> +     * and outputs to an fstream
> +     * @param mode the type of data that is being provided
> +     * @param h the hight of the image
> +     * @param w the width of the image
> +     * @param d the data for the image in mode
> +     */
> +    Bitmap(VideoConvert::Mode mode, uint16_t w, uint16_t h, uint8_t *d);
> +
> +    /** Provide the converter with the data that should be output. It will be
> +     * converted into rgb8888 and write out when write() is called.
> +     * @param d the data
> +     */
> +    void rawData(uint8_t* d) { data = d; }
> +
> +    /** Write the provided data into the fstream provided
> +     * @param bmp stream to write to
> +     */
> +    void write(std::ostream *bmp);
> +
> +  private:
> +    VideoConvert::Mode mode;
> +    uint16_t height;
> +    uint16_t width;
> +    uint8_t *data;
> +
> +    VideoConvert vc;
> +
> +    struct Magic
> +    {
> +        unsigned char magic_number[2];
> +    };
> +
> +    struct Header
> +    {
> +        uint32_t size;
> +        uint16_t reserved1;
> +        uint16_t reserved2;
> +        uint32_t offset;
> +    };
> +
> +    struct Info
> +    {
> +        uint32_t Size;
> +        uint32_t Width;
> +        uint32_t Height;
> +        uint16_t Planes;
> +        uint16_t BitCount;
> +        uint32_t Compression;
> +        uint32_t SizeImage;
> +        uint32_t XPelsPerMeter;
> +        uint32_t YPelsPerMeter;
> +        uint32_t ClrUsed;
> +        uint32_t ClrImportant;
> +    };
> +};
> +
> +#endif // __BASE_BITMAP_HH__
> +
> diff -r 20da8e9ed59f -r e59dac494020 src/base/compiler.hh
> --- a/src/base/compiler.hh      Fri Feb 11 18:29:35 2011 -0600
> +++ b/src/base/compiler.hh      Fri Feb 11 18:29:35 2011 -0600
> @@ -41,6 +41,7 @@
>  #define M5_PRAGMA_NORETURN(x)
>  #define M5_DUMMY_RETURN
>  #define M5_VAR_USED __attribute__((unused))
> +#define M5_ATTR_PACKED __attribute__ ((__packed__))
>  #elif defined(__SUNPRO_CC)
>  // this doesn't do anything with sun cc, but why not
>  #define M5_ATTR_NORETURN  __sun_attr__((__noreturn__))
> @@ -48,6 +49,7 @@
>  #define DO_PRAGMA(x) _Pragma(#x)
>  #define M5_VAR_USED
>  #define M5_PRAGMA_NORETURN(x) DO_PRAGMA(does_not_return(x))
> +#define M5_ATTR_PACKED __attribute__ ((__packed__))
>  #else
>  #error "Need to define compiler options in base/compiler.hh"
>  #endif
> diff -r 20da8e9ed59f -r e59dac494020 src/base/vnc/SConscript
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/src/base/vnc/SConscript   Fri Feb 11 18:29:35 2011 -0600
> @@ -0,0 +1,48 @@
> +# -*- mode:python -*-
> +
> +# Copyright (c) 2010 ARM Limited
> +# All rights reserved.
> +#
> +# The license below extends only to copyright in the software and shall
> +# not be construed as granting a license to any other intellectual
> +# property including but not limited to intellectual property relating
> +# to a hardware implementation of the functionality of the software
> +# licensed hereunder.  You may use the software subject to the license
> +# terms below provided that you ensure that this notice is replicated
> +# unmodified and in its entirety in all distributions of the software,
> +# modified or unmodified, in source code or in binary form.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions are
> +# met: redistributions of source code must retain the above copyright
> +# notice, this list of conditions and the following disclaimer;
> +# redistributions in binary form must reproduce the above copyright
> +# notice, this list of conditions and the following disclaimer in the
> +# documentation and/or other materials provided with the distribution;
> +# neither the name of the copyright holders nor the names of its
> +# contributors may be used to endorse or promote products derived from
> +# this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +#
> +# Authors: William Wang
> +
> +Import('*')
> +
> +if env['FULL_SYSTEM']:
> +    SimObject('VncServer.py')
> +    Source('vncserver.cc')
> +    TraceFlag('VNC')
> +
> +Source('convert.cc')
> +
> diff -r 20da8e9ed59f -r e59dac494020 src/base/vnc/VncServer.py
> --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
> +++ b/src/base/vnc/VncServer.py Fri Feb 11 18:29:35 2011 -0600
> _______________________________________________
> m5-dev mailing list
> m5-dev@m5sim.org
> http://m5sim.org/mailman/listinfo/m5-dev
>
>
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to