diff options
author | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2014-01-20 17:48:17 -0800 |
---|---|---|
committer | Laxmikant Rashinkar <LK.Rashinkar@gmail.com> | 2014-01-20 17:48:17 -0800 |
commit | 6cd342a20aa988ce21e27261117c6bc6d2dced80 (patch) | |
tree | 7932faf859a3d6cf8fef6b7aaa5d9a3477cf6466 /xorg/server | |
parent | b001b9432aef7642a64bdb84dcd0964ea72a1531 (diff) | |
download | xrdp-proprietary-6cd342a20aa988ce21e27261117c6bc6d2dced80.tar.gz xrdp-proprietary-6cd342a20aa988ce21e27261117c6bc6d2dced80.zip |
added code for region copy used in codec mode
Diffstat (limited to 'xorg/server')
-rw-r--r-- | xorg/server/module/Makefile | 2 | ||||
-rw-r--r-- | xorg/server/module/rdpCapture.c | 101 | ||||
-rw-r--r-- | xorg/server/module/rdpCapture.h | 24 | ||||
-rw-r--r-- | xorg/server/readme.txt | 11 |
4 files changed, 136 insertions, 2 deletions
diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index d30b2ba9..8ddfb864 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -5,7 +5,7 @@ rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \ rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \ rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \ rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \ -rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o +rdpComposite.o rdpGlyphs.o rdpPixmap.o rdpInput.o rdpClientCon.o rdpCapture.o CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 diff --git a/xorg/server/module/rdpCapture.c b/xorg/server/module/rdpCapture.c new file mode 100644 index 00000000..1ab6c4ec --- /dev/null +++ b/xorg/server/module/rdpCapture.c @@ -0,0 +1,101 @@ +/** + * xrdp: A Remote Desktop Protocol server. + * + * Copyright (C) Laxmikant Rashinkar 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Routines to copy regions from framebuffer to shared memory + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* this should be before all X11 .h files */ +#include <xorg-server.h> + +/* all driver need this */ +#include <xf86.h> +#include <xf86_OSproc.h> + +#include "rdp.h" +#include "rdpDraw.h" +#include "rdpClientCon.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/** + * Copy an array of rectangles from one memory area to another + *****************************************************************************/ + +Bool rdpCapture(RegionPtr in_reg, RegionPtr out_reg, + void *src, int src_width, int src_height, int src_stride, int src_format, + void *dst, int dst_width, int dst_height, int dst_stride, int dst_format, + int mode) +{ + BoxRec rect; + char *src_rect; + char *dst_rect; + int num_regions; + int bpp; + int width; + int height; + int offset; + int bytes; + int i; + int j; + + /* + * note: mode = 0: default, one is to one copy + * xxx_format = 0: default, 4 bytes per pixel + */ + + /* for now we only handle defaults */ + + /* number of rectangles to copy */ + num_regions = REGION_NUM_RECTS(in_reg); + + /* get bytes per pixel */ + bpp = src_stride / src_width; + + for (i = 0; i < num_regions; i++) + { + /* get rect to copy */ + rect = REGION_RECTS(in_reg)[i]; + + /* get rect dimensions */ + width = rect.x2 - rect.x1; + height = rect.y2 - rect.y1; + + /* point to start of each rect in respective memory */ + offset = rect.y1 * src_stride + rect.x1 * bpp; + src_rect = src + offset; + dst_rect = dst + offset; + + /* bytes per line */ + bytes = width * bpp; + + /* copy one line at a time */ + for (j = 0; j < height; j++) + { + memcpy(dst_rect, src_rect, bytes); + src_rect += src_stride; + dst_rect += src_stride; + } + } + + return rdpRegionCopy(out_reg, in_reg); +} diff --git a/xorg/server/module/rdpCapture.h b/xorg/server/module/rdpCapture.h new file mode 100644 index 00000000..87bf692b --- /dev/null +++ b/xorg/server/module/rdpCapture.h @@ -0,0 +1,24 @@ +/** + * xrdp: A Remote Desktop Protocol server. + * + * Copyright (C) Laxmikant Rashinkar 2014 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Routines to copy regions from framebuffer to shared memory + */ + +Bool rdpCapture(RegionPtr in_reg, RegionPtr out_reg, + void *src, int src_width, int src_height, int src_stride, int src_format, + void *dst, int dst_width, int dst_height, int dst_stride, int dst_format, + int mode) diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt index dce66306..28bbc692 100644 --- a/xorg/server/readme.txt +++ b/xorg/server/readme.txt @@ -1,7 +1,16 @@ -Notes for building xrdpdev_drv.so and libxorgxrdp.so +------------------------------------------------------ + Notes for building xrdpdev_drv.so and libxorgxrdp.so +------------------------------------------------------ +Pre-requisites: + o sudo apt-get install xserver-xorg-dev +quick and easy way to build and run the driver + o cd xorg/server + o ./test-in-home.sh + + o see /etc/X11/xrdp/xorg.conf to see how things are configured to run it create /etc/X11/xrdp |