diff options
Diffstat (limited to 'src/rdc_extension.c')
-rw-r--r-- | src/rdc_extension.c | 203 |
1 files changed, 57 insertions, 146 deletions
diff --git a/src/rdc_extension.c b/src/rdc_extension.c index cba9c61..5d37c0a 100644 --- a/src/rdc_extension.c +++ b/src/rdc_extension.c @@ -18,9 +18,8 @@ * <jason.lin@rdc.com.tw> */ -/* - * I N C L U D E S - */ + + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -48,37 +47,35 @@ #include "xf86PciInfo.h" #include "xf86Pci.h" -/* framebuffer offscreen manager */ + #include "xf86fbman.h" -/* include xaa includes */ + #include "xaa.h" #include "xaarop.h" -/* H/W cursor support */ + #include "xf86Cursor.h" -/* Driver specific headers */ + #include "rdc.h" -#include "X11/Xproto.h" /* For Xextension */ -#include "extnsionst.h" /* For Xextension */ -#include "dixstruct.h" /* For Xextension */ +#include "X11/Xproto.h" +#include "extnsionst.h" +#include "dixstruct.h" #include "rdc_extension.h" //#include <sys/ipc.h> //#include <sys/shm.h> -CARD32 *inBufPtr, *outBufPtr ; /* For share memory use */ +CARD32 *inBufPtr, *outBufPtr ; + -/* Record screen number. */ int g_ScreenNumber; -/* - Query the RDCGFX_API version. -*/ + static int ProcRDCGFXQueryVersion (ClientPtr client) { xRDCGFXQueryVersionReply rep; @@ -104,29 +101,23 @@ static int ProcRDCGFXQueryVersion (ClientPtr client) } -/* - Receive and process the request from AP. -*/ + static int ProcRDCGFXCommand(ClientPtr client) { xRDCGFXCommandReq *req = (xRDCGFXCommandReq*)client->requestBuffer; register int n; int i, ret; REQUEST_SIZE_MATCH(*req); - /*if ((SIZEOF(xRDCGFXCommandReq) >> 2) != req->length) { \ - int lengthword = req->length; \ - SendErrToClient(client, FSBadLength, (pointer)&lengthword); \ - return (FSBadLength); \ - }*/ + - /* Get pointer to ExtensionEntry */ + if(!CheckExtension(RDC_GFX_UT_EXTENSION_NAME)) return BadMatch; - /* Process the request. */ + RDCGFXUtilityProc(req); - //req->reqType = X_Reply; - //req->length = (CARD16)(sizeof(xRDCGFXCommandReq) - sizeof(xGenericReply)) >> 2; + + xGenericReply *reply = client->requestBuffer; reply->type = X_Reply; reply->length = 0; @@ -143,7 +134,7 @@ static int ProcRDCGFXCommand(ClientPtr client) } } #endif - //WriteToClient(client, sizeof(xRDCGFXCommandReq), (char *)req); + WriteToClient(client, sizeof(xGenericReply), (char *)reply); return client->noClientException; } @@ -170,7 +161,7 @@ void RDCDisplayExtensionInit(ScrnInfoPtr pScrn) { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 5, "==Enter RDCDisplayExtensionInit()== \n"); - // init share memory + int shm_in_id, shm_out_id ; key_t in_key, out_key ; char inBufName[32] = "/RDC/GFX/shm/inBuf" ; @@ -186,7 +177,7 @@ void RDCDisplayExtensionInit(ScrnInfoPtr pScrn) if(NULL == CheckExtension(RDC_GFX_UT_EXTENSION_NAME)) { xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 6, "== check point 1== \n"); - /* if extension doesn't exist, add it */ + if (!AddExtension(RDC_GFX_UT_EXTENSION_NAME, 0, 0, ProcRDCGFXDispatch, ProcRDCGFXDispatch, @@ -199,7 +190,7 @@ void RDCDisplayExtensionInit(ScrnInfoPtr pScrn) } else { - /* else if extension exists */ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "error: RDC GFX Extension Exists!\n"); } xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 5, "==Exit RDCDisplayExtensionInit()== \n"); @@ -216,26 +207,16 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) CBIOSExtension.pCBiosArguments = &CBiosArguments; CBIOSExtension.IOAddress = (USHORT)(pRDC->RelocateIO) ; CBIOSExtension.VideoVirtualAddress = (ULONG)(pRDC->FBVirtualAddr); - /* - STChen[2006.7.11]: In SAMM case, a driver controls a screen. - In the past, we have to move application's window to switch to correct driver. - So I add following step to detect which driver we should use to avoid this problem. - - if (pRDC->pBIOSInfo->SAMM) - { - pScrn = RDCScreenSelection(pScrn, rep->primary_id, rep->secondary_id); - pRDC = RDCPTR(pScrn); - } - */ + ULONG ulResult; switch(req->util_cmd_id) { - // - // Output devices function group - // - case UT_QUERY_SUPPORT_DEVICE: /* done */ + + + + case UT_QUERY_SUPPORT_DEVICE: xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "DrvEscape: Query Device Support"); if (req->outBufferSize != sizeof(ULONG)) @@ -254,7 +235,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) } break; - case UT_QUERY_CONNECT_DEVICE: /* done */ + case UT_QUERY_CONNECT_DEVICE: xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "DrvEscape: Query Device Connect"); if (req->outBufferSize != sizeof(ULONG)) @@ -284,17 +265,17 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) switch (inBufPtr[0] & 0xFFFF) { - case 0x04: /* B_CRT */ - CBiosArguments.reg.lh.CL = 3; /* CRT_ID */ + case 0x04: + CBiosArguments.reg.lh.CL = 3; break; - case 0x01: /* B_LCD */ - CBiosArguments.reg.lh.CL = 1; /* LCD_ID */ + case 0x01: + CBiosArguments.reg.lh.CL = 1; break; - case 0x02: /* B_DVI */ - CBiosArguments.reg.lh.CL = 2; /* DVI_ID */ + case 0x02: + CBiosArguments.reg.lh.CL = 2; break; - case 0x20: /* B_TV */ - CBiosArguments.reg.lh.CL = 6; /* TV_ID */ + case 0x20: + CBiosArguments.reg.lh.CL = 6; break; default: CBiosArguments.reg.lh.CL = 0; @@ -324,34 +305,34 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) outBufPtr[0] = 0; switch ((CBiosArguments.reg.ex.EBX & 0x000F0000) >> 16) { - case 3: /* CRT_ID */ - outBufPtr[0] |= 0x0004; /* B_CRT */ + case 3: + outBufPtr[0] |= 0x0004; break; - case 1: /* LCD_ID */ - outBufPtr[0] |= 0x0001; /* B_LCD */ + case 1: + outBufPtr[0] |= 0x0001; break; - case 2: /* DVI_ID */ - outBufPtr[0] |= 0x0002; /* B_DVI */ + case 2: + outBufPtr[0] |= 0x0002; break; - case 6: /* TV_ID */ - outBufPtr[0] |= 0x0020; /* B_TV */ + case 6: + outBufPtr[0] |= 0x0020; break; default: break; } switch ((CBiosArguments.reg.ex.ECX & 0x000F0000) >> 16) { - case 3: /* CRT_ID */ - outBufPtr[0] |= 0x0004; /* B_CRT */ + case 3: + outBufPtr[0] |= 0x0004; break; - case 1: /* LCD_ID */ - outBufPtr[0] |= 0x0001; /* B_LCD */ + case 1: + outBufPtr[0] |= 0x0001; break; - case 2: /* DVI_ID */ - outBufPtr[0] |= 0x0002; /* B_DVI */ + case 2: + outBufPtr[0] |= 0x0002; break; - case 6: /* TV_ID */ - outBufPtr[0] |= 0x0020; /* B_TV */ + case 6: + outBufPtr[0] |= 0x0020; break; default: break; @@ -365,7 +346,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) } break; - /* Query hardware info function group */ + case UT_QUERY_HW_INFO: if (req->outBufferSize != sizeof(UTHWINFO)) return UT_FAIL; @@ -439,55 +420,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) } break; #if 0 -/* - case UT_QUERY_SAMM: - { - if (cjOut != sizeof(ULONG)) - return UT_INVALID; - *(ULONG*)pvOut = ppdev->pMultiMon->bEnableSAMMMode; - - return (UT_SUCCESS); - } - break; - case UT_SET_GAMMA: - { - if ((cjIn != sizeof(GammaTbl)) || - (((pGammaTbl)pvIn)->dwSize != MAX_CLUT_SIZE)) - return UT_INVALID; - - if (!EngDeviceIoControl(ppdev->hDriver, - IOCTL_VIDEO_SET_COLOR_REGISTERS, - ((pGammaTbl)pvIn)->pClut, - ((pGammaTbl)pvIn)->dwSize, - NULL, - 0, - &ulResult)) - { - return UT_SUCCESS; - } - else - return UT_FAIL; - } - break; - case UT_QUERY_GAMMA: - { - if ((cjOut != sizeof(GammaTbl)) || - (((pGammaTbl)pvIn)->dwSize != MAX_CLUT_SIZE)) - return UT_INVALID; - - // - // Get Gamma value from Look up table - // - if (*(ULONG*)pvIn & CRT) - QueryRegistryValue(ppdev, CRTGamma, ((pGammaTbl)pvOut)->pClut, MAX_CLUT_SIZE); - else if (*(ULONG*)pvIn & LCD) - QueryRegistryValue(ppdev, LCDGamma, ((pGammaTbl)pvOut)->pClut, MAX_CLUT_SIZE); - - return UT_SUCCESS; - } - break; -*/ #endif case UT_SET_LCD_PWM: if (req->inBufferSize != sizeof(UCHAR)) @@ -521,14 +454,14 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) if (req->outBufferSize != sizeof(LCDINFO)) return UT_FAIL; - // If color depth is 32 bpp, set it to 24. + int iDepth = pScrn->depth; - if (iDepth == 32) // 24 and 32 bpp should have same index 2. + if (iDepth == 32) iDepth = 24; CBiosArguments.reg.x.AX = OEMFunction; CBiosArguments.reg.x.BX = QueryLCDPanelSizeMode; - CBiosArguments.reg.lh.CL = (iDepth/8) - 1; // Color depth : 0(8 bpp), 1(16 bpp), 2(24/32 bpp) + CBiosArguments.reg.lh.CL = (iDepth/8) - 1; xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "Color depth is %d\n", CBiosArguments.reg.lh.CL); if (CInt10(&CBIOSExtension)) { @@ -540,29 +473,7 @@ int RDCGFXUtilityProc(xRDCGFXCommandReq* req) } break; #if 0 -/* - case UT_DECODER_JPEG_ENTRY: - { - DBG_GDI((0, "DrvEscape: UT_DECODER_JPEG_ENTRY")); - ulResult = ExtJpegDecoderEntry(pso, cjIn, pvIn, cjOut, pvOut); - return ulResult; - } - break; - case UT_ENCODER_JPEG_ENTRY: - { - DBG_GDI((0, "DrvEscape: UT_ENCODER_JPEG_ENTRY")); - ulResult = ExtJpegEncoderEntry(pso, cjIn, pvIn, cjOut, pvOut); - return ulResult; - } - break; - case UT_GET_USERMODE_DIRECTACCESS: - { - DBG_GDI((0, "DrvEscape: UT_GET_USERMODE_DIRECTACCESS")) ; - ulResult = ExtUserModeDirectAccess(pso, cjIn, pvIn, cjOut, pvOut) ; - return ulResult ; - } - break ; -*/ + #endif default: xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 4, "RDCGFXUtilityProc: unknown command 0x%x", req->util_cmd_id); |