From e466b054b766c034a957ff9227c11874e2f53211 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 23 Jun 2013 15:00:24 -0700 Subject: [PATCH 01/45] libxrdp: no logic change, warnings and code cleanup --- libxrdp/libxrdp.c | 1 + libxrdp/xrdp_orders.c | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/libxrdp/libxrdp.c b/libxrdp/libxrdp.c index 23cf5b09..15e34e91 100644 --- a/libxrdp/libxrdp.c +++ b/libxrdp/libxrdp.c @@ -19,6 +19,7 @@ */ #include "libxrdp.h" +#include "xrdp_orders_rail.h" /******************************************************************************/ struct xrdp_session *EXPORT_CC diff --git a/libxrdp/xrdp_orders.c b/libxrdp/xrdp_orders.c index aa399004..29234173 100644 --- a/libxrdp/xrdp_orders.c +++ b/libxrdp/xrdp_orders.c @@ -212,14 +212,17 @@ xrdp_orders_check(struct xrdp_orders *self, int max_size) } if (size > max_packet_size) { - // this suggests someone calls this function without passing the correct - // max_size so we end up putting more into the buffer than we indicate we can + /* this suggests someone calls this function without passing the + correct max_size so we end up putting more into the buffer + than we indicate we can */ g_writeln("error in xrdp_orders_check, size too big, its %d", size); - // We where getting called with size allready greater than max_packet_size - // Which I suspect was because the sending of text did not include the text len - // to check the buffer size. So attempt to send the data anyway. - // Lets write the data anyway, somewhere else may barf. - // return 1; + /* We where getting called with size already greater than + max_packet_size + Which I suspect was because the sending of text did not include + the text len to check the buffer size. So attempt to send the data + anyway. + Lets write the data anyway, somewhere else may barf. */ + /* return 1; */ } if ((size + max_size + 100) > max_packet_size) @@ -363,7 +366,8 @@ xrdp_orders_out_bounds(struct xrdp_orders *self, struct xrdp_rect *rect) /* right */ if (bounds_flags & 0x04) { - out_uint16_le(self->out_s, rect->right - 1); /* silly rdp right clip */ + /* silly rdp right clip */ + out_uint16_le(self->out_s, rect->right - 1); } else if (bounds_flags & 0x40) { @@ -375,7 +379,8 @@ xrdp_orders_out_bounds(struct xrdp_orders *self, struct xrdp_rect *rect) /* bottom */ if (bounds_flags & 0x08) { - out_uint16_le(self->out_s, rect->bottom - 1); /* silly rdp bottom clip */ + /* silly rdp bottom clip */ + out_uint16_le(self->out_s, rect->bottom - 1); } else if (bounds_flags & 0x80) { @@ -1184,8 +1189,8 @@ xrdp_orders_line(struct xrdp_orders *self, int mix_mode, g_memset(&blank_pen, 0, sizeof(struct xrdp_pen)); - /* if mix mode or rop are out of range, mstsc build 6000+ will parse the orders - wrong */ + /* if mix mode or rop are out of range, mstsc build 6000+ will parse the + orders wrong */ if ((mix_mode < 1) || (mix_mode > 2)) /* TRANSPARENT(1) or OPAQUE(2) */ { mix_mode = 1; @@ -2336,8 +2341,8 @@ xrdp_orders_send_bitmap3(struct xrdp_orders *self, rfx_compose_message(context, fr_s, &rect, 1, (tui8 *)data, width, height, width * 4); bufsize = stream_get_length(fr_s); - xrdp_orders_out_v3(self, cache_id, cache_idx, (char *)(fr_s->data), bufsize, - width, height, bpp, ci->v3_codec_id); + xrdp_orders_out_v3(self, cache_id, cache_idx, (char *)(fr_s->data), + bufsize, width, height, bpp, ci->v3_codec_id); stream_detach(fr_s); stream_free(fr_s); free_stream(xr_s); From 2aad1b2d5da9d7412092d8c76601fa9bca95685d Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 23 Jun 2013 21:17:14 -0700 Subject: [PATCH 02/45] work on neutrinordp proxy, cursor and glyph --- neutrinordp/xrdp-neutrinordp.c | 124 +++++++++++++++++++++++++-------- neutrinordp/xrdp-neutrinordp.h | 5 +- 2 files changed, 100 insertions(+), 29 deletions(-) diff --git a/neutrinordp/xrdp-neutrinordp.c b/neutrinordp/xrdp-neutrinordp.c index ef0e4d4c..f0424c26 100644 --- a/neutrinordp/xrdp-neutrinordp.c +++ b/neutrinordp/xrdp-neutrinordp.c @@ -27,7 +27,7 @@ #ifdef XRDP_DEBUG #define LOG_LEVEL 99 #else -#define LOG_LEVEL 0 +#define LOG_LEVEL 1 #endif #define LLOG(_level, _args) \ @@ -617,14 +617,19 @@ lfreerdp_pat_blt(rdpContext *context, PATBLT_ORDER *patblt) server_bpp = mod->inst->settings->color_depth; client_bpp = mod->bpp; - LLOGLN(0, ("lfreerdp_pat_blt: bpp %d %d", server_bpp, client_bpp)); + LLOGLN(10, ("lfreerdp_pat_blt: bpp %d %d", server_bpp, client_bpp)); fgcolor = convert_color(server_bpp, client_bpp, patblt->foreColor, mod->colormap); bgcolor = convert_color(server_bpp, client_bpp, patblt->backColor, mod->colormap); - if(fgcolor==bgcolor) + LLOGLN(10, ("lfreerdp_pat_blt: nLeftRect %d nTopRect %d " + "nWidth %d nHeight %d fgcolor 0x%8.8x bgcolor 0x%8.8x", + patblt->nLeftRect, patblt->nTopRect, + patblt->nWidth, patblt->nHeight, fgcolor, bgcolor)); + + if (fgcolor == bgcolor) { LLOGLN(0, ("Warning same color on both bg and fg")); } @@ -691,6 +696,10 @@ lfreerdp_opaque_rect(rdpContext *context, OPAQUE_RECT_ORDER *opaque_rect) client_bpp = mod->bpp; fgcolor = convert_color(server_bpp, client_bpp, opaque_rect->color, mod->colormap); + LLOGLN(10, ("lfreerdp_opaque_rect: nLeftRect %d nTopRect %d " + "nWidth %d nHeight %d fgcolor 0x%8.8x", + opaque_rect->nLeftRect, opaque_rect->nTopRect, + opaque_rect->nWidth, opaque_rect->nHeight, fgcolor)); mod->server_set_fgcolor(mod, fgcolor); mod->server_fill_rect(mod, opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nWidth, opaque_rect->nHeight); @@ -749,6 +758,10 @@ lfreerdp_glyph_index(rdpContext *context, GLYPH_INDEX_ORDER *glyph_index) int client_bpp; int fgcolor; int bgcolor; + int opLeft; + int opTop; + int opRight; + int opBottom; mod = ((struct mod_context *)context)->modi; LLOGLN(10, ("lfreerdp_glyph_index:")); @@ -758,14 +771,39 @@ lfreerdp_glyph_index(rdpContext *context, GLYPH_INDEX_ORDER *glyph_index) glyph_index->foreColor, mod->colormap); bgcolor = convert_color(server_bpp, client_bpp, glyph_index->backColor, mod->colormap); + LLOGLN(10, ("lfreerdp_glyph_index: " + "bkLeft %d bkTop %d width %d height %d " + "opLeft %d opTop %d width %d height %d " + "cbData %d fgcolor 0x%8.8x bgcolor 0x%8.8x fOpRedundant %d", + glyph_index->bkLeft, glyph_index->bkTop, + glyph_index->bkRight - glyph_index->bkLeft, + glyph_index->bkBottom - glyph_index->bkTop, + glyph_index->opLeft, glyph_index->opTop, + glyph_index->opRight - glyph_index->opLeft, + glyph_index->opBottom - glyph_index->opTop, + glyph_index->cbData, fgcolor, bgcolor, glyph_index->fOpRedundant)); mod->server_set_bgcolor(mod, fgcolor); mod->server_set_fgcolor(mod, bgcolor); + opLeft = glyph_index->opLeft; + opTop = glyph_index->opTop; + opRight = glyph_index->opRight; + opBottom = glyph_index->opBottom; +#if 1 + /* workarounds for freerdp not using fOpRedundant in + glyph.c::update_gdi_glyph_index */ + if (glyph_index->fOpRedundant) + { + opLeft = glyph_index->bkLeft; + opTop = glyph_index->bkTop; + opRight = glyph_index->bkRight; + opBottom =glyph_index->bkBottom; + } +#endif mod->server_draw_text(mod, glyph_index->cacheId, glyph_index->flAccel, glyph_index->fOpRedundant, glyph_index->bkLeft, glyph_index->bkTop, glyph_index->bkRight, glyph_index->bkBottom, - glyph_index->opLeft, glyph_index->opTop, - glyph_index->opRight, glyph_index->opBottom, + opLeft, opTop, opRight, opBottom, glyph_index->x, glyph_index->y, (char *)(glyph_index->data), glyph_index->cbData); } @@ -863,7 +901,7 @@ lfreerdp_cache_bitmapV2(rdpContext *context, if (flags & 0x10) /* CBR2_DO_NOT_CACHE */ { - LLOGLN(0, ("lfreerdp_cache_bitmapV2: CBR2_DO_NOT_CACHE")); + LLOGLN(10, ("lfreerdp_cache_bitmapV2: CBR2_DO_NOT_CACHE")); idx = 4096 - 1; } @@ -1049,6 +1087,13 @@ lfreerdp_get_pixel(void *bits, int width, int height, int bpp, pixel = (src8[start] & (0x80 >> shift)) != 0; return pixel ? 0xffffff : 0; } + else if (bpp == 32) + { + src8 = (tui8 *)bits; + src8 += y * delta + x * 4; + pixel = ((int*)(src8))[0]; + return pixel; + } else { LLOGLN(0, ("lfreerdp_get_pixel: unknown bpp %d", bpp)); @@ -1089,6 +1134,12 @@ lfreerdp_set_pixel(int pixel, void *bits, int width, int height, int bpp, dst8[1] = (pixel >> 8) & 0xff; dst8[2] = (pixel >> 16) & 0xff; } + else if (bpp == 32) + { + dst8 = (tui8 *)bits; + dst8 += y * delta + x * 4; + ((int*)(dst8))[0] = pixel; + } else { LLOGLN(0, ("lfreerdp_set_pixel: unknown bpp %d", bpp)); @@ -1129,6 +1180,8 @@ lfreerdp_pointer_new(rdpContext *context, { struct mod *mod; int index; + int bytes_per_pixel; + int bits_per_pixel; tui8 *dst; tui8 *src; @@ -1143,40 +1196,47 @@ lfreerdp_pointer_new(rdpContext *context, pointer_new->colorPtrAttr.lengthAndMask)); index = pointer_new->colorPtrAttr.cacheIndex; - if(index>=32) + if (index >= 32) { - LLOGLN(0,("pointer index too big")); + LLOGLN(0, ("lfreerdp_pointer_new: pointer index too big")); return ; } - // In this fix we remove the xorBpp check, even if - // the mouse pointers are not correct we can use them. - // Configure your destination not to use windows Aero as pointer scheme - else if ( // pointer_new->xorBpp == 1 && - pointer_new->colorPtrAttr.width == 32 && - pointer_new->colorPtrAttr.height == 32 && - index < 32) + if (pointer_new->xorBpp == 1 && + pointer_new->colorPtrAttr.width == 32 && + pointer_new->colorPtrAttr.height == 32) { + LLOGLN(10, ("lfreerdp_pointer_new:")); mod->pointer_cache[index].hotx = pointer_new->colorPtrAttr.xPos; mod->pointer_cache[index].hoty = pointer_new->colorPtrAttr.yPos; - + mod->pointer_cache[index].bpp = 0; dst = (tui8 *)(mod->pointer_cache[index].data); dst += 32 * 32 * 3 - 32 * 3; src = pointer_new->colorPtrAttr.xorMaskData; lfreerdp_convert_color_image(dst, 32, 32, 24, 32 * -3, src, 32, 32, 1, 32 / 8); - dst = (tui8 *)(mod->pointer_cache[index].mask); dst += ( 32 * 32 / 8) - (32 / 8); src = pointer_new->colorPtrAttr.andMaskData; lfreerdp_convert_color_image(dst, 32, 32, 1, 32 / -8, src, 32, 32, 1, 32 / 8); - - //memcpy(mod->pointer_cache[index].mask, - // pointer_new->colorPtrAttr.andMaskData, 32 * 32 / 8); - - mod->server_set_pointer(mod, mod->pointer_cache[index].hotx, - mod->pointer_cache[index].hoty, mod->pointer_cache[index].data, - mod->pointer_cache[index].mask); + } + else if(pointer_new->xorBpp >= 8 && + pointer_new->colorPtrAttr.width == 32 && + pointer_new->colorPtrAttr.height == 32) + { + bytes_per_pixel = (pointer_new->xorBpp + 7) / 8; + bits_per_pixel = pointer_new->xorBpp; + LLOGLN(10, ("lfreerdp_pointer_new: bpp %d Bpp %d", bits_per_pixel, + bytes_per_pixel)); + mod->pointer_cache[index].hotx = pointer_new->colorPtrAttr.xPos; + mod->pointer_cache[index].hoty = pointer_new->colorPtrAttr.yPos; + mod->pointer_cache[index].bpp = bits_per_pixel; + memcpy(mod->pointer_cache[index].data, + pointer_new->colorPtrAttr.xorMaskData, + 32 * 32 * bytes_per_pixel); + memcpy(mod->pointer_cache[index].mask, + pointer_new->colorPtrAttr.andMaskData, + 32 * (32 / 8)); } else { @@ -1185,6 +1245,12 @@ lfreerdp_pointer_new(rdpContext *context, pointer_new->colorPtrAttr.height,index)); } + mod->server_set_pointer_ex(mod, mod->pointer_cache[index].hotx, + mod->pointer_cache[index].hoty, + mod->pointer_cache[index].data, + mod->pointer_cache[index].mask, + mod->pointer_cache[index].bpp); + free(pointer_new->colorPtrAttr.xorMaskData); pointer_new->colorPtrAttr.xorMaskData = 0; free(pointer_new->colorPtrAttr.andMaskData); @@ -1203,10 +1269,11 @@ lfreerdp_pointer_cached(rdpContext *context, mod = ((struct mod_context *)context)->modi; index = pointer_cached->cacheIndex; LLOGLN(10, ("lfreerdp_pointer_cached:%d", index)); - mod->server_set_pointer(mod, mod->pointer_cache[index].hotx, - mod->pointer_cache[index].hoty, - mod->pointer_cache[index].data, - mod->pointer_cache[index].mask); + mod->server_set_pointer_ex(mod, mod->pointer_cache[index].hotx, + mod->pointer_cache[index].hoty, + mod->pointer_cache[index].data, + mod->pointer_cache[index].mask, + mod->pointer_cache[index].bpp); } static void DEFAULT_CC lfreerdp_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) @@ -1308,6 +1375,7 @@ lfreerdp_pre_connect(freerdp *instance) instance->settings->draw_nine_grid = 0; instance->settings->glyph_cache = true; + /* GLYPH_SUPPORT_FULL and GLYPH_SUPPORT_PARTIAL seem to be the same */ instance->settings->glyphSupportLevel = GLYPH_SUPPORT_FULL; instance->settings->order_support[NEG_GLYPH_INDEX_INDEX] = 1; instance->settings->order_support[NEG_FAST_GLYPH_INDEX] = 0; diff --git a/neutrinordp/xrdp-neutrinordp.h b/neutrinordp/xrdp-neutrinordp.h index 474c46b7..9cd3a8c3 100644 --- a/neutrinordp/xrdp-neutrinordp.h +++ b/neutrinordp/xrdp-neutrinordp.h @@ -53,8 +53,9 @@ struct pointer_item { int hotx; int hoty; - char data[32 * 32 * 3]; + char data[32 * 32 * 4]; char mask[32 * 32 / 8]; + int bpp; }; #define CURRENT_MOD_VER 2 @@ -148,6 +149,8 @@ struct mod int (*server_monitored_desktop)(struct mod* mod, struct rail_monitored_desktop_order* mdo, int flags); + int (*server_set_pointer_ex)(struct mod* mod, int x, int y, char* data, + char* mask, int bpp); long server_dumby[100 - 37]; /* align, 100 minus the number of server functions above */ From aab0176867552516a8358463e875cf437887f31c Mon Sep 17 00:00:00 2001 From: speidy Date: Tue, 25 Jun 2013 00:00:32 +0300 Subject: [PATCH 03/45] chansrv: fix for pulse simple method, to get it work again. --- sesman/chansrv/sound.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c index c4ca8261..2b027a82 100644 --- a/sesman/chansrv/sound.c +++ b/sesman/chansrv/sound.c @@ -706,7 +706,7 @@ read_raw_audio_data(void *arg) } strans->trans_data_in = sttrans_data_in; - g_snprintf(path, 255, "/tmp/xrdp_chansrv_audio_socket_%d", g_display_num); + g_snprintf(path, 255, CHANSRV_PORT_STR, g_display_num); if (trans_connect(strans, "", path, 100) != 0) { From b1389eac9940c710ff9c892fe4593f02635164ec Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 27 Jun 2013 16:23:12 -0700 Subject: [PATCH 04/45] xup: from Marc, added missing bgcolor --- xup/xup.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xup/xup.c b/xup/xup.c index 27063366..5320a3c9 100644 --- a/xup/xup.c +++ b/xup/xup.c @@ -534,6 +534,7 @@ lib_mod_process_orders(struct mod *mod, int type, struct stream *s) int width; int height; int fgcolor; + int bgcolor; int opcode; char *bmpdata; char cur_data[32 * (32 * 3)]; @@ -594,6 +595,10 @@ lib_mod_process_orders(struct mod *mod, int type, struct stream *s) in_uint32_le(s, fgcolor); rv = mod->server_set_fgcolor(mod, fgcolor); break; + case 13: /* server_set_bgcolor */ + in_uint32_le(s, bgcolor); + rv = mod->server_set_bgcolor(mod, bgcolor); + break; case 14: in_uint16_le(s, opcode); rv = mod->server_set_opcode(mod, opcode); From 6d3a2cd5fd6ef933159f0d79d7361c6d7434c2e9 Mon Sep 17 00:00:00 2001 From: Laxmikant Rashinkar Date: Thu, 27 Jun 2013 17:48:52 -0700 Subject: [PATCH 05/45] vrplayer: pause video during window move and resize --- vrplayer/mainwindow.cpp | 99 ++++++++++++++++++++++++++++++++++++----- vrplayer/mainwindow.h | 5 +++ 2 files changed, 94 insertions(+), 10 deletions(-) diff --git a/vrplayer/mainwindow.cpp b/vrplayer/mainwindow.cpp index b97da148..ec2d338a 100644 --- a/vrplayer/mainwindow.cpp +++ b/vrplayer/mainwindow.cpp @@ -4,12 +4,18 @@ /* * TODO * o should we use tick marks in QSlider? + * o check for memory leaks + * o double click should make it full screen + * o when opening files, pause video */ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { + gotMediaOnCmdline = false; + moveResizeTimer = NULL; + /* connect to remote client */ interface = new OurInterface(); if (interface->oneTimeInit()) @@ -35,16 +41,42 @@ MainWindow::MainWindow(QWidget *parent) : connect(interface, SIGNAL(onMediaDurationInSeconds(int)), this, SLOT(onMediaDurationInSeconds(int))); + + /* if media file is specified on cmd line, use it */ + QStringList args = QApplication::arguments(); + if (args.count() > 1) + { + if (QFile::exists(args.at(1))) + { + interface->setFilename(args.at(1)); + filename = args.at(1); + gotMediaOnCmdline = true; + on_actionOpen_Media_File_triggered(); + } + else + { + QMessageBox::warning(this, "Invalid media file specified", + "\nThe media file\n\n" + args.at(1) + + "\n\ndoes not exist"); + } + } } MainWindow::~MainWindow() { delete ui; + + if (moveResizeTimer) + delete moveResizeTimer; } void MainWindow::closeEvent(QCloseEvent *event) { - if (!oneTimeInitSuccess) + if (oneTimeInitSuccess) + { + interface->deInitRemoteClient(); + } + else { QMessageBox::warning(this, "Closing application", "This is not an xrdp session with xrdpvr"); @@ -54,18 +86,50 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::resizeEvent(QResizeEvent *) { - QRect rect; + if (vcrFlag != VCR_PLAY) + { + QRect rect; - getVdoGeometry(&rect); - interface->sendGeometry(rect); + getVdoGeometry(&rect); + interface->sendGeometry(rect); + return; + } + + interface->setVcrOp(VCR_PAUSE); + vcrFlag = VCR_PAUSE; + + if (!moveResizeTimer) + { + moveResizeTimer = new QTimer; + connect(moveResizeTimer, SIGNAL(timeout()), + this, SLOT(onMoveCompleted())); + } + lblVideo->setStyleSheet("QLabel { background-color : black; color : blue; }"); + moveResizeTimer->start(1000); } void MainWindow::moveEvent(QMoveEvent *) { - QRect rect; + if (vcrFlag != VCR_PLAY) + { + QRect rect; - getVdoGeometry(&rect); - interface->sendGeometry(rect); + getVdoGeometry(&rect); + interface->sendGeometry(rect); + return; + } + + interface->setVcrOp(VCR_PAUSE); + vcrFlag = VCR_PAUSE; + + if (!moveResizeTimer) + { + moveResizeTimer = new QTimer; + connect(moveResizeTimer, SIGNAL(timeout()), + this, SLOT(onMoveCompleted())); + } + lblVideo->setStyleSheet("QLabel { background-color : black; color : blue; }"); + moveResizeTimer->start(1000); } void MainWindow::setupUI() @@ -208,9 +272,14 @@ void MainWindow::clearDisplay() void MainWindow::on_actionOpen_Media_File_triggered() { if (vcrFlag != 0) - onBtnStopClicked(false); + onBtnStopClicked(true); + + /* if media was specified on cmd line, use it just once */ + if (gotMediaOnCmdline) + gotMediaOnCmdline = false; + else + openMediaFile(); - openMediaFile(); if (filename.length() == 0) { /* cancel btn was clicked */ @@ -238,7 +307,7 @@ void MainWindow::on_actionOpen_Media_File_triggered() remoteClientInited = true; interface->playMedia(); - if (vcrFlag != 0) + //if (vcrFlag != 0) { interface->setVcrOp(VCR_PLAY); btnPlay->setText("Pause"); @@ -404,3 +473,13 @@ void MainWindow::onSliderActionTriggered(int action) } } +void MainWindow::onMoveCompleted() +{ + QRect rect; + + getVdoGeometry(&rect); + interface->sendGeometry(rect); + + interface->setVcrOp(VCR_PLAY); + vcrFlag = VCR_PLAY; +} diff --git a/vrplayer/mainwindow.h b/vrplayer/mainwindow.h index 802fd10d..56f94edb 100644 --- a/vrplayer/mainwindow.h +++ b/vrplayer/mainwindow.h @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "xrdpapi.h" #include "xrdpvr.h" @@ -75,6 +77,7 @@ private slots: void onMediaDurationInSeconds(int duration); void onElapsedTime(int secs); void onSliderActionTriggered(int value); + void onMoveCompleted(); protected: void resizeEvent(QResizeEvent *e); @@ -98,6 +101,7 @@ private: QSlider *slider; QWidget *window; bool acceptSliderMove; + QTimer *moveResizeTimer; /* private stuff */ OurInterface *interface; @@ -109,6 +113,7 @@ private: int stream_id; int64_t elapsedTime; /* elapsed time in usecs since play started */ int vcrFlag; + bool gotMediaOnCmdline; /* private methods */ void setupUI(); From a330226dd999f2061e5616b06deb96197eb1cc59 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 28 Jun 2013 19:37:03 -0700 Subject: [PATCH 06/45] added libmem and a test --- tests/memtest/Makefile | 13 ++ tests/memtest/libmem.c | 423 ++++++++++++++++++++++++++++++++++++++++ tests/memtest/libmem.h | 18 ++ tests/memtest/memtest.c | 60 ++++++ 4 files changed, 514 insertions(+) create mode 100644 tests/memtest/Makefile create mode 100644 tests/memtest/libmem.c create mode 100644 tests/memtest/libmem.h create mode 100644 tests/memtest/memtest.c diff --git a/tests/memtest/Makefile b/tests/memtest/Makefile new file mode 100644 index 00000000..c0310ece --- /dev/null +++ b/tests/memtest/Makefile @@ -0,0 +1,13 @@ + +OBJS = libmem.o memtest.o + +#CFLAGS = -O2 -Wall +CFLAGS = -g + +all: memtest + +memtest: $(OBJS) + $(CC) -o memtest $(OBJS) + +clean: + rm -f $(OBJS) librdp.a diff --git a/tests/memtest/libmem.c b/tests/memtest/libmem.c new file mode 100644 index 00000000..8038f108 --- /dev/null +++ b/tests/memtest/libmem.c @@ -0,0 +1,423 @@ + +#include +#include +#include + +#define ALIGN_BY 1024 +#define ALIGN_BY_M1 (ALIGN_BY - 1) +#define ALIGN(_in) (((_in) + ALIGN_BY_M1) & (~ALIGN_BY_M1)) + +struct mem_item +{ + unsigned int addr; + int bytes; + struct mem_item* next; + struct mem_item* prev; +}; + +struct mem_info +{ + unsigned int addr; + int bytes; + int flags; + struct mem_item* free_head; + struct mem_item* free_tail; + struct mem_item* used_head; + struct mem_item* used_tail; +}; + +/*****************************************************************************/ +static int +libmem_free_mem_item(struct mem_info* self, struct mem_item* mi) +{ + if (self == 0 || mi == 0) + { + return 0; + } + if (mi->prev != 0) + { + mi->prev->next = mi->next; + } + if (mi->next != 0) + { + mi->next->prev = mi->prev; + } + if (mi == self->free_head) + { + self->free_head = mi->next; + } + if (mi == self->free_tail) + { + self->free_tail = mi->prev; + } + if (mi == self->used_head) + { + self->used_head = mi->next; + } + if (mi == self->used_tail) + { + self->used_tail = mi->prev; + } + free(mi); + return 0; +} + +/*****************************************************************************/ +void* +libmem_init(unsigned int addr, int bytes) +{ + struct mem_info* self; + struct mem_item* mi; + + self = (struct mem_info*)malloc(sizeof(struct mem_info)); + memset(self, 0, sizeof(struct mem_info)); + self->addr = addr; + self->bytes = bytes; + //self->flags = 1; + mi = (struct mem_item*)malloc(sizeof(struct mem_item)); + memset(mi, 0, sizeof(struct mem_item)); + mi->addr = addr; + mi->bytes = bytes; + self->free_head = mi; + self->free_tail = mi; + return self; +} + +/*****************************************************************************/ +void +libmem_deinit(void* aself) +{ + struct mem_info* self; + + self = (struct mem_info*)aself; + if (self == 0) + { + return; + } + while (self->free_head != 0) + { + libmem_free_mem_item(self, self->free_head); + } + while (self->used_head != 0) + { + libmem_free_mem_item(self, self->used_head); + } + free(self); +} + +/****************************************************************************/ +static int +libmem_add_used_item(struct mem_info* self, unsigned int addr, int bytes) +{ + struct mem_item* mi; + struct mem_item* new_mi; + int added; + + if (self == 0 || addr == 0) + { + return 1; + } + if (self->used_head == 0) + { + /* add first item */ + new_mi = (struct mem_item*)malloc(sizeof(struct mem_item)); + memset(new_mi, 0, sizeof(struct mem_item)); + new_mi->addr = addr; + new_mi->bytes = bytes; + self->used_head = new_mi; + self->used_tail = new_mi; + return 0; + } + added = 0; + mi = self->used_head; + while (mi != 0) + { + if (mi->addr > addr) + { + /* add before */ + new_mi = (struct mem_item*)malloc(sizeof(struct mem_item)); + memset(new_mi, 0, sizeof(struct mem_item)); + new_mi->addr = addr; + new_mi->bytes = bytes; + new_mi->prev = mi->prev; + new_mi->next = mi; + if (mi->prev != 0) + { + mi->prev->next = new_mi; + } + mi->prev = new_mi; + if (self->used_head == mi) + { + self->used_head = new_mi; + } + added = 1; + break; + } + mi = mi->next; + } + if (!added) + { + /* add last */ + new_mi = (struct mem_item*)malloc(sizeof(struct mem_item)); + memset(new_mi, 0, sizeof(struct mem_item)); + new_mi->addr = addr; + new_mi->bytes = bytes; + self->used_tail->next = new_mi; + new_mi->prev = self->used_tail; + self->used_tail = new_mi; + } + return 0; +} + +/****************************************************************************/ +static int +libmem_add_free_item(struct mem_info* self, unsigned int addr, int bytes) +{ + struct mem_item* mi; + struct mem_item* new_mi; + int added; + + if (self == 0 || addr == 0) + { + return 1; + } + if (self->free_head == 0) + { + /* add first item */ + new_mi = (struct mem_item*)malloc(sizeof(struct mem_item)); + memset(new_mi, 0, sizeof(struct mem_item)); + new_mi->addr = addr; + new_mi->bytes = bytes; + self->free_head = new_mi; + self->free_tail = new_mi; + return 0; + } + added = 0; + mi = self->free_head; + while (mi != 0) + { + if (mi->addr > addr) + { + /* add before */ + new_mi = (struct mem_item*)malloc(sizeof(struct mem_item)); + memset(new_mi, 0, sizeof(struct mem_item)); + new_mi->addr = addr; + new_mi->bytes = bytes; + new_mi->prev = mi->prev; + new_mi->next = mi; + if (mi->prev != 0) + { + mi->prev->next = new_mi; + } + mi->prev = new_mi; + if (self->free_head == mi) + { + self->free_head = new_mi; + } + added = 1; + break; + } + mi = mi->next; + } + if (!added) + { + /* add last */ + new_mi = (struct mem_item*)malloc(sizeof(struct mem_item)); + memset(new_mi, 0, sizeof(struct mem_item)); + new_mi->addr = addr; + new_mi->bytes = bytes; + self->free_tail->next = new_mi; + new_mi->prev = self->free_tail; + self->free_tail = new_mi; + } + return 0; +} + +/*****************************************************************************/ +static int +libmem_pack_free(struct mem_info* self) +{ + struct mem_item* mi; + int cont; + + cont = 1; + while (cont) + { + cont = 0; + mi = self->free_head; + while (mi != 0) + { + /* combine */ + if (mi->next != 0) + { + if (mi->addr + mi->bytes == mi->next->addr) + { + mi->bytes += mi->next->bytes; + cont = 1; + libmem_free_mem_item(self, mi->next); + } + } + /* remove empties */ + if (mi->bytes == 0) + { + cont = 1; + libmem_free_mem_item(self, mi); + mi = self->free_head; + continue; + } + mi = mi->next; + } + } + return 0; +} + +/*****************************************************************************/ +static int +libmem_print(struct mem_info* self) +{ + struct mem_item* mi; + + printf("libmem_print:\n"); + printf(" used_head %p\n", self->used_head); + printf(" used_tail %p\n", self->used_tail); + mi = self->used_head; + if (mi != 0) + { + printf(" used list\n"); + while (mi != 0) + { + printf(" ptr %p prev %p next %p addr 0x%8.8x bytes %d\n", + mi, mi->prev, mi->next, mi->addr, mi->bytes); + mi = mi->next; + } + } + printf(" free_head %p\n", self->free_head); + printf(" free_tail %p\n", self->free_tail); + mi = self->free_head; + if (mi != 0) + { + printf(" free list\n"); + while (mi != 0) + { + printf(" ptr %p prev %p next %p addr 0x%8.8x bytes %d\n", + mi, mi->prev, mi->next, mi->addr, mi->bytes); + mi = mi->next; + } + } + return 0; +} + +/*****************************************************************************/ +unsigned int +libmem_alloc(void* obj, int bytes) +{ + struct mem_info* self; + struct mem_item* mi; + unsigned int addr; + + if (bytes < 1) + { + return 0; + } + bytes = ALIGN(bytes); + self = (struct mem_info*)obj; + addr = 0; + if (bytes > 16 * 1024) + { + /* big blocks */ + mi = self->free_tail; + while (mi != 0) + { + if (bytes <= mi->bytes) + { + addr = mi->addr; + mi->bytes -= bytes; + mi->addr += bytes; + break; + } + mi = mi->prev; + } + } + else + { + /* small blocks */ + mi = self->free_head; + while (mi != 0) + { + if (bytes <= mi->bytes) + { + addr = mi->addr; + mi->bytes -= bytes; + mi->addr += bytes; + break; + } + mi = mi->next; + } + } + if (addr != 0) + { + libmem_add_used_item(self, addr, bytes); + libmem_pack_free(self); + if (self->flags & 1) + { + libmem_print(self); + } + } + else + { + printf("libmem_alloc: error\n"); + } + return addr; +} + +/*****************************************************************************/ +int +libmem_free(void* obj, unsigned int addr) +{ + struct mem_info* self; + struct mem_item* mi; + + if (addr == 0) + { + return 0; + } + self = (struct mem_info*)obj; + mi = self->used_head; + while (mi != 0) + { + if (mi->addr == addr) + { + libmem_add_free_item(self, mi->addr, mi->bytes); + libmem_free_mem_item(self, mi); + libmem_pack_free(self); + if (self->flags & 1) + { + libmem_print(self); + } + return 0; + } + mi = mi->next; + } + printf("libmem_free: error\n"); + return 1; +} + +/*****************************************************************************/ +int +libmem_set_flags(void* obj, int flags) +{ + struct mem_info* self; + + self = (struct mem_info*)obj; + self->flags |= flags; +} + +/*****************************************************************************/ +int +libmem_clear_flags(void* obj, int flags) +{ + struct mem_info* self; + + self = (struct mem_info*)obj; + self->flags &= ~flags; +} diff --git a/tests/memtest/libmem.h b/tests/memtest/libmem.h new file mode 100644 index 00000000..4bc4b1ec --- /dev/null +++ b/tests/memtest/libmem.h @@ -0,0 +1,18 @@ + +#ifndef _LIBMEM_C +#define _LIBMEM_C + +void* +libmem_init(unsigned int addr, int bytes); +void +libmem_deinit(void* aself); +unsigned int +libmem_alloc(void* obj, int bytes); +int +libmem_free(void* obj, unsigned int addr); +int +libmem_set_flags(void* obj, int flags); +int +libmem_clear_flags(void* obj, int flags); + +#endif diff --git a/tests/memtest/memtest.c b/tests/memtest/memtest.c new file mode 100644 index 00000000..e7a26045 --- /dev/null +++ b/tests/memtest/memtest.c @@ -0,0 +1,60 @@ + +#include +#include +#include + +#include "libmem.h" + +int main(int argc, char** argv) +{ + void* obj; + unsigned int addr1; + unsigned int addr2; + unsigned int addr3; + unsigned int addr4; + unsigned int addr5; + int index; + int rd; + + srand(time(0)); + obj = libmem_init(0x80000000, 64 * 1024 * 1024); + for (index = 0; index < 256; index++) + { + rd = rand() & 0xffff; + printf("1 rd %d\n", rd); + addr1 = libmem_alloc(obj, rd); + rd = rand() & 0xffff; + printf("2 rd %d\n", rd); + addr2 = libmem_alloc(obj, rd); + rd = rand() & 0xffff; + printf("3 rd %d\n", rd); + addr3 = libmem_alloc(obj, rd); + rd = rand() & 0xffff; + printf("4 rd %d\n", rd); + addr4 = libmem_alloc(obj, rd); + addr5 = libmem_alloc(obj, rd); + libmem_free(obj, addr1); + printf("5\n"); + addr1 = libmem_alloc(obj, 64); + printf("6\n"); + libmem_free(obj, addr3); + printf("7\n"); + addr3 = libmem_alloc(obj, 64 * 1024); + libmem_free(obj, addr5); + addr5 = libmem_alloc(obj, 64 * 1024); + printf("8\n"); + libmem_free(obj, addr1); + printf("9\n"); + libmem_free(obj, addr2); + printf("10\n"); + libmem_free(obj, addr3); + libmem_free(obj, addr4); + if (index == 255) + { + libmem_set_flags(obj, 1); + } + libmem_free(obj, addr5); + } + libmem_deinit(obj); + return 0; +} From bddf48602d0dd01408e578144863cceb52f78b31 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 28 Jun 2013 22:11:15 -0700 Subject: [PATCH 07/45] optimize libmem.c --- tests/memtest/libmem.c | 143 ++++++++++++++++++----------------------- 1 file changed, 61 insertions(+), 82 deletions(-) diff --git a/tests/memtest/libmem.c b/tests/memtest/libmem.c index 8038f108..54744f1c 100644 --- a/tests/memtest/libmem.c +++ b/tests/memtest/libmem.c @@ -3,10 +3,20 @@ #include #include -#define ALIGN_BY 1024 +#define ALIGN_BY 32 #define ALIGN_BY_M1 (ALIGN_BY - 1) #define ALIGN(_in) (((_in) + ALIGN_BY_M1) & (~ALIGN_BY_M1)) +#define LLOG_LEVEL 1 +#define LLOGLN(_log_level, _params) \ +do { \ + if (_log_level < LLOG_LEVEL) \ + { \ + printf _params ; \ + printf ("\n") ; \ + } \ +} while (0) + struct mem_item { unsigned int addr; @@ -24,6 +34,7 @@ struct mem_info struct mem_item* free_tail; struct mem_item* used_head; struct mem_item* used_tail; + int total_bytes; }; /*****************************************************************************/ @@ -198,6 +209,28 @@ libmem_add_free_item(struct mem_info* self, unsigned int addr, int bytes) { if (mi->addr > addr) { + if (mi->prev != 0) + { + if (mi->prev->addr + mi->prev->bytes == addr) + { + /* don't need to add, just make prev bigger */ + mi->prev->bytes += bytes; + if (mi->prev->addr + mi->prev->bytes == mi->addr) + { + /* here we can remove one */ + mi->prev->bytes += mi->bytes; + libmem_free_mem_item(self, mi); + } + return 0; + } + } + if (addr + bytes == mi->addr) + { + /* don't need to add here either */ + mi->addr = addr; + mi->bytes += bytes; + return 0; + } /* add before */ new_mi = (struct mem_item*)malloc(sizeof(struct mem_item)); memset(new_mi, 0, sizeof(struct mem_item)); @@ -233,74 +266,36 @@ libmem_add_free_item(struct mem_info* self, unsigned int addr, int bytes) return 0; } -/*****************************************************************************/ -static int -libmem_pack_free(struct mem_info* self) -{ - struct mem_item* mi; - int cont; - - cont = 1; - while (cont) - { - cont = 0; - mi = self->free_head; - while (mi != 0) - { - /* combine */ - if (mi->next != 0) - { - if (mi->addr + mi->bytes == mi->next->addr) - { - mi->bytes += mi->next->bytes; - cont = 1; - libmem_free_mem_item(self, mi->next); - } - } - /* remove empties */ - if (mi->bytes == 0) - { - cont = 1; - libmem_free_mem_item(self, mi); - mi = self->free_head; - continue; - } - mi = mi->next; - } - } - return 0; -} - /*****************************************************************************/ static int libmem_print(struct mem_info* self) { struct mem_item* mi; - printf("libmem_print:\n"); - printf(" used_head %p\n", self->used_head); - printf(" used_tail %p\n", self->used_tail); + LLOGLN(0, ("libmem_print:")); + LLOGLN(0, (" used_head %p", self->used_head)); + LLOGLN(0, (" used_tail %p", self->used_tail)); mi = self->used_head; if (mi != 0) { - printf(" used list\n"); + LLOGLN(0, (" used list")); while (mi != 0) { - printf(" ptr %p prev %p next %p addr 0x%8.8x bytes %d\n", - mi, mi->prev, mi->next, mi->addr, mi->bytes); + LLOGLN(0, (" ptr %p prev %p next %p addr 0x%8.8x bytes %d", + mi, mi->prev, mi->next, mi->addr, mi->bytes)); mi = mi->next; } } - printf(" free_head %p\n", self->free_head); - printf(" free_tail %p\n", self->free_tail); + LLOGLN(0, (" free_head %p", self->free_head)); + LLOGLN(0, (" free_tail %p", self->free_tail)); mi = self->free_head; if (mi != 0) { - printf(" free list\n"); + LLOGLN(0, (" free list")); while (mi != 0) { - printf(" ptr %p prev %p next %p addr 0x%8.8x bytes %d\n", - mi, mi->prev, mi->next, mi->addr, mi->bytes); + LLOGLN(0, (" ptr %p prev %p next %p addr 0x%8.8x bytes %d", + mi, mi->prev, mi->next, mi->addr, mi->bytes)); mi = mi->next; } } @@ -322,42 +317,26 @@ libmem_alloc(void* obj, int bytes) bytes = ALIGN(bytes); self = (struct mem_info*)obj; addr = 0; - if (bytes > 16 * 1024) - { - /* big blocks */ - mi = self->free_tail; - while (mi != 0) - { - if (bytes <= mi->bytes) - { - addr = mi->addr; - mi->bytes -= bytes; - mi->addr += bytes; - break; - } - mi = mi->prev; - } - } - else + mi = self->free_head; + while (mi != 0) { - /* small blocks */ - mi = self->free_head; - while (mi != 0) + if (bytes <= mi->bytes) { - if (bytes <= mi->bytes) + addr = mi->addr; + mi->bytes -= bytes; + mi->addr += bytes; + if (mi->bytes < 1) { - addr = mi->addr; - mi->bytes -= bytes; - mi->addr += bytes; - break; + libmem_free_mem_item(self, mi); } - mi = mi->next; + break; } + mi = mi->next; } if (addr != 0) { + self->total_bytes += bytes; libmem_add_used_item(self, addr, bytes); - libmem_pack_free(self); if (self->flags & 1) { libmem_print(self); @@ -365,7 +344,7 @@ libmem_alloc(void* obj, int bytes) } else { - printf("libmem_alloc: error\n"); + LLOGLN(0, ("libmem_alloc: error")); } return addr; } @@ -382,23 +361,23 @@ libmem_free(void* obj, unsigned int addr) return 0; } self = (struct mem_info*)obj; - mi = self->used_head; + mi = self->used_tail; while (mi != 0) { if (mi->addr == addr) { + self->total_bytes -= mi->bytes; libmem_add_free_item(self, mi->addr, mi->bytes); libmem_free_mem_item(self, mi); - libmem_pack_free(self); if (self->flags & 1) { libmem_print(self); } return 0; } - mi = mi->next; + mi = mi->prev; } - printf("libmem_free: error\n"); + LLOGLN(0, ("libmem_free: error")); return 1; } From 29420b31341ab0c2ce7255b4b6f4b34f3bdf3158 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 2 Jul 2013 00:45:40 -0700 Subject: [PATCH 08/45] chansrv: no logic change, work on warning --- sesman/chansrv/chansrv.c | 1 + sesman/chansrv/chansrv_fuse.c | 18 +++++++++--------- sesman/chansrv/clipboard.c | 11 ----------- sesman/chansrv/devredir.c | 10 +++++----- sesman/chansrv/drdynvc.c | 12 ++++++++++++ sesman/chansrv/drdynvc.h | 20 -------------------- sesman/chansrv/irp.c | 2 +- sesman/chansrv/rail.c | 35 ----------------------------------- sesman/chansrv/smartcard.c | 8 ++++---- sesman/chansrv/sound.c | 2 -- 10 files changed, 32 insertions(+), 87 deletions(-) diff --git a/sesman/chansrv/chansrv.c b/sesman/chansrv/chansrv.c index bd9c27c5..388d0273 100644 --- a/sesman/chansrv/chansrv.c +++ b/sesman/chansrv/chansrv.c @@ -33,6 +33,7 @@ #include "rail.h" #include "xcommon.h" #include "chansrv_fuse.h" +#include "drdynvc.h" static struct trans *g_lis_trans = 0; static struct trans *g_con_trans = 0; diff --git a/sesman/chansrv/chansrv_fuse.c b/sesman/chansrv/chansrv_fuse.c index 48936910..661d0bca 100644 --- a/sesman/chansrv/chansrv_fuse.c +++ b/sesman/chansrv/chansrv_fuse.c @@ -59,15 +59,15 @@ char g_fuse_clipboard_path[256] = ""; /* for clipboard use */ #include "chansrv_fuse.h" /* dummy calls when XRDP_FUSE is not defined */ -int xfuse_init() {} -int xfuse_deinit() {} -int xfuse_check_wait_objs(void) {} -int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout) {} -int xfuse_clear_clip_dir(void) {} -int xfuse_file_contents_range(int stream_id, char *data, int data_bytes) {} -int xfuse_file_contents_size(int stream_id, int file_size) {} -int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex) {} -int xfuse_create_share(tui32 device_id, char *dirname) {} +int xfuse_init() { return 0; } +int xfuse_deinit() { return 0; } +int xfuse_check_wait_objs(void) { return 0; } +int xfuse_get_wait_objs(tbus *objs, int *count, int *timeout) { return 0; } +int xfuse_clear_clip_dir(void) { return 0; } +int xfuse_file_contents_range(int stream_id, char *data, int data_bytes) { return 0; } +int xfuse_file_contents_size(int stream_id, int file_size) { return 0; } +int xfuse_add_clip_dir_item(char *filename, int flags, int size, int lindex) { return 0; } +int xfuse_create_share(tui32 device_id, char *dirname) { return 0; } void xfuse_devredir_cb_open_file(void *vp, tui32 IoStatus, tui32 DeviceId, tui32 FileId) {} void xfuse_devredir_cb_write_file(void *vp, char *buf, size_t length) {} void xfuse_devredir_cb_read_file(void *vp, char *buf, size_t length) {} diff --git a/sesman/chansrv/clipboard.c b/sesman/chansrv/clipboard.c index 89dbdbbb..3aac8dbc 100644 --- a/sesman/chansrv/clipboard.c +++ b/sesman/chansrv/clipboard.c @@ -272,17 +272,6 @@ clipboard_get_server_time(void) return xevent.xproperty.time; } -/*****************************************************************************/ -/* returns time in miliseconds - this is like g_time2 in os_calls, but not miliseconds since machine was - up, something else - this is a time value similar to what the xserver uses */ -static int APP_CC -clipboard_get_local_time(void) -{ - return g_time3(); -} - /*****************************************************************************/ static int APP_CC clipboard_find_format_id(int format_id) diff --git a/sesman/chansrv/devredir.c b/sesman/chansrv/devredir.c index 067738ac..8de28e43 100644 --- a/sesman/chansrv/devredir.c +++ b/sesman/chansrv/devredir.c @@ -296,7 +296,7 @@ dev_redir_check_wait_objs(void) * @brief let client know our capabilities *****************************************************************************/ -void dev_redir_send_server_core_cap_req() +void dev_redir_send_server_core_cap_req(void) { struct stream *s; int bytes; @@ -340,8 +340,8 @@ void dev_redir_send_server_core_cap_req() /* setup file system capability */ xstream_wr_u16_le(s, CAP_DRIVE_TYPE); /* CapabilityType */ xstream_wr_u16_le(s, 8); /* CapabilityLength - len of this */ - /* CAPABILITY_SET in bytes, inc */ - /* the header */ + /* CAPABILITY_SET in bytes, inc */ + /* the header */ xstream_wr_u32_le(s, 2); /* Version */ /* setup smart card capability */ @@ -356,7 +356,7 @@ void dev_redir_send_server_core_cap_req() xstream_free(s); } -void dev_redir_send_server_clientID_confirm() +void dev_redir_send_server_clientID_confirm(void) { struct stream *s; int bytes; @@ -377,7 +377,7 @@ void dev_redir_send_server_clientID_confirm() xstream_free(s); } -void dev_redir_send_server_user_logged_on() +void dev_redir_send_server_user_logged_on(void) { struct stream *s; int bytes; diff --git a/sesman/chansrv/drdynvc.c b/sesman/chansrv/drdynvc.c index 6bcac45e..af86ea57 100644 --- a/sesman/chansrv/drdynvc.c +++ b/sesman/chansrv/drdynvc.c @@ -21,6 +21,18 @@ int g_drdynvc_chan_id; int g_drdynvc_inited = 0; +static int APP_CC drdynvc_send_capability_request(uint16_t version); +static int APP_CC drdynvc_process_capability_response(struct stream* s, + unsigned char cmd); +static int APP_CC drdynvc_process_open_channel_response(struct stream *s, + unsigned char cmd); +static int APP_CC drdynvc_process_close_channel_response(struct stream *s, + unsigned char cmd); +static int APP_CC drdynvc_process_data_first(struct stream* s, unsigned char cmd); +static int APP_CC drdynvc_process_data(struct stream* s, unsigned char cmd); +static int APP_CC drdynvc_insert_uint_124(struct stream *s, uint32_t val); +static int APP_CC drdynvc_get_chan_id(struct stream *s, char cmd, uint32_t *chan_id_p); + /** * bring up dynamic virtual channel * diff --git a/sesman/chansrv/drdynvc.h b/sesman/chansrv/drdynvc.h index fcf46249..15398867 100644 --- a/sesman/chansrv/drdynvc.h +++ b/sesman/chansrv/drdynvc.h @@ -57,31 +57,11 @@ #define CMD_DVC_CAPABILITY 0x50 int APP_CC drdynvc_init(void); - -static int APP_CC drdynvc_send_capability_request(uint16_t version); -static int APP_CC drdynvc_process_capability_response(struct stream* s, - unsigned char cmd); - int APP_CC drdynvc_send_open_channel_request(int chan_pri, unsigned int chan_id, char *chan_name); - -static int APP_CC drdynvc_process_open_channel_response(struct stream *s, - unsigned char cmd); - int APP_CC drdynvc_send_close_channel_request(unsigned int chan_id); - -static int APP_CC drdynvc_process_close_channel_response(struct stream *s, - unsigned char cmd); - int APP_CC drdynvc_write_data(uint32_t chan_id, char *data, int data_size); - int APP_CC drdynvc_data_in(struct stream* s, int chan_id, int chan_flags, int length, int total_length); -static int APP_CC drdynvc_process_data_first(struct stream* s, unsigned char cmd); -static int APP_CC drdynvc_process_data(struct stream* s, unsigned char cmd); - -static int APP_CC drdynvc_insert_uint_124(struct stream *s, uint32_t val); -static int APP_CC drdynvc_get_chan_id(struct stream *s, char cmd, uint32_t *chan_id_p); - #endif diff --git a/sesman/chansrv/irp.c b/sesman/chansrv/irp.c index fcf3e537..2a5209d8 100644 --- a/sesman/chansrv/irp.c +++ b/sesman/chansrv/irp.c @@ -119,7 +119,7 @@ IRP * devredir_irp_clone(IRP *irp) next = new_irp->next; /* copy all members */ - memcpy(new_irp, irp, sizeof(IRP)); + g_memcpy(new_irp, irp, sizeof(IRP)); /* restore link pointers */ new_irp->prev = prev; diff --git a/sesman/chansrv/rail.c b/sesman/chansrv/rail.c index 1ea8d73a..cfa3c5de 100644 --- a/sesman/chansrv/rail.c +++ b/sesman/chansrv/rail.c @@ -101,33 +101,6 @@ static int g_rail_running = 1; /* Perform the default action of the window's system menu. */ #define SC_DEFAULT 0xF160 -/******************************************************************************/ -static int APP_CC -is_window_valid_child_of_root(unsigned int window_id) -{ - int found; - unsigned int i; - unsigned int nchild; - Window r; - Window p; - Window *children; - - found = 0; - XQueryTree(g_display, g_root_window, &r, &p, &children, &nchild); - - for (i = 0; i < nchild; i++) - { - if (window_id == children[i]) - { - found = 1; - break; - } - } - - XFree(children); - return found; -} - /*****************************************************************************/ static int APP_CC rail_send_init(void) @@ -258,7 +231,6 @@ read_uni(struct stream *s, int num_chars) static int APP_CC rail_process_exec(struct stream *s, int size) { - int pid; int flags; int ExeOrFileLength; int WorkingDirLength; @@ -624,13 +596,6 @@ rail_xevent(void *xevent) XEvent *lxevent; XWindowChanges xwc; int rv; - int nchildren_return = 0; - Window root_return; - Window parent_return; - Window *children_return; - Window wreturn; - int revert_to; - XWindowAttributes wnd_attributes; LOG(10, ("chansrv::rail_xevent:")); diff --git a/sesman/chansrv/smartcard.c b/sesman/chansrv/smartcard.c index 3fdb6723..19650be1 100644 --- a/sesman/chansrv/smartcard.c +++ b/sesman/chansrv/smartcard.c @@ -140,8 +140,8 @@ static void scard_send_EstablishContext(IRP *irp); static void scard_send_ListReaders(IRP *irp, int wide); static struct stream *scard_make_new_ioctl(IRP *irp, tui32 ioctl); static int scard_add_new_device(tui32 device_id); -static int scard_get_free_slot(); -static void scard_release_resources(); +static int scard_get_free_slot(void); +static void scard_release_resources(void); /****************************************************************************** ** non static functions ** @@ -488,7 +488,7 @@ static int scard_add_new_device(tui32 device_id) * @return index of first unused entry in smartcards or -1 if smartcards is full *****************************************************************************/ -static int scard_get_free_slot() +static int scard_get_free_slot(void) { int i; @@ -509,7 +509,7 @@ static int scard_get_free_slot() * Release resources prior to shutting down *****************************************************************************/ -static void scard_release_resources() +static void scard_release_resources(void) { int i; diff --git a/sesman/chansrv/sound.c b/sesman/chansrv/sound.c index c4ca8261..124ff4b9 100644 --- a/sesman/chansrv/sound.c +++ b/sesman/chansrv/sound.c @@ -194,8 +194,6 @@ sound_process_format(int aindex, int wFormatTag, int nChannels, int nBlockAlign, int wBitsPerSample, int cbSize, char *data) { - int lindex; - LOG(0, ("sound_process_format:")); LOG(0, (" wFormatTag %d", wFormatTag)); LOG(0, (" nChannels %d", nChannels)); From 110edd31c81f7e41365aecd82ce96f2b9a0fcf77 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Mon, 8 Jul 2013 12:46:31 -0700 Subject: [PATCH 09/45] fix Makefile error, fix for warnings --- tests/memtest/libmem.c | 2 ++ xorg/X11R7.6/rdp/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/memtest/libmem.c b/tests/memtest/libmem.c index 54744f1c..2fa0dea7 100644 --- a/tests/memtest/libmem.c +++ b/tests/memtest/libmem.c @@ -389,6 +389,7 @@ libmem_set_flags(void* obj, int flags) self = (struct mem_info*)obj; self->flags |= flags; + return 0; } /*****************************************************************************/ @@ -399,4 +400,5 @@ libmem_clear_flags(void* obj, int flags) self = (struct mem_info*)obj; self->flags &= ~flags; + return 0; } diff --git a/xorg/X11R7.6/rdp/Makefile b/xorg/X11R7.6/rdp/Makefile index 755af882..e40b7473 100644 --- a/xorg/X11R7.6/rdp/Makefile +++ b/xorg/X11R7.6/rdp/Makefile @@ -112,4 +112,4 @@ fbcmap_mi.o: ../build_dir/xorg-server-1.9.3/fb/fbcmap_mi.c $(CC) $(CFLAGS) -c ../build_dir/xorg-server-1.9.3/fb/fbcmap_mi.c install: all - $(INSTALL) X11rdp $(X11RDPBASE)/bin/X11rdp + $(INSTALL) X11rdp $(X11RDPBASE)/bin/X11rdp From 14a4ac5a791882ad2171a522ce146fbba02bb4c7 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 9 Jul 2013 21:34:20 -0700 Subject: [PATCH 10/45] libxrdp: started adding fastpath support --- common/xrdp_client_info.h | 1 + libxrdp/xrdp_rdp.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/common/xrdp_client_info.h b/common/xrdp_client_info.h index 86d0dc25..aefc7119 100644 --- a/common/xrdp_client_info.h +++ b/common/xrdp_client_info.h @@ -91,6 +91,7 @@ struct xrdp_client_info int order_flags_ex; int use_bulk_comp; int pointer_flags; /* 0 color, 1 new, 2 no new */ + int use_fast_path; }; #endif diff --git a/libxrdp/xrdp_rdp.c b/libxrdp/xrdp_rdp.c index 624b3b5d..82ccdea0 100644 --- a/libxrdp/xrdp_rdp.c +++ b/libxrdp/xrdp_rdp.c @@ -625,8 +625,16 @@ xrdp_rdp_send_demand_active(struct xrdp_rdp *self) out_uint16_le(s, 0x200); /* Protocol version */ out_uint16_le(s, 0); /* pad */ out_uint16_le(s, 0); /* Compression types */ - //out_uint16_le(s, 0); /* pad use 0x40d for rdp packets, 0 for not */ - out_uint16_le(s, 0x40d); /* pad use 0x40d for rdp packets, 0 for not */ + /* NO_BITMAP_COMPRESSION_HDR 0x0400 + FASTPATH_OUTPUT_SUPPORTED 0x0001 */ + if (self->client_info.use_fast_path & 1) + { + out_uint16_le(s, 0x401); + } + else + { + out_uint16_le(s, 0x400); + } out_uint16_le(s, 0); /* Update capability */ out_uint16_le(s, 0); /* Remote unshare capability */ out_uint16_le(s, 0); /* Compression level */ @@ -761,7 +769,17 @@ xrdp_rdp_send_demand_active(struct xrdp_rdp *self) caps_count++; out_uint16_le(s, RDP_CAPSET_INPUT); /* 13(0xd) */ out_uint16_le(s, RDP_CAPLEN_INPUT); /* 88(0x58) */ - out_uint8(s, 1); + if (self->client_info.use_fast_path & 2) + { + /* INPUT_FLAG_SCANCODES 0x0001 + INPUT_FLAG_FASTPATH_INPUT 0x0008 + INPUT_FLAG_FASTPATH_INPUT2 0x0020 */ + out_uint8(s, 1 | 8 | 0x20); + } + else + { + out_uint8(s, 1); + } out_uint8s(s, 83); /* Remote Programs Capability Set */ From 318ed3acb1eed0ddb3aadc75895f371124ffc5fa Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 11 Jul 2013 23:33:38 -0700 Subject: [PATCH 11/45] vrplayer: got rid of some usleep compile errors --- vrplayer/demuxmedia.cpp | 3 +++ vrplayer/playaudio.cpp | 3 +++ vrplayer/playvideo.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/vrplayer/demuxmedia.cpp b/vrplayer/demuxmedia.cpp index ed91b387..c6893ceb 100644 --- a/vrplayer/demuxmedia.cpp +++ b/vrplayer/demuxmedia.cpp @@ -1,3 +1,6 @@ + +#include + #include "demuxmedia.h" DemuxMedia::DemuxMedia(QObject *parent, QQueue *audioQueue, diff --git a/vrplayer/playaudio.cpp b/vrplayer/playaudio.cpp index bab7d38b..fee98f9d 100644 --- a/vrplayer/playaudio.cpp +++ b/vrplayer/playaudio.cpp @@ -1,3 +1,6 @@ + +#include + #include "playaudio.h" #include diff --git a/vrplayer/playvideo.cpp b/vrplayer/playvideo.cpp index e1a7ec90..24ef492d 100644 --- a/vrplayer/playvideo.cpp +++ b/vrplayer/playvideo.cpp @@ -1,3 +1,6 @@ + +#include + #include "playvideo.h" #include From 4b58f943a99a5f885dba36d095d954b4bedc2499 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 12 Jul 2013 16:56:15 -0700 Subject: [PATCH 12/45] xorg driver skeleton --- xorg/server/module/Makefile | 16 +++++++++++++++ xorg/server/module/rdpMain.c | 37 +++++++++++++++++++++++++++++++++++ xorg/server/xrdpdev/Makefile | 17 ++++++++++++++++ xorg/server/xrdpdev/xrdpdev.c | 37 +++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 xorg/server/module/Makefile create mode 100644 xorg/server/module/rdpMain.c create mode 100644 xorg/server/xrdpdev/Makefile create mode 100644 xorg/server/xrdpdev/xrdpdev.c diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile new file mode 100644 index 00000000..39bfbbed --- /dev/null +++ b/xorg/server/module/Makefile @@ -0,0 +1,16 @@ + +OBJS = rdpMain.o + +CFLAGS = -O2 -Wall -I/usr/include/xorg -I/usr/include/pixman-1 + +LDFLAGS = + +LIBS = + +all: xrdpdev_drv.so + +xrdpdev_drv.so: $(OBJS) Makefile + $(CC) -shared -o libxorgxrdp.so $(LDFLAGS) $(OBJS) $(LIBS) + +clean: + rm -f $(OBJS) libxorgxrdp.so diff --git a/xorg/server/module/rdpMain.c b/xorg/server/module/rdpMain.c new file mode 100644 index 00000000..5f3ab8c2 --- /dev/null +++ b/xorg/server/module/rdpMain.c @@ -0,0 +1,37 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +This is the main modules file + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include +#include + +#include + diff --git a/xorg/server/xrdpdev/Makefile b/xorg/server/xrdpdev/Makefile new file mode 100644 index 00000000..920e7a55 --- /dev/null +++ b/xorg/server/xrdpdev/Makefile @@ -0,0 +1,17 @@ + +OBJS = xrdpdev.o + +CFLAGS = -O2 -Wall -I/usr/include/xorg -I/usr/include/pixman-1 + +LDFLAGS = + +LIBS = + +all: xrdpdev_drv.so + +xrdpdev_drv.so: $(OBJS) Makefile + $(CC) -shared -o xrdpdev_drv.so $(LDFLAGS) $(OBJS) $(LIBS) + +clean: + rm -f $(OBJS) xrdpdev_drv.so + diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c new file mode 100644 index 00000000..f426d7a5 --- /dev/null +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -0,0 +1,37 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +This is the main driver file + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include +#include + +#include + From 7862f87410318fc39333c453a7e037d94dae1cdf Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 12 Jul 2013 22:30:20 -0700 Subject: [PATCH 13/45] xorg: work on Xorg driver --- xorg/server/xrdpdev/Makefile | 2 +- xorg/server/xrdpdev/xorg.conf | 73 +++++ xorg/server/xrdpdev/xrdpdev.c | 507 +++++++++++++++++++++++++++++++++- 3 files changed, 580 insertions(+), 2 deletions(-) create mode 100644 xorg/server/xrdpdev/xorg.conf diff --git a/xorg/server/xrdpdev/Makefile b/xorg/server/xrdpdev/Makefile index 920e7a55..1e97b94f 100644 --- a/xorg/server/xrdpdev/Makefile +++ b/xorg/server/xrdpdev/Makefile @@ -1,7 +1,7 @@ OBJS = xrdpdev.o -CFLAGS = -O2 -Wall -I/usr/include/xorg -I/usr/include/pixman-1 +CFLAGS = -O2 -Wall -I/usr/include/xorg -I/usr/include/pixman-1 -I../module LDFLAGS = diff --git a/xorg/server/xrdpdev/xorg.conf b/xorg/server/xrdpdev/xorg.conf new file mode 100644 index 00000000..76b7590d --- /dev/null +++ b/xorg/server/xrdpdev/xorg.conf @@ -0,0 +1,73 @@ + +Section "ServerLayout" + Identifier "X11 Server" + Screen "Screen (xrdpdev)" + InputDevice "ScrollMouse" "CorePointer" + InputDevice "Keyboard" "CoreKeyboard" +EndSection + +Section "ServerFlags" + Option "DontVTSwitch" "off" +EndSection + +Section "Files" + FontPath "/usr/X11R6/lib/X11/fonts/misc/:unscaled" + FontPath "/usr/X11R6/lib/X11/fonts/75dpi/:unscaled" + FontPath "/usr/X11R6/lib/X11/fonts/100dpi/:unscaled" + FontPath "/usr/X11R6/lib/X11/fonts/viewtouch" +EndSection + +Section "Module" + Load "dbe" + Load "ddc" + Load "extmod" + Load "glx" + Load "int10" + Load "record" + Load "vbe" + Load "xorgxrdp" +EndSection + +Section "InputDevice" + Identifier "Keyboard" + Driver "kbd" + Option "XkbRules" "xorg" + Option "XkbModel" "pc104" + Option "XkbLayout" "us" +EndSection + +Section "InputDevice" + Identifier "ScrollMouse" + Driver "mouse" + Option "CorePointer" + Option "Device" "/dev/input/mice" + Option "Protocol" "ImPS/2" + Option "ZAxisMapping" "4 5" +EndSection + +Section "Monitor" + Identifier "Monitor" + Option "DPMS" + HorizSync 30-80 + VertRefresh 60-75 + ModeLine "1920x1080" 138.500 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync + ModeLine "1280x720" 74.25 1280 1720 1760 1980 720 725 730 750 +HSync +VSync + Modeline "1368x768" 72.25 1368 1416 1448 1528 768 771 781 790 +hsync -vsync + Modeline "1600x900" 119.00 1600 1696 1864 2128 900 901 904 932 -hsync +vsync +EndSection + +Section "Device" + Identifier "Video Card (xrdpdev)" + Driver "xrdp" +EndSection + +Section "Screen" + Identifier "Screen (xrdpdev)" + Device "Video Card (xrdpdev)" + Monitor "Monitor" + DefaultDepth 24 + SubSection "Display" + Depth 24 + Modes "640x480" "800x600" "1024x768" "1280x720" "1280x1024" "1600x900" "1920x1080" + EndSubSection +EndSection diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index f426d7a5..4c2fdddb 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -31,7 +31,512 @@ This is the main driver file /* all driver need this */ #include #include + #include +#include +#include +#include -#include +#include "rdp.h" +#include "rdpPri.h" +#include "rdpDraw.h" +#include "rdpGC.h" + +#define XRDP_DRIVER_NAME "XRDPDEV" +#define XRDP_NAME "XRDPDEV" +#define XRDP_VERSION 1000 + +#define PACKAGE_VERSION_MAJOR 1 +#define PACKAGE_VERSION_MINOR 0 +#define PACKAGE_VERSION_PATCHLEVEL 0 + +#define LLOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do \ + { \ + if (_level < LLOG_LEVEL) \ + { \ + ErrorF _args ; \ + ErrorF("\n"); \ + } \ + } \ + while (0) + +int g_bpp = 32; +int g_depth = 24; +int g_rgb_bits = 8; +int g_redOffset = 16; +int g_redBits = 8; +int g_greenOffset = 8; +int g_greenBits = 8; +int g_blueOffset = 0; +int g_blueBits = 8; + +static int g_setup_done = 0; + +/* Supported "chipsets" */ +static SymTabRec g_Chipsets[] = +{ + { 0, XRDP_DRIVER_NAME }, + { -1, 0 } +}; + +static XF86ModuleVersionInfo g_VersRec = +{ + XRDP_DRIVER_NAME, + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + PACKAGE_VERSION_MAJOR, + PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + 0, + { 0, 0, 0, 0 } +}; + +/*****************************************************************************/ +static Bool +rdpAllocRec(ScrnInfoPtr pScrn) +{ + LLOGLN(10, ("rdpAllocRec:")); + if (pScrn->driverPrivate != 0) + { + return 1; + } + pScrn->driverPrivate = xnfcalloc(sizeof(rdpRec), 1); + return 1; +} + +/*****************************************************************************/ +static void +rdpFreeRec(ScrnInfoPtr pScrn) +{ + LLOGLN(10, ("rdpFreeRec:")); + if (pScrn->driverPrivate == 0) + { + return; + } + free(pScrn->driverPrivate); + pScrn->driverPrivate = 0; +} + +/*****************************************************************************/ +static Bool +rdpPreInit(ScrnInfoPtr pScrn, int flags) +{ + rgb zeros1; + Gamma zeros2; + int got_res_match; + char **modename; + DisplayModePtr mode; + rdpPtr dev; + + LLOGLN(0, ("rdpPreInit:")); + if (flags & PROBE_DETECT) + { + return 0; + } + if (pScrn->numEntities != 1) + { + return 0; + } + + rdpAllocRec(pScrn); + dev = XRDPPTR(pScrn); + + dev->width = 1024; + dev->height = 768; + + pScrn->monitor = pScrn->confScreen->monitor; + pScrn->bitsPerPixel = g_bpp; + pScrn->virtualX = dev->width; + pScrn->displayWidth = dev->width; + pScrn->virtualY = dev->height; + pScrn->progClock = 1; + pScrn->rgbBits = g_rgb_bits; + pScrn->depth = g_depth; + pScrn->chipset = XRDP_DRIVER_NAME; + pScrn->currentMode = pScrn->modes; + pScrn->offset.blue = g_blueOffset; + pScrn->offset.green = g_greenOffset; + pScrn->offset.red = g_redOffset; + pScrn->mask.blue = ((1 << g_blueBits) - 1) << pScrn->offset.blue; + pScrn->mask.green = ((1 << g_greenBits) - 1) << pScrn->offset.green; + pScrn->mask.red = ((1 << g_redBits) - 1) << pScrn->offset.red; + + if (!xf86SetDepthBpp(pScrn, g_depth, g_bpp, g_bpp, + Support24bppFb | Support32bppFb | + SupportConvert32to24 | SupportConvert24to32)) + { + LLOGLN(0, ("rdpPreInit: xf86SetDepthBpp failed")); + rdpFreeRec(pScrn); + return 0; + } + xf86PrintDepthBpp(pScrn); + memset(&zeros1, 0, sizeof(zeros1)); + if (!xf86SetWeight(pScrn, zeros1, zeros1)) + { + LLOGLN(0, ("rdpPreInit: xf86SetWeight failed")); + rdpFreeRec(pScrn); + return 0; + } + memset(&zeros2, 0, sizeof(zeros2)); + if (!xf86SetGamma(pScrn, zeros2)) + { + LLOGLN(0, ("rdpPreInit: xf86SetGamma failed")); + rdpFreeRec(pScrn); + return 0; + } + if (!xf86SetDefaultVisual(pScrn, -1)) + { + LLOGLN(0, ("rdpPreInit: xf86SetDefaultVisual failed")); + rdpFreeRec(pScrn); + return 0; + } + xf86SetDpi(pScrn, 0, 0); + if (0 == pScrn->display->modes) + { + LLOGLN(0, ("rdpPreInit: modes error")); + rdpFreeRec(pScrn); + return 0; + } + + pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + got_res_match = 0; + for (modename = pScrn->display->modes; *modename != 0; modename++) + { + for (mode = pScrn->monitor->Modes; mode != 0; mode = mode->next) + { + LLOGLN(10, ("%s %s", mode->name, *modename)); + if (0 == strcmp(mode->name, *modename)) + { + break; + } + } + if (0 == mode) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" not found\n", + *modename); + continue; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tmode \"%s\" ok\n", *modename); + LLOGLN(10, ("%d %d %d %d", mode->HDisplay, dev->width, + mode->VDisplay, dev->height)); + if ((mode->HDisplay == dev->width) && (mode->VDisplay == dev->height)) + { + pScrn->virtualX = mode->HDisplay; + pScrn->virtualY = mode->VDisplay; + got_res_match = 1; + } + if (got_res_match) + { + pScrn->modes = xf86DuplicateMode(mode); + pScrn->modes->next = pScrn->modes; + pScrn->modes->prev = pScrn->modes; + dev->num_modes = 1; + break; + } + } + pScrn->currentMode = pScrn->modes; + xf86PrintModes(pScrn); + LLOGLN(10, ("rdpPreInit: out fPtr->num_modes %d", dev->num_modes)); + if (!got_res_match) + { + LLOGLN(0, ("rdpPreInit: could not find screen resolution %dx%d", + dev->width, dev->height)); + return 0; + } + return 1; +} + +#if 0 +static miPointerSpriteFuncRec g_rdpSpritePointerFuncs = +{ + /* these are in viv_cur.c */ + rdpSpriteRealizeCursor, + rdpSpriteUnrealizeCursor, + rdpSpriteSetCursor, + rdpSpriteMoveCursor, + rdpDeviceCursorInitialize, + rdpDeviceCursorCleanup +}; +#endif + +/******************************************************************************/ +static Bool +rdpSaveScreen(ScreenPtr pScreen, int on) +{ + LLOGLN(10, ("rdpSaveScreen:")); + return 1; +} + +/*****************************************************************************/ +static Bool +rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScrn; + rdpPtr dev; + VisualPtr vis; + int vis_found; + + rdpPrivateInit(); + + pScrn = xf86Screens[scrnIndex]; + dev = XRDPPTR(pScrn); + + miClearVisualTypes(); + miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, TrueColor); + miSetPixmapDepths(); + LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d", + pScrn->virtualX, pScrn->virtualY)); + dev->ptr = malloc(1024 * 768 * 4); + if (!fbScreenInit(pScreen, dev->ptr, pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, + pScrn->bitsPerPixel)) + { + LLOGLN(0, ("rdpScreenInit: fbScreenInit failed")); + return 0; + } + miInitializeBackingStore(pScreen); + +#if 0 + /* XVideo */ + if (rdp_xv_init(pScreen, pScrn) != 0) + { + LLOGLN(0, ("rdpScreenInit: rdp_xv_init failed")); + } +#endif + + vis = pScreen->visuals + (pScreen->numVisuals - 1); + while (vis >= pScreen->visuals) + { + if ((vis->class | DynamicClass) == DirectColor) + { + vis->offsetBlue = pScrn->offset.blue; + vis->blueMask = pScrn->mask.blue; + vis->offsetGreen = pScrn->offset.green; + vis->greenMask = pScrn->mask.green; + vis->offsetRed = pScrn->offset.red; + vis->redMask = pScrn->mask.red; + } + vis--; + } + fbPictureInit(pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); + xf86SetBackingStore(pScreen); + + /* hardware cursor */ + //dev->pCursorFuncs = xf86GetPointerScreenFuncs(); + //miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs, + // dev->pCursorFuncs, 0); + + fbCreateDefColormap(pScreen); + + /* must assign this one */ + pScreen->SaveScreen = rdpSaveScreen; + + vis_found = 0; + vis = pScreen->visuals + (pScreen->numVisuals - 1); + while (vis >= pScreen->visuals) + { + if (vis->vid == pScreen->rootVisual) + { + vis_found = 1; + } + vis--; + } + if (!vis_found) + { + LLOGLN(0, ("rdpScreenInit: no root visual")); + return 0; + } + + dev->privateKeyRecGC = rdpAllocateGCPrivate(pScreen, sizeof(rdpGCRec)); + dev->privateKeyRecPixmap =rdpAllocatePixmapPrivate(pScreen, sizeof(rdpPixmapRec)); + + dev->CopyWindow = pScreen->CopyWindow; + pScreen->CopyWindow = rdpCopyWindow; + + dev->CreateGC = pScreen->CreateGC; + pScreen->CreateGC = rdpCreateGC; + + dev->CreatePixmap = pScreen->CreatePixmap; + pScreen->CreatePixmap = rdpCreatePixmap; + + dev->DestroyPixmap = pScreen->DestroyPixmap; + pScreen->DestroyPixmap = rdpDestroyPixmap; + + dev->ModifyPixmapHeader = pScreen->ModifyPixmapHeader; + pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader; + + LLOGLN(0, ("rdpScreenInit: out")); + return 1; +} + +/*****************************************************************************/ +static Bool +rdpSwitchMode(int a, DisplayModePtr b, int c) +{ + LLOGLN(0, ("rdpSwitchMode:")); + return 1; +} + +/*****************************************************************************/ +static void +rdpAdjustFrame(int a, int b, int c, int d) +{ + LLOGLN(10, ("rdpAdjustFrame:")); +} + +/*****************************************************************************/ +static Bool +rdpEnterVT(int a, int b) +{ + LLOGLN(0, ("rdpEnterVT:")); + return 1; +} + +/*****************************************************************************/ +static void +rdpLeaveVT(int a, int b) +{ + LLOGLN(0, ("rdpLeaveVT:")); +} + +/*****************************************************************************/ +static ModeStatus +rdpValidMode(int a, DisplayModePtr b, Bool c, int d) +{ + LLOGLN(0, ("rdpValidMode:")); + return 0; +} + +/*****************************************************************************/ +static Bool +rdpProbe(DriverPtr drv, int flags) +{ + int num_dev_sections; + int i; + int entity; + GDevPtr *dev_sections; + Bool found_screen; + ScrnInfoPtr pscrn; + + LLOGLN(0, ("rdpProbe:")); + if (flags & PROBE_DETECT) + { + return 0; + } + /* fbScreenInit, fbPictureInit, ... */ + if (!xf86LoadDrvSubModule(drv, "fb")) + { + LLOGLN(0, ("rdpProbe: xf86LoadDrvSubModule for fb failed")); + return 0; + } + + num_dev_sections = xf86MatchDevice(XRDP_DRIVER_NAME, &dev_sections); + if (num_dev_sections <= 0) + { + LLOGLN(0, ("rdpProbe: xf86MatchDevice failed")); + return 0; + } + + pscrn = 0; + found_screen = 0; + for (i = 0; i < num_dev_sections; i++) + { + entity = xf86ClaimFbSlot(drv, 0, dev_sections[i], 1); + pscrn = xf86ConfigFbEntity(pscrn, 0, entity, 0, 0, 0, 0); + if (pscrn) + { + LLOGLN(10, ("rdpProbe: found screen")); + found_screen = 1; + pscrn->driverVersion = XRDP_VERSION; + pscrn->driverName = XRDP_DRIVER_NAME; + pscrn->name = XRDP_NAME; + pscrn->Probe = rdpProbe; + pscrn->PreInit = rdpPreInit; + pscrn->ScreenInit = rdpScreenInit; + pscrn->SwitchMode = rdpSwitchMode; + pscrn->AdjustFrame = rdpAdjustFrame; + pscrn->EnterVT = rdpEnterVT; + pscrn->LeaveVT = rdpLeaveVT; + pscrn->ValidMode = rdpValidMode; + + xf86DrvMsg(pscrn->scrnIndex, X_INFO, "%s", "using default device\n"); + } + } + free(dev_sections); + return found_screen; +} + +/*****************************************************************************/ +static const OptionInfoRec * +rdpAvailableOptions(int chipid, int busid) +{ + LLOGLN(0, ("rdpAvailableOptions:")); + return 0; +} + +/*****************************************************************************/ +static Bool +rdpDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) +{ + LLOGLN(0, ("rdpDriverFunc:")); + return 0; +} + +/*****************************************************************************/ +static void +rdpIdentify(int flags) +{ + LLOGLN(0, ("rdpIdentify:")); + xf86PrintChipsets(XRDP_NAME, "driver for xrdp", g_Chipsets); +} + +_X_EXPORT DriverRec g_DriverRec = +{ + XRDP_VERSION, + XRDP_DRIVER_NAME, + rdpIdentify, + rdpProbe, + rdpAvailableOptions, + 0, + 0, + rdpDriverFunc +}; + +/*****************************************************************************/ +static pointer +Setup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + LLOGLN(0, ("Setup:")); + if (!g_setup_done) + { + g_setup_done = 1; + xf86AddDriver(&g_DriverRec, module, HaveDriverFuncs); + return (pointer)1; + } + else + { + if (errmaj != 0) + { + *errmaj = LDR_ONCEONLY; + } + return 0; + } +} +/* ModuleData */ +_X_EXPORT XF86ModuleData rdpModuleData = +{ + &g_VersRec, + Setup, + 0 +}; From 6eed5a1475df4076f697aafdc55a1e1c2f288a04 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 12 Jul 2013 22:36:16 -0700 Subject: [PATCH 14/45] xorg: work on Xorg driver --- xorg/server/module/Makefile | 6 +- xorg/server/module/rdp.h | 69 +++++ xorg/server/module/rdpCopyArea.c | 55 ++++ xorg/server/module/rdpCopyArea.h | 29 +++ xorg/server/module/rdpCopyPlane.c | 59 +++++ .../module/{rdpMain.c => rdpCopyPlane.h} | 21 +- xorg/server/module/rdpDraw.c | 117 +++++++++ xorg/server/module/rdpDraw.h | 66 +++++ xorg/server/module/rdpFillPolygon.c | 52 ++++ xorg/server/module/rdpFillPolygon.h | 30 +++ xorg/server/module/rdpFillSpans.c | 52 ++++ xorg/server/module/rdpFillSpans.h | 29 +++ xorg/server/module/rdpGC.c | 235 ++++++++++++++++++ xorg/server/module/rdpGC.h | 30 +++ xorg/server/module/rdpImageGlyphBlt.c | 52 ++++ xorg/server/module/rdpImageGlyphBlt.h | 30 +++ xorg/server/module/rdpImageText16.c | 50 ++++ xorg/server/module/rdpImageText16.h | 29 +++ xorg/server/module/rdpImageText8.c | 51 ++++ xorg/server/module/rdpImageText8.h | 29 +++ xorg/server/module/rdpPolyArc.c | 48 ++++ xorg/server/module/rdpPolyArc.h | 28 +++ xorg/server/module/rdpPolyFillArc.c | 48 ++++ xorg/server/module/rdpPolyFillArc.h | 28 +++ xorg/server/module/rdpPolyFillRect.c | 50 ++++ xorg/server/module/rdpPolyFillRect.h | 29 +++ xorg/server/module/rdpPolyGlyphBlt.c | 52 ++++ xorg/server/module/rdpPolyGlyphBlt.h | 30 +++ xorg/server/module/rdpPolyPoint.c | 50 ++++ xorg/server/module/rdpPolyPoint.h | 29 +++ xorg/server/module/rdpPolyRectangle.c | 51 ++++ xorg/server/module/rdpPolyRectangle.h | 29 +++ xorg/server/module/rdpPolySegment.c | 48 ++++ xorg/server/module/rdpPolySegment.h | 28 +++ xorg/server/module/rdpPolyText16.c | 55 ++++ xorg/server/module/rdpPolyText16.h | 29 +++ xorg/server/module/rdpPolyText8.c | 55 ++++ xorg/server/module/rdpPolyText8.h | 29 +++ xorg/server/module/rdpPolylines.c | 50 ++++ xorg/server/module/rdpPolylines.h | 29 +++ xorg/server/module/rdpPri.c | 89 +++++++ xorg/server/module/rdpPri.h | 47 ++++ xorg/server/module/rdpPushPixels.c | 50 ++++ xorg/server/module/rdpPushPixels.h | 29 +++ xorg/server/module/rdpPutImage.c | 51 ++++ xorg/server/module/rdpPutImage.h | 29 +++ xorg/server/module/rdpSetSpans.c | 52 ++++ xorg/server/module/rdpSetSpans.h | 29 +++ 48 files changed, 2247 insertions(+), 15 deletions(-) create mode 100644 xorg/server/module/rdp.h create mode 100644 xorg/server/module/rdpCopyArea.c create mode 100644 xorg/server/module/rdpCopyArea.h create mode 100644 xorg/server/module/rdpCopyPlane.c rename xorg/server/module/{rdpMain.c => rdpCopyPlane.h} (76%) create mode 100644 xorg/server/module/rdpDraw.c create mode 100644 xorg/server/module/rdpDraw.h create mode 100644 xorg/server/module/rdpFillPolygon.c create mode 100644 xorg/server/module/rdpFillPolygon.h create mode 100644 xorg/server/module/rdpFillSpans.c create mode 100644 xorg/server/module/rdpFillSpans.h create mode 100644 xorg/server/module/rdpGC.c create mode 100644 xorg/server/module/rdpGC.h create mode 100644 xorg/server/module/rdpImageGlyphBlt.c create mode 100644 xorg/server/module/rdpImageGlyphBlt.h create mode 100644 xorg/server/module/rdpImageText16.c create mode 100644 xorg/server/module/rdpImageText16.h create mode 100644 xorg/server/module/rdpImageText8.c create mode 100644 xorg/server/module/rdpImageText8.h create mode 100644 xorg/server/module/rdpPolyArc.c create mode 100644 xorg/server/module/rdpPolyArc.h create mode 100644 xorg/server/module/rdpPolyFillArc.c create mode 100644 xorg/server/module/rdpPolyFillArc.h create mode 100644 xorg/server/module/rdpPolyFillRect.c create mode 100644 xorg/server/module/rdpPolyFillRect.h create mode 100644 xorg/server/module/rdpPolyGlyphBlt.c create mode 100644 xorg/server/module/rdpPolyGlyphBlt.h create mode 100644 xorg/server/module/rdpPolyPoint.c create mode 100644 xorg/server/module/rdpPolyPoint.h create mode 100644 xorg/server/module/rdpPolyRectangle.c create mode 100644 xorg/server/module/rdpPolyRectangle.h create mode 100644 xorg/server/module/rdpPolySegment.c create mode 100644 xorg/server/module/rdpPolySegment.h create mode 100644 xorg/server/module/rdpPolyText16.c create mode 100644 xorg/server/module/rdpPolyText16.h create mode 100644 xorg/server/module/rdpPolyText8.c create mode 100644 xorg/server/module/rdpPolyText8.h create mode 100644 xorg/server/module/rdpPolylines.c create mode 100644 xorg/server/module/rdpPolylines.h create mode 100644 xorg/server/module/rdpPri.c create mode 100644 xorg/server/module/rdpPri.h create mode 100644 xorg/server/module/rdpPushPixels.c create mode 100644 xorg/server/module/rdpPushPixels.h create mode 100644 xorg/server/module/rdpPutImage.c create mode 100644 xorg/server/module/rdpPutImage.h create mode 100644 xorg/server/module/rdpSetSpans.c create mode 100644 xorg/server/module/rdpSetSpans.h diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index 39bfbbed..cb2439fa 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -1,5 +1,9 @@ -OBJS = rdpMain.o +OBJS = rdpDraw.o rdpPri.o rdpGC.o rdpFillSpans.o rdpSetSpans.o rdpPutImage.o \ +rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \ +rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \ +rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \ +rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o CFLAGS = -O2 -Wall -I/usr/include/xorg -I/usr/include/pixman-1 diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h new file mode 100644 index 00000000..c812e251 --- /dev/null +++ b/xorg/server/module/rdp.h @@ -0,0 +1,69 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef _RDP_H +#define _RDP_H + +#include +#include +#include + +#include "rdpPri.h" + +/* move this to common header */ +struct _rdpRec +{ + char data[1024]; + int width; + int height; + int num_modes; + char *ptr; + ScreenPtr pScreen; + rdpDevPrivateKey privateKeyRecGC; + rdpDevPrivateKey privateKeyRecPixmap; + + CopyWindowProcPtr CopyWindow; + CreateGCProcPtr CreateGC; + CreatePixmapProcPtr CreatePixmap; + DestroyPixmapProcPtr DestroyPixmap; + ModifyPixmapHeaderProcPtr ModifyPixmapHeader; + +}; +typedef struct _rdpRec rdpRec; +typedef struct _rdpRec * rdpPtr; +#define XRDPPTR(_p) ((rdpPtr)((_p)->driverPrivate)) + +struct _rdpGCRec +{ + GCFuncs *funcs; + GCOps *ops; +}; +typedef struct _rdpGCRec rdpGCRec; +typedef struct _rdpGCRec * rdpGCPtr; + +struct _rdpPixmapRec +{ + int i1; +}; +typedef struct _rdpPixmapRec rdpPixmapRec; +typedef struct _rdpPixmapRec * rdpPixmapPtr; + +#endif diff --git a/xorg/server/module/rdpCopyArea.c b/xorg/server/module/rdpCopyArea.c new file mode 100644 index 00000000..dd32644e --- /dev/null +++ b/xorg/server/module/rdpCopyArea.c @@ -0,0 +1,55 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static RegionPtr +rdpCopyAreaOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + RegionPtr rv; + + GC_OP_PROLOGUE(pGC); + rv = pGC->ops->CopyArea(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); + GC_OP_EPILOGUE(pGC); + return rv; +} + +/******************************************************************************/ +RegionPtr +rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty) +{ + RegionPtr rv; + + LLOGLN(10, ("rdpCopyArea:")); + /* do original call */ + rv = rdpCopyAreaOrg(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); + return rv; +} diff --git a/xorg/server/module/rdpCopyArea.h b/xorg/server/module/rdpCopyArea.h new file mode 100644 index 00000000..654b6edc --- /dev/null +++ b/xorg/server/module/rdpCopyArea.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPCOPYAREA_H +#define __RDPCOPYAREA_H + +RegionPtr +rdpCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, + int srcx, int srcy, int w, int h, int dstx, int dsty); + +#endif diff --git a/xorg/server/module/rdpCopyPlane.c b/xorg/server/module/rdpCopyPlane.c new file mode 100644 index 00000000..64b8a1ea --- /dev/null +++ b/xorg/server/module/rdpCopyPlane.c @@ -0,0 +1,59 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +RegionPtr +rdpCopyPlaneOrg(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, int h, + int dstx, int dsty, unsigned long bitPlane) +{ + RegionPtr rv; + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + rv = pGC->ops->CopyPlane(pSrc, pDst, pGC, srcx, srcy, + w, h, dstx, dsty, bitPlane); + GC_OP_EPILOGUE(pGC); + return rv; +} + +/******************************************************************************/ +RegionPtr +rdpCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, int h, + int dstx, int dsty, unsigned long bitPlane) +{ + RegionPtr rv; + + LLOGLN(10, ("rdpCopyPlane:")); + /* do original call */ + rv = rdpCopyPlaneOrg(pSrc, pDst, pGC, srcx, srcy, w, h, + dstx, dsty, bitPlane); + return rv; +} diff --git a/xorg/server/module/rdpMain.c b/xorg/server/module/rdpCopyPlane.h similarity index 76% rename from xorg/server/module/rdpMain.c rename to xorg/server/module/rdpCopyPlane.h index 5f3ab8c2..85a79e76 100644 --- a/xorg/server/module/rdpMain.c +++ b/xorg/server/module/rdpCopyPlane.h @@ -17,21 +17,14 @@ OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -This is the main modules file - */ -#include -#include -#include - -/* this should be before all X11 .h files */ -#include - -/* all driver need this */ -#include -#include -#include +#ifndef __RDPCOPYPLANE_H +#define __RDPCOPYPLANE_H -#include +RegionPtr +rdpCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, + GCPtr pGC, int srcx, int srcy, int width, int height, + int dstx, int dsty, unsigned long bitPlane); +#endif diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c new file mode 100644 index 00000000..0018fdf6 --- /dev/null +++ b/xorg/server/module/rdpDraw.c @@ -0,0 +1,117 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +misc draw calls + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include +#include +#include +#include + +#include "rdp.h" + +/******************************************************************************/ +#define LLOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/*****************************************************************************/ +PixmapPtr +rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, + unsigned usage_hint) +{ + ScrnInfoPtr pScrn; + rdpPtr dev; + PixmapPtr rv; + + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + pScreen->CreatePixmap = dev->CreatePixmap; + rv = pScreen->CreatePixmap(pScreen, 0, 0, 0, 0); + pScreen->CreatePixmap = XVivCreatePixmap; + return rv; +} + +/******************************************************************************/ +Bool +rdpDestroyPixmap(PixmapPtr pPixmap) +{ + Bool rv; + ScreenPtr pScreen; + rdpPtr dev; + ScrnInfoPtr pScrn; + + LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt)); + pScreen = pPixmap->drawable.pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + pScreen->DestroyPixmap = dev->DestroyPixmap; + rv = pScreen->DestroyPixmap(pPixmap); + pScreen->DestroyPixmap = XVivDestroyPixmap; + return rv; +} + +/******************************************************************************/ +Bool +rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData) +{ + Bool rv; + ScreenPtr pScreen; + rdpPtr dev; + ScrnInfoPtr pScrn; + + pScreen = pPixmap->drawable.pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader; + rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, + devKind, pPixData); + pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader; + return rv; +} + +/*****************************************************************************/ +void +rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) +{ + ScrnInfoPtr pScrn; + ScreenPtr pScreen; + rdpPtr dev; + + pScreen = pWin->drawable.pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + dev->pScreen->CopyWindow = dev->CopyWindow; + dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); + dev->pScreen->CopyWindow = rdpCopyWindow; +} diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h new file mode 100644 index 00000000..e0e3988e --- /dev/null +++ b/xorg/server/module/rdpDraw.h @@ -0,0 +1,66 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +misc draw calls + +*/ + +#ifndef __RDPDRAW_H +#define __RDPDRAW_H + +#include +#include + +/******************************************************************************/ +#define GC_OP_PROLOGUE(_pGC) \ +do { \ + rdpPtr dev; \ + ScreenPtr pScreen; \ + ScrnInfoPtr pScrn; \ + pScreen = (_pGC)->pScreen; \ + pScrn = xf86Screens[pScreen->myNum]; \ + dev = XRDPPTR(pScrn); \ + priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \ + oldFuncs = (_pGC)->funcs; \ + (_pGC)->funcs = priv->funcs; \ + (_pGC)->ops = priv->ops; \ +} while (0) + +/******************************************************************************/ +#define GC_OP_EPILOGUE(_pGC) \ +do { \ + priv->ops = (_pGC)->ops; \ + (_pGC)->funcs = oldFuncs; \ + (_pGC)->ops = &g_rdpGCOps; \ +} while (0) + +extern GCOps g_rdpGCOps; /* in rdpGC.c */ + +PixmapPtr +rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, + unsigned usage_hint); +Bool +rdpDestroyPixmap(PixmapPtr pPixmap); +Bool +rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, + int bitsPerPixel, int devKind, pointer pPixData); +void +rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion); + +#endif diff --git a/xorg/server/module/rdpFillPolygon.c b/xorg/server/module/rdpFillPolygon.c new file mode 100644 index 00000000..38043c0b --- /dev/null +++ b/xorg/server/module/rdpFillPolygon.c @@ -0,0 +1,52 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpFillPolygonOrg(DrawablePtr pDrawable, GCPtr pGC, + int shape, int mode, int count, + DDXPointPtr pPts) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->FillPolygon(pDrawable, pGC, shape, mode, count, pPts); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, + int shape, int mode, int count, + DDXPointPtr pPts) +{ + LLOGLN(10, ("rdpFillPolygon:")); + /* do original call */ + rdpFillPolygonOrg(pDrawable, pGC, shape, mode, count, pPts); +} diff --git a/xorg/server/module/rdpFillPolygon.h b/xorg/server/module/rdpFillPolygon.h new file mode 100644 index 00000000..89da9ae0 --- /dev/null +++ b/xorg/server/module/rdpFillPolygon.h @@ -0,0 +1,30 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPFILLPOLYGON_H +#define __RDPFILLPOLYGON_H + +void +rdpFillPolygon(DrawablePtr pDrawable, GCPtr pGC, + int shape, int mode, int count, + DDXPointPtr pPts); + +#endif diff --git a/xorg/server/module/rdpFillSpans.c b/xorg/server/module/rdpFillSpans.c new file mode 100644 index 00000000..dbd4cc1e --- /dev/null +++ b/xorg/server/module/rdpFillSpans.c @@ -0,0 +1,52 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LDEBUG 0 + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static void +rdpFillSpansOrg(DrawablePtr pDrawable, GCPtr pGC, int nInit, + DDXPointPtr pptInit, int *pwidthInit, int fSorted) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, + DDXPointPtr pptInit, int *pwidthInit, int fSorted) +{ + LLOGLN(0, ("rdpFillSpans:")); + /* do original call */ + rdpFillSpansOrg(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); +} diff --git a/xorg/server/module/rdpFillSpans.h b/xorg/server/module/rdpFillSpans.h new file mode 100644 index 00000000..7e014e6b --- /dev/null +++ b/xorg/server/module/rdpFillSpans.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPFILLSPANS_H +#define __RDPFILLSPANS_H + +void +rdpFillSpans(DrawablePtr pDrawable, GCPtr pGC, int nInit, + DDXPointPtr pptInit, int* pwidthInit, int fSorted); + +#endif diff --git a/xorg/server/module/rdpGC.c b/xorg/server/module/rdpGC.c new file mode 100644 index 00000000..a7fe9ff5 --- /dev/null +++ b/xorg/server/module/rdpGC.c @@ -0,0 +1,235 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +GC related calls + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include +#include +#include +#include + +#include "rdp.h" +#include "rdpFillSpans.h" +#include "rdpSetSpans.h" +#include "rdpPutImage.h" +#include "rdpCopyArea.h" +#include "rdpCopyPlane.h" +#include "rdpPolyPoint.h" +#include "rdpPolylines.h" +#include "rdpPolySegment.h" +#include "rdpPolyRectangle.h" +#include "rdpPolyArc.h" +#include "rdpFillPolygon.h" +#include "rdpPolyFillRect.h" +#include "rdpPolyFillArc.h" +#include "rdpPolyText8.h" +#include "rdpPolyText16.h" +#include "rdpImageText8.h" +#include "rdpImageText16.h" +#include "rdpImageGlyphBlt.h" +#include "rdpPolyGlyphBlt.h" +#include "rdpPushPixels.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +#define GC_FUNC_PROLOGUE(_pGC) \ + do { \ + rdpPtr dev; \ + ScreenPtr pScreen; \ + ScrnInfoPtr pScrn; \ + pScreen = _pGC->pScreen; \ + pScrn = xf86Screens[pScreen->myNum]; \ + dev = XRDPPTR(pScrn); \ + priv = (rdpGCPtr)rdpGetGCPrivate(_pGC, dev->privateKeyRecGC); \ + (_pGC)->funcs = priv->funcs; \ + if (priv->ops != 0) \ + { \ + (_pGC)->ops = priv->ops; \ + } \ + } while (0) + +/******************************************************************************/ +#define GC_FUNC_EPILOGUE(_pGC) \ + do { \ + priv->funcs = (_pGC)->funcs; \ + (_pGC)->funcs = &g_rdpGCFuncs; \ + if (priv->ops != 0) \ + { \ + priv->ops = (_pGC)->ops; \ + (_pGC)->ops = &g_rdpGCOps; \ + } \ + } while (0) + +static void +rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d); +static void +rdpChangeGC(GCPtr pGC, unsigned long mask); +static void +rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst); +static void +rdpDestroyGC(GCPtr pGC); +static void +rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects); +static void +rdpDestroyClip(GCPtr pGC); +static void +rdpCopyClip(GCPtr dst, GCPtr src); + +GCFuncs g_rdpGCFuncs = +{ + rdpValidateGC, rdpChangeGC, rdpCopyGC, rdpDestroyGC, rdpChangeClip, + rdpDestroyClip, rdpCopyClip +}; + +GCOps g_rdpGCOps = +{ + rdpFillSpans, rdpSetSpans, rdpPutImage, rdpCopyArea, rdpCopyPlane, + rdpPolyPoint, rdpPolylines, rdpPolySegment, rdpPolyRectangle, + rdpPolyArc, rdpFillPolygon, rdpPolyFillRect, rdpPolyFillArc, + rdpPolyText8, rdpPolyText16, rdpImageText8, rdpImageText16, + rdpImageGlyphBlt, rdpPolyGlyphBlt, rdpPushPixels +}; + +/******************************************************************************/ +static void +rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d) +{ + rdpGCRec *priv; + + LLOGLN(10, ("rdpValidateGC:")); + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ValidateGC(pGC, changes, d); + GC_FUNC_EPILOGUE(pGC); +} + +/******************************************************************************/ +static void +rdpChangeGC(GCPtr pGC, unsigned long mask) +{ + rdpGCRec *priv; + + LLOGLN(10, ("rdpChangeGC:")); + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeGC(pGC, mask); + GC_FUNC_EPILOGUE(pGC); +} + +/******************************************************************************/ +static void +rdpCopyGC(GCPtr src, unsigned long mask, GCPtr dst) +{ + rdpGCRec *priv; + + LLOGLN(10, ("rdpCopyGC:")); + GC_FUNC_PROLOGUE(dst); + dst->funcs->CopyGC(src, mask, dst); + GC_FUNC_EPILOGUE(dst); +} + +/******************************************************************************/ +static void +rdpDestroyGC(GCPtr pGC) +{ + rdpGCRec *priv; + + LLOGLN(10, ("rdpDestroyGC:")); + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyGC(pGC); + GC_FUNC_EPILOGUE(pGC); +} + +/******************************************************************************/ +static void +rdpChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) +{ + rdpGCRec *priv; + + LLOGLN(10, ("rdpChangeClip:")); + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeClip(pGC, type, pValue, nrects); + GC_FUNC_EPILOGUE(pGC); +} + +/******************************************************************************/ +static void +rdpDestroyClip(GCPtr pGC) +{ + rdpGCRec *priv; + + LLOGLN(10, ("rdpDestroyClip:")); + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyClip(pGC); + GC_FUNC_EPILOGUE(pGC); +} + +/******************************************************************************/ +static void +rdpCopyClip(GCPtr dst, GCPtr src) +{ + rdpGCRec *priv; + + LLOGLN(10, ("rdpCopyClip:")); + GC_FUNC_PROLOGUE(dst); + dst->funcs->CopyClip(dst, src); + GC_FUNC_EPILOGUE(dst); +} + +/*****************************************************************************/ +Bool +rdpCreateGC(GCPtr pGC) +{ + Bool rv; + rdpPtr dev; + ScreenPtr pScreen; + ScrnInfoPtr pScrn; + rdpGCPtr priv; + + LLOGLN(10, ("rdpCreateGC:")); + pScreen = pGC->pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + priv = (rdpGCPtr)rdpGetGCPrivate(pGC, dev->privateKeyRecGC); + pScreen->CreateGC = dev->CreateGC; + rv = pScreen->CreateGC(pGC); + if (rv) + { + priv->funcs = pGC->funcs; + priv->ops = 0; + pGC->funcs = &g_rdpGCFuncs; + } + pScreen->CreateGC = rdpCreateGC; + return rv; +} diff --git a/xorg/server/module/rdpGC.h b/xorg/server/module/rdpGC.h new file mode 100644 index 00000000..4ad129a2 --- /dev/null +++ b/xorg/server/module/rdpGC.h @@ -0,0 +1,30 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +GC related calls + +*/ + +#ifndef _RDPGC_H +#define _RDPGC_H + +Bool +rdpCreateGC(GCPtr pGC); + +#endif diff --git a/xorg/server/module/rdpImageGlyphBlt.c b/xorg/server/module/rdpImageGlyphBlt.c new file mode 100644 index 00000000..0b0d7ce8 --- /dev/null +++ b/xorg/server/module/rdpImageGlyphBlt.c @@ -0,0 +1,52 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpImageGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->ImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase) +{ + LLOGLN(10, ("rdpImageGlyphBlt:")); + /* do original call */ + rdpImageGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); +} diff --git a/xorg/server/module/rdpImageGlyphBlt.h b/xorg/server/module/rdpImageGlyphBlt.h new file mode 100644 index 00000000..c5483c7e --- /dev/null +++ b/xorg/server/module/rdpImageGlyphBlt.h @@ -0,0 +1,30 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPIMAGEGLYPHBLT_H +#define __RDPIMAGEGLYPHBLT_H + +void +rdpImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr* ppci, pointer pglyphBase); + +#endif diff --git a/xorg/server/module/rdpImageText16.c b/xorg/server/module/rdpImageText16.c new file mode 100644 index 00000000..8ddd9bf3 --- /dev/null +++ b/xorg/server/module/rdpImageText16.c @@ -0,0 +1,50 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpImageText16Org(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->ImageText16(pDrawable, pGC, x, y, count, chars); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars) +{ + LLOGLN(10, ("rdpImageText16:")); + /* do original call */ + rdpImageText16Org(pDrawable, pGC, x, y, count, chars); +} diff --git a/xorg/server/module/rdpImageText16.h b/xorg/server/module/rdpImageText16.h new file mode 100644 index 00000000..0ffb90f2 --- /dev/null +++ b/xorg/server/module/rdpImageText16.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPIMAGETEXT16_H +#define __RDPIMAGETEXT16_H + +void +rdpImageText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short* chars); + +#endif diff --git a/xorg/server/module/rdpImageText8.c b/xorg/server/module/rdpImageText8.c new file mode 100644 index 00000000..ab41753b --- /dev/null +++ b/xorg/server/module/rdpImageText8.c @@ -0,0 +1,51 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpImageText8Org(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->ImageText8(pDrawable, pGC, x, y, count, chars); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars) +{ + LLOGLN(10, ("rdpImageText8:")); + /* do original call */ + rdpImageText8Org(pDrawable, pGC, x, y, count, chars); + return; +} diff --git a/xorg/server/module/rdpImageText8.h b/xorg/server/module/rdpImageText8.h new file mode 100644 index 00000000..dc0c4ec5 --- /dev/null +++ b/xorg/server/module/rdpImageText8.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPIMAGETEXT8_H +#define __RDPIMAGETEXT8_H + +void +rdpImageText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char* chars); + +#endif diff --git a/xorg/server/module/rdpPolyArc.c b/xorg/server/module/rdpPolyArc.c new file mode 100644 index 00000000..63fc699b --- /dev/null +++ b/xorg/server/module/rdpPolyArc.c @@ -0,0 +1,48 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpPolyArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PolyArc(pDrawable, pGC, narcs, parcs); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) +{ + LLOGLN(10, ("rdpPolyArc:")); + /* do original call */ + rdpPolyArcOrg(pDrawable, pGC, narcs, parcs); +} diff --git a/xorg/server/module/rdpPolyArc.h b/xorg/server/module/rdpPolyArc.h new file mode 100644 index 00000000..7ebadc35 --- /dev/null +++ b/xorg/server/module/rdpPolyArc.h @@ -0,0 +1,28 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYARC_H +#define __RDPPOLYARC_H + +void +rdpPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs); + +#endif diff --git a/xorg/server/module/rdpPolyFillArc.c b/xorg/server/module/rdpPolyFillArc.c new file mode 100644 index 00000000..b53a1131 --- /dev/null +++ b/xorg/server/module/rdpPolyFillArc.c @@ -0,0 +1,48 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpPolyFillArcOrg(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PolyFillArc(pDrawable, pGC, narcs, parcs); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) +{ + LLOGLN(10, ("rdpPolyFillArc:")); + /* do original call */ + rdpPolyFillArcOrg(pDrawable, pGC, narcs, parcs); +} diff --git a/xorg/server/module/rdpPolyFillArc.h b/xorg/server/module/rdpPolyFillArc.h new file mode 100644 index 00000000..9a9846e1 --- /dev/null +++ b/xorg/server/module/rdpPolyFillArc.h @@ -0,0 +1,28 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYFILLARC_H +#define __RDPPOLYFILLARC_H + +void +rdpPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc* parcs); + +#endif diff --git a/xorg/server/module/rdpPolyFillRect.c b/xorg/server/module/rdpPolyFillRect.c new file mode 100644 index 00000000..dc929f9f --- /dev/null +++ b/xorg/server/module/rdpPolyFillRect.c @@ -0,0 +1,50 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static void +rdpPolyFillRectOrg(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, + xRectangle *prectInit) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PolyFillRect(pDrawable, pGC, nrectFill, prectInit); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, + xRectangle *prectInit) +{ + LLOGLN(10, ("rdpPolyFillRect:")); + /* do original call */ + rdpPolyFillRectOrg(pDrawable, pGC, nrectFill, prectInit); +} diff --git a/xorg/server/module/rdpPolyFillRect.h b/xorg/server/module/rdpPolyFillRect.h new file mode 100644 index 00000000..94ac4b59 --- /dev/null +++ b/xorg/server/module/rdpPolyFillRect.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYFILLRECT_H +#define __RDPPOLYFILLRECT_H + +void +rdpPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, + xRectangle* prectInit); + +#endif diff --git a/xorg/server/module/rdpPolyGlyphBlt.c b/xorg/server/module/rdpPolyGlyphBlt.c new file mode 100644 index 00000000..5265ed72 --- /dev/null +++ b/xorg/server/module/rdpPolyGlyphBlt.c @@ -0,0 +1,52 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpPolyGlyphBltOrg(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr *ppci, pointer pglyphBase) +{ + LLOGLN(10, ("rdpPolyGlyphBlt:")); + /* do original call */ + rdpPolyGlyphBltOrg(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); +} diff --git a/xorg/server/module/rdpPolyGlyphBlt.h b/xorg/server/module/rdpPolyGlyphBlt.h new file mode 100644 index 00000000..9c6519d8 --- /dev/null +++ b/xorg/server/module/rdpPolyGlyphBlt.h @@ -0,0 +1,30 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYGLYPHBLT_H +#define __RDPPOLYGLYPHBLT_H + +void +rdpPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, unsigned int nglyph, + CharInfoPtr* ppci, pointer pglyphBase); + +#endif diff --git a/xorg/server/module/rdpPolyPoint.c b/xorg/server/module/rdpPolyPoint.c new file mode 100644 index 00000000..6c9c77c1 --- /dev/null +++ b/xorg/server/module/rdpPolyPoint.c @@ -0,0 +1,50 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpPolyPointOrg(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, DDXPointPtr in_pts) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PolyPoint(pDrawable, pGC, mode, npt, in_pts); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, DDXPointPtr in_pts) +{ + LLOGLN(10, ("rdpPolyPoint:")); + /* do original call */ + rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts); +} diff --git a/xorg/server/module/rdpPolyPoint.h b/xorg/server/module/rdpPolyPoint.h new file mode 100644 index 00000000..87bf9459 --- /dev/null +++ b/xorg/server/module/rdpPolyPoint.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYPOINT_H +#define __RDPPOLYPOINT_H + +void +rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, DDXPointPtr in_pts); + +#endif diff --git a/xorg/server/module/rdpPolyRectangle.c b/xorg/server/module/rdpPolyRectangle.c new file mode 100644 index 00000000..e80b8178 --- /dev/null +++ b/xorg/server/module/rdpPolyRectangle.c @@ -0,0 +1,51 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static void +rdpPolyRectangleOrg(DrawablePtr pDrawable, GCPtr pGC, int nrects, + xRectangle *rects) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PolyRectangle(pDrawable, pGC, nrects, rects); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +/* tested with pGC->lineWidth = 0, 1, 2, 4 and opcodes 3 and 6 */ +void +rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, + xRectangle *rects) +{ + LLOGLN(10, ("rdpPolyRectangle:")); + /* do original call */ + rdpPolyRectangleOrg(pDrawable, pGC, nrects, rects); +} diff --git a/xorg/server/module/rdpPolyRectangle.h b/xorg/server/module/rdpPolyRectangle.h new file mode 100644 index 00000000..d09446d5 --- /dev/null +++ b/xorg/server/module/rdpPolyRectangle.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYRECTANGLE_H +#define __RDPPOLYRECTANGLE_H + +void +rdpPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, + xRectangle* rects); + +#endif diff --git a/xorg/server/module/rdpPolySegment.c b/xorg/server/module/rdpPolySegment.c new file mode 100644 index 00000000..f4a9d40c --- /dev/null +++ b/xorg/server/module/rdpPolySegment.c @@ -0,0 +1,48 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpPolySegmentOrg(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PolySegment(pDrawable, pGC, nseg, pSegs); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs) +{ + LLOGLN(10, ("rdpPolySegment:")); + /* do original call */ + rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs); +} diff --git a/xorg/server/module/rdpPolySegment.h b/xorg/server/module/rdpPolySegment.h new file mode 100644 index 00000000..8c5f33ab --- /dev/null +++ b/xorg/server/module/rdpPolySegment.h @@ -0,0 +1,28 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYSEGMENT_H +#define __RDPPOLYSEGMENT_H + +void +rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs); + +#endif diff --git a/xorg/server/module/rdpPolyText16.c b/xorg/server/module/rdpPolyText16.c new file mode 100644 index 00000000..b5eac8c5 --- /dev/null +++ b/xorg/server/module/rdpPolyText16.c @@ -0,0 +1,55 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +int +rdpPolyText16Org(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars) +{ + int rv; + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + rv = pGC->ops->PolyText16(pDrawable, pGC, x, y, count, chars); + GC_OP_EPILOGUE(pGC); + return rv; +} + +/******************************************************************************/ +int +rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short *chars) +{ + int rv; + + LLOGLN(10, ("rdpPolyText16:")); + /* do original call */ + rv = rdpPolyText16Org(pDrawable, pGC, x, y, count, chars); + return rv; +} diff --git a/xorg/server/module/rdpPolyText16.h b/xorg/server/module/rdpPolyText16.h new file mode 100644 index 00000000..bcfa8379 --- /dev/null +++ b/xorg/server/module/rdpPolyText16.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYTEXT16_H +#define __RDPPOLYTEXT16_H + +int +rdpPolyText16(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, unsigned short* chars); + +#endif diff --git a/xorg/server/module/rdpPolyText8.c b/xorg/server/module/rdpPolyText8.c new file mode 100644 index 00000000..8931a4c1 --- /dev/null +++ b/xorg/server/module/rdpPolyText8.c @@ -0,0 +1,55 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +int +rdpPolyText8Org(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars) +{ + int rv; + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + rv = pGC->ops->PolyText8(pDrawable, pGC, x, y, count, chars); + GC_OP_EPILOGUE(pGC); + return rv; +} + +/******************************************************************************/ +int +rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char *chars) +{ + int rv; + + LLOGLN(10, ("rdpPolyText8:")); + /* do original call */ + rv = rdpPolyText8Org(pDrawable, pGC, x, y, count, chars); + return rv; +} diff --git a/xorg/server/module/rdpPolyText8.h b/xorg/server/module/rdpPolyText8.h new file mode 100644 index 00000000..95e80412 --- /dev/null +++ b/xorg/server/module/rdpPolyText8.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYTEXT8_H +#define __RDPPOLYTEXT8_H + +int +rdpPolyText8(DrawablePtr pDrawable, GCPtr pGC, + int x, int y, int count, char* chars); + +#endif diff --git a/xorg/server/module/rdpPolylines.c b/xorg/server/module/rdpPolylines.c new file mode 100644 index 00000000..b439db28 --- /dev/null +++ b/xorg/server/module/rdpPolylines.c @@ -0,0 +1,50 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static void +rdpPolylinesOrg(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, DDXPointPtr pptInit) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->Polylines(pDrawable, pGC, mode, npt, pptInit); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, DDXPointPtr pptInit) +{ + LLOGLN(10, ("rdpPolylines:")); + /* do original call */ + rdpPolylinesOrg(pDrawable, pGC, mode, npt, pptInit); +} diff --git a/xorg/server/module/rdpPolylines.h b/xorg/server/module/rdpPolylines.h new file mode 100644 index 00000000..2df3d388 --- /dev/null +++ b/xorg/server/module/rdpPolylines.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPOLYLINES_H +#define __RDPPOLYLINES_H + +void +rdpPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, + int npt, DDXPointPtr pptInit); + +#endif diff --git a/xorg/server/module/rdpPri.c b/xorg/server/module/rdpPri.c new file mode 100644 index 00000000..d8346fa9 --- /dev/null +++ b/xorg/server/module/rdpPri.c @@ -0,0 +1,89 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +to deal with privates changing in xorg versions + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include +#include +#include +#include + +#include "rdpPri.h" + +/*****************************************************************************/ +rdpDevPrivateKey +rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes) +{ + return 0; +} + +/*****************************************************************************/ +rdpDevPrivateKey +rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes) +{ + return 0; +} + +/*****************************************************************************/ +rdpDevPrivateKey +rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes) +{ + return 0; +} + +/*****************************************************************************/ +void* +rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key) +{ + return 0; +} + +/*****************************************************************************/ +void* +rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key) +{ + return 0; +} + +/*****************************************************************************/ +void* +rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key) +{ + return 0; +} + +/*****************************************************************************/ +int +rdpPrivateInit(void) +{ + return 0; +} diff --git a/xorg/server/module/rdpPri.h b/xorg/server/module/rdpPri.h new file mode 100644 index 00000000..625947a3 --- /dev/null +++ b/xorg/server/module/rdpPri.h @@ -0,0 +1,47 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +to deal with privates changing in xorg versions + +*/ + +#ifndef _XRDPPRI_H +#define _XRDPPRI_H + +#include +#include + +typedef void* rdpDevPrivateKey; + +rdpDevPrivateKey +rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes); +rdpDevPrivateKey +rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes); +rdpDevPrivateKey +rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes); +void* +rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key); +void* +rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key); +void* +rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key); +int +rdpPrivateInit(void); + +#endif diff --git a/xorg/server/module/rdpPushPixels.c b/xorg/server/module/rdpPushPixels.c new file mode 100644 index 00000000..3491d556 --- /dev/null +++ b/xorg/server/module/rdpPushPixels.c @@ -0,0 +1,50 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpPushPixelsOrg(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, + int w, int h, int x, int y) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PushPixels(pGC, pBitMap, pDst, w, h, x, y); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, + int w, int h, int x, int y) +{ + LLOGLN(10, ("rdpPushPixels:")); + /* do original call */ + rdpPushPixelsOrg(pGC, pBitMap, pDst, w, h, x, y); +} diff --git a/xorg/server/module/rdpPushPixels.h b/xorg/server/module/rdpPushPixels.h new file mode 100644 index 00000000..2e0cd1d1 --- /dev/null +++ b/xorg/server/module/rdpPushPixels.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPUSHPIXELS_H +#define __RDPPUSHPIXELS_H + +void +rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, + int w, int h, int x, int y); + +#endif diff --git a/xorg/server/module/rdpPutImage.c b/xorg/server/module/rdpPutImage.c new file mode 100644 index 00000000..2d9faa89 --- /dev/null +++ b/xorg/server/module/rdpPutImage.c @@ -0,0 +1,51 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static void +rdpPutImageOrg(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, + int w, int h, int leftPad, int format, char *pBits) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->PutImage(pDst, pGC, depth, x, y, w, h, leftPad, + format, pBits); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, + int w, int h, int leftPad, int format, char *pBits) +{ + LLOGLN(10, ("rdpPutImage:")); + /* do original call */ + rdpPutImageOrg(pDst, pGC, depth, x, y, w, h, leftPad, format, pBits); +} diff --git a/xorg/server/module/rdpPutImage.h b/xorg/server/module/rdpPutImage.h new file mode 100644 index 00000000..82e27872 --- /dev/null +++ b/xorg/server/module/rdpPutImage.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPPUTIMAGE_H +#define __RDPPUTIMAGE_H + +void +rdpPutImage(DrawablePtr pDst, GCPtr pGC, int depth, int x, int y, + int w, int h, int leftPad, int format, char* pBits); + +#endif diff --git a/xorg/server/module/rdpSetSpans.c b/xorg/server/module/rdpSetSpans.c new file mode 100644 index 00000000..1bd9ed80 --- /dev/null +++ b/xorg/server/module/rdpSetSpans.c @@ -0,0 +1,52 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "rdp.h" +#include "rdpDraw.h" + +#define LDEBUG 0 + +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +void +rdpSetSpansOrg(DrawablePtr pDrawable, GCPtr pGC, char *psrc, + DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) +{ + rdpGCPtr priv; + GCFuncs *oldFuncs; + + GC_OP_PROLOGUE(pGC); + pGC->ops->SetSpans(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); + GC_OP_EPILOGUE(pGC); +} + +/******************************************************************************/ +void +rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char *psrc, + DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) +{ + LLOGLN(0, ("rdpSetSpans:")); + /* do original call */ + rdpSetSpansOrg(pDrawable, pGC, psrc, ppt, pwidth, nspans, fSorted); +} diff --git a/xorg/server/module/rdpSetSpans.h b/xorg/server/module/rdpSetSpans.h new file mode 100644 index 00000000..acaedd66 --- /dev/null +++ b/xorg/server/module/rdpSetSpans.h @@ -0,0 +1,29 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef __RDPSETSPANS_H +#define __RDPSETSPANS_H + +void +rdpSetSpans(DrawablePtr pDrawable, GCPtr pGC, char* psrc, + DDXPointPtr ppt, int* pwidth, int nspans, int fSorted); + +#endif From e2b4f8cf7e46b51a48bb9a3ca482378bcf8e5212 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 12 Jul 2013 23:26:04 -0700 Subject: [PATCH 15/45] xorg: work on Xorg driver --- xorg/server/module/rdpDraw.c | 49 ++++++++++++++++++++++++++++++++--- xorg/server/readme.txt | 11 ++++++++ xorg/server/xrdpdev/xorg.conf | 24 +++++++---------- xorg/server/xrdpdev/xrdpdev.c | 2 +- 4 files changed, 67 insertions(+), 19 deletions(-) create mode 100644 xorg/server/readme.txt diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c index 0018fdf6..9e989fe7 100644 --- a/xorg/server/module/rdpDraw.c +++ b/xorg/server/module/rdpDraw.c @@ -39,8 +39,16 @@ misc draw calls #include "rdp.h" +#define XRDP_DRIVER_NAME "XRDPDEV" +#define XRDP_NAME "XRDPDEV" +#define XRDP_VERSION 1000 + +#define PACKAGE_VERSION_MAJOR 1 +#define PACKAGE_VERSION_MINOR 0 +#define PACKAGE_VERSION_PATCHLEVEL 0 + /******************************************************************************/ -#define LLOG_LEVEL 1 +#define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) @@ -57,7 +65,7 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, dev = XRDPPTR(pScrn); pScreen->CreatePixmap = dev->CreatePixmap; rv = pScreen->CreatePixmap(pScreen, 0, 0, 0, 0); - pScreen->CreatePixmap = XVivCreatePixmap; + pScreen->CreatePixmap = rdpCreatePixmap; return rv; } @@ -76,7 +84,7 @@ rdpDestroyPixmap(PixmapPtr pPixmap) dev = XRDPPTR(pScrn); pScreen->DestroyPixmap = dev->DestroyPixmap; rv = pScreen->DestroyPixmap(pPixmap); - pScreen->DestroyPixmap = XVivDestroyPixmap; + pScreen->DestroyPixmap = rdpDestroyPixmap; return rv; } @@ -115,3 +123,38 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); dev->pScreen->CopyWindow = rdpCopyWindow; } + +/*****************************************************************************/ +static pointer +RDPSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) +{ + static int initialised = 0; + + LLOGLN(0, ("RDPSetup:")); + if (!initialised) + { + initialised = 1; + //xf86AddModuleInfo(&THINC, Module); + //LoaderRefSymLists(cursorSymbols, NULL); + } + return (pointer) 1; +} + +static MODULESETUPPROTO(RDPSetup); +static XF86ModuleVersionInfo RDPVersRec = +{ + XRDP_DRIVER_NAME, + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + PACKAGE_VERSION_MAJOR, + PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + 0, + { 0, 0, 0, 0 } +}; + +XF86ModuleData xorgxrdpModuleData = { &RDPVersRec, RDPSetup, NULL }; diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt new file mode 100644 index 00000000..f9380ef7 --- /dev/null +++ b/xorg/server/readme.txt @@ -0,0 +1,11 @@ + +Notes for building xrdpdev_drv.so and libxorgxrdp.so + + + +to run it +create /etc/X11/xrdp +copy xorg.conf into it + +Xorg -config xrdp/xorg.conf -logfile /tmp/Xjay.log :10 + diff --git a/xorg/server/xrdpdev/xorg.conf b/xorg/server/xrdpdev/xorg.conf index 76b7590d..9cda5d4d 100644 --- a/xorg/server/xrdpdev/xorg.conf +++ b/xorg/server/xrdpdev/xorg.conf @@ -2,12 +2,12 @@ Section "ServerLayout" Identifier "X11 Server" Screen "Screen (xrdpdev)" - InputDevice "ScrollMouse" "CorePointer" - InputDevice "Keyboard" "CoreKeyboard" + InputDevice "xrdpMouse" "CorePointer" + InputDevice "xrdpKeyboard" "CoreKeyboard" EndSection Section "ServerFlags" - Option "DontVTSwitch" "off" + Option "DontVTSwitch" "on" EndSection Section "Files" @@ -26,23 +26,17 @@ Section "Module" Load "record" Load "vbe" Load "xorgxrdp" + Load "fb" EndSection Section "InputDevice" - Identifier "Keyboard" - Driver "kbd" - Option "XkbRules" "xorg" - Option "XkbModel" "pc104" - Option "XkbLayout" "us" + Identifier "xrdpKeyboard" + Driver "xrdpkeyb" EndSection Section "InputDevice" - Identifier "ScrollMouse" - Driver "mouse" - Option "CorePointer" - Option "Device" "/dev/input/mice" - Option "Protocol" "ImPS/2" - Option "ZAxisMapping" "4 5" + Identifier "xrdpMouse" + Driver "xrdpmouse" EndSection Section "Monitor" @@ -58,7 +52,7 @@ EndSection Section "Device" Identifier "Video Card (xrdpdev)" - Driver "xrdp" + Driver "xrdpdev" EndSection Section "Screen" diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index 4c2fdddb..74c36a97 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -534,7 +534,7 @@ Setup(pointer module, pointer opts, int *errmaj, int *errmin) } /* ModuleData */ -_X_EXPORT XF86ModuleData rdpModuleData = +_X_EXPORT XF86ModuleData xrdpdevModuleData = { &g_VersRec, Setup, From bca7e7a0238505d2c350265b57e5a1e59c7b1ec1 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 13 Jul 2013 14:07:01 -0700 Subject: [PATCH 16/45] xorg, work on driver --- xorg/server/module/Makefile | 2 +- xorg/server/readme.txt | 2 +- xorg/server/xrdpdev/Makefile | 3 +-- xorg/server/xrdpdev/xorg.conf | 8 ++++---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index cb2439fa..f2442c82 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 -CFLAGS = -O2 -Wall -I/usr/include/xorg -I/usr/include/pixman-1 +CFLAGS = -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 LDFLAGS = diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt index f9380ef7..3c607e85 100644 --- a/xorg/server/readme.txt +++ b/xorg/server/readme.txt @@ -7,5 +7,5 @@ to run it create /etc/X11/xrdp copy xorg.conf into it -Xorg -config xrdp/xorg.conf -logfile /tmp/Xjay.log :10 +Xorg -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset :10 diff --git a/xorg/server/xrdpdev/Makefile b/xorg/server/xrdpdev/Makefile index 1e97b94f..1c680268 100644 --- a/xorg/server/xrdpdev/Makefile +++ b/xorg/server/xrdpdev/Makefile @@ -1,7 +1,7 @@ OBJS = xrdpdev.o -CFLAGS = -O2 -Wall -I/usr/include/xorg -I/usr/include/pixman-1 -I../module +CFLAGS = -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module LDFLAGS = @@ -14,4 +14,3 @@ xrdpdev_drv.so: $(OBJS) Makefile clean: rm -f $(OBJS) xrdpdev_drv.so - diff --git a/xorg/server/xrdpdev/xorg.conf b/xorg/server/xrdpdev/xorg.conf index 9cda5d4d..a44c92dd 100644 --- a/xorg/server/xrdpdev/xorg.conf +++ b/xorg/server/xrdpdev/xorg.conf @@ -6,9 +6,9 @@ Section "ServerLayout" InputDevice "xrdpKeyboard" "CoreKeyboard" EndSection -Section "ServerFlags" - Option "DontVTSwitch" "on" -EndSection +#Section "ServerFlags" +# Option "DontVTSwitch" "on" +#EndSection Section "Files" FontPath "/usr/X11R6/lib/X11/fonts/misc/:unscaled" @@ -51,7 +51,7 @@ Section "Monitor" EndSection Section "Device" - Identifier "Video Card (xrdpdev)" + Identifier "Video Card (xrdpdev)" Driver "xrdpdev" EndSection From 39b749e09d0b3958d015b1ab04de6068c763776b Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 13 Jul 2013 19:03:03 -0700 Subject: [PATCH 17/45] work on xorg driver --- xorg/server/module/Makefile | 9 +-- xorg/server/module/rdp.h | 3 + xorg/server/module/rdpCursor.c | 91 +++++++++++++++++++++++++++++ xorg/server/module/rdpCursor.h | 44 ++++++++++++++ xorg/server/module/rdpDraw.c | 59 +++++++++---------- xorg/server/module/rdpGC.c | 1 + xorg/server/module/rdpPri.c | 102 ++++++++++++++++++++++++++++++--- 7 files changed, 267 insertions(+), 42 deletions(-) create mode 100644 xorg/server/module/rdpCursor.c create mode 100644 xorg/server/module/rdpCursor.h diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index f2442c82..70df8e72 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -3,17 +3,18 @@ OBJS = rdpDraw.o rdpPri.o rdpGC.o rdpFillSpans.o rdpSetSpans.o rdpPutImage.o \ rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \ rdpPolyRectangle.o rdpPolyArc.o rdpFillPolygon.o rdpPolyFillRect.o \ rdpPolyFillArc.o rdpPolyText8.o rdpPolyText16.o rdpImageText8.o \ -rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o +rdpImageText16.o rdpImageGlyphBlt.o rdpPolyGlyphBlt.o rdpPushPixels.o \ +rdpCursor.o -CFLAGS = -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 +CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 LDFLAGS = LIBS = -all: xrdpdev_drv.so +all: libxorgxrdp.so -xrdpdev_drv.so: $(OBJS) Makefile +libxorgxrdp.so: $(OBJS) Makefile $(CC) -shared -o libxorgxrdp.so $(LDFLAGS) $(OBJS) $(LIBS) clean: diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h index c812e251..ea48a8ee 100644 --- a/xorg/server/module/rdp.h +++ b/xorg/server/module/rdp.h @@ -25,6 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include "rdpPri.h" @@ -46,6 +47,8 @@ struct _rdpRec DestroyPixmapProcPtr DestroyPixmap; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; + miPointerScreenFuncPtr pCursorFuncs; + }; typedef struct _rdpRec rdpRec; typedef struct _rdpRec * rdpPtr; diff --git a/xorg/server/module/rdpCursor.c b/xorg/server/module/rdpCursor.c new file mode 100644 index 00000000..82aafd78 --- /dev/null +++ b/xorg/server/module/rdpCursor.c @@ -0,0 +1,91 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +cursor + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include +#include +#include +#include + +#include "rdp.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +Bool +rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs) +{ + LLOGLN(0, ("rdpSpriteRealizeCursor:")); + return 1; +} + +/******************************************************************************/ +Bool +rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs) +{ + LLOGLN(0, ("rdpSpriteUnrealizeCursor:")); + return 1; +} + +/******************************************************************************/ +void +rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs, + int x, int y) +{ + LLOGLN(0, ("rdpSpriteSetCursor:")); +} + +/******************************************************************************/ +void +rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y) +{ + LLOGLN(0, ("rdpSpriteMoveCursor:")); +} + +/******************************************************************************/ +Bool +rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr) +{ + LLOGLN(0, ("rdpSpriteDeviceCursorInitialize:")); + return 1; +} + +/******************************************************************************/ +void +rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr) +{ + LLOGLN(0, ("rdpSpriteDeviceCursorCleanup:")); +} diff --git a/xorg/server/module/rdpCursor.h b/xorg/server/module/rdpCursor.h new file mode 100644 index 00000000..b847d842 --- /dev/null +++ b/xorg/server/module/rdpCursor.h @@ -0,0 +1,44 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +misc draw calls + +*/ + +#ifndef __RDPCURSOR_H +#define __RDPCURSOR_H + +#include +#include + +Bool +rdpSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs); +Bool +rdpSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs); +void +rdpSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScr, CursorPtr pCurs, + int x, int y); +void +rdpSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScr, int x, int y); +Bool +rdpSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr); +void +rdpSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr); + +#endif diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c index 9e989fe7..ff8fdb7f 100644 --- a/xorg/server/module/rdpDraw.c +++ b/xorg/server/module/rdpDraw.c @@ -61,10 +61,12 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, rdpPtr dev; PixmapPtr rv; + LLOGLN(10, ("rdpCreatePixmap: width %d height %d depth %d", + width, height, depth)); pScrn = xf86Screens[pScreen->myNum]; dev = XRDPPTR(pScrn); pScreen->CreatePixmap = dev->CreatePixmap; - rv = pScreen->CreatePixmap(pScreen, 0, 0, 0, 0); + rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint); pScreen->CreatePixmap = rdpCreatePixmap; return rv; } @@ -73,19 +75,19 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, Bool rdpDestroyPixmap(PixmapPtr pPixmap) { - Bool rv; - ScreenPtr pScreen; - rdpPtr dev; - ScrnInfoPtr pScrn; - - LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt)); - pScreen = pPixmap->drawable.pScreen; - pScrn = xf86Screens[pScreen->myNum]; - dev = XRDPPTR(pScrn); - pScreen->DestroyPixmap = dev->DestroyPixmap; - rv = pScreen->DestroyPixmap(pPixmap); - pScreen->DestroyPixmap = rdpDestroyPixmap; - return rv; + Bool rv; + ScreenPtr pScreen; + rdpPtr dev; + ScrnInfoPtr pScrn; + + LLOGLN(10, ("rdpDestroyPixmap: refcnt %d", pPixmap->refcnt)); + pScreen = pPixmap->drawable.pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + pScreen->DestroyPixmap = dev->DestroyPixmap; + rv = pScreen->DestroyPixmap(pPixmap); + pScreen->DestroyPixmap = rdpDestroyPixmap; + return rv; } /******************************************************************************/ @@ -93,19 +95,20 @@ Bool rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, pointer pPixData) { - Bool rv; - ScreenPtr pScreen; - rdpPtr dev; - ScrnInfoPtr pScrn; - - pScreen = pPixmap->drawable.pScreen; - pScrn = xf86Screens[pScreen->myNum]; - dev = XRDPPTR(pScrn); - pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader; - rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, - devKind, pPixData); - pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader; - return rv; + Bool rv; + ScreenPtr pScreen; + rdpPtr dev; + ScrnInfoPtr pScrn; + + LLOGLN(10, ("rdpModifyPixmapHeader:")); + pScreen = pPixmap->drawable.pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + pScreen->ModifyPixmapHeader = dev->ModifyPixmapHeader; + rv = pScreen->ModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, + devKind, pPixData); + pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader; + return rv; } /*****************************************************************************/ @@ -134,8 +137,6 @@ RDPSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) if (!initialised) { initialised = 1; - //xf86AddModuleInfo(&THINC, Module); - //LoaderRefSymLists(cursorSymbols, NULL); } return (pointer) 1; } diff --git a/xorg/server/module/rdpGC.c b/xorg/server/module/rdpGC.c index a7fe9ff5..3a585e2c 100644 --- a/xorg/server/module/rdpGC.c +++ b/xorg/server/module/rdpGC.c @@ -132,6 +132,7 @@ rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d) LLOGLN(10, ("rdpValidateGC:")); GC_FUNC_PROLOGUE(pGC); pGC->funcs->ValidateGC(pGC, changes, d); + priv->ops = pGC->ops; GC_FUNC_EPILOGUE(pGC); } diff --git a/xorg/server/module/rdpPri.c b/xorg/server/module/rdpPri.c index d8346fa9..6a10c59b 100644 --- a/xorg/server/module/rdpPri.c +++ b/xorg/server/module/rdpPri.c @@ -39,51 +39,135 @@ to deal with privates changing in xorg versions #include "rdpPri.h" +/* not sure if these versions are right */ +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((5) * 100000) + ((1) * 1000) + 0) +#define FBDEV_PRI 1 +#elif XORG_VERSION_CURRENT < (((1) * 10000000) + ((7) * 100000) + ((7) * 1000) + 1) +#define FBDEV_PRI 2 +#else +#define FBDEV_PRI 3 +#endif + +#define PTR2INT(_ptr) ((int) ((long) ((void*) (_ptr)))) +#define INT2PTR(_int) ((void *) ((long) ((int) (_int)))) + +#if FBDEV_PRI == 3 +static DevPrivateKeyRec g_privateKeyRecGC; +static DevPrivateKeyRec g_privateKeyRecPixmap; +static DevPrivateKeyRec g_privateKeyRecWindow; +#elif FBDEV_PRI == 2 +static int g_privateKeyRecGC = 0; +static int g_privateKeyRecPixmap = 0; +static int g_privateKeyRecWindow = 0; +#endif + /*****************************************************************************/ rdpDevPrivateKey rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes) { - return 0; + rdpDevPrivateKey rv; + +#if FBDEV_PRI == 1 + rv = INT2PTR(AllocateGCPrivateIndex()); + AllocateGCPrivate(pScreen, PTR2INT(rv), bytes); +#elif FBDEV_PRI == 2 + dixRequestPrivate(&g_privateKeyRecGC, bytes); + rv = &g_privateKeyRecGC; +#else + dixRegisterPrivateKey(&g_privateKeyRecGC, PRIVATE_GC, bytes); + rv = &g_privateKeyRecGC; +#endif + return rv; } /*****************************************************************************/ rdpDevPrivateKey rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes) { - return 0; + rdpDevPrivateKey rv; + +#if FBDEV_PRI == 1 + rv = INT2PTR(AllocatePixmapPrivateIndex()); + AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes); +#elif FBDEV_PRI == 2 + dixRequestPrivate(&g_privateKeyRecPixmap, bytes); + rv = &g_privateKeyRecPixmap; +#else + dixRegisterPrivateKey(&g_privateKeyRecPixmap, PRIVATE_PIXMAP, bytes); + rv = &g_privateKeyRecPixmap; +#endif + return rv; } /*****************************************************************************/ rdpDevPrivateKey rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes) { - return 0; + rdpDevPrivateKey rv; + +#if FBDEV_PRI == 1 + rv = INT2PTR(AllocateWindowPrivateIndex()); + AllocateWindowPrivate(pScreen, PTR2INT(rv), bytes); +#elif FBDEV_PRI == 2 + dixRequestPrivate(&g_privateKeyRecWindow, bytes); + rv = &g_privateKeyRecWindow; +#else + dixRegisterPrivateKey(&g_privateKeyRecWindow, PRIVATE_WINDOW, bytes); + rv = &g_privateKeyRecWindow; +#endif + return rv; } /*****************************************************************************/ -void* +void * rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key) { - return 0; + void *rv; + +#if FBDEV_PRI == 1 + rv = pGC->devPrivates[PTR2INT(key)].ptr; +#else + rv = dixLookupPrivate(&(pGC->devPrivates), key); +#endif + return rv; } /*****************************************************************************/ -void* +void * rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key) { - return 0; + void *rv; + +#if FBDEV_PRI == 1 + rv = pPixmap->devPrivates[PTR2INT(key)].ptr; +#else + rv = dixLookupPrivate(&(pPixmap->devPrivates), key); +#endif + return rv; } /*****************************************************************************/ -void* +void * rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key) { - return 0; + void *rv; + +#if FBDEV_PRI == 1 + rv = pWindow->devPrivates[PTR2INT(key)].ptr; +#else + rv = dixLookupPrivate(&(pWindow->devPrivates), key); +#endif + return rv; } /*****************************************************************************/ int rdpPrivateInit(void) { +#if FBDEV_PRI == 3 + memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC)); + memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow)); + memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap)); +#endif return 0; } From 0ff197f30c096e4fad52fd5722f0c40e012c42c7 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 13 Jul 2013 19:04:54 -0700 Subject: [PATCH 18/45] work on xorg driver --- xorg/server/readme.txt | 6 ++++- xorg/server/xrdpdev/Makefile | 2 +- xorg/server/xrdpdev/xrdpdev.c | 47 ++++++++++++++++++++++++----------- 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt index 3c607e85..a6041f4d 100644 --- a/xorg/server/readme.txt +++ b/xorg/server/readme.txt @@ -7,5 +7,9 @@ to run it create /etc/X11/xrdp copy xorg.conf into it -Xorg -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset :10 +copy xrdpdev_drv.so to /usr/lib/xorg/modules/drivers +copy libxorgxrdp.so to /usr/lib/xorg/modules + +strat xserver like this +Xorg -modulepath /usr/lib/xorg/modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -nohwaccess -ac :10 diff --git a/xorg/server/xrdpdev/Makefile b/xorg/server/xrdpdev/Makefile index 1c680268..0219959e 100644 --- a/xorg/server/xrdpdev/Makefile +++ b/xorg/server/xrdpdev/Makefile @@ -1,7 +1,7 @@ OBJS = xrdpdev.o -CFLAGS = -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module +CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module LDFLAGS = diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index 74c36a97..f4b2807a 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -41,6 +41,7 @@ This is the main driver file #include "rdpPri.h" #include "rdpDraw.h" #include "rdpGC.h" +#include "rdpCursor.h" #define XRDP_DRIVER_NAME "XRDPDEV" #define XRDP_NAME "XRDPDEV" @@ -144,6 +145,8 @@ rdpPreInit(ScrnInfoPtr pScrn, int flags) return 0; } + rdpPrivateInit(); + rdpAllocRec(pScrn); dev = XRDPPTR(pScrn); @@ -254,24 +257,22 @@ rdpPreInit(ScrnInfoPtr pScrn, int flags) return 1; } -#if 0 static miPointerSpriteFuncRec g_rdpSpritePointerFuncs = { - /* these are in viv_cur.c */ + /* these are in rdpCursor.c */ rdpSpriteRealizeCursor, rdpSpriteUnrealizeCursor, rdpSpriteSetCursor, rdpSpriteMoveCursor, - rdpDeviceCursorInitialize, - rdpDeviceCursorCleanup + rdpSpriteDeviceCursorInitialize, + rdpSpriteDeviceCursorCleanup }; -#endif /******************************************************************************/ static Bool rdpSaveScreen(ScreenPtr pScreen, int on) { - LLOGLN(10, ("rdpSaveScreen:")); + LLOGLN(0, ("rdpSaveScreen:")); return 1; } @@ -284,18 +285,18 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) VisualPtr vis; int vis_found; - rdpPrivateInit(); - pScrn = xf86Screens[scrnIndex]; dev = XRDPPTR(pScrn); + dev->pScreen = pScreen; + miClearVisualTypes(); miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, TrueColor); miSetPixmapDepths(); LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d", pScrn->virtualX, pScrn->virtualY)); - dev->ptr = malloc(1024 * 768 * 4); + dev->ptr = malloc(dev->width * dev->height * 4); if (!fbScreenInit(pScreen, dev->ptr, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) @@ -331,10 +332,16 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); xf86SetBackingStore(pScreen); +#if 1 /* hardware cursor */ - //dev->pCursorFuncs = xf86GetPointerScreenFuncs(); - //miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs, - // dev->pCursorFuncs, 0); + dev->pCursorFuncs = xf86GetPointerScreenFuncs(); + miPointerInitialize(pScreen, &g_rdpSpritePointerFuncs, + dev->pCursorFuncs, 0); +#else + /* software cursor */ + dev->pCursorFuncs = xf86GetPointerScreenFuncs(); + miDCInitialize(pScreen, dev->pCursorFuncs); +#endif fbCreateDefColormap(pScreen); @@ -358,7 +365,7 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } dev->privateKeyRecGC = rdpAllocateGCPrivate(pScreen, sizeof(rdpGCRec)); - dev->privateKeyRecPixmap =rdpAllocatePixmapPrivate(pScreen, sizeof(rdpPixmapRec)); + dev->privateKeyRecPixmap = rdpAllocatePixmapPrivate(pScreen, sizeof(rdpPixmapRec)); dev->CopyWindow = pScreen->CopyWindow; pScreen->CopyWindow = rdpCopyWindow; @@ -488,8 +495,18 @@ rdpAvailableOptions(int chipid, int busid) static Bool rdpDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) { - LLOGLN(0, ("rdpDriverFunc:")); - return 0; + xorgHWFlags *flags; + int rv; + + rv = 0; + LLOGLN(0, ("rdpDriverFunc: op %d", (int)op)); + if (op == GET_REQUIRED_HW_INTERFACES) + { + flags = (xorgHWFlags *) ptr; + *flags = HW_SKIP_CONSOLE; + rv = 1; + } + return rv; } /*****************************************************************************/ From 759d6f4d86b0f232c4823f5d2f1ca640cbad5824 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 13 Jul 2013 20:38:30 -0700 Subject: [PATCH 19/45] xorg, add keyboard driver --- xorg/server/xrdpkeyb/Makefile | 16 ++++++++++++++++ xorg/server/xrdpkeyb/rdpKeyboard.c | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 xorg/server/xrdpkeyb/Makefile create mode 100644 xorg/server/xrdpkeyb/rdpKeyboard.c diff --git a/xorg/server/xrdpkeyb/Makefile b/xorg/server/xrdpkeyb/Makefile new file mode 100644 index 00000000..c8654851 --- /dev/null +++ b/xorg/server/xrdpkeyb/Makefile @@ -0,0 +1,16 @@ + +OBJS = rdpKeyboard.o + +CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module + +LDFLAGS = + +LIBS = + +all: xrdpkeyb_drv.so + +xrdpkeyb_drv.so: $(OBJS) Makefile + $(CC) -shared -o xrdpkeyb_drv.so $(LDFLAGS) $(OBJS) $(LIBS) + +clean: + rm -f $(OBJS) xrdpkeyb_drv.so diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c new file mode 100644 index 00000000..fbf4eb1c --- /dev/null +++ b/xorg/server/xrdpkeyb/rdpKeyboard.c @@ -0,0 +1,22 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +xrdp keyboard module + +*/ From 18ed4097bf9391696ba49370a2ac5ad80a2dbe40 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 13 Jul 2013 20:39:03 -0700 Subject: [PATCH 20/45] xorg, add mouse driver --- xorg/server/xrdpmouse/Makefile | 16 ++++++++++++++++ xorg/server/xrdpmouse/rdpMouse.c | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 xorg/server/xrdpmouse/Makefile create mode 100644 xorg/server/xrdpmouse/rdpMouse.c diff --git a/xorg/server/xrdpmouse/Makefile b/xorg/server/xrdpmouse/Makefile new file mode 100644 index 00000000..dfcabc88 --- /dev/null +++ b/xorg/server/xrdpmouse/Makefile @@ -0,0 +1,16 @@ + +OBJS = rdpMouse.o + +CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 -I../module + +LDFLAGS = + +LIBS = + +all: xrdpmouse_drv.so + +xrdpmouse_drv.so: $(OBJS) Makefile + $(CC) -shared -o xrdpmouse_drv.so $(LDFLAGS) $(OBJS) $(LIBS) + +clean: + rm -f $(OBJS) xrdpmouse_drv.so diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c new file mode 100644 index 00000000..a6cbb0f2 --- /dev/null +++ b/xorg/server/xrdpmouse/rdpMouse.c @@ -0,0 +1,22 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +xrdp mouse module + +*/ From 90060a7d89e778aeaeb8f312a27a3c104ab852ee Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 13 Jul 2013 21:11:28 -0700 Subject: [PATCH 21/45] work on xorg driver --- xorg/server/module/Makefile | 2 +- xorg/server/module/rdpDraw.c | 41 ----------------------------------- xorg/server/readme.txt | 3 +++ xorg/server/xrdpdev/xorg.conf | 8 +++---- xorg/server/xrdpdev/xrdpdev.c | 6 ++--- 5 files changed, 11 insertions(+), 49 deletions(-) diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index 70df8e72..65ede6d0 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -4,7 +4,7 @@ rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \ 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 +rdpCursor.o rdpMain.o CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c index ff8fdb7f..6495bf4a 100644 --- a/xorg/server/module/rdpDraw.c +++ b/xorg/server/module/rdpDraw.c @@ -39,14 +39,6 @@ misc draw calls #include "rdp.h" -#define XRDP_DRIVER_NAME "XRDPDEV" -#define XRDP_NAME "XRDPDEV" -#define XRDP_VERSION 1000 - -#define PACKAGE_VERSION_MAJOR 1 -#define PACKAGE_VERSION_MINOR 0 -#define PACKAGE_VERSION_PATCHLEVEL 0 - /******************************************************************************/ #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ @@ -126,36 +118,3 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); dev->pScreen->CopyWindow = rdpCopyWindow; } - -/*****************************************************************************/ -static pointer -RDPSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) -{ - static int initialised = 0; - - LLOGLN(0, ("RDPSetup:")); - if (!initialised) - { - initialised = 1; - } - return (pointer) 1; -} - -static MODULESETUPPROTO(RDPSetup); -static XF86ModuleVersionInfo RDPVersRec = -{ - XRDP_DRIVER_NAME, - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - PACKAGE_VERSION_MAJOR, - PACKAGE_VERSION_MINOR, - PACKAGE_VERSION_PATCHLEVEL, - ABI_CLASS_VIDEODRV, - ABI_VIDEODRV_VERSION, - 0, - { 0, 0, 0, 0 } -}; - -XF86ModuleData xorgxrdpModuleData = { &RDPVersRec, RDPSetup, NULL }; diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt index a6041f4d..6fc3aca6 100644 --- a/xorg/server/readme.txt +++ b/xorg/server/readme.txt @@ -10,6 +10,9 @@ copy xorg.conf into it copy xrdpdev_drv.so to /usr/lib/xorg/modules/drivers copy libxorgxrdp.so to /usr/lib/xorg/modules +copy xrdpmouse_drv.so to /usr/lib/xorg/modules/input +copy xrdpkeyb_drv.so to /usr/lib/xorg/modules/input + strat xserver like this Xorg -modulepath /usr/lib/xorg/modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -nohwaccess -ac :10 diff --git a/xorg/server/xrdpdev/xorg.conf b/xorg/server/xrdpdev/xorg.conf index a44c92dd..2d6096fc 100644 --- a/xorg/server/xrdpdev/xorg.conf +++ b/xorg/server/xrdpdev/xorg.conf @@ -6,9 +6,9 @@ Section "ServerLayout" InputDevice "xrdpKeyboard" "CoreKeyboard" EndSection -#Section "ServerFlags" -# Option "DontVTSwitch" "on" -#EndSection +Section "ServerFlags" + Option "DontVTSwitch" "off" +EndSection Section "Files" FontPath "/usr/X11R6/lib/X11/fonts/misc/:unscaled" @@ -31,7 +31,7 @@ EndSection Section "InputDevice" Identifier "xrdpKeyboard" - Driver "xrdpkeyb" + Driver "xrdpkeyb" EndSection Section "InputDevice" diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index f4b2807a..ff00c0bd 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -531,9 +531,9 @@ _X_EXPORT DriverRec g_DriverRec = /*****************************************************************************/ static pointer -Setup(pointer module, pointer opts, int *errmaj, int *errmin) +xrdpdevSetup(pointer module, pointer opts, int *errmaj, int *errmin) { - LLOGLN(0, ("Setup:")); + LLOGLN(0, ("xrdpdevSetup:")); if (!g_setup_done) { g_setup_done = 1; @@ -554,6 +554,6 @@ Setup(pointer module, pointer opts, int *errmaj, int *errmin) _X_EXPORT XF86ModuleData xrdpdevModuleData = { &g_VersRec, - Setup, + xrdpdevSetup, 0 }; From be53b52102c02ffed43d89b082ecf7bf2e612416 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 13 Jul 2013 21:15:03 -0700 Subject: [PATCH 22/45] work on xorg driver --- xorg/server/module/rdpMain.c | 86 ++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 xorg/server/module/rdpMain.c diff --git a/xorg/server/module/rdpMain.c b/xorg/server/module/rdpMain.c new file mode 100644 index 00000000..9930764c --- /dev/null +++ b/xorg/server/module/rdpMain.c @@ -0,0 +1,86 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +rdp module main + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include +#include +#include +#include + +#include "rdp.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +#define XRDP_DRIVER_NAME "XORGXRDP" +#define XRDP_NAME "XORGXRDP" +#define XRDP_VERSION 1000 + +#define PACKAGE_VERSION_MAJOR 1 +#define PACKAGE_VERSION_MINOR 0 +#define PACKAGE_VERSION_PATCHLEVEL 0 + +static int g_initialised = 0; + +/*****************************************************************************/ +static pointer +xorgxrdpSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) +{ + LLOGLN(0, ("xorgxrdpSetup:")); + if (!g_initialised) + { + g_initialised = 1; + } + return (pointer) 1; +} + +static MODULESETUPPROTO(xorgxrdpSetup); +static XF86ModuleVersionInfo RDPVersRec = +{ + XRDP_DRIVER_NAME, + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + PACKAGE_VERSION_MAJOR, + PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + 0, + { 0, 0, 0, 0 } +}; + +XF86ModuleData xorgxrdpModuleData = { &RDPVersRec, xorgxrdpSetup, NULL }; From d53588b683a3d2ad4db43ff4564b31187d9455e6 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 14 Jul 2013 13:44:17 -0700 Subject: [PATCH 23/45] xorg driver, fix for older xorg-server and added some notes --- xorg/server/readme.txt | 8 ++++++++ xorg/server/xrdpdev/xrdpdev.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt index 6fc3aca6..11e81e1e 100644 --- a/xorg/server/readme.txt +++ b/xorg/server/readme.txt @@ -16,3 +16,11 @@ copy xrdpkeyb_drv.so to /usr/lib/xorg/modules/input strat xserver like this Xorg -modulepath /usr/lib/xorg/modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -nohwaccess -ac :10 +older Xorg don't have -nohwaccess so you need to run Xorg as root +or do something like this. + +sudo rm /dev/tty0 +sudo mknod -m 666 /dev/vc/7 c 7 7 + +sudo mkdir /dev/vc/ +sudo mknod -m 666 /dev/tty0 c 4 0 \ No newline at end of file diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index ff00c0bd..e68b6cb5 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -491,6 +491,10 @@ rdpAvailableOptions(int chipid, int busid) return 0; } +#ifndef HW_SKIP_CONSOLE +#define HW_SKIP_CONSOLE 4 +#endif + /*****************************************************************************/ static Bool rdpDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) From 720751ae360bfbf16b1e11dcffc0e2d5cce4540b Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 14 Jul 2013 20:47:52 -0700 Subject: [PATCH 24/45] work on Xorg keyboard and mouse drivers --- xorg/server/xrdpdev/xorg.conf | 3 +- xorg/server/xrdpkeyb/rdpKeyboard.c | 114 ++++++++++++++ xorg/server/xrdpmouse/rdpMouse.c | 241 +++++++++++++++++++++++++++++ 3 files changed, 357 insertions(+), 1 deletion(-) diff --git a/xorg/server/xrdpdev/xorg.conf b/xorg/server/xrdpdev/xorg.conf index 2d6096fc..1c9d7cfc 100644 --- a/xorg/server/xrdpdev/xorg.conf +++ b/xorg/server/xrdpdev/xorg.conf @@ -7,7 +7,8 @@ Section "ServerLayout" EndSection Section "ServerFlags" - Option "DontVTSwitch" "off" + Option "DontVTSwitch" "on" + Option "AutoAddDevices" "off" EndSection Section "Files" diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c index fbf4eb1c..88bcf680 100644 --- a/xorg/server/xrdpkeyb/rdpKeyboard.c +++ b/xorg/server/xrdpkeyb/rdpKeyboard.c @@ -20,3 +20,117 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. xrdp keyboard module */ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include "xf86Xinput.h" + +#include +#include +#include +#include + +#include "rdp.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +#define XRDP_DRIVER_NAME "XRDPKEYB" +#define XRDP_NAME "XRDPKEYB" +#define XRDP_VERSION 1000 + +#define PACKAGE_VERSION_MAJOR 1 +#define PACKAGE_VERSION_MINOR 0 +#define PACKAGE_VERSION_PATCHLEVEL 0 + +/******************************************************************************/ +static int +rdpKeybControl(DeviceIntPtr device, int what) +{ + LLOGLN(0, ("rdpKeybControl: what %d", what)); + return 0; +} + +/******************************************************************************/ +static int +rdpkeybPreInit(InputDriverPtr drv, InputInfoPtr info, int flags) +{ + LLOGLN(0, ("rdpkeybPreInit: drv %p info %p, flags 0x%x", + drv, info, flags)); + info->device_control = rdpKeybControl; + info->type_name = "Keyboard"; + + return 0; +} + +/******************************************************************************/ +static void +rdpkeybUnInit(InputDriverPtr drv, InputInfoPtr info, int flags) +{ + LLOGLN(0, ("rdpkeybUnInit: drv %p info %p, flags 0x%x", + drv, info, flags)); +} + +/******************************************************************************/ +static InputDriverRec rdpkeyb = +{ + PACKAGE_VERSION_MAJOR, /* version */ + XRDP_NAME, /* name */ + NULL, /* identify */ + rdpkeybPreInit, /* preinit */ + rdpkeybUnInit, /* uninit */ + NULL, /* module */ + 0 /* ref count */ +}; + +/******************************************************************************/ +static void +rdpkeybUnplug(pointer p) +{ + LLOGLN(0, ("rdpkeybUnplug:")); +} + +/******************************************************************************/ +static pointer +rdpkeybPlug(pointer module, pointer options, int *errmaj, int *errmin) +{ + LLOGLN(0, ("rdpkeybPlug:")); + xf86AddInputDriver(&rdpkeyb, module, 0); + return module; +} + +/******************************************************************************/ +static XF86ModuleVersionInfo rdpkeybVersionRec = +{ + XRDP_DRIVER_NAME, + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + PACKAGE_VERSION_MAJOR, + PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_PATCHLEVEL, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + { 0, 0, 0, 0 } +}; + +/******************************************************************************/ +XF86ModuleData xrdpkeybModuleData = +{ + &rdpkeybVersionRec, + rdpkeybPlug, + rdpkeybUnplug +}; diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c index a6cbb0f2..a444ea55 100644 --- a/xorg/server/xrdpmouse/rdpMouse.c +++ b/xorg/server/xrdpmouse/rdpMouse.c @@ -20,3 +20,244 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. xrdp mouse module */ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include "xf86Xinput.h" + +#include +#include +#include +#include +#include +#include + +#include "rdp.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +#define XRDP_DRIVER_NAME "XRDPMOUSE" +#define XRDP_NAME "XRDPMOUSE" +#define XRDP_VERSION 1000 + +#define PACKAGE_VERSION_MAJOR 1 +#define PACKAGE_VERSION_MINOR 0 +#define PACKAGE_VERSION_PATCHLEVEL 0 + +/******************************************************************************/ +static void +rdpMouseDeviceInit(void) +{ + LLOGLN(0, ("rdpMouseDeviceInit:")); +} + +/******************************************************************************/ +static void +rdpMouseDeviceOn(DeviceIntPtr pDev) +{ + LLOGLN(0, ("rdpMouseDeviceOn:")); +} + +/******************************************************************************/ +static void +rdpMouseDeviceOff(void) +{ + LLOGLN(0, ("rdpMouseDeviceOff:")); +} + +/******************************************************************************/ +static void +rdpMouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl) +{ + LLOGLN(0, ("rdpMouseCtrl:")); +} + +/******************************************************************************/ +static int +rdpMouseControl(DeviceIntPtr device, int what) +{ + BYTE map[6]; + DevicePtr pDev; + Atom btn_labels[6]; + Atom axes_labels[2]; + + LLOGLN(0, ("rdpMouseControl: what %d", what)); + pDev = (DevicePtr)device; + + switch (what) + { + case DEVICE_INIT: + rdpMouseDeviceInit(); + map[0] = 0; + map[1] = 1; + map[2] = 2; + map[3] = 3; + map[4] = 4; + map[5] = 5; + + btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); + btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); + btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); + btn_labels[3] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_UP); + btn_labels[4] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_WHEEL_DOWN); + + axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); + axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); + + InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpMouseCtrl, + GetMotionHistorySize(), 2, axes_labels); + + break; + case DEVICE_ON: + pDev->on = 1; + rdpMouseDeviceOn(device); + break; + case DEVICE_OFF: + pDev->on = 0; + rdpMouseDeviceOff(); + break; + case DEVICE_CLOSE: + + if (pDev->on) + { + rdpMouseDeviceOff(); + } + + break; + } + + return Success; +} + +/******************************************************************************/ +static void +rdpMouseReadInput(struct _InputInfoRec *local) +{ + LLOGLN(0, ("rdpMouseReadInput:")); +} + +/******************************************************************************/ +static int +rdpMouseControlProc(struct _InputInfoRec *local, xDeviceCtl *control) +{ + LLOGLN(0, ("rdpMouseControlProc:")); + return 0; +} + +/******************************************************************************/ +static int +rdpMouseSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) +{ + LLOGLN(0, ("rdpMouseSwitchMode:")); + return 0; +} + +/******************************************************************************/ +static int +rdpMouseSetDeviceValuators(struct _InputInfoRec *local, + int *valuators, int first_valuator, + int num_valuators) +{ + LLOGLN(0, ("rdpMouseSetDeviceValuators:")); + return 0; +} + +/******************************************************************************/ +static int +rdpmousePreInit(InputDriverPtr drv, InputInfoPtr info, int flags) +{ + //MouseDevPtr pMse; + + LLOGLN(0, ("rdpmousePreInit: drv %p info %p, flags 0x%x", + drv, info, flags)); + info->device_control = rdpMouseControl; + info->read_input = rdpMouseReadInput; + info->control_proc = rdpMouseControlProc; + info->switch_mode = rdpMouseSwitchMode; + info->set_device_valuators = rdpMouseSetDeviceValuators; + //info->fd = -1; + //LLOGLN(0, ("%p", info->dev)); + //LLOGLN(0, ("rdpmousePreInit: info->flags 0x%x", info->flags)); + //info->flags |= 0x40 | 0x08 | 0x02 | 0x10;; + //LLOGLN(0, ("rdpmousePreInit: info->flags 0x%x", info->flags)); + //LLOGLN(0, ("rdpmousePreInit: %s %s %s", info->type_name, info->name, info->driver)); + info->type_name = "Mouse"; + //info->driver = "xrdpmouse"; + + //xf86AddEnabledDevice(info); + + return 0; +} + +/******************************************************************************/ +static void +rdpmouseUnInit(InputDriverPtr drv, InputInfoPtr info, int flags) +{ + LLOGLN(0, ("rdpmouseUnInit: drv %p info %p, flags 0x%x", + drv, info, flags)); +} + +/******************************************************************************/ +static InputDriverRec rdpmouse = +{ + PACKAGE_VERSION_MAJOR, /* version */ + XRDP_NAME, /* name */ + NULL, /* identify */ + rdpmousePreInit, /* preinit */ + rdpmouseUnInit, /* uninit */ + NULL, /* module */ + 0 /* ref count */ +}; + +/******************************************************************************/ +static void +rdpmouseUnplug(pointer p) +{ + LLOGLN(0, ("rdpmouseUnplug:")); +} + +/******************************************************************************/ +static pointer +rdpmousePlug(pointer module, pointer options, int *errmaj, int *errmin) +{ + LLOGLN(0, ("rdpmousePlug:")); + xf86AddInputDriver(&rdpmouse, module, 0); + return module; +} + +/******************************************************************************/ +static XF86ModuleVersionInfo rdpmouseVersionRec = +{ + XRDP_DRIVER_NAME, + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + PACKAGE_VERSION_MAJOR, + PACKAGE_VERSION_MINOR, + PACKAGE_VERSION_PATCHLEVEL, + ABI_CLASS_XINPUT, + ABI_XINPUT_VERSION, + MOD_CLASS_XINPUT, + { 0, 0, 0, 0 } +}; + +/******************************************************************************/ +XF86ModuleData xrdpmouseModuleData = +{ + &rdpmouseVersionRec, + rdpmousePlug, + rdpmouseUnplug +}; From 74861acfa2f6ce4cdaa5069d47ce30c00ce03bce Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 14 Jul 2013 23:58:33 -0700 Subject: [PATCH 25/45] work on Xorg keyboard and mouse drivers --- xorg/server/xrdpkeyb/rdpKeyboard.c | 303 ++++++++++++++++++++++++++++- xorg/server/xrdpmouse/rdpMouse.c | 12 -- 2 files changed, 302 insertions(+), 13 deletions(-) diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c index 88bcf680..33c89ee9 100644 --- a/xorg/server/xrdpkeyb/rdpKeyboard.c +++ b/xorg/server/xrdpkeyb/rdpKeyboard.c @@ -39,6 +39,8 @@ xrdp keyboard module #include #include +#include "X11/keysym.h" + #include "rdp.h" /******************************************************************************/ @@ -54,12 +56,311 @@ xrdp keyboard module #define PACKAGE_VERSION_MINOR 0 #define PACKAGE_VERSION_PATCHLEVEL 0 +#define MIN_KEY_CODE 8 +#define MAX_KEY_CODE 255 +#define NO_OF_KEYS ((MAX_KEY_CODE - MIN_KEY_CODE) + 1) +#define GLYPHS_PER_KEY 2 +/* control */ +#define CONTROL_L_KEY_CODE 37 +#define CONTROL_R_KEY_CODE 109 +/* shift */ +#define SHIFT_L_KEY_CODE 50 +#define SHIFT_R_KEY_CODE 62 +/* win keys */ +#define SUPER_L_KEY_CODE 115 +#define SUPER_R_KEY_CODE 116 +/* alt */ +#define ALT_L_KEY_CODE 64 +#define ALT_R_KEY_CODE 113 +/* caps lock */ +#define CAPS_LOCK_KEY_CODE 66 +/* num lock */ +#define NUM_LOCK_KEY_CODE 77 + +#define N_PREDEFINED_KEYS \ + (sizeof(g_kbdMap) / (sizeof(KeySym) * GLYPHS_PER_KEY)) + +static DeviceIntPtr g_keyboard = 0; +static OsTimerPtr g_timer = 0; + +static KeySym g_kbdMap[] = +{ + NoSymbol, NoSymbol, /* 8 */ + XK_Escape, NoSymbol, /* 9 */ + XK_1, XK_exclam, /* 10 */ + XK_2, XK_at, + XK_3, XK_numbersign, + XK_4, XK_dollar, + XK_5, XK_percent, + XK_6, XK_asciicircum, + XK_7, XK_ampersand, + XK_8, XK_asterisk, + XK_9, XK_parenleft, + XK_0, XK_parenright, + XK_minus, XK_underscore, /* 20 */ + XK_equal, XK_plus, + XK_BackSpace, NoSymbol, + XK_Tab, XK_ISO_Left_Tab, + XK_Q, NoSymbol, + XK_W, NoSymbol, + XK_E, NoSymbol, + XK_R, NoSymbol, + XK_T, NoSymbol, + XK_Y, NoSymbol, + XK_U, NoSymbol, /* 30 */ + XK_I, NoSymbol, + XK_O, NoSymbol, + XK_P, NoSymbol, + XK_bracketleft, XK_braceleft, + XK_bracketright, XK_braceright, + XK_Return, NoSymbol, + XK_Control_L, NoSymbol, + XK_A, NoSymbol, + XK_S, NoSymbol, + XK_D, NoSymbol, /* 40 */ + XK_F, NoSymbol, + XK_G, NoSymbol, + XK_H, NoSymbol, + XK_J, NoSymbol, + XK_K, NoSymbol, + XK_L, NoSymbol, + XK_semicolon, XK_colon, + XK_apostrophe, XK_quotedbl, + XK_grave, XK_asciitilde, + XK_Shift_L, NoSymbol, /* 50 */ + XK_backslash, XK_bar, + XK_Z, NoSymbol, + XK_X, NoSymbol, + XK_C, NoSymbol, + XK_V, NoSymbol, + XK_B, NoSymbol, + XK_N, NoSymbol, + XK_M, NoSymbol, + XK_comma, XK_less, + XK_period, XK_greater, /* 60 */ + XK_slash, XK_question, + XK_Shift_R, NoSymbol, + XK_KP_Multiply, NoSymbol, + XK_Alt_L, NoSymbol, + XK_space, NoSymbol, + XK_Caps_Lock, NoSymbol, + XK_F1, NoSymbol, + XK_F2, NoSymbol, + XK_F3, NoSymbol, + XK_F4, NoSymbol, /* 70 */ + XK_F5, NoSymbol, + XK_F6, NoSymbol, + XK_F7, NoSymbol, + XK_F8, NoSymbol, + XK_F9, NoSymbol, + XK_F10, NoSymbol, + XK_Num_Lock, NoSymbol, + XK_Scroll_Lock, NoSymbol, + XK_KP_Home, XK_KP_7, + XK_KP_Up, XK_KP_8, /* 80 */ + XK_KP_Prior, XK_KP_9, + XK_KP_Subtract, NoSymbol, + XK_KP_Left, XK_KP_4, + XK_KP_Begin, XK_KP_5, + XK_KP_Right, XK_KP_6, + XK_KP_Add, NoSymbol, + XK_KP_End, XK_KP_1, + XK_KP_Down, XK_KP_2, + XK_KP_Next, XK_KP_3, + XK_KP_Insert, XK_KP_0, /* 90 */ + XK_KP_Delete, XK_KP_Decimal, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + XK_F11, NoSymbol, + XK_F12, NoSymbol, + XK_Home, NoSymbol, + XK_Up, NoSymbol, + XK_Prior, NoSymbol, + XK_Left, NoSymbol, /* 100 */ + XK_Print, NoSymbol, + XK_Right, NoSymbol, + XK_End, NoSymbol, + XK_Down, NoSymbol, + XK_Next, NoSymbol, + XK_Insert, NoSymbol, + XK_Delete, NoSymbol, + XK_KP_Enter, NoSymbol, + XK_Control_R, NoSymbol, + XK_Pause, NoSymbol, /* 110 */ + XK_Print, NoSymbol, + XK_KP_Divide, NoSymbol, + XK_Alt_R, NoSymbol, + NoSymbol, NoSymbol, + XK_Super_L, NoSymbol, + XK_Super_R, NoSymbol, + XK_Menu, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, + NoSymbol, NoSymbol, /* 120 */ + NoSymbol, NoSymbol +}; + +/******************************************************************************/ +static void +rdpEnqueueKey(int type, int scancode) +{ + int i; + int n; + EventListPtr rdp_events; + xEvent *pev; + + i = GetEventList(&rdp_events); + LLOGLN(0, ("rdpEnqueueKey: i %d g_keyboard %p %p", i, g_keyboard, rdp_events)); + n = GetKeyboardEvents(rdp_events, g_keyboard, type, scancode); + LLOGLN(0, ("rdpEnqueueKey: n %d", n)); + for (i = 0; i < n; i++) + { + pev = (rdp_events + i)->event; + mieqEnqueue(g_keyboard, (InternalEvent *)pev); + } +} + +#if 0 +/******************************************************************************/ +static CARD32 +rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) +{ + LLOGLN(0, ("rdpDeferredUpdateCallback:")); + + rdpEnqueueKey(KeyPress, 115); + rdpEnqueueKey(KeyRelease, 115); + + //xf86PostKeyboardEvent(g_keyboard, 9, 1); + //xf86PostKeyboardEvent(g_keyboard, 9, 0); + + g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); + return 0; +} +#endif + +/******************************************************************************/ +void +rdpKeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) +{ + int i; + + LLOGLN(0, ("rdpKeybDeviceInit:")); + LLOGLN(10, (" MAP_LENGTH %d GLYPHS_PER_KEY %d N_PREDEFINED_KEYS %d", + MAP_LENGTH, GLYPHS_PER_KEY, N_PREDEFINED_KEYS)); + + for (i = 0; i < MAP_LENGTH; i++) + { + pModMap[i] = NoSymbol; + } + + pModMap[SHIFT_L_KEY_CODE] = ShiftMask; + pModMap[SHIFT_R_KEY_CODE] = ShiftMask; + pModMap[CAPS_LOCK_KEY_CODE] = LockMask; + pModMap[CONTROL_L_KEY_CODE] = ControlMask; + pModMap[CONTROL_R_KEY_CODE] = ControlMask; + pModMap[ALT_L_KEY_CODE] = Mod1Mask; + pModMap[ALT_R_KEY_CODE] = Mod1Mask; + pModMap[NUM_LOCK_KEY_CODE] = Mod2Mask; + pModMap[SUPER_L_KEY_CODE] = Mod4Mask; + pModMap[SUPER_R_KEY_CODE] = Mod4Mask; + pKeySyms->minKeyCode = MIN_KEY_CODE; + pKeySyms->maxKeyCode = MAX_KEY_CODE; + pKeySyms->mapWidth = GLYPHS_PER_KEY; + i = sizeof(KeySym) * MAP_LENGTH * GLYPHS_PER_KEY; + pKeySyms->map = (KeySym *)malloc(i); + if (pKeySyms->map == 0) + { + LLOGLN(0, ("rdpKeybDeviceInit: malloc failed")); + exit(1); + } + else + { + memset(pKeySyms->map, 0, i); + } + + for (i = 0; i < MAP_LENGTH * GLYPHS_PER_KEY; i++) + { + pKeySyms->map[i] = NoSymbol; + } + + for (i = 0; i < N_PREDEFINED_KEYS * GLYPHS_PER_KEY; i++) + { + pKeySyms->map[i] = g_kbdMap[i]; + } +} + +/******************************************************************************/ +static void +rdpKeybDeviceOn(void) +{ + LLOGLN(0, ("rdpKeybDeviceOn:")); +} + +/******************************************************************************/ +static void +rdpKeybDeviceOff(void) +{ + LLOGLN(0, ("rdpKeybDeviceOff:")); +} + +/******************************************************************************/ +static void +rdpKeybBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) +{ + LLOGLN(0, ("rdpKeybBell:")); +} + +/******************************************************************************/ +static void +rdpKeybChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) +{ + LLOGLN(0, ("rdpKeybChangeKeyboardControl:")); +} + /******************************************************************************/ static int rdpKeybControl(DeviceIntPtr device, int what) { + KeySymsRec keySyms; + CARD8 modMap[MAP_LENGTH]; + DevicePtr pDev; + XkbRMLVOSet set; + LLOGLN(0, ("rdpKeybControl: what %d", what)); - return 0; + pDev = (DevicePtr)device; + + switch (what) + { + case DEVICE_INIT: + rdpKeybDeviceInit(device, &keySyms, modMap); + memset(&set, 0, sizeof(set)); + set.rules = "base"; + set.model = "pc104"; + set.layout = "us"; + set.variant = ""; + set.options = ""; + InitKeyboardDeviceStruct(device, &set, rdpKeybBell, + rdpKeybChangeKeyboardControl); + g_keyboard = device; + //g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); + break; + case DEVICE_ON: + pDev->on = 1; + rdpKeybDeviceOn(); + break; + case DEVICE_OFF: + pDev->on = 0; + rdpKeybDeviceOff(); + break; + case DEVICE_CLOSE: + if (pDev->on) + { + rdpKeybDeviceOff(); + } + break; + } + return Success; } /******************************************************************************/ diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c index a444ea55..b5fdd0e7 100644 --- a/xorg/server/xrdpmouse/rdpMouse.c +++ b/xorg/server/xrdpmouse/rdpMouse.c @@ -178,8 +178,6 @@ rdpMouseSetDeviceValuators(struct _InputInfoRec *local, static int rdpmousePreInit(InputDriverPtr drv, InputInfoPtr info, int flags) { - //MouseDevPtr pMse; - LLOGLN(0, ("rdpmousePreInit: drv %p info %p, flags 0x%x", drv, info, flags)); info->device_control = rdpMouseControl; @@ -187,17 +185,7 @@ rdpmousePreInit(InputDriverPtr drv, InputInfoPtr info, int flags) info->control_proc = rdpMouseControlProc; info->switch_mode = rdpMouseSwitchMode; info->set_device_valuators = rdpMouseSetDeviceValuators; - //info->fd = -1; - //LLOGLN(0, ("%p", info->dev)); - //LLOGLN(0, ("rdpmousePreInit: info->flags 0x%x", info->flags)); - //info->flags |= 0x40 | 0x08 | 0x02 | 0x10;; - //LLOGLN(0, ("rdpmousePreInit: info->flags 0x%x", info->flags)); - //LLOGLN(0, ("rdpmousePreInit: %s %s %s", info->type_name, info->name, info->driver)); info->type_name = "Mouse"; - //info->driver = "xrdpmouse"; - - //xf86AddEnabledDevice(info); - return 0; } From 52266913bd634abafcdc3e02aad9903da9139697 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 16 Jul 2013 00:46:07 -0700 Subject: [PATCH 26/45] xorg driver, mouse, keybaord working in 1.7.0 and newer xorg --- xorg/server/readme.txt | 26 +++++++- xorg/server/xrdpkeyb/rdpKeyboard.c | 100 ++++++++++++++++++----------- xorg/server/xrdpmouse/rdpMouse.c | 87 ++++++++++++------------- 3 files changed, 127 insertions(+), 86 deletions(-) diff --git a/xorg/server/readme.txt b/xorg/server/readme.txt index 11e81e1e..1207efda 100644 --- a/xorg/server/readme.txt +++ b/xorg/server/readme.txt @@ -13,14 +13,34 @@ copy libxorgxrdp.so to /usr/lib/xorg/modules copy xrdpmouse_drv.so to /usr/lib/xorg/modules/input copy xrdpkeyb_drv.so to /usr/lib/xorg/modules/input -strat xserver like this +start xserver like this Xorg -modulepath /usr/lib/xorg/modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -nohwaccess -ac :10 +or this on older Xorg but need /dev/vc/ thing below +Xorg -modulepath /home/jay/xorg-modules -config xrdp/xorg.conf -logfile /tmp/Xjay.log -novtswitch -sharevts -noreset -ac vt7 :10 older Xorg don't have -nohwaccess so you need to run Xorg as root or do something like this. sudo rm /dev/tty0 -sudo mknod -m 666 /dev/vc/7 c 7 7 +sudo mknod -m 666 /dev/tty0 c 4 0 sudo mkdir /dev/vc/ -sudo mknod -m 666 /dev/tty0 c 4 0 \ No newline at end of file +sudo mknod -m 666 /dev/vc/7 c 7 7 + +--modules + libfb.so + libint10.so + libvbe.so + libxorgxrdp.so +----drivers + xrdpdev_drv.so +----extensions + libdbe.so + libdri.so + libdri2.so + libextmod.so + libglx.so + librecord.so +----input + xrdpkeyb_drv.so + xrdpmouse_drv.so diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c index 33c89ee9..ac7d284d 100644 --- a/xorg/server/xrdpkeyb/rdpKeyboard.c +++ b/xorg/server/xrdpkeyb/rdpKeyboard.c @@ -205,23 +205,17 @@ static KeySym g_kbdMap[] = static void rdpEnqueueKey(int type, int scancode) { - int i; - int n; - EventListPtr rdp_events; - xEvent *pev; - - i = GetEventList(&rdp_events); - LLOGLN(0, ("rdpEnqueueKey: i %d g_keyboard %p %p", i, g_keyboard, rdp_events)); - n = GetKeyboardEvents(rdp_events, g_keyboard, type, scancode); - LLOGLN(0, ("rdpEnqueueKey: n %d", n)); - for (i = 0; i < n; i++) + if (type == KeyPress) + { + xf86PostKeyboardEvent(g_keyboard, scancode, 1); + } + else { - pev = (rdp_events + i)->event; - mieqEnqueue(g_keyboard, (InternalEvent *)pev); + xf86PostKeyboardEvent(g_keyboard, scancode, 0); } } -#if 0 +#if 1 /******************************************************************************/ static CARD32 rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) @@ -231,8 +225,8 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) rdpEnqueueKey(KeyPress, 115); rdpEnqueueKey(KeyRelease, 115); - //xf86PostKeyboardEvent(g_keyboard, 9, 1); - //xf86PostKeyboardEvent(g_keyboard, 9, 0); + //xf86PostKeyboardEvent(g_keyboard, 115, 1); + //xf86PostKeyboardEvent(g_keyboard, 115, 0); g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); return 0; @@ -241,13 +235,13 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) /******************************************************************************/ void -rdpKeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) +rdpkeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) { int i; - LLOGLN(0, ("rdpKeybDeviceInit:")); + LLOGLN(0, ("rdpkeybDeviceInit:")); LLOGLN(10, (" MAP_LENGTH %d GLYPHS_PER_KEY %d N_PREDEFINED_KEYS %d", - MAP_LENGTH, GLYPHS_PER_KEY, N_PREDEFINED_KEYS)); + MAP_LENGTH, GLYPHS_PER_KEY, (int) N_PREDEFINED_KEYS)); for (i = 0; i < MAP_LENGTH; i++) { @@ -271,7 +265,7 @@ rdpKeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) pKeySyms->map = (KeySym *)malloc(i); if (pKeySyms->map == 0) { - LLOGLN(0, ("rdpKeybDeviceInit: malloc failed")); + LLOGLN(0, ("rdpkeybDeviceInit: malloc failed")); exit(1); } else @@ -292,89 +286,121 @@ rdpKeybDeviceInit(DeviceIntPtr pDevice, KeySymsPtr pKeySyms, CARD8 *pModMap) /******************************************************************************/ static void -rdpKeybDeviceOn(void) +rdpkeybDeviceOn(void) { - LLOGLN(0, ("rdpKeybDeviceOn:")); + LLOGLN(0, ("rdpkeybDeviceOn:")); } /******************************************************************************/ static void -rdpKeybDeviceOff(void) +rdpkeybDeviceOff(void) { - LLOGLN(0, ("rdpKeybDeviceOff:")); + LLOGLN(0, ("rdpkeybDeviceOff:")); } /******************************************************************************/ static void -rdpKeybBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) +rdpkeybBell(int volume, DeviceIntPtr pDev, pointer ctrl, int cls) { - LLOGLN(0, ("rdpKeybBell:")); + LLOGLN(0, ("rdpkeybBell:")); } /******************************************************************************/ static void -rdpKeybChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) +rdpkeybChangeKeyboardControl(DeviceIntPtr pDev, KeybdCtrl *ctrl) { - LLOGLN(0, ("rdpKeybChangeKeyboardControl:")); + LLOGLN(0, ("rdpkeybChangeKeyboardControl:")); } /******************************************************************************/ static int -rdpKeybControl(DeviceIntPtr device, int what) +rdpkeybControl(DeviceIntPtr device, int what) { KeySymsRec keySyms; CARD8 modMap[MAP_LENGTH]; DevicePtr pDev; XkbRMLVOSet set; - LLOGLN(0, ("rdpKeybControl: what %d", what)); + LLOGLN(0, ("rdpkeybControl: what %d", what)); pDev = (DevicePtr)device; switch (what) { case DEVICE_INIT: - rdpKeybDeviceInit(device, &keySyms, modMap); + rdpkeybDeviceInit(device, &keySyms, modMap); memset(&set, 0, sizeof(set)); set.rules = "base"; set.model = "pc104"; set.layout = "us"; set.variant = ""; set.options = ""; - InitKeyboardDeviceStruct(device, &set, rdpKeybBell, - rdpKeybChangeKeyboardControl); + InitKeyboardDeviceStruct(device, &set, rdpkeybBell, + rdpkeybChangeKeyboardControl); g_keyboard = device; - //g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); + g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); break; case DEVICE_ON: pDev->on = 1; - rdpKeybDeviceOn(); + rdpkeybDeviceOn(); break; case DEVICE_OFF: pDev->on = 0; - rdpKeybDeviceOff(); + rdpkeybDeviceOff(); break; case DEVICE_CLOSE: if (pDev->on) { - rdpKeybDeviceOff(); + rdpkeybDeviceOff(); } break; } return Success; } +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1) + +/* debian 6 + ubuntu 10.04 */ + +/******************************************************************************/ +static InputInfoPtr +rdpkeybPreInit(InputDriverPtr drv, IDevPtr dev, int flags) +{ + InputInfoPtr info; + + LLOGLN(0, ("rdpkeybPreInit: drv %p dev %p, flags 0x%x", + drv, dev, flags)); + info = xf86AllocateInput(drv, 0); + info->name = dev->identifier; + info->device_control = rdpkeybControl; + info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS | + XI86_CORE_KEYBOARD | XI86_KEYBOARD_CAPABLE; + info->type_name = "Keyboard"; + info->fd = -1; + info->conf_idev = dev; + + return info; +} + +#else + +/* debian 7 + ubuntu 12.04 */ + /******************************************************************************/ static int rdpkeybPreInit(InputDriverPtr drv, InputInfoPtr info, int flags) { LLOGLN(0, ("rdpkeybPreInit: drv %p info %p, flags 0x%x", drv, info, flags)); - info->device_control = rdpKeybControl; + info->device_control = rdpkeybControl; info->type_name = "Keyboard"; return 0; } +#endif + /******************************************************************************/ static void rdpkeybUnInit(InputDriverPtr drv, InputInfoPtr info, int flags) diff --git a/xorg/server/xrdpmouse/rdpMouse.c b/xorg/server/xrdpmouse/rdpMouse.c index b5fdd0e7..7142a4ee 100644 --- a/xorg/server/xrdpmouse/rdpMouse.c +++ b/xorg/server/xrdpmouse/rdpMouse.c @@ -58,48 +58,48 @@ xrdp mouse module /******************************************************************************/ static void -rdpMouseDeviceInit(void) +rdpmouseDeviceInit(void) { - LLOGLN(0, ("rdpMouseDeviceInit:")); + LLOGLN(0, ("rdpmouseDeviceInit:")); } /******************************************************************************/ static void -rdpMouseDeviceOn(DeviceIntPtr pDev) +rdpmouseDeviceOn(DeviceIntPtr pDev) { - LLOGLN(0, ("rdpMouseDeviceOn:")); + LLOGLN(0, ("rdpmouseDeviceOn:")); } /******************************************************************************/ static void -rdpMouseDeviceOff(void) +rdpmouseDeviceOff(void) { - LLOGLN(0, ("rdpMouseDeviceOff:")); + LLOGLN(0, ("rdpmouseDeviceOff:")); } /******************************************************************************/ static void -rdpMouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl) +rdpmouseCtrl(DeviceIntPtr pDevice, PtrCtrl *pCtrl) { - LLOGLN(0, ("rdpMouseCtrl:")); + LLOGLN(0, ("rdpmouseCtrl:")); } /******************************************************************************/ static int -rdpMouseControl(DeviceIntPtr device, int what) +rdpmouseControl(DeviceIntPtr device, int what) { BYTE map[6]; DevicePtr pDev; Atom btn_labels[6]; Atom axes_labels[2]; - LLOGLN(0, ("rdpMouseControl: what %d", what)); + LLOGLN(0, ("rdpmouseControl: what %d", what)); pDev = (DevicePtr)device; switch (what) { case DEVICE_INIT: - rdpMouseDeviceInit(); + rdpmouseDeviceInit(); map[0] = 0; map[1] = 1; map[2] = 2; @@ -116,23 +116,23 @@ rdpMouseControl(DeviceIntPtr device, int what) axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X); axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y); - InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpMouseCtrl, + InitPointerDeviceStruct(pDev, map, 5, btn_labels, rdpmouseCtrl, GetMotionHistorySize(), 2, axes_labels); break; case DEVICE_ON: pDev->on = 1; - rdpMouseDeviceOn(device); + rdpmouseDeviceOn(device); break; case DEVICE_OFF: pDev->on = 0; - rdpMouseDeviceOff(); + rdpmouseDeviceOff(); break; case DEVICE_CLOSE: if (pDev->on) { - rdpMouseDeviceOff(); + rdpmouseDeviceOff(); } break; @@ -141,54 +141,49 @@ rdpMouseControl(DeviceIntPtr device, int what) return Success; } -/******************************************************************************/ -static void -rdpMouseReadInput(struct _InputInfoRec *local) -{ - LLOGLN(0, ("rdpMouseReadInput:")); -} +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 1) -/******************************************************************************/ -static int -rdpMouseControlProc(struct _InputInfoRec *local, xDeviceCtl *control) -{ - LLOGLN(0, ("rdpMouseControlProc:")); - return 0; -} +/* debian 6 + ubuntu 10.04 */ /******************************************************************************/ -static int -rdpMouseSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) +static InputInfoPtr +rdpmousePreInit(InputDriverPtr drv, IDevPtr dev, int flags) { - LLOGLN(0, ("rdpMouseSwitchMode:")); - return 0; -} + InputInfoPtr info; -/******************************************************************************/ -static int -rdpMouseSetDeviceValuators(struct _InputInfoRec *local, - int *valuators, int first_valuator, - int num_valuators) -{ - LLOGLN(0, ("rdpMouseSetDeviceValuators:")); - return 0; + LLOGLN(0, ("rdpmousePreInit: drv %p dev %p, flags 0x%x", + drv, dev, flags)); + info = xf86AllocateInput(drv, 0); + info->name = dev->identifier; + info->device_control = rdpmouseControl; + info->flags = XI86_CONFIGURED | XI86_ALWAYS_CORE | XI86_SEND_DRAG_EVENTS | + XI86_CORE_POINTER | XI86_POINTER_CAPABLE; + info->type_name = "Mouse"; + info->fd = -1; + info->conf_idev = dev; + + return info; } +#else + +/* debian 7 + ubuntu 12.04 */ + /******************************************************************************/ static int rdpmousePreInit(InputDriverPtr drv, InputInfoPtr info, int flags) { LLOGLN(0, ("rdpmousePreInit: drv %p info %p, flags 0x%x", drv, info, flags)); - info->device_control = rdpMouseControl; - info->read_input = rdpMouseReadInput; - info->control_proc = rdpMouseControlProc; - info->switch_mode = rdpMouseSwitchMode; - info->set_device_valuators = rdpMouseSetDeviceValuators; + info->device_control = rdpmouseControl; info->type_name = "Mouse"; return 0; } +#endif + /******************************************************************************/ static void rdpmouseUnInit(InputDriverPtr drv, InputInfoPtr info, int flags) From 3ce6644791a1bdc6d932429f690f416ad9a5a8db Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 16 Jul 2013 11:20:36 -0700 Subject: [PATCH 27/45] xorg driver, added top level makefile --- xorg/server/Makefile | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 xorg/server/Makefile diff --git a/xorg/server/Makefile b/xorg/server/Makefile new file mode 100644 index 00000000..acc13763 --- /dev/null +++ b/xorg/server/Makefile @@ -0,0 +1,8 @@ + +all: alldirs + +alldirs: + cd module; $(MAKE) $(MFLAGS) + cd xrdpdev; $(MAKE) $(MFLAGS) + cd xrdpkeyb; $(MAKE) $(MFLAGS) + cd xrdpmouse; $(MAKE) $(MFLAGS) From e7039c460300c63362876f4df88f7e7a31b99b90 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 16 Jul 2013 11:21:57 -0700 Subject: [PATCH 28/45] xorg driver, added make clean to toplevel makefile --- xorg/server/Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xorg/server/Makefile b/xorg/server/Makefile index acc13763..12548dd9 100644 --- a/xorg/server/Makefile +++ b/xorg/server/Makefile @@ -1,8 +1,16 @@ -all: alldirs +all: allmake -alldirs: +allmake: cd module; $(MAKE) $(MFLAGS) cd xrdpdev; $(MAKE) $(MFLAGS) cd xrdpkeyb; $(MAKE) $(MFLAGS) cd xrdpmouse; $(MAKE) $(MFLAGS) + +clean: allclean + +allclean: + cd module; $(MAKE) clean + cd xrdpdev; $(MAKE) clean + cd xrdpkeyb; $(MAKE) clean + cd xrdpmouse; $(MAKE) clean From e7741d040c62259932f28286acfad6dd908d95ea Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Tue, 16 Jul 2013 21:04:00 -0700 Subject: [PATCH 29/45] xorg driver, added randr --- xorg/server/module/Makefile | 2 +- xorg/server/module/rdp.h | 16 +++- xorg/server/module/rdpRandR.c | 156 ++++++++++++++++++++++++++++++++++ xorg/server/module/rdpRandR.h | 60 +++++++++++++ xorg/server/xrdpdev/xrdpdev.c | 54 ++++++++++++ 5 files changed, 286 insertions(+), 2 deletions(-) create mode 100644 xorg/server/module/rdpRandR.c create mode 100644 xorg/server/module/rdpRandR.h diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index 65ede6d0..7ee49277 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -4,7 +4,7 @@ rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \ 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 +rdpCursor.o rdpMain.o rdpRandR.o CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h index ea48a8ee..f90baa1a 100644 --- a/xorg/server/module/rdp.h +++ b/xorg/server/module/rdp.h @@ -26,13 +26,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include "rdpPri.h" /* move this to common header */ struct _rdpRec { - char data[1024]; int width; int height; int num_modes; @@ -49,6 +49,20 @@ struct _rdpRec miPointerScreenFuncPtr pCursorFuncs; + /* RandR */ + RRSetConfigProcPtr rrSetConfig; + RRGetInfoProcPtr rrGetInfo; + RRScreenSetSizeProcPtr rrScreenSetSize; + RRCrtcSetProcPtr rrCrtcSet; + RRCrtcSetGammaProcPtr rrCrtcSetGamma; + RRCrtcGetGammaProcPtr rrCrtcGetGamma; + RROutputSetPropertyProcPtr rrOutputSetProperty; + RROutputValidateModeProcPtr rrOutputValidateMode; + RRModeDestroyProcPtr rrModeDestroy; + RROutputGetPropertyProcPtr rrOutputGetProperty; + RRGetPanningProcPtr rrGetPanning; + RRSetPanningProcPtr rrSetPanning; + }; typedef struct _rdpRec rdpRec; typedef struct _rdpRec * rdpPtr; diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c new file mode 100644 index 00000000..6c568b14 --- /dev/null +++ b/xorg/server/module/rdpRandR.c @@ -0,0 +1,156 @@ +/* +Copyright 2011-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +RandR draw calls + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include +#include +#include +#include + +#include "rdp.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +Bool +rdpRRRegisterSize(ScreenPtr pScreen, int width, int height) +{ + LLOGLN(0, ("rdpRRRegisterSize:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate, + RRScreenSizePtr pSize) +{ + LLOGLN(0, ("rdpRRSetConfig:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations) +{ + LLOGLN(0, ("rdpRRGetInfo:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, + CARD32 mmWidth, CARD32 mmHeight) +{ + LLOGLN(0, ("rdpRRScreenSetSize:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode, + int x, int y, Rotation rotation, int numOutputs, + RROutputPtr *outputs) +{ + LLOGLN(0, ("rdpRRCrtcSet:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc) +{ + LLOGLN(0, ("rdpRRCrtcSetGamma:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc) +{ + LLOGLN(0, ("rdpRRCrtcGetGamma:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property, + RRPropertyValuePtr value) +{ + LLOGLN(0, ("rdpRROutputSetProperty:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output, + RRModePtr mode) +{ + LLOGLN(0, ("rdpRROutputValidateMode:")); + return TRUE; +} + +/******************************************************************************/ +void +rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode) +{ + LLOGLN(0, ("rdpRRModeDestroy:")); +} + +/******************************************************************************/ +Bool +rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property) +{ + LLOGLN(0, ("rdpRROutputGetProperty:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, + BoxPtr trackingArea, INT16 *border) +{ + LLOGLN(0, ("rdpRRGetPanning:")); + return TRUE; +} + +/******************************************************************************/ +Bool +rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, + BoxPtr trackingArea, INT16 *border) +{ + LLOGLN(0, ("rdpRRSetPanning:")); + return TRUE; +} diff --git a/xorg/server/module/rdpRandR.h b/xorg/server/module/rdpRandR.h new file mode 100644 index 00000000..3aba7e1a --- /dev/null +++ b/xorg/server/module/rdpRandR.h @@ -0,0 +1,60 @@ +/* +Copyright 2011-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef _RDPRANDR_H +#define _RDPRANDR_H + +Bool +rdpRRRegisterSize(ScreenPtr pScreen, int width, int height); +Bool +rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations); +Bool +rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate, + RRScreenSizePtr pSize); +Bool +rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, + CARD32 mmWidth, CARD32 mmHeight); +Bool +rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode, + int x, int y, Rotation rotation, int numOutputs, + RROutputPtr* outputs); +Bool +rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc); +Bool +rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc); +Bool +rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property, + RRPropertyValuePtr value); +Bool +rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output, + RRModePtr mode); +void +rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode); +Bool +rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property); +Bool +rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, + BoxPtr trackingArea, INT16* border); +Bool +rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, + BoxPtr trackingArea, INT16* border); + +#endif diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index e68b6cb5..4fad95b6 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -36,12 +36,14 @@ This is the main driver file #include #include #include +#include #include "rdp.h" #include "rdpPri.h" #include "rdpDraw.h" #include "rdpGC.h" #include "rdpCursor.h" +#include "rdpRandR.h" #define XRDP_DRIVER_NAME "XRDPDEV" #define XRDP_NAME "XRDPDEV" @@ -74,6 +76,7 @@ int g_blueOffset = 0; int g_blueBits = 8; static int g_setup_done = 0; +static OsTimerPtr g_timer = 0; /* Supported "chipsets" */ static SymTabRec g_Chipsets[] = @@ -276,6 +279,55 @@ rdpSaveScreen(ScreenPtr pScreen, int on) return 1; } +/******************************************************************************/ +static CARD32 +rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg) +{ + ScreenPtr pScreen; + rrScrPrivPtr pRRScrPriv; + ScrnInfoPtr pScrn; + rdpPtr dev; + + pScreen = (ScreenPtr) arg; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + LLOGLN(10, ("rdpDeferredRandR:")); + pRRScrPriv = rrGetScrPriv(pScreen); + if (pRRScrPriv == 0) + { + LLOGLN(0, ("rdpDeferredRandR: rrGetScrPriv failed")); + return 1; + } + + dev->rrSetConfig = pRRScrPriv->rrSetConfig; + dev->rrGetInfo = pRRScrPriv->rrGetInfo; + dev->rrScreenSetSize = pRRScrPriv->rrScreenSetSize; + dev->rrCrtcSet = pRRScrPriv->rrCrtcSet; + dev->rrCrtcSetGamma = pRRScrPriv->rrCrtcSetGamma; + dev->rrCrtcGetGamma = pRRScrPriv->rrCrtcGetGamma; + dev->rrOutputSetProperty = pRRScrPriv->rrOutputSetProperty; + dev->rrOutputValidateMode = pRRScrPriv->rrOutputValidateMode; + dev->rrModeDestroy = pRRScrPriv->rrModeDestroy; + dev->rrOutputGetProperty = pRRScrPriv->rrOutputGetProperty; + dev->rrGetPanning = pRRScrPriv->rrGetPanning; + dev->rrSetPanning = pRRScrPriv->rrSetPanning; + + pRRScrPriv->rrSetConfig = rdpRRSetConfig; + pRRScrPriv->rrGetInfo = rdpRRGetInfo; + pRRScrPriv->rrScreenSetSize = rdpRRScreenSetSize; + pRRScrPriv->rrCrtcSet = rdpRRCrtcSet; + pRRScrPriv->rrCrtcSetGamma = rdpRRCrtcSetGamma; + pRRScrPriv->rrCrtcGetGamma = rdpRRCrtcGetGamma; + pRRScrPriv->rrOutputSetProperty = rdpRROutputSetProperty; + pRRScrPriv->rrOutputValidateMode = rdpRROutputValidateMode; + pRRScrPriv->rrModeDestroy = rdpRRModeDestroy; + pRRScrPriv->rrOutputGetProperty = rdpRROutputGetProperty; + pRRScrPriv->rrGetPanning = rdpRRGetPanning; + pRRScrPriv->rrSetPanning = rdpRRSetPanning; + + return 0; +} + /*****************************************************************************/ static Bool rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) @@ -382,6 +434,8 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) dev->ModifyPixmapHeader = pScreen->ModifyPixmapHeader; pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader; + g_timer = TimerSet(g_timer, 0, 10, rdpDeferredRandR, pScreen); + LLOGLN(0, ("rdpScreenInit: out")); return 1; } From a8c42c51c111f5e9e62e8aaf493258feb2183aec Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Wed, 17 Jul 2013 01:22:59 -0700 Subject: [PATCH 30/45] xorg driver, work on randr --- xorg/server/module/rdp.h | 6 +- xorg/server/module/rdpRandR.c | 141 ++++++++++++++++++++++++++++++++-- xorg/server/xrdpdev/xrdpdev.c | 11 ++- 3 files changed, 150 insertions(+), 8 deletions(-) diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h index f90baa1a..7bb2fbc1 100644 --- a/xorg/server/module/rdp.h +++ b/xorg/server/module/rdp.h @@ -35,8 +35,12 @@ struct _rdpRec { int width; int height; + int depth; + int paddedWidthInBytes; + int sizeInBytes; int num_modes; - char *ptr; + int bitsPerPixel; + char *pfbMemory; ScreenPtr pScreen; rdpDevPrivateKey privateKeyRecGC; rdpDevPrivateKey privateKeyRecPixmap; diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c index 6c568b14..b481ae8e 100644 --- a/xorg/server/module/rdpRandR.c +++ b/xorg/server/module/rdpRandR.c @@ -39,16 +39,36 @@ RandR draw calls #include "rdp.h" +#define PixelDPI 100 +#define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10)) + /******************************************************************************/ #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) +/******************************************************************************/ +static WindowPtr +rdpGetRootWindowPtr(ScreenPtr pScreen) +{ + /* in globals.c */ + return WindowTable[pScreen->myNum]; +} + /******************************************************************************/ Bool rdpRRRegisterSize(ScreenPtr pScreen, int width, int height) { - LLOGLN(0, ("rdpRRRegisterSize:")); + int mmwidth; + int mmheight; + RRScreenSizePtr pSize; + + LLOGLN(0, ("rdpRRRegisterSize: width %d height %d", width, height)); + mmwidth = PixelToMM(width); + mmheight = PixelToMM(height); + pSize = RRRegisterSize(pScreen, width, height, mmwidth, mmheight); + /* Tell RandR what the current config is */ + RRSetCurrentConfig(pScreen, RR_Rotate_0, 0, pSize); return TRUE; } @@ -65,7 +85,18 @@ rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate, Bool rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations) { + int width; + int height; + ScrnInfoPtr pScrn; + rdpPtr dev; + LLOGLN(0, ("rdpRRGetInfo:")); + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + *pRotations = RR_Rotate_0; + width = dev->width; + height = dev->height; + rdpRRRegisterSize(pScreen, width, height); return TRUE; } @@ -74,7 +105,63 @@ Bool rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { - LLOGLN(0, ("rdpRRScreenSetSize:")); + WindowPtr root; + PixmapPtr screenPixmap; + BoxRec box; + ScrnInfoPtr pScrn; + rdpPtr dev; + + LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d", + width, height, (int)mmWidth, (int)mmHeight)); + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + root = rdpGetRootWindowPtr(pScreen); + + if ((width < 1) || (height < 1)) + { + LLOGLN(10, (" error width %d height %d", width, height)); + return FALSE; + } + + dev->width = width; + dev->height = height; + dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth); + dev->sizeInBytes = dev->paddedWidthInBytes * dev->height; + pScreen->width = width; + pScreen->height = height; + pScreen->mmWidth = mmWidth; + pScreen->mmHeight = mmHeight; + + screenPixmap = pScreen->GetScreenPixmap(pScreen); + + if (screenPixmap != 0) + { + LLOGLN(0, (" resizing screenPixmap [%p] to %dx%d, " + "currently at %dx%d", (void *)screenPixmap, width, height, + screenPixmap->drawable.width, screenPixmap->drawable.height)); + pScreen->ModifyPixmapHeader(screenPixmap, width, height, + dev->depth, dev->bitsPerPixel, + dev->paddedWidthInBytes, + dev->pfbMemory); + LLOGLN(0, (" pixmap resized to %dx%d", + screenPixmap->drawable.width, screenPixmap->drawable.height)); + } + + LLOGLN(10, (" root window %p", (void *)root)); + box.x1 = 0; + box.y1 = 0; + box.x2 = width; + box.y2 = height; + REGION_INIT(pScreen, &root->winSize, &box, 1); + REGION_INIT(pScreen, &root->borderSize, &box, 1); + REGION_RESET(pScreen, &root->borderClip, &box); + REGION_BREAK(pScreen, &root->clipList); + root->drawable.width = width; + root->drawable.height = height; + ResizeChildrenWinSize(root, 0, 0, 0, 0); + RRGetInfo(pScreen, 1); + //rdpInvalidateArea(g_pScreen, 0, 0, dev->width, dev->height); + LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height)); return TRUE; } @@ -100,7 +187,21 @@ rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc) Bool rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc) { - LLOGLN(0, ("rdpRRCrtcGetGamma:")); + LLOGLN(0, ("rdpRRCrtcGetGamma: %p %p %p", crtc->gammaRed, + crtc->gammaBlue, crtc->gammaGreen)); + crtc->gammaSize = 1; + if (crtc->gammaRed == NULL) + { + crtc->gammaRed = xnfcalloc(2, 16); + } + if (crtc->gammaBlue == NULL) + { + crtc->gammaBlue = xnfcalloc(2, 16); + } + if (crtc->gammaGreen == NULL) + { + crtc->gammaGreen = xnfcalloc(2, 16); + } return TRUE; } @@ -139,16 +240,46 @@ rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property) /******************************************************************************/ Bool -rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, +rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border) { + ScrnInfoPtr pScrn; + rdpPtr dev; + LLOGLN(0, ("rdpRRGetPanning:")); + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + + if (totalArea != 0) + { + totalArea->x1 = 0; + totalArea->y1 = 0; + totalArea->x2 = dev->width; + totalArea->y2 = dev->height; + } + + if (trackingArea != 0) + { + trackingArea->x1 = 0; + trackingArea->y1 = 0; + trackingArea->x2 = dev->width; + trackingArea->y2 = dev->height; + } + + if (border != 0) + { + border[0] = 0; + border[1] = 0; + border[2] = 0; + border[3] = 0; + } + return TRUE; } /******************************************************************************/ Bool -rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea, +rdpRRSetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea, BoxPtr trackingArea, INT16 *border) { LLOGLN(0, ("rdpRRSetPanning:")); diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index 4fad95b6..c68d8700 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -348,8 +348,15 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) miSetPixmapDepths(); LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d", pScrn->virtualX, pScrn->virtualY)); - dev->ptr = malloc(dev->width * dev->height * 4); - if (!fbScreenInit(pScreen, dev->ptr, pScrn->virtualX, pScrn->virtualY, + + dev->depth = 24; + dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth); + dev->bitsPerPixel = 32; + dev->sizeInBytes = dev->paddedWidthInBytes * dev->height; + LLOGLN(0, ("pfbMemory bytes %d", dev->sizeInBytes)); + dev->pfbMemory = (char *) malloc(dev->sizeInBytes); + if (!fbScreenInit(pScreen, dev->pfbMemory, + pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) { From 2ad9b26c21dda68228e8ecd777375656de77dcc5 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Wed, 17 Jul 2013 17:28:53 -0700 Subject: [PATCH 31/45] xorg driver, work on randr --- xorg/server/module/rdp.h | 4 +++ xorg/server/module/rdpDraw.c | 50 +++++++++++++++++++++++++++++ xorg/server/module/rdpDraw.h | 6 ++++ xorg/server/module/rdpPri.c | 38 +++++++++++----------- xorg/server/module/rdpRandR.c | 14 ++------- xorg/server/xrdpdev/xrdpdev.c | 59 ++++++++++++++++++++++++++++++++--- 6 files changed, 137 insertions(+), 34 deletions(-) diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h index 7bb2fbc1..e10ba779 100644 --- a/xorg/server/module/rdp.h +++ b/xorg/server/module/rdp.h @@ -30,6 +30,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "rdpPri.h" +#define PixelDPI 100 +#define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10)) + /* move this to common header */ struct _rdpRec { @@ -50,6 +53,7 @@ struct _rdpRec CreatePixmapProcPtr CreatePixmap; DestroyPixmapProcPtr DestroyPixmap; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; + CloseScreenProcPtr CloseScreen; miPointerScreenFuncPtr pCursorFuncs; diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c index 6495bf4a..4de9fa9f 100644 --- a/xorg/server/module/rdpDraw.c +++ b/xorg/server/module/rdpDraw.c @@ -118,3 +118,53 @@ rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) dev->pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); dev->pScreen->CopyWindow = rdpCopyWindow; } + +/*****************************************************************************/ +Bool +rdpCloseScreen(int index, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn; + rdpPtr dev; + Bool rv; + + LLOGLN(0, ("rdpCloseScreen:")); + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + dev->pScreen->CloseScreen = dev->CloseScreen; + rv = dev->pScreen->CloseScreen(index, pScreen); + dev->pScreen->CloseScreen = rdpCloseScreen; + return rv; +} + +/******************************************************************************/ +WindowPtr +rdpGetRootWindowPtr(ScreenPtr pScreen) +{ +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0) + return WindowTable[pScreen->myNum]; /* in globals.c */ +#else + return pScreen->root; +#endif +} + +/******************************************************************************/ +int +rdpBitsPerPixel(int depth) +{ + if (depth == 1) + { + return 1; + } + else if (depth <= 8) + { + return 8; + } + else if (depth <= 16) + { + return 16; + } + else + { + return 32; + } +} diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h index e0e3988e..632a7467 100644 --- a/xorg/server/module/rdpDraw.h +++ b/xorg/server/module/rdpDraw.h @@ -62,5 +62,11 @@ rdpModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, pointer pPixData); void rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion); +Bool +rdpCloseScreen(int index, ScreenPtr pScreen); +WindowPtr +rdpGetRootWindowPtr(ScreenPtr pScreen); +int +rdpBitsPerPixel(int depth); #endif diff --git a/xorg/server/module/rdpPri.c b/xorg/server/module/rdpPri.c index 6a10c59b..3de181a8 100644 --- a/xorg/server/module/rdpPri.c +++ b/xorg/server/module/rdpPri.c @@ -39,23 +39,25 @@ to deal with privates changing in xorg versions #include "rdpPri.h" -/* not sure if these versions are right */ -#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((5) * 100000) + ((1) * 1000) + 0) -#define FBDEV_PRI 1 -#elif XORG_VERSION_CURRENT < (((1) * 10000000) + ((7) * 100000) + ((7) * 1000) + 1) -#define FBDEV_PRI 2 +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((5) * 100000) + ((0) * 1000) + 0) +/* 1.1, 1.2, 1.3, 1.4 */ +#define XRDP_PRI 1 +#elif XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0) +/* 1.5, 1.6, 1.7, 1.8 */ +#define XRDP_PRI 2 #else -#define FBDEV_PRI 3 +/* 1.9, 1.10, 1.11, 1.12 */ +#define XRDP_PRI 3 #endif #define PTR2INT(_ptr) ((int) ((long) ((void*) (_ptr)))) #define INT2PTR(_int) ((void *) ((long) ((int) (_int)))) -#if FBDEV_PRI == 3 +#if XRDP_PRI == 3 static DevPrivateKeyRec g_privateKeyRecGC; static DevPrivateKeyRec g_privateKeyRecPixmap; static DevPrivateKeyRec g_privateKeyRecWindow; -#elif FBDEV_PRI == 2 +#elif XRDP_PRI == 2 static int g_privateKeyRecGC = 0; static int g_privateKeyRecPixmap = 0; static int g_privateKeyRecWindow = 0; @@ -67,10 +69,10 @@ rdpAllocateGCPrivate(ScreenPtr pScreen, int bytes) { rdpDevPrivateKey rv; -#if FBDEV_PRI == 1 +#if XRDP_PRI == 1 rv = INT2PTR(AllocateGCPrivateIndex()); AllocateGCPrivate(pScreen, PTR2INT(rv), bytes); -#elif FBDEV_PRI == 2 +#elif XRDP_PRI == 2 dixRequestPrivate(&g_privateKeyRecGC, bytes); rv = &g_privateKeyRecGC; #else @@ -86,10 +88,10 @@ rdpAllocatePixmapPrivate(ScreenPtr pScreen, int bytes) { rdpDevPrivateKey rv; -#if FBDEV_PRI == 1 +#if XRDP_PRI == 1 rv = INT2PTR(AllocatePixmapPrivateIndex()); AllocatePixmapPrivate(pScreen, PTR2INT(rv), bytes); -#elif FBDEV_PRI == 2 +#elif XRDP_PRI == 2 dixRequestPrivate(&g_privateKeyRecPixmap, bytes); rv = &g_privateKeyRecPixmap; #else @@ -105,10 +107,10 @@ rdpAllocateWindowPrivate(ScreenPtr pScreen, int bytes) { rdpDevPrivateKey rv; -#if FBDEV_PRI == 1 +#if XRDP_PRI == 1 rv = INT2PTR(AllocateWindowPrivateIndex()); AllocateWindowPrivate(pScreen, PTR2INT(rv), bytes); -#elif FBDEV_PRI == 2 +#elif XRDP_PRI == 2 dixRequestPrivate(&g_privateKeyRecWindow, bytes); rv = &g_privateKeyRecWindow; #else @@ -124,7 +126,7 @@ rdpGetGCPrivate(GCPtr pGC, rdpDevPrivateKey key) { void *rv; -#if FBDEV_PRI == 1 +#if XRDP_PRI == 1 rv = pGC->devPrivates[PTR2INT(key)].ptr; #else rv = dixLookupPrivate(&(pGC->devPrivates), key); @@ -138,7 +140,7 @@ rdpGetPixmapPrivate(PixmapPtr pPixmap, rdpDevPrivateKey key) { void *rv; -#if FBDEV_PRI == 1 +#if XRDP_PRI == 1 rv = pPixmap->devPrivates[PTR2INT(key)].ptr; #else rv = dixLookupPrivate(&(pPixmap->devPrivates), key); @@ -152,7 +154,7 @@ rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key) { void *rv; -#if FBDEV_PRI == 1 +#if XRDP_PRI == 1 rv = pWindow->devPrivates[PTR2INT(key)].ptr; #else rv = dixLookupPrivate(&(pWindow->devPrivates), key); @@ -164,7 +166,7 @@ rdpGetWindowPrivate(WindowPtr pWindow, rdpDevPrivateKey key) int rdpPrivateInit(void) { -#if FBDEV_PRI == 3 +#if XRDP_PRI == 3 memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC)); memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow)); memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap)); diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c index b481ae8e..bcd01928 100644 --- a/xorg/server/module/rdpRandR.c +++ b/xorg/server/module/rdpRandR.c @@ -38,23 +38,13 @@ RandR draw calls #include #include "rdp.h" - -#define PixelDPI 100 -#define PixelToMM(_size) (((_size) * 254 + (PixelDPI) * 5) / ((PixelDPI) * 10)) +#include "rdpDraw.h" /******************************************************************************/ #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) -/******************************************************************************/ -static WindowPtr -rdpGetRootWindowPtr(ScreenPtr pScreen) -{ - /* in globals.c */ - return WindowTable[pScreen->myNum]; -} - /******************************************************************************/ Bool rdpRRRegisterSize(ScreenPtr pScreen, int width, int height) @@ -139,6 +129,8 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, LLOGLN(0, (" resizing screenPixmap [%p] to %dx%d, " "currently at %dx%d", (void *)screenPixmap, width, height, screenPixmap->drawable.width, screenPixmap->drawable.height)); + free(dev->pfbMemory); + dev->pfbMemory = (char *) malloc(dev->sizeInBytes); pScreen->ModifyPixmapHeader(screenPixmap, width, height, dev->depth, dev->bitsPerPixel, dev->paddedWidthInBytes, diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index c68d8700..bd80b75c 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -279,6 +279,32 @@ rdpSaveScreen(ScreenPtr pScreen, int on) return 1; } +/******************************************************************************/ +static Bool +rdpResizeSession(rdpPtr dev, int width, int height) +{ + int mmwidth; + int mmheight; + RRScreenSizePtr pSize; + Bool ok; + + LLOGLN(0, ("rdpResizeSession: width %d height %d", width, height)); + mmwidth = PixelToMM(width); + mmheight = PixelToMM(height); + + pSize = RRRegisterSize(dev->pScreen, width, height, mmwidth, mmheight); + RRSetCurrentConfig(dev->pScreen, RR_Rotate_0, 0, pSize); + + ok = 1; + if ((dev->width != width) || (dev->height != height)) + { + LLOGLN(0, (" calling RRScreenSizeSet")); + ok = RRScreenSizeSet(dev->pScreen, width, height, mmwidth, mmheight); + LLOGLN(0, (" RRScreenSizeSet ok=[%d]", ok)); + } + return ok; +} + /******************************************************************************/ static CARD32 rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg) @@ -287,6 +313,9 @@ rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg) rrScrPrivPtr pRRScrPriv; ScrnInfoPtr pScrn; rdpPtr dev; + char *envvar; + int width; + int height; pScreen = (ScreenPtr) arg; pScrn = xf86Screens[pScreen->myNum]; @@ -325,6 +354,26 @@ rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg) pRRScrPriv->rrGetPanning = rdpRRGetPanning; pRRScrPriv->rrSetPanning = rdpRRSetPanning; + rdpResizeSession(dev, dev->width, dev->height); + + envvar = getenv("XRDP_START_WIDTH"); + if (envvar != 0) + { + width = atoi(envvar); + if ((width >= 16) && (width < 8192)) + { + envvar = getenv("XRDP_START_HEIGHT"); + if (envvar != 0) + { + height = atoi(envvar); + if ((height >= 16) && (height < 8192)) + { + rdpResizeSession(dev, width, height); + } + } + } + } + return 0; } @@ -346,14 +395,14 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, TrueColor); miSetPixmapDepths(); - LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d", - pScrn->virtualX, pScrn->virtualY)); + LLOGLN(0, ("rdpScreenInit: virtualX %d virtualY %d rgbBits %d depth %d", + pScrn->virtualX, pScrn->virtualY, pScrn->rgbBits, pScrn->depth)); - dev->depth = 24; + dev->depth = pScrn->depth; dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth); - dev->bitsPerPixel = 32; + dev->bitsPerPixel = rdpBitsPerPixel(dev->depth); dev->sizeInBytes = dev->paddedWidthInBytes * dev->height; - LLOGLN(0, ("pfbMemory bytes %d", dev->sizeInBytes)); + LLOGLN(0, ("rdpScreenInit: pfbMemory bytes %d", dev->sizeInBytes)); dev->pfbMemory = (char *) malloc(dev->sizeInBytes); if (!fbScreenInit(pScreen, dev->pfbMemory, pScrn->virtualX, pScrn->virtualY, From 961105ba95a89b6e97e75d7c18f6e58a8d07e28f Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Wed, 17 Jul 2013 23:40:01 -0700 Subject: [PATCH 32/45] xorg driver, randr working now --- xorg/server/module/rdpRandR.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c index bcd01928..8ad4989b 100644 --- a/xorg/server/module/rdpRandR.c +++ b/xorg/server/module/rdpRandR.c @@ -97,12 +97,15 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, { WindowPtr root; PixmapPtr screenPixmap; + PixmapPtr rootWindowPixmap; BoxRec box; ScrnInfoPtr pScrn; rdpPtr dev; + char *oldpfbMemory; LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d", width, height, (int)mmWidth, (int)mmHeight)); + pScrn = xf86Screens[pScreen->myNum]; dev = XRDPPTR(pScrn); root = rdpGetRootWindowPtr(pScreen); @@ -123,23 +126,29 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, pScreen->mmHeight = mmHeight; screenPixmap = pScreen->GetScreenPixmap(pScreen); + rootWindowPixmap = pScreen->GetWindowPixmap(root); + + oldpfbMemory = dev->pfbMemory; + dev->pfbMemory = (char *) malloc(dev->sizeInBytes); if (screenPixmap != 0) { - LLOGLN(0, (" resizing screenPixmap [%p] to %dx%d, " - "currently at %dx%d", (void *)screenPixmap, width, height, - screenPixmap->drawable.width, screenPixmap->drawable.height)); - free(dev->pfbMemory); - dev->pfbMemory = (char *) malloc(dev->sizeInBytes); pScreen->ModifyPixmapHeader(screenPixmap, width, height, - dev->depth, dev->bitsPerPixel, + -1, -1, + dev->paddedWidthInBytes, + dev->pfbMemory); + } + + if (rootWindowPixmap != 0) + { + pScreen->ModifyPixmapHeader(rootWindowPixmap, width, height, + -1, -1, dev->paddedWidthInBytes, dev->pfbMemory); - LLOGLN(0, (" pixmap resized to %dx%d", - screenPixmap->drawable.width, screenPixmap->drawable.height)); } - LLOGLN(10, (" root window %p", (void *)root)); + free(oldpfbMemory); + box.x1 = 0; box.y1 = 0; box.x2 = width; @@ -152,8 +161,11 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, root->drawable.height = height; ResizeChildrenWinSize(root, 0, 0, 0, 0); RRGetInfo(pScreen, 1); - //rdpInvalidateArea(g_pScreen, 0, 0, dev->width, dev->height); LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height)); + + xf86EnableDisableFBAccess(pScreen->myNum, 0); + xf86EnableDisableFBAccess(pScreen->myNum, 1); + return TRUE; } From bf9419c527708ce20c72391a826eee6b696170ed Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 18 Jul 2013 01:01:28 -0700 Subject: [PATCH 33/45] xorg driver, still working on randr --- xorg/server/module/rdpRandR.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c index 8ad4989b..82de2f2e 100644 --- a/xorg/server/module/rdpRandR.c +++ b/xorg/server/module/rdpRandR.c @@ -97,25 +97,20 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, { WindowPtr root; PixmapPtr screenPixmap; - PixmapPtr rootWindowPixmap; BoxRec box; ScrnInfoPtr pScrn; rdpPtr dev; - char *oldpfbMemory; LLOGLN(0, ("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d", width, height, (int)mmWidth, (int)mmHeight)); - pScrn = xf86Screens[pScreen->myNum]; dev = XRDPPTR(pScrn); root = rdpGetRootWindowPtr(pScreen); - if ((width < 1) || (height < 1)) { LLOGLN(10, (" error width %d height %d", width, height)); return FALSE; } - dev->width = width; dev->height = height; dev->paddedWidthInBytes = PixmapBytePad(dev->width, dev->depth); @@ -124,13 +119,9 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, pScreen->height = height; pScreen->mmWidth = mmWidth; pScreen->mmHeight = mmHeight; - screenPixmap = pScreen->GetScreenPixmap(pScreen); - rootWindowPixmap = pScreen->GetWindowPixmap(root); - - oldpfbMemory = dev->pfbMemory; + free(dev->pfbMemory); dev->pfbMemory = (char *) malloc(dev->sizeInBytes); - if (screenPixmap != 0) { pScreen->ModifyPixmapHeader(screenPixmap, width, height, @@ -138,17 +129,6 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, dev->paddedWidthInBytes, dev->pfbMemory); } - - if (rootWindowPixmap != 0) - { - pScreen->ModifyPixmapHeader(rootWindowPixmap, width, height, - -1, -1, - dev->paddedWidthInBytes, - dev->pfbMemory); - } - - free(oldpfbMemory); - box.x1 = 0; box.y1 = 0; box.x2 = width; @@ -162,10 +142,8 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, ResizeChildrenWinSize(root, 0, 0, 0, 0); RRGetInfo(pScreen, 1); LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height)); - xf86EnableDisableFBAccess(pScreen->myNum, 0); xf86EnableDisableFBAccess(pScreen->myNum, 1); - return TRUE; } From 4322a136f1d23585e6b95c9d38e1f56de4cb81d0 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 18 Jul 2013 21:23:40 -0700 Subject: [PATCH 34/45] xrdpvr: fix a crash in xrdpvr_deinit_player --- xrdpvr/xrdpvr.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/xrdpvr/xrdpvr.c b/xrdpvr/xrdpvr.c index 6f39e975..89daccf8 100644 --- a/xrdpvr/xrdpvr.c +++ b/xrdpvr/xrdpvr.c @@ -92,11 +92,27 @@ xrdpvr_deinit_player(void *channel, int stream_id) } /* do local clean up */ - av_free(g_psi.frame); - avcodec_close(g_psi.p_audio_codec_ctx); - avcodec_close(g_psi.p_video_codec_ctx); + if (g_psi.frame != 0) + { + av_free(g_psi.frame); + g_psi.frame = 0; + } + if (g_psi.p_audio_codec_ctx != 0) + { + avcodec_close(g_psi.p_audio_codec_ctx); + g_psi.p_audio_codec_ctx = 0; + } + if (g_psi.p_video_codec_ctx != 0) + { + avcodec_close(g_psi.p_video_codec_ctx); + g_psi.p_video_codec_ctx = 0; + } //avformat_close_input(&g_psi.p_format_ctx); - av_close_input_file(g_psi.p_format_ctx); + if (g_psi.p_format_ctx != 0) + { + av_close_input_file(g_psi.p_format_ctx); + g_psi.p_format_ctx = 0; + } /* do remote cleanup */ From 89daffaaef626c82f0a7822b1679d0703990667b Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Thu, 18 Jul 2013 22:20:34 -0700 Subject: [PATCH 35/45] vrplayer: added help about and fix seg fault when closing --- vrplayer/mainwindow.cpp | 10 ++++++++++ vrplayer/mainwindow.h | 2 ++ vrplayer/mainwindow.ui | 12 ++++++++++++ 3 files changed, 24 insertions(+) diff --git a/vrplayer/mainwindow.cpp b/vrplayer/mainwindow.cpp index ec2d338a..4c8ea2b1 100644 --- a/vrplayer/mainwindow.cpp +++ b/vrplayer/mainwindow.cpp @@ -483,3 +483,13 @@ void MainWindow::onMoveCompleted() interface->setVcrOp(VCR_PLAY); vcrFlag = VCR_PLAY; } + +void MainWindow::on_actionAbout_triggered() +{ + QMessageBox msgBox; + + msgBox.setText("VRPlayer version 1.2"); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec(); +} diff --git a/vrplayer/mainwindow.h b/vrplayer/mainwindow.h index 56f94edb..50663408 100644 --- a/vrplayer/mainwindow.h +++ b/vrplayer/mainwindow.h @@ -79,6 +79,8 @@ private slots: void onSliderActionTriggered(int value); void onMoveCompleted(); + void on_actionAbout_triggered(); + protected: void resizeEvent(QResizeEvent *e); void closeEvent(QCloseEvent *e); diff --git a/vrplayer/mainwindow.ui b/vrplayer/mainwindow.ui index af924894..b9c2a85c 100644 --- a/vrplayer/mainwindow.ui +++ b/vrplayer/mainwindow.ui @@ -31,7 +31,14 @@ + + + Help + + + + @@ -55,6 +62,11 @@ Exit application + + + About + + From fad70062d6b158f253b95968bc4f01361210f79e Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 19 Jul 2013 11:10:55 -0700 Subject: [PATCH 36/45] common: no logic change --- common/parse.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/common/parse.h b/common/parse.h index 3d6a5058..226e246b 100644 --- a/common/parse.h +++ b/common/parse.h @@ -338,7 +338,7 @@ do \ #define xstream_wr_s16_le(_s, _var) TODO #define xstream_wr_s32_le(_s, _var) TODO -#define xstream_rd_u64_le(_s, _v) \ +#define xstream_rd_u64_le(_s, _v) \ do \ { \ _v = \ @@ -353,7 +353,7 @@ do \ _s->p += 8; \ } while (0) -#define xstream_wr_u64_le(_s, _v) \ +#define xstream_wr_u64_le(_s, _v) \ do \ { \ *(((unsigned char *) _s->p) + 0) = (unsigned char) ((_v >> 0) & 0xff); \ @@ -384,16 +384,16 @@ do \ } while (0) #define xstream_rd_string(_dest, _s, _len) \ -do \ -{ \ - g_memcpy((_dest), (_s)->p, (_len)); \ - (_s)->p += (_len); \ +do \ +{ \ + g_memcpy((_dest), (_s)->p, (_len)); \ + (_s)->p += (_len); \ } while (0) -#define xstream_wr_string(_s, _src, _len) \ +#define xstream_wr_string(_s, _src, _len) \ do \ { \ - g_memcpy((_s)->p, (_src), (_len)); \ + g_memcpy((_s)->p, (_src), (_len)); \ (_s)->p += (_len); \ } while (0) From 50db19c88c97a99770ce53fefcc14a74ca7e87ab Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 19 Jul 2013 11:11:31 -0700 Subject: [PATCH 37/45] xrdpvr: added volume message --- xrdpvr/xrdpvr.c | 35 +++++++++++++++++++++++++++++++++++ xrdpvr/xrdpvr.h | 1 + xrdpvr/xrdpvr_internal.h | 1 + 3 files changed, 37 insertions(+) diff --git a/xrdpvr/xrdpvr.c b/xrdpvr/xrdpvr.c index 89daccf8..d6a4fdb7 100644 --- a/xrdpvr/xrdpvr.c +++ b/xrdpvr/xrdpvr.c @@ -750,3 +750,38 @@ xrdpvr_write_to_client(void *channel, STREAM *s) usleep(1000 * 3); } } + +/** + * write set volume to a xrdpvr client + * + * @param channel opaque handle returned by WTSVirtualChannelOpenEx + * @param volume volume 0x0000 to 0xffff + * + * @return 0 on success, -1 on failure + ******************************************************************************/ +int +send_volume(void *channel, int volume) +{ + STREAM *s; + char *cptr; + int rv; + int len; + + stream_new(s, MAX_BUFSIZE); + + stream_ins_u32_le(s, 0); /* number of bytes to follow */ + stream_ins_u32_le(s, CMD_SET_VOLUME); + stream_ins_u32_le(s, volume); + + /* insert number of bytes in stream */ + len = stream_length(s) - 4; + cptr = s->p; + s->p = s->data; + stream_ins_u32_le(s, len); + s->p = cptr; + + /* write data to virtual channel */ + rv = xrdpvr_write_to_client(channel, s); + stream_free(s); + return rv; +} diff --git a/xrdpvr/xrdpvr.h b/xrdpvr/xrdpvr.h index f278a703..ba5dc6b9 100644 --- a/xrdpvr/xrdpvr.h +++ b/xrdpvr/xrdpvr.h @@ -44,6 +44,7 @@ int xrdpvr_seek_media(int64_t pos, int backward); int xrdpvr_get_frame(void **av_pkt_ret, int *is_video_frame, int *delay_in_us); int send_audio_pkt(void *channel, int stream_id, void *pkt_p); int send_video_pkt(void *channel, int stream_id, void *pkt_p); +int send_volume(void *channel, int volume); #ifdef __cplusplus } diff --git a/xrdpvr/xrdpvr_internal.h b/xrdpvr/xrdpvr_internal.h index 90753a06..ca01941c 100644 --- a/xrdpvr/xrdpvr_internal.h +++ b/xrdpvr/xrdpvr_internal.h @@ -61,6 +61,7 @@ #define CMD_WRITE_META_DATA 7 #define CMD_DEINIT_XRDPVR 8 #define CMD_SET_GEOMETRY 9 +#define CMD_SET_VOLUME 10 /* max number of bytes we can send in one pkt */ #define MAX_PDU_SIZE 1600 From c41bced4dfb1ddca86f0e7026e04dec6129ad038 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 19 Jul 2013 17:34:39 -0700 Subject: [PATCH 38/45] xrdpvr: rename the set volume function --- xrdpvr/xrdpvr.c | 2 +- xrdpvr/xrdpvr.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xrdpvr/xrdpvr.c b/xrdpvr/xrdpvr.c index d6a4fdb7..09a0a6b8 100644 --- a/xrdpvr/xrdpvr.c +++ b/xrdpvr/xrdpvr.c @@ -760,7 +760,7 @@ xrdpvr_write_to_client(void *channel, STREAM *s) * @return 0 on success, -1 on failure ******************************************************************************/ int -send_volume(void *channel, int volume) +xrdpvr_set_volume(void *channel, int volume) { STREAM *s; char *cptr; diff --git a/xrdpvr/xrdpvr.h b/xrdpvr/xrdpvr.h index ba5dc6b9..1324282c 100644 --- a/xrdpvr/xrdpvr.h +++ b/xrdpvr/xrdpvr.h @@ -44,7 +44,7 @@ int xrdpvr_seek_media(int64_t pos, int backward); int xrdpvr_get_frame(void **av_pkt_ret, int *is_video_frame, int *delay_in_us); int send_audio_pkt(void *channel, int stream_id, void *pkt_p); int send_video_pkt(void *channel, int stream_id, void *pkt_p); -int send_volume(void *channel, int volume); +int xrdpvr_set_volume(void *channel, int volume); #ifdef __cplusplus } From def3ba8d6a2a216028e0da963e31079907a3dd24 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 19 Jul 2013 17:38:36 -0700 Subject: [PATCH 39/45] vrplayer: added volume, fix some useability issues --- vrplayer/mainwindow.cpp | 37 +++++++++++++++++++++++++++++++++++++ vrplayer/mainwindow.h | 4 ++++ vrplayer/ourinterface.cpp | 12 ++++++++++++ vrplayer/ourinterface.h | 1 + vrplayer/vrplayer.pro | 9 ++++++--- 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/vrplayer/mainwindow.cpp b/vrplayer/mainwindow.cpp index 4c8ea2b1..1782f710 100644 --- a/vrplayer/mainwindow.cpp +++ b/vrplayer/mainwindow.cpp @@ -132,8 +132,22 @@ void MainWindow::moveEvent(QMoveEvent *) moveResizeTimer->start(1000); } +void MainWindow::onVolSliderValueChanged(int value) +{ + int volume; + + volume = (value * 0xffff) / 100; + if (interface != 0) + { + interface->setVolume(volume); + } + qDebug() << "vol = " << volume; +} + void MainWindow::setupUI() { + this->setWindowTitle("vrplayer"); + /* setup area to display video */ lblVideo = new QLabel(); lblVideo->setMinimumWidth(320); @@ -198,10 +212,26 @@ void MainWindow::setupUI() connect(btnRewind, SIGNAL(clicked(bool)), this, SLOT(onBtnRewindClicked(bool))); + /* setup volume control slider */ + volSlider = new QSlider(); + volSlider->setOrientation(Qt::Horizontal); + volSlider->setMinimumWidth(100); + volSlider->setMaximumWidth(100); + volSlider->setMinimum(0); + volSlider->setMaximum(100); + volSlider->setValue(20); + volSlider->setTickPosition(QSlider::TicksAbove); + volSlider->setTickInterval(10); + + connect(volSlider, SIGNAL(valueChanged(int)), + this, SLOT(onVolSliderValueChanged(int))); + /* add buttons to bottom panel */ hboxLayoutBottom = new QHBoxLayout; hboxLayoutBottom->addWidget(btnPlay); hboxLayoutBottom->addWidget(btnStop); + hboxLayoutBottom->addWidget(volSlider); + //hboxLayoutBottom->addWidget(btnRewind); hboxLayoutBottom->addStretch(); @@ -482,14 +512,21 @@ void MainWindow::onMoveCompleted() interface->setVcrOp(VCR_PLAY); vcrFlag = VCR_PLAY; + moveResizeTimer->stop(); } void MainWindow::on_actionAbout_triggered() { +#if 0 QMessageBox msgBox; msgBox.setText("VRPlayer version 1.2"); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok); msgBox.exec(); +#else + DlgAbout *dlgabt = new DlgAbout(this); + dlgabt->exec(); + +#endif } diff --git a/vrplayer/mainwindow.h b/vrplayer/mainwindow.h index 50663408..4fef0d60 100644 --- a/vrplayer/mainwindow.h +++ b/vrplayer/mainwindow.h @@ -33,6 +33,7 @@ #include "decoder.h" #include "ourinterface.h" #include "playvideo.h" +#include "dlgabout.h" /* ffmpeg related stuff */ extern "C" @@ -81,6 +82,8 @@ private slots: void on_actionAbout_triggered(); + void onVolSliderValueChanged(int value); + protected: void resizeEvent(QResizeEvent *e); void closeEvent(QCloseEvent *e); @@ -101,6 +104,7 @@ private: QPushButton *btnStop; QPushButton *btnRewind; QSlider *slider; + QSlider *volSlider; QWidget *window; bool acceptSliderMove; QTimer *moveResizeTimer; diff --git a/vrplayer/ourinterface.cpp b/vrplayer/ourinterface.cpp index 094a84f7..cee66691 100644 --- a/vrplayer/ourinterface.cpp +++ b/vrplayer/ourinterface.cpp @@ -215,3 +215,15 @@ void OurInterface::setVcrOp(int op) if (demuxMedia) demuxMedia->setVcrOp(op); } + +int OurInterface::setVolume(int volume) +{ + printf("OurInterface::setVolume\n"); + if (xrdpvr_set_volume(channel, volume)) + { + emit on_ErrorMsg("I/O Error", + "Error sending volume to remote client"); + return -1; + } + return 0; +} diff --git a/vrplayer/ourinterface.h b/vrplayer/ourinterface.h index ea402048..86352001 100644 --- a/vrplayer/ourinterface.h +++ b/vrplayer/ourinterface.h @@ -42,6 +42,7 @@ public: void playMedia(); PlayVideo *getPlayVideoInstance(); void setVcrOp(int op); + int setVolume(int volume); public slots: void onGeometryChanged(int x, int y, int width, int height); diff --git a/vrplayer/vrplayer.pro b/vrplayer/vrplayer.pro index a6e53231..1708a7f4 100644 --- a/vrplayer/vrplayer.pro +++ b/vrplayer/vrplayer.pro @@ -16,16 +16,19 @@ SOURCES += main.cpp\ mediapacket.cpp \ playaudio.cpp \ demuxmedia.cpp \ - ourinterface.cpp + ourinterface.cpp \ + dlgabout.cpp HEADERS += mainwindow.h \ mediapacket.h \ playvideo.h \ playaudio.h \ demuxmedia.h \ - ourinterface.h + ourinterface.h \ + dlgabout.h -FORMS += mainwindow.ui +FORMS += mainwindow.ui \ + dlgabout.ui # added by LK INCLUDEPATH += ../xrdpvr From bb19b8ed5770a5a45e78ec8e3919b859932a76a0 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Fri, 19 Jul 2013 23:45:13 -0700 Subject: [PATCH 40/45] vrplayer: added help about dialog --- vrplayer/dlgabout.cpp | 20 +++++++++++++++++++ vrplayer/dlgabout.h | 25 ++++++++++++++++++++++++ vrplayer/dlgabout.ui | 45 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 vrplayer/dlgabout.cpp create mode 100644 vrplayer/dlgabout.h create mode 100644 vrplayer/dlgabout.ui diff --git a/vrplayer/dlgabout.cpp b/vrplayer/dlgabout.cpp new file mode 100644 index 00000000..b6ec55ee --- /dev/null +++ b/vrplayer/dlgabout.cpp @@ -0,0 +1,20 @@ +#include "dlgabout.h" +#include "ui_dlgabout.h" + +DlgAbout::DlgAbout(QWidget *parent) : + QDialog(parent), + ui(new Ui::DlgAbout) +{ + ui->setupUi(this); + connect(ui->okButton, SIGNAL(clicked()), this, SLOT(onOk())); +} + +DlgAbout::~DlgAbout() +{ + delete ui; +} + +void DlgAbout::onOk() +{ + this->done(0); +} diff --git a/vrplayer/dlgabout.h b/vrplayer/dlgabout.h new file mode 100644 index 00000000..4795e2fe --- /dev/null +++ b/vrplayer/dlgabout.h @@ -0,0 +1,25 @@ +#ifndef DLGABOUT_H +#define DLGABOUT_H + +#include + +namespace Ui { +class DlgAbout; +} + +class DlgAbout : public QDialog +{ + Q_OBJECT + +public: + explicit DlgAbout(QWidget *parent = 0); + ~DlgAbout(); + +private: + Ui::DlgAbout *ui; + +private slots: + void onOk(); +}; + +#endif // DLGABOUT_H diff --git a/vrplayer/dlgabout.ui b/vrplayer/dlgabout.ui new file mode 100644 index 00000000..8b2c38e5 --- /dev/null +++ b/vrplayer/dlgabout.ui @@ -0,0 +1,45 @@ + + + DlgAbout + + + + 0 + 0 + 288 + 168 + + + + Dialog + + + + + 70 + 60 + 151 + 17 + + + + VRPlayer v1.2 + + + + + + 180 + 120 + 94 + 27 + + + + OK + + + + + + From 058e2ecd2824475bb3866c89bab24cefab1b7f06 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 20 Jul 2013 15:11:54 -0700 Subject: [PATCH 41/45] xorg driver, added region files, misc, cleanup --- xorg/server/module/Makefile | 2 +- xorg/server/module/rdpDraw.c | 22 -- xorg/server/module/rdpDraw.h | 2 - xorg/server/module/rdpMisc.c | 415 ++++++++++++++++++++++++++++++++++ xorg/server/module/rdpMisc.h | 78 +++++++ xorg/server/module/rdpPri.c | 7 +- xorg/server/module/rdpRandR.c | 14 +- xorg/server/module/rdpReg.c | 233 +++++++++++++++++++ xorg/server/module/rdpReg.h | 60 +++++ xorg/server/xrdpdev/xrdpdev.c | 65 +++--- 10 files changed, 834 insertions(+), 64 deletions(-) create mode 100644 xorg/server/module/rdpMisc.c create mode 100644 xorg/server/module/rdpMisc.h create mode 100644 xorg/server/module/rdpReg.c create mode 100644 xorg/server/module/rdpReg.h diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index 7ee49277..3662b218 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -4,7 +4,7 @@ rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \ 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 +rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 diff --git a/xorg/server/module/rdpDraw.c b/xorg/server/module/rdpDraw.c index 4de9fa9f..7abcb406 100644 --- a/xorg/server/module/rdpDraw.c +++ b/xorg/server/module/rdpDraw.c @@ -146,25 +146,3 @@ rdpGetRootWindowPtr(ScreenPtr pScreen) return pScreen->root; #endif } - -/******************************************************************************/ -int -rdpBitsPerPixel(int depth) -{ - if (depth == 1) - { - return 1; - } - else if (depth <= 8) - { - return 8; - } - else if (depth <= 16) - { - return 16; - } - else - { - return 32; - } -} diff --git a/xorg/server/module/rdpDraw.h b/xorg/server/module/rdpDraw.h index 632a7467..ba696541 100644 --- a/xorg/server/module/rdpDraw.h +++ b/xorg/server/module/rdpDraw.h @@ -66,7 +66,5 @@ Bool rdpCloseScreen(int index, ScreenPtr pScreen); WindowPtr rdpGetRootWindowPtr(ScreenPtr pScreen); -int -rdpBitsPerPixel(int depth); #endif diff --git a/xorg/server/module/rdpMisc.c b/xorg/server/module/rdpMisc.c new file mode 100644 index 00000000..34e71110 --- /dev/null +++ b/xorg/server/module/rdpMisc.c @@ -0,0 +1,415 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +the rest + +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +/******************************************************************************/ +int +rdpBitsPerPixel(int depth) +{ + if (depth == 1) + { + return 1; + } + else if (depth <= 8) + { + return 8; + } + else if (depth <= 16) + { + return 16; + } + else + { + return 32; + } +} + +/* the g_ functions from os_calls.c */ + +/*****************************************************************************/ +int +g_tcp_recv(int sck, void *ptr, int len, int flags) +{ + return recv(sck, ptr, len, flags); +} + +/*****************************************************************************/ +void +g_tcp_close(int sck) +{ + if (sck == 0) + { + return; + } + + shutdown(sck, 2); + close(sck); +} + +/*****************************************************************************/ +int +g_tcp_last_error_would_block(int sck) +{ + return (errno == EWOULDBLOCK) || (errno == EINPROGRESS); +} + +/*****************************************************************************/ +void +g_sleep(int msecs) +{ + usleep(msecs * 1000); +} + +/*****************************************************************************/ +int +g_tcp_send(int sck, void *ptr, int len, int flags) +{ + return send(sck, ptr, len, flags); +} + +/*****************************************************************************/ +void * +g_malloc(int size, int zero) +{ + char *rv; + + rv = (char *)malloc(size); + if (zero) + { + if (rv != 0) + { + memset(rv, 0, size); + } + } + return rv; +} + +/*****************************************************************************/ +void +g_free(void *ptr) +{ + if (ptr != 0) + { + free(ptr); + } +} + +/*****************************************************************************/ +void +g_sprintf(char *dest, char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vsprintf(dest, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +int +g_tcp_socket(void) +{ + int rv; + int i; + + i = 1; + rv = socket(PF_INET, SOCK_STREAM, 0); + setsockopt(rv, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i)); + setsockopt(rv, SOL_SOCKET, SO_REUSEADDR, (void *)&i, sizeof(i)); + return rv; +} + +/*****************************************************************************/ +int +g_tcp_local_socket_dgram(void) +{ + return socket(AF_UNIX, SOCK_DGRAM, 0); +} + +/*****************************************************************************/ +int +g_tcp_local_socket_stream(void) +{ + return socket(AF_UNIX, SOCK_STREAM, 0); +} + +/*****************************************************************************/ +void +g_memcpy(void *d_ptr, const void *s_ptr, int size) +{ + memcpy(d_ptr, s_ptr, size); +} + +/*****************************************************************************/ +void +g_memset(void *d_ptr, const unsigned char chr, int size) +{ + memset(d_ptr, chr, size); +} + +/*****************************************************************************/ +int +g_tcp_set_no_delay(int sck) +{ + int i; + + i = 1; + setsockopt(sck, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i)); + return 0; +} + +/*****************************************************************************/ +int +g_tcp_set_non_blocking(int sck) +{ + unsigned long i; + + i = fcntl(sck, F_GETFL); + i = i | O_NONBLOCK; + fcntl(sck, F_SETFL, i); + return 0; +} + +/*****************************************************************************/ +int +g_tcp_accept(int sck) +{ + struct sockaddr_in s; + unsigned int i; + + i = sizeof(struct sockaddr_in); + memset(&s, 0, i); + return accept(sck, (struct sockaddr *)&s, &i); +} + +/*****************************************************************************/ +int +g_tcp_select(int sck1, int sck2, int sck3) +{ + fd_set rfds; + struct timeval time; + int max; + int rv; + + time.tv_sec = 0; + time.tv_usec = 0; + FD_ZERO(&rfds); + + if (sck1 > 0) + { + FD_SET(((unsigned int)sck1), &rfds); + } + + if (sck2 > 0) + { + FD_SET(((unsigned int)sck2), &rfds); + } + + if (sck3 > 0) + { + FD_SET(((unsigned int)sck3), &rfds); + } + + max = sck1; + + if (sck2 > max) + { + max = sck2; + } + + if (sck3 > max) + { + max = sck3; + } + + rv = select(max + 1, &rfds, 0, 0, &time); + + if (rv > 0) + { + rv = 0; + + if (FD_ISSET(((unsigned int)sck1), &rfds)) + { + rv = rv | 1; + } + + if (FD_ISSET(((unsigned int)sck2), &rfds)) + { + rv = rv | 2; + } + + if (FD_ISSET(((unsigned int)sck3), &rfds)) + { + rv = rv | 4; + } + } + else + { + rv = 0; + } + + return rv; +} + +/*****************************************************************************/ +int +g_tcp_bind(int sck, char *port) +{ + struct sockaddr_in s; + + memset(&s, 0, sizeof(struct sockaddr_in)); + s.sin_family = AF_INET; + s.sin_port = htons(atoi(port)); + s.sin_addr.s_addr = INADDR_ANY; + return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_in)); +} + +/*****************************************************************************/ +int +g_tcp_local_bind(int sck, char *port) +{ + struct sockaddr_un s; + + memset(&s, 0, sizeof(struct sockaddr_un)); + s.sun_family = AF_UNIX; + strcpy(s.sun_path, port); + return bind(sck, (struct sockaddr *)&s, sizeof(struct sockaddr_un)); +} + +/*****************************************************************************/ +int +g_tcp_listen(int sck) +{ + return listen(sck, 2); +} + +/*****************************************************************************/ +/* returns boolean */ +int +g_create_dir(const char *dirname) +{ + return mkdir(dirname, (mode_t) - 1) == 0; +} + +/*****************************************************************************/ +/* returns boolean, non zero if the directory exists */ +int +g_directory_exist(const char *dirname) +{ + struct stat st; + + if (stat(dirname, &st) == 0) + { + return S_ISDIR(st.st_mode); + } + else + { + return 0; + } +} + +/*****************************************************************************/ +/* returns error */ +int +g_chmod_hex(const char *filename, int flags) +{ + int fl; + + fl = 0; + fl |= (flags & 0x4000) ? S_ISUID : 0; + fl |= (flags & 0x2000) ? S_ISGID : 0; + fl |= (flags & 0x1000) ? S_ISVTX : 0; + fl |= (flags & 0x0400) ? S_IRUSR : 0; + fl |= (flags & 0x0200) ? S_IWUSR : 0; + fl |= (flags & 0x0100) ? S_IXUSR : 0; + fl |= (flags & 0x0040) ? S_IRGRP : 0; + fl |= (flags & 0x0020) ? S_IWGRP : 0; + fl |= (flags & 0x0010) ? S_IXGRP : 0; + fl |= (flags & 0x0004) ? S_IROTH : 0; + fl |= (flags & 0x0002) ? S_IWOTH : 0; + fl |= (flags & 0x0001) ? S_IXOTH : 0; + return chmod(filename, fl); +} + +/*****************************************************************************/ +/* produce a hex dump */ +void +g_hexdump(unsigned char *p, unsigned int len) +{ + unsigned char *line; + int i; + int thisline; + int offset; + + offset = 0; + line = p; + + while (offset < len) + { + ErrorF("%04x ", offset); + thisline = len - offset; + + if (thisline > 16) + { + thisline = 16; + } + + for (i = 0; i < thisline; i++) + { + ErrorF("%02x ", line[i]); + } + + for (; i < 16; i++) + { + ErrorF(" "); + } + + for (i = 0; i < thisline; i++) + { + ErrorF("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); + } + + ErrorF("\n"); + offset += thisline; + line += thisline; + } +} diff --git a/xorg/server/module/rdpMisc.h b/xorg/server/module/rdpMisc.h new file mode 100644 index 00000000..8318f7bd --- /dev/null +++ b/xorg/server/module/rdpMisc.h @@ -0,0 +1,78 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +the rest + +*/ + +#ifndef __RDPMISC_H +#define __RDPMISC_H + +int +rdpBitsPerPixel(int depth); +int +g_tcp_recv(int sck, void *ptr, int len, int flags); +void +g_tcp_close(int sck); +int +g_tcp_last_error_would_block(int sck); +void +g_sleep(int msecs); +int +g_tcp_send(int sck, void *ptr, int len, int flags); +void * +g_malloc(int size, int zero); +void +g_free(void *ptr); +void +g_sprintf(char *dest, char *format, ...); +int +g_tcp_socket(void); +int +g_tcp_local_socket_dgram(void); +int +g_tcp_local_socket_stream(void); +void +g_memcpy(void *d_ptr, const void *s_ptr, int size); +void +g_memset(void *d_ptr, const unsigned char chr, int size); +int +g_tcp_set_no_delay(int sck); +int +g_tcp_set_non_blocking(int sck); +int +g_tcp_accept(int sck); +int +g_tcp_select(int sck1, int sck2, int sck3); +int +g_tcp_bind(int sck, char *port); +int +g_tcp_local_bind(int sck, char *port); +int +g_tcp_listen(int sck); +int +g_create_dir(const char *dirname); +int +g_directory_exist(const char *dirname); +int +g_chmod_hex(const char *filename, int flags); +void +g_hexdump(unsigned char *p, unsigned int len); + +#endif diff --git a/xorg/server/module/rdpPri.c b/xorg/server/module/rdpPri.c index 3de181a8..43f3d883 100644 --- a/xorg/server/module/rdpPri.c +++ b/xorg/server/module/rdpPri.c @@ -38,6 +38,7 @@ to deal with privates changing in xorg versions #include #include "rdpPri.h" +#include "rdpMisc.h" #if XORG_VERSION_CURRENT < (((1) * 10000000) + ((5) * 100000) + ((0) * 1000) + 0) /* 1.1, 1.2, 1.3, 1.4 */ @@ -167,9 +168,9 @@ int rdpPrivateInit(void) { #if XRDP_PRI == 3 - memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC)); - memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow)); - memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap)); + g_memset(&g_privateKeyRecGC, 0, sizeof(g_privateKeyRecGC)); + g_memset(&g_privateKeyRecWindow, 0, sizeof(g_privateKeyRecWindow)); + g_memset(&g_privateKeyRecPixmap, 0, sizeof(g_privateKeyRecPixmap)); #endif return 0; } diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c index 82de2f2e..e5ce814b 100644 --- a/xorg/server/module/rdpRandR.c +++ b/xorg/server/module/rdpRandR.c @@ -39,6 +39,8 @@ RandR draw calls #include "rdp.h" #include "rdpDraw.h" +#include "rdpReg.h" +#include "rdpMisc.h" /******************************************************************************/ #define LOG_LEVEL 1 @@ -120,8 +122,8 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, pScreen->mmWidth = mmWidth; pScreen->mmHeight = mmHeight; screenPixmap = pScreen->GetScreenPixmap(pScreen); - free(dev->pfbMemory); - dev->pfbMemory = (char *) malloc(dev->sizeInBytes); + g_free(dev->pfbMemory); + dev->pfbMemory = (char *) g_malloc(dev->sizeInBytes, 1); if (screenPixmap != 0) { pScreen->ModifyPixmapHeader(screenPixmap, width, height, @@ -133,10 +135,10 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, box.y1 = 0; box.x2 = width; box.y2 = height; - REGION_INIT(pScreen, &root->winSize, &box, 1); - REGION_INIT(pScreen, &root->borderSize, &box, 1); - REGION_RESET(pScreen, &root->borderClip, &box); - REGION_BREAK(pScreen, &root->clipList); + rdpRegionInit(&root->winSize, &box, 1); + rdpRegionInit(&root->borderSize, &box, 1); + rdpRegionReset(&root->borderClip, &box); + rdpRegionBreak(&root->clipList); root->drawable.width = width; root->drawable.height = height; ResizeChildrenWinSize(root, 0, 0, 0, 0); diff --git a/xorg/server/module/rdpReg.c b/xorg/server/module/rdpReg.c new file mode 100644 index 00000000..3a343f14 --- /dev/null +++ b/xorg/server/module/rdpReg.c @@ -0,0 +1,233 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +to deal with regions changing in xorg versions + +*/ +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +/* +miRegionCopy -> RegionCopy +miTranslateRegion -> RegionTranslate +miRegionNotEmpty -> RegionNotEmpty +miIntersect -> RegionIntersect +miRectIn -> RegionContainsRect +miRegionInit -> RegionInit +miRegionUninit -> RegionUninit +miRectsToRegion -> RegionFromRects +miRegionDestroy -> RegionDestroy +miRegionCreate -> RegionCreate +miUnion -> RegionUnion +miRegionExtents -> RegionExtents +miRegionReset -> RegionReset +miRegionBreak -> RegionBreak +*/ + +#if XORG_VERSION_CURRENT < (((1) * 10000000) + ((9) * 100000) + ((0) * 1000) + 0) +/* 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8 */ +#define XRDP_REG 1 +#else +/* 1.9, 1.10, 1.11, 1.12 */ +#define XRDP_REG 2 +#endif + +/*****************************************************************************/ +Bool +rdpRegionCopy(RegionPtr dst, RegionPtr src) +{ +#if XRDP_REG == 1 + return miRegionCopy(dst, src); +#else + return RegionCopy(dst, src); +#endif +} + +/*****************************************************************************/ +void +rdpRegionTranslate(RegionPtr pReg, int x, int y) +{ +#if XRDP_REG == 1 + miTranslateRegion(pReg, x, y); +#else + RegionTranslate(pReg, x, y); +#endif +} + +/*****************************************************************************/ +Bool +rdpRegionNotEmpty(RegionPtr pReg) +{ +#if XRDP_REG == 1 + return miRegionNotEmpty(pReg); +#else + return RegionNotEmpty(pReg); +#endif +} + +/*****************************************************************************/ +Bool +rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2) +{ +#if XRDP_REG == 1 + return miIntersect(newReg, reg1, reg2); +#else + return RegionIntersect(newReg, reg1, reg2); +#endif +} + +/*****************************************************************************/ +int +rdpRegionContainsRect(RegionPtr region, BoxPtr prect) +{ +#if XRDP_REG == 1 + return miRectIn(region, prect); +#else + return RegionContainsRect(region, prect); +#endif +} + +/*****************************************************************************/ +void +rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size) +{ +#if XRDP_REG == 1 + miRegionInit(pReg, rect, size); +#else + RegionInit(pReg, rect, size); +#endif +} + +/*****************************************************************************/ +void +rdpRegionUninit(RegionPtr pReg) +{ +#if XRDP_REG == 1 + miRegionUninit(pReg); +#else + RegionUninit(pReg); +#endif +} + +/*****************************************************************************/ +RegionPtr +rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype) +{ +#if XRDP_REG == 1 + return miRectsToRegion(nrects, prect, ctype); +#else + return RegionFromRects(nrects, prect, ctype); +#endif +} + +/*****************************************************************************/ +void +rdpRegionDestroy(RegionPtr pReg) +{ +#if XRDP_REG == 1 + miRegionDestroy(pReg); +#else + RegionDestroy(pReg); +#endif +} + +/*****************************************************************************/ +RegionPtr +rdpRegionCreate(BoxPtr rect, int size) +{ +#if XRDP_REG == 1 + return miRegionCreate(rect, size); +#else + return RegionCreate(rect, size); +#endif +} + +/*****************************************************************************/ +Bool +rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2) +{ +#if XRDP_REG == 1 + return miUnion(newReg, reg1, reg2); +#else + return RegionUnion(newReg, reg1, reg2); +#endif +} + +/*****************************************************************************/ +Bool +rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2) +{ +#if XRDP_REG == 1 + return miSubtract(newReg, reg1, reg2); +#else + return RegionSubtract(newReg, reg1, reg2); +#endif +} + +/*****************************************************************************/ +Bool +rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect) +{ +#if XRDP_REG == 1 + return miInverse(newReg, reg1, invRect); +#else + return RegionInverse(newReg, reg1, invRect); +#endif +} + +/*****************************************************************************/ +BoxPtr +rdpRegionExtents(RegionPtr pReg) +{ +#if XRDP_REG == 1 + return miRegionExtents(pReg); +#else + return RegionExtents(pReg); +#endif +} + +/*****************************************************************************/ +void +rdpRegionReset(RegionPtr pReg, BoxPtr pBox) +{ +#if XRDP_REG == 1 + miRegionReset(pReg, pBox); +#else + RegionReset(pReg, pBox); +#endif +} + +/*****************************************************************************/ +Bool +rdpRegionBreak(RegionPtr pReg) +{ +#if XRDP_REG == 1 + return miRegionBreak(pReg); +#else + return RegionBreak(pReg); +#endif +} diff --git a/xorg/server/module/rdpReg.h b/xorg/server/module/rdpReg.h new file mode 100644 index 00000000..b788cd69 --- /dev/null +++ b/xorg/server/module/rdpReg.h @@ -0,0 +1,60 @@ +/* +Copyright 2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +to deal with regions changing in xorg versions + +*/ + +#ifndef __RDPREG_H +#define __RDPREG_H + +Bool +rdpRegionCopy(RegionPtr dst, RegionPtr src); +void +rdpRegionTranslate(RegionPtr pReg, int x, int y); +Bool +rdpRegionNotEmpty(RegionPtr pReg); +Bool +rdpRegionIntersect(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2); +int +rdpRegionContainsRect(RegionPtr region, BoxPtr prect); +void +rdpRegionInit(RegionPtr pReg, BoxPtr rect, int size); +void +rdpRegionUninit(RegionPtr pReg); +RegionPtr +rdpRegionFromRects(int nrects, xRectanglePtr prect, int ctype); +void +rdpRegionDestroy(RegionPtr pReg); +RegionPtr +rdpRegionCreate(BoxPtr rect, int size); +Bool +rdpRegionUnion(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2); +Bool +rdpRegionSubtract(RegionPtr newReg, RegionPtr reg1, RegionPtr reg2); +Bool +rdpRegionInverse(RegionPtr newReg, RegionPtr reg1, BoxPtr invRect); +BoxPtr +rdpRegionExtents(RegionPtr pReg); +void +rdpRegionReset(RegionPtr pReg, BoxPtr pBox); +Bool +rdpRegionBreak(RegionPtr pReg); + +#endif diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index bd80b75c..9e3095c2 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -44,6 +44,7 @@ This is the main driver file #include "rdpGC.h" #include "rdpCursor.h" #include "rdpRandR.h" +#include "rdpMisc.h" #define XRDP_DRIVER_NAME "XRDPDEV" #define XRDP_NAME "XRDPDEV" @@ -108,10 +109,11 @@ rdpAllocRec(ScrnInfoPtr pScrn) LLOGLN(10, ("rdpAllocRec:")); if (pScrn->driverPrivate != 0) { - return 1; + return TRUE; } + /* xnfcalloc exits if alloc failed */ pScrn->driverPrivate = xnfcalloc(sizeof(rdpRec), 1); - return 1; + return TRUE; } /*****************************************************************************/ @@ -141,11 +143,11 @@ rdpPreInit(ScrnInfoPtr pScrn, int flags) LLOGLN(0, ("rdpPreInit:")); if (flags & PROBE_DETECT) { - return 0; + return FALSE; } if (pScrn->numEntities != 1) { - return 0; + return FALSE; } rdpPrivateInit(); @@ -179,35 +181,35 @@ rdpPreInit(ScrnInfoPtr pScrn, int flags) { LLOGLN(0, ("rdpPreInit: xf86SetDepthBpp failed")); rdpFreeRec(pScrn); - return 0; + return FALSE; } xf86PrintDepthBpp(pScrn); - memset(&zeros1, 0, sizeof(zeros1)); + g_memset(&zeros1, 0, sizeof(zeros1)); if (!xf86SetWeight(pScrn, zeros1, zeros1)) { LLOGLN(0, ("rdpPreInit: xf86SetWeight failed")); rdpFreeRec(pScrn); - return 0; + return FALSE; } - memset(&zeros2, 0, sizeof(zeros2)); + g_memset(&zeros2, 0, sizeof(zeros2)); if (!xf86SetGamma(pScrn, zeros2)) { LLOGLN(0, ("rdpPreInit: xf86SetGamma failed")); rdpFreeRec(pScrn); - return 0; + return FALSE; } if (!xf86SetDefaultVisual(pScrn, -1)) { LLOGLN(0, ("rdpPreInit: xf86SetDefaultVisual failed")); rdpFreeRec(pScrn); - return 0; + return FALSE; } xf86SetDpi(pScrn, 0, 0); if (0 == pScrn->display->modes) { LLOGLN(0, ("rdpPreInit: modes error")); rdpFreeRec(pScrn); - return 0; + return FALSE; } pScrn->virtualX = pScrn->display->virtualX; @@ -255,11 +257,12 @@ rdpPreInit(ScrnInfoPtr pScrn, int flags) { LLOGLN(0, ("rdpPreInit: could not find screen resolution %dx%d", dev->width, dev->height)); - return 0; + return FALSE; } - return 1; + return TRUE; } +/******************************************************************************/ static miPointerSpriteFuncRec g_rdpSpritePointerFuncs = { /* these are in rdpCursor.c */ @@ -276,7 +279,7 @@ static Bool rdpSaveScreen(ScreenPtr pScreen, int on) { LLOGLN(0, ("rdpSaveScreen:")); - return 1; + return TRUE; } /******************************************************************************/ @@ -295,7 +298,7 @@ rdpResizeSession(rdpPtr dev, int width, int height) pSize = RRRegisterSize(dev->pScreen, width, height, mmwidth, mmheight); RRSetCurrentConfig(dev->pScreen, RR_Rotate_0, 0, pSize); - ok = 1; + ok = TRUE; if ((dev->width != width) || (dev->height != height)) { LLOGLN(0, (" calling RRScreenSizeSet")); @@ -306,6 +309,7 @@ rdpResizeSession(rdpPtr dev, int width, int height) } /******************************************************************************/ +/* returns error */ static CARD32 rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg) { @@ -384,7 +388,7 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ScrnInfoPtr pScrn; rdpPtr dev; VisualPtr vis; - int vis_found; + Bool vis_found; pScrn = xf86Screens[scrnIndex]; dev = XRDPPTR(pScrn); @@ -403,14 +407,14 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) dev->bitsPerPixel = rdpBitsPerPixel(dev->depth); dev->sizeInBytes = dev->paddedWidthInBytes * dev->height; LLOGLN(0, ("rdpScreenInit: pfbMemory bytes %d", dev->sizeInBytes)); - dev->pfbMemory = (char *) malloc(dev->sizeInBytes); + dev->pfbMemory = (char *) g_malloc(dev->sizeInBytes, 1); if (!fbScreenInit(pScreen, dev->pfbMemory, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) { LLOGLN(0, ("rdpScreenInit: fbScreenInit failed")); - return 0; + return FALSE; } miInitializeBackingStore(pScreen); @@ -456,20 +460,20 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) /* must assign this one */ pScreen->SaveScreen = rdpSaveScreen; - vis_found = 0; + vis_found = FALSE; vis = pScreen->visuals + (pScreen->numVisuals - 1); while (vis >= pScreen->visuals) { if (vis->vid == pScreen->rootVisual) { - vis_found = 1; + vis_found = TRUE; } vis--; } if (!vis_found) { LLOGLN(0, ("rdpScreenInit: no root visual")); - return 0; + return FALSE; } dev->privateKeyRecGC = rdpAllocateGCPrivate(pScreen, sizeof(rdpGCRec)); @@ -493,7 +497,7 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) g_timer = TimerSet(g_timer, 0, 10, rdpDeferredRandR, pScreen); LLOGLN(0, ("rdpScreenInit: out")); - return 1; + return TRUE; } /*****************************************************************************/ @@ -501,7 +505,7 @@ static Bool rdpSwitchMode(int a, DisplayModePtr b, int c) { LLOGLN(0, ("rdpSwitchMode:")); - return 1; + return TRUE; } /*****************************************************************************/ @@ -516,7 +520,7 @@ static Bool rdpEnterVT(int a, int b) { LLOGLN(0, ("rdpEnterVT:")); - return 1; + return TRUE; } /*****************************************************************************/ @@ -548,24 +552,24 @@ rdpProbe(DriverPtr drv, int flags) LLOGLN(0, ("rdpProbe:")); if (flags & PROBE_DETECT) { - return 0; + return FALSE; } /* fbScreenInit, fbPictureInit, ... */ if (!xf86LoadDrvSubModule(drv, "fb")) { LLOGLN(0, ("rdpProbe: xf86LoadDrvSubModule for fb failed")); - return 0; + return FALSE; } num_dev_sections = xf86MatchDevice(XRDP_DRIVER_NAME, &dev_sections); if (num_dev_sections <= 0) { LLOGLN(0, ("rdpProbe: xf86MatchDevice failed")); - return 0; + return FALSE; } pscrn = 0; - found_screen = 0; + found_screen = FALSE; for (i = 0; i < num_dev_sections; i++) { entity = xf86ClaimFbSlot(drv, 0, dev_sections[i], 1); @@ -612,13 +616,13 @@ rdpDriverFunc(ScrnInfoPtr pScrn, xorgDriverFuncOp op, pointer ptr) xorgHWFlags *flags; int rv; - rv = 0; + rv = FALSE; LLOGLN(0, ("rdpDriverFunc: op %d", (int)op)); if (op == GET_REQUIRED_HW_INTERFACES) { flags = (xorgHWFlags *) ptr; *flags = HW_SKIP_CONSOLE; - rv = 1; + rv = TRUE; } return rv; } @@ -631,6 +635,7 @@ rdpIdentify(int flags) xf86PrintChipsets(XRDP_NAME, "driver for xrdp", g_Chipsets); } +/*****************************************************************************/ _X_EXPORT DriverRec g_DriverRec = { XRDP_VERSION, From 5c581ff5a5e43ee9abd4d4b5043a7978f24280dd Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 20 Jul 2013 21:59:15 -0700 Subject: [PATCH 42/45] added more randr test logging --- xorg/tests/randr/trandr.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xorg/tests/randr/trandr.c b/xorg/tests/randr/trandr.c index 77ce2c33..b50f5ac2 100644 --- a/xorg/tests/randr/trandr.c +++ b/xorg/tests/randr/trandr.c @@ -31,17 +31,22 @@ #include static int -process_randr(Display *disp, Window win, int event_base, XEvent *ev) +process_randr(Display *disp, Screen *screen, int screenNumber, Window win, + int event_base, XEvent *ev) { XRRScreenChangeNotifyEvent *rr_screen_change_notify; switch (ev->type - event_base) { case RRScreenChangeNotify: + XRRUpdateConfiguration(ev); rr_screen_change_notify = (XRRScreenChangeNotifyEvent *) ev; printf("RRScreenChangeNotify: width %d height %d\n", rr_screen_change_notify->width, rr_screen_change_notify->height); + printf("DisplayWidth %d DisplayHeight %d\n", + DisplayWidth(disp, screenNumber), + DisplayHeight(disp, screenNumber)); break; } return 0; @@ -128,7 +133,8 @@ main(int argc, char **argv) (ev.type < rr_event_base + RRNumberEvents)) { printf("randr\n"); - process_randr(disp, win, rr_event_base, &ev); + process_randr(disp, screen, screenNumber, win, + rr_event_base, &ev); } break; } From 47dddfed0c211e49410673684832953d717f9a93 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sat, 20 Jul 2013 22:07:53 -0700 Subject: [PATCH 43/45] xorg driver, randr --- xorg/server/module/rdpRandR.c | 58 ++++++++++++++++++++++++------ xorg/server/xrdpdev/xrdpdev.c | 13 +++++++ xorg/server/xrdpkeyb/rdpKeyboard.c | 16 +++++---- 3 files changed, 71 insertions(+), 16 deletions(-) diff --git a/xorg/server/module/rdpRandR.c b/xorg/server/module/rdpRandR.c index e5ce814b..fd080184 100644 --- a/xorg/server/module/rdpRandR.c +++ b/xorg/server/module/rdpRandR.c @@ -69,8 +69,29 @@ Bool rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate, RRScreenSizePtr pSize) { + ScrnInfoPtr pScrn; + rdpPtr dev; + rrScrPrivPtr pRRScrPriv; + Bool rv; + LLOGLN(0, ("rdpRRSetConfig:")); - return TRUE; + rv = TRUE; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); +#if 0 + pRRScrPriv = rrGetScrPriv(pScreen); + if (pRRScrPriv != 0) + { + if (dev->rrSetConfig != 0) + { + LLOGLN(0, ("rdpRRSetConfig: here")); + pRRScrPriv->rrSetConfig = dev->rrSetConfig; + rv = pRRScrPriv->rrSetConfig(pScreen, rotateKind, rate, pSize); + pRRScrPriv->rrSetConfig = rdpRRSetConfig; + } + } +#endif + return rv; } /******************************************************************************/ @@ -81,15 +102,32 @@ rdpRRGetInfo(ScreenPtr pScreen, Rotation *pRotations) int height; ScrnInfoPtr pScrn; rdpPtr dev; + rrScrPrivPtr pRRScrPriv; + Bool rv; LLOGLN(0, ("rdpRRGetInfo:")); + rv = TRUE; pScrn = xf86Screens[pScreen->myNum]; dev = XRDPPTR(pScrn); +#if 0 + pRRScrPriv = rrGetScrPriv(pScreen); + if (pRRScrPriv != 0) + { + if (dev->rrGetInfo != 0) + { + LLOGLN(0, ("rdpRRGetInfo: here")); + pRRScrPriv->rrGetInfo = dev->rrGetInfo; + rv = pRRScrPriv->rrGetInfo(pScreen, pRotations); + pRRScrPriv->rrGetInfo = rdpRRGetInfo; + } + } +#else *pRotations = RR_Rotate_0; width = dev->width; height = dev->height; rdpRRRegisterSize(pScreen, width, height); - return TRUE; +#endif + return rv; } /******************************************************************************/ @@ -144,8 +182,9 @@ rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, ResizeChildrenWinSize(root, 0, 0, 0, 0); RRGetInfo(pScreen, 1); LLOGLN(0, (" screen resized to %dx%d", pScreen->width, pScreen->height)); - xf86EnableDisableFBAccess(pScreen->myNum, 0); - xf86EnableDisableFBAccess(pScreen->myNum, 1); + RRScreenSizeNotify(pScreen); + xf86EnableDisableFBAccess(pScreen->myNum, FALSE); + xf86EnableDisableFBAccess(pScreen->myNum, TRUE); return TRUE; } @@ -171,20 +210,20 @@ rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc) Bool rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc) { - LLOGLN(0, ("rdpRRCrtcGetGamma: %p %p %p", crtc->gammaRed, + LLOGLN(0, ("rdpRRCrtcGetGamma: %p %p %p %p", crtc, crtc->gammaRed, crtc->gammaBlue, crtc->gammaGreen)); crtc->gammaSize = 1; if (crtc->gammaRed == NULL) { - crtc->gammaRed = xnfcalloc(2, 16); + crtc->gammaRed = g_malloc(32, 1); } if (crtc->gammaBlue == NULL) { - crtc->gammaBlue = xnfcalloc(2, 16); + crtc->gammaBlue = g_malloc(32, 1); } if (crtc->gammaGreen == NULL) { - crtc->gammaGreen = xnfcalloc(2, 16); + crtc->gammaGreen = g_malloc(32, 1); } return TRUE; } @@ -230,7 +269,7 @@ rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea, ScrnInfoPtr pScrn; rdpPtr dev; - LLOGLN(0, ("rdpRRGetPanning:")); + LLOGLN(0, ("rdpRRGetPanning: %p", crtc)); pScrn = xf86Screens[pScreen->myNum]; dev = XRDPPTR(pScrn); @@ -257,7 +296,6 @@ rdpRRGetPanning(ScreenPtr pScreen, RRCrtcPtr crtc, BoxPtr totalArea, border[2] = 0; border[3] = 0; } - return TRUE; } diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index 9e3095c2..a4f39b46 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -345,6 +345,19 @@ rdpDeferredRandR(OsTimerPtr timer, CARD32 now, pointer arg) dev->rrGetPanning = pRRScrPriv->rrGetPanning; dev->rrSetPanning = pRRScrPriv->rrSetPanning; + LLOGLN(10, (" rrSetConfig = %p", dev->rrSetConfig)); + LLOGLN(10, (" rrGetInfo = %p", dev->rrGetInfo)); + LLOGLN(10, (" rrScreenSetSize = %p", dev->rrScreenSetSize)); + LLOGLN(10, (" rrCrtcSet = %p", dev->rrCrtcSet)); + LLOGLN(10, (" rrCrtcSetGamma = %p", dev->rrCrtcSetGamma)); + LLOGLN(10, (" rrCrtcGetGamma = %p", dev->rrCrtcGetGamma)); + LLOGLN(10, (" rrOutputSetProperty = %p", dev->rrOutputSetProperty)); + LLOGLN(10, (" rrOutputValidateMode = %p", dev->rrOutputValidateMode)); + LLOGLN(10, (" rrModeDestroy = %p", dev->rrModeDestroy)); + LLOGLN(10, (" rrOutputGetProperty = %p", dev->rrOutputGetProperty)); + LLOGLN(10, (" rrGetPanning = %p", dev->rrGetPanning)); + LLOGLN(10, (" rrSetPanning = %p", dev->rrSetPanning)); + pRRScrPriv->rrSetConfig = rdpRRSetConfig; pRRScrPriv->rrGetInfo = rdpRRGetInfo; pRRScrPriv->rrScreenSetSize = rdpRRScreenSetSize; diff --git a/xorg/server/xrdpkeyb/rdpKeyboard.c b/xorg/server/xrdpkeyb/rdpKeyboard.c index ac7d284d..4fda5e76 100644 --- a/xorg/server/xrdpkeyb/rdpKeyboard.c +++ b/xorg/server/xrdpkeyb/rdpKeyboard.c @@ -43,6 +43,9 @@ xrdp keyboard module #include "rdp.h" +/* if 1, a keystroke is done every minute, down, then up */ +#define XRDPKB_TEST 0 + /******************************************************************************/ #define LOG_LEVEL 1 #define LLOGLN(_level, _args) \ @@ -207,15 +210,17 @@ rdpEnqueueKey(int type, int scancode) { if (type == KeyPress) { - xf86PostKeyboardEvent(g_keyboard, scancode, 1); + /* need this cause rdp and X11 repeats are different */ + xf86PostKeyboardEvent(g_keyboard, scancode, FALSE); + xf86PostKeyboardEvent(g_keyboard, scancode, TRUE); } else { - xf86PostKeyboardEvent(g_keyboard, scancode, 0); + xf86PostKeyboardEvent(g_keyboard, scancode, FALSE); } } -#if 1 +#if XRDPKB_TEST /******************************************************************************/ static CARD32 rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) @@ -225,9 +230,6 @@ rdpDeferredUpdateCallback(OsTimerPtr timer, CARD32 now, pointer arg) rdpEnqueueKey(KeyPress, 115); rdpEnqueueKey(KeyRelease, 115); - //xf86PostKeyboardEvent(g_keyboard, 115, 1); - //xf86PostKeyboardEvent(g_keyboard, 115, 0); - g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); return 0; } @@ -337,7 +339,9 @@ rdpkeybControl(DeviceIntPtr device, int what) InitKeyboardDeviceStruct(device, &set, rdpkeybBell, rdpkeybChangeKeyboardControl); g_keyboard = device; +#if XRDPKB_TEST g_timer = TimerSet(g_timer, 0, 1000, rdpDeferredUpdateCallback, 0); +#endif break; case DEVICE_ON: pDev->on = 1; From c11cc0f82c76a3675dac66e0100f0e89a0595f81 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 21 Jul 2013 20:19:21 -0700 Subject: [PATCH 44/45] xorg driver, wrap composite and glyphs --- xorg/server/module/Makefile | 3 +- xorg/server/module/rdp.h | 2 + xorg/server/module/rdpComposite.c | 76 +++++++++++++++++++++++++++++ xorg/server/module/rdpComposite.h | 32 +++++++++++++ xorg/server/module/rdpCopyPlane.c | 2 +- xorg/server/module/rdpGlyphs.c | 79 +++++++++++++++++++++++++++++++ xorg/server/module/rdpGlyphs.h | 33 +++++++++++++ xorg/server/xrdpdev/xrdpdev.c | 14 ++++++ 8 files changed, 239 insertions(+), 2 deletions(-) create mode 100644 xorg/server/module/rdpComposite.c create mode 100644 xorg/server/module/rdpComposite.h create mode 100644 xorg/server/module/rdpGlyphs.c create mode 100644 xorg/server/module/rdpGlyphs.h diff --git a/xorg/server/module/Makefile b/xorg/server/module/Makefile index 3662b218..66b09f91 100644 --- a/xorg/server/module/Makefile +++ b/xorg/server/module/Makefile @@ -4,7 +4,8 @@ rdpCopyArea.o rdpCopyPlane.o rdpPolyPoint.o rdpPolylines.o rdpPolySegment.o \ 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 +rdpCursor.o rdpMain.o rdpRandR.o rdpMisc.o rdpReg.o \ +rdpComposite.o rdpGlyphs.o CFLAGS = -g -O2 -Wall -fPIC -I/usr/include/xorg -I/usr/include/pixman-1 diff --git a/xorg/server/module/rdp.h b/xorg/server/module/rdp.h index e10ba779..085e114f 100644 --- a/xorg/server/module/rdp.h +++ b/xorg/server/module/rdp.h @@ -54,6 +54,8 @@ struct _rdpRec DestroyPixmapProcPtr DestroyPixmap; ModifyPixmapHeaderProcPtr ModifyPixmapHeader; CloseScreenProcPtr CloseScreen; + CompositeProcPtr Composite; + GlyphsProcPtr Glyphs; miPointerScreenFuncPtr pCursorFuncs; diff --git a/xorg/server/module/rdpComposite.c b/xorg/server/module/rdpComposite.c new file mode 100644 index 00000000..a2c5568e --- /dev/null +++ b/xorg/server/module/rdpComposite.c @@ -0,0 +1,76 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +composite(alpha blending) calls + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include + +#include "rdp.h" +#include "rdpComposite.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static void +rdpCompositeOrg(PictureScreenPtr ps, rdpPtr dev, + CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height) +{ + ps->Composite = dev->Composite; + ps->Composite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height); + ps->Composite = rdpComposite; +} + +/******************************************************************************/ +void +rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height) +{ + ScreenPtr pScreen; + rdpPtr dev; + ScrnInfoPtr pScrn; + PictureScreenPtr ps; + + LLOGLN(10, ("rdpComposite:")); + pScreen = pSrc->pDrawable->pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + ps = GetPictureScreen(pScreen); + rdpCompositeOrg(ps, dev, op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, + xDst, yDst, width, height); +} diff --git a/xorg/server/module/rdpComposite.h b/xorg/server/module/rdpComposite.h new file mode 100644 index 00000000..8924c1b4 --- /dev/null +++ b/xorg/server/module/rdpComposite.h @@ -0,0 +1,32 @@ +/* +Copyright 2005-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +composite(alpha blending) calls + +*/ + +#ifndef _RDPCOMPOSITE_H +#define _RDPCOMPOSITE_H + +void +rdpComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, + INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask, INT16 xDst, + INT16 yDst, CARD16 width, CARD16 height); + +#endif diff --git a/xorg/server/module/rdpCopyPlane.c b/xorg/server/module/rdpCopyPlane.c index 64b8a1ea..9b89125c 100644 --- a/xorg/server/module/rdpCopyPlane.c +++ b/xorg/server/module/rdpCopyPlane.c @@ -27,7 +27,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) /******************************************************************************/ -RegionPtr +static RegionPtr rdpCopyPlaneOrg(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty, unsigned long bitPlane) diff --git a/xorg/server/module/rdpGlyphs.c b/xorg/server/module/rdpGlyphs.c new file mode 100644 index 00000000..3a222e79 --- /dev/null +++ b/xorg/server/module/rdpGlyphs.c @@ -0,0 +1,79 @@ +/* +Copyright 2012-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +gylph(font) calls + +*/ + +#include +#include +#include + +/* this should be before all X11 .h files */ +#include + +/* all driver need this */ +#include +#include + +#include +#include + +#include "rdp.h" +#include "rdpGlyphs.h" + +/******************************************************************************/ +#define LOG_LEVEL 1 +#define LLOGLN(_level, _args) \ + do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0) + +/******************************************************************************/ +static void +rdpGlyphsOrg(PictureScreenPtr ps, rdpPtr dev, + CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, + GlyphPtr *glyphs) +{ + ps->Glyphs = dev->Glyphs; + ps->Glyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, + nlists, lists, glyphs); + ps->Glyphs = rdpGlyphs; +} + +/******************************************************************************/ +void +rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, + GlyphPtr *glyphs) +{ + ScreenPtr pScreen; + rdpPtr dev; + ScrnInfoPtr pScrn; + PictureScreenPtr ps; + + LLOGLN(10, ("rdpGlyphs:")); + pScreen = pSrc->pDrawable->pScreen; + pScrn = xf86Screens[pScreen->myNum]; + dev = XRDPPTR(pScrn); + ps = GetPictureScreen(pScreen); + rdpGlyphsOrg(ps, dev, op, pSrc, pDst, maskFormat, xSrc, ySrc, + nlists, lists, glyphs); +} diff --git a/xorg/server/module/rdpGlyphs.h b/xorg/server/module/rdpGlyphs.h new file mode 100644 index 00000000..d451d9f9 --- /dev/null +++ b/xorg/server/module/rdpGlyphs.h @@ -0,0 +1,33 @@ +/* +Copyright 2012-2013 Jay Sorg + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +gylph(font) calls + +*/ + +#ifndef _RDPGLYPHS_H +#define _RDPGLYPHS_H + +void +rdpGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, INT16 ySrc, int nlists, GlyphListPtr lists, + GlyphPtr *glyphs); + +#endif diff --git a/xorg/server/xrdpdev/xrdpdev.c b/xorg/server/xrdpdev/xrdpdev.c index a4f39b46..cc863d4d 100644 --- a/xorg/server/xrdpdev/xrdpdev.c +++ b/xorg/server/xrdpdev/xrdpdev.c @@ -45,6 +45,8 @@ This is the main driver file #include "rdpCursor.h" #include "rdpRandR.h" #include "rdpMisc.h" +#include "rdpComposite.h" +#include "rdpGlyphs.h" #define XRDP_DRIVER_NAME "XRDPDEV" #define XRDP_NAME "XRDPDEV" @@ -402,6 +404,7 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) rdpPtr dev; VisualPtr vis; Bool vis_found; + PictureScreenPtr ps; pScrn = xf86Screens[scrnIndex]; dev = XRDPPTR(pScrn); @@ -507,6 +510,17 @@ rdpScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) dev->ModifyPixmapHeader = pScreen->ModifyPixmapHeader; pScreen->ModifyPixmapHeader = rdpModifyPixmapHeader; + ps = GetPictureScreenIfSet(pScreen); + if (ps != 0) + { + /* composite */ + dev->Composite = ps->Composite; + ps->Composite = rdpComposite; + /* glyphs */ + dev->Glyphs = ps->Glyphs; + ps->Glyphs = rdpGlyphs; + } + g_timer = TimerSet(g_timer, 0, 10, rdpDeferredRandR, pScreen); LLOGLN(0, ("rdpScreenInit: out")); From c176208133d7da718ca1f580ad2604982ba0d05a Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 21 Jul 2013 20:24:59 -0700 Subject: [PATCH 45/45] xorg tests, randr, call XRRUpdateConfiguration on configure notify on root window --- xorg/tests/randr/trandr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xorg/tests/randr/trandr.c b/xorg/tests/randr/trandr.c index b50f5ac2..4f7be527 100644 --- a/xorg/tests/randr/trandr.c +++ b/xorg/tests/randr/trandr.c @@ -124,7 +124,9 @@ main(int argc, char **argv) case ConfigureNotify: if (ev.xconfigure.window == root_window) { - printf("ConfigureNotify for root window width %d height %d\n", + XRRUpdateConfiguration(&ev); + printf("ConfigureNotify for root window " + "width %d height %d\n", ev.xconfigure.width, ev.xconfigure.height); } break;