Win: Build Glave replay on Windows (REQUIRES NEW CMAKE COMMAND).

Starting with this commit, building XGL on Windows requires explicitly stating
whether a "Release" or "Debug" build is desired when doing the initial cmake
command.  This is documented in the "Build.md" file.

Linux trace of cube plays to completion on windows!

Changes to the null driver:
    advertise support for both WIN WSI and X11 WSI
    added support for xglCreateBufferView
    and added a logging capability (turned off by default)

Still have some issues:
    - x11 support emulation/replacement
    - Windows null driver creates a bad device queue
    - Need to copy libraries to dir containing the .exe

Glave ext libs are now put in same dir as glvreplay64.exe...

This change only affects Windows -- on Linux the libs and
the glave replay progs were already in the same dir.

Also added a line to BUILD.md regarding the need to have XGL.dll
in PATH.
This commit is contained in:
David Pinedo 2015-02-10 15:02:08 -07:00 committed by Ian Elliott
parent 7f0bf594f7
commit 73436a55a4
4 changed files with 193 additions and 8 deletions

View File

@ -145,11 +145,13 @@ Example debug build:
cd GL-Next # cd to the root of the xgl git repository
mkdir _out64
cd _out64
cmake -G "Visual Studio 12 Win64" ..
cmake -G "Visual Studio 12 Win64" -DCMAKE_BUILD_TYPE=Debug ..
```
At this point, you can use Windows Explorer to launch Visual Studio by double-clicking on the "XGL.sln" file in the _out64 folder. Once Visual Studio comes up, you can select "Debug" or "Release" from a drop-down list. You can start a build with either the menu (Build->Build Solution), or a keyboard shortcut (Ctrl+Shift+B). As part of the build process, Python scripts will create additional Visual Studio files and projects, along with additional source files. All of these auto-generated files are under the "_out64" folder.
XGL programs must be able to find and use the XGL.dll libary. Make sure it is either installed in the C:\Windows\System32 folder, or the PATH enviroment variable includes the folder that it is located in.
To run XGL programs you must have an appropriate icd (installable client driver) that is either installed in the C:\Windows\System32 folder, or pointed to by the
environment variable LIBXGL_DRIVERS_PATH. This environment variable cannot be set with Cygwin, but must be set via Windows, and may require a system restart in order for it to take effect. Here is how to set this environment variable on a Windows 7 system:

View File

@ -2294,12 +2294,10 @@ class Subcommand(object):
ri_body.append('int xglReplay::init(glv_replay::Display & disp)')
ri_body.append('{')
ri_body.append(' int err;')
ri_body.append('#if defined _WIN64')
ri_body.append(' HMODULE handle = LoadLibrary("xgl64.dll" );')
ri_body.append('#elif defined _WIN32')
ri_body.append(' HMODULE handle = LoadLibrary("xgl32.dll" );')
ri_body.append('#elif defined PLATFORM_LINUX')
ri_body.append('#if defined PLATFORM_LINUX')
ri_body.append(' void * handle = dlopen("libXGL.so", RTLD_LAZY);')
ri_body.append('#else')
ri_body.append(' HMODULE handle = LoadLibrary("xgl.dll" );')
ri_body.append('#endif\n')
ri_body.append(' if (handle == NULL) {')
ri_body.append(' glv_LogError("Failed to open xgl library.\\n");')
@ -3078,18 +3076,32 @@ class Subcommand(object):
def _gen_replay_wsi_associate_connection(self):
wac_body = []
wac_body.append('#ifdef WIN32')
wac_body.append(' //TBD')
wac_body.append(' replayResult = XGL_SUCCESS;')
wac_body.append('#else')
wac_body.append(' //associate with the replayers Wsi connection rather than tracers')
wac_body.append(' replayResult = m_xglFuncs.real_xglWsiX11AssociateConnection(remap(pPacket->gpu), &(m_display->m_WsiConnection));')
wac_body.append('#endif')
return "\n".join(wac_body)
def _gen_replay_wsi_get_msc(self):
wgm_body = []
wgm_body.append('#ifdef WIN32')
wgm_body.append(' //TBD')
wgm_body.append(' replayResult = XGL_SUCCESS;')
wgm_body.append('#else')
wgm_body.append(' xcb_window_t window = m_display->m_XcbWindow;')
wgm_body.append(' replayResult = m_xglFuncs.real_xglWsiX11GetMSC(remap(pPacket->device), window, pPacket->crtc, pPacket->pMsc);')
wgm_body.append('#endif')
return "\n".join(wgm_body)
def _gen_replay_wsi_create_presentable_image(self):
cpi_body = []
cpi_body.append('#ifdef WIN32')
cpi_body.append(' //TBD')
cpi_body.append(' replayResult = XGL_SUCCESS;')
cpi_body.append('#else')
cpi_body.append(' XGL_IMAGE img;')
cpi_body.append(' XGL_GPU_MEMORY mem;')
cpi_body.append(' m_display->imageHeight.push_back(pPacket->pCreateInfo->extent.height);')
@ -3104,10 +3116,15 @@ class Subcommand(object):
cpi_body.append(' m_display->imageHandles.push_back(img);')
cpi_body.append(' m_display->imageMemory.push_back(mem);')
cpi_body.append(' }')
cpi_body.append('#endif')
return "\n".join(cpi_body)
def _gen_replay_wsi_queue_present(self):
wqp_body = []
wqp_body.append('#ifdef WIN32')
wqp_body.append(' //TBD')
wqp_body.append(' replayResult = XGL_SUCCESS;')
wqp_body.append('#else')
wqp_body.append(' XGL_WSI_X11_PRESENT_INFO pInfo;')
wqp_body.append(' std::vector<int>::iterator it;')
wqp_body.append(' memcpy(&pInfo, pPacket->pPresentInfo, sizeof(XGL_WSI_X11_PRESENT_INFO));')
@ -3130,6 +3147,7 @@ class Subcommand(object):
wqp_body.append(' }')
wqp_body.append(' }')
wqp_body.append(' }')
wqp_body.append('#endif')
wqp_body.append(' m_display->m_frameNumber++;')
return "\n".join(wqp_body)
@ -3462,7 +3480,11 @@ class GlaveWsiHeader(Subcommand):
header_txt = []
header_txt.append('#pragma once\n')
header_txt.append('#include "xgl.h"')
header_txt.append('#if defined(PLATFORM_LINUX)')
header_txt.append('#include "xglWsiX11Ext.h"\n')
header_txt.append('#else')
header_txt.append('#include "xglWsiWinExt.h"')
header_txt.append('#endif')
header_txt.append('void AttachHooks_xglwsix11ext();')
header_txt.append('void DetachHooks_xglwsix11ext();')
return "\n".join(header_txt)
@ -3498,7 +3520,11 @@ class GlaveWsiStructs(Subcommand):
def generate_header(self):
header_txt = []
header_txt.append('#pragma once\n')
header_txt.append('#if defined(PLATFORM_LINUX)')
header_txt.append('#include "xglWsiX11Ext.h"')
header_txt.append('#else')
header_txt.append('#include "xglWsiWinExt.h"')
header_txt.append('#endif')
header_txt.append('#include "glv_trace_packet_utils.h"\n')
return "\n".join(header_txt)
@ -3566,13 +3592,19 @@ class GlaveReplayHeader(Subcommand):
header_txt.append('#include <map>')
header_txt.append('#include <vector>')
header_txt.append('#include <string>')
header_txt.append('#if defined(PLATFORM_LINUX)')
header_txt.append('#include <xcb/xcb.h>\n')
header_txt.append('#endif')
header_txt.append('#include "glvreplay_window.h"')
header_txt.append('#include "glvreplay_factory.h"')
header_txt.append('#include "glv_trace_packet_identifiers.h"\n')
header_txt.append('#include "xgl.h"')
header_txt.append('#include "xglDbg.h"')
header_txt.append('#if defined(PLATFORM_LINUX)')
header_txt.append('#include "xglWsiX11Ext.h"')
header_txt.append('#else')
header_txt.append('#include "xglWsiWinExt.h"')
header_txt.append('#endif')
return "\n".join(header_txt)
def generate_body(self):

View File

@ -19,8 +19,9 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
if (WIN32)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXGL_PROTOTYPES -D_CRT_SECURE_NO_WARNINGS")
add_library(XGL SHARED loader.c dirent_on_windows.c dispatch.c table_ops.h)
add_library(XGLstatic STATIC loader.c dirent_on_windows.c dispatch.c table_ops.h)
add_library(XGL SHARED loader.c loader.h dirent_on_windows.c dispatch.c table_ops.h XGL.def)
set_target_properties(XGL PROPERTIES LINK_FLAGS "/DEF:${PROJECT_SOURCE_DIR}/loader/XGL.def")
add_library(XGLstatic STATIC loader.c loader.h dirent_on_windows.c dispatch.c table_ops.h)
set_target_properties(XGLstatic PROPERTIES OUTPUT_NAME XGL)
target_link_libraries(XGL)
endif()

150
loader/XGL.def Normal file
View File

@ -0,0 +1,150 @@
;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; XGL
;
; Copyright (C) 2015 LunarG, Inc.
;
; Permission is hereby granted, free of charge, to any person obtaining a
; copy of this software and associated documentation files (the "Software"),
; to deal in the Software without restriction, including without limitation
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
; and/or sell copies of the Software, and to permit persons to whom the
; Software is furnished to do so, subject to the following conditions:
;
; 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 AUTHORS OR COPYRIGHT HOLDERS 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.
;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The following is required on Windows, for exporting symbols from the DLL
LIBRARY XGL
EXPORTS
xglCreateInstance
xglDestroyInstance
xglEnumerateGpus
xglGetGpuInfo
xglGetProcAddr
xglCreateDevice
xglDestroyDevice
xglGetExtensionSupport
xglEnumerateLayers
xglGetDeviceQueue
xglQueueSubmit
xglQueueSetGlobalMemReferences
xglQueueWaitIdle
xglDeviceWaitIdle
xglAllocMemory
xglFreeMemory
xglSetMemoryPriority
xglMapMemory
xglUnmapMemory
xglPinSystemMemory
xglGetMultiGpuCompatibility
xglOpenSharedMemory
xglOpenSharedQueueSemaphore
xglOpenPeerMemory
xglOpenPeerImage
xglDestroyObject
xglGetObjectInfo
xglBindObjectMemory
xglBindObjectMemoryRange
xglBindImageMemoryRange
xglCreateFence
xglGetFenceStatus
xglWaitForFences
xglCreateQueueSemaphore
xglSignalQueueSemaphore
xglWaitQueueSemaphore
xglCreateEvent
xglGetEventStatus
xglSetEvent
xglResetEvent
xglCreateQueryPool
xglGetQueryPoolResults
xglGetFormatInfo
xglCreateBuffer
xglCreateBufferView
xglCreateImage
xglSetFastClearColor
xglSetFastClearDepth
xglGetImageSubresourceInfo
xglCreateImageView
xglCreateColorAttachmentView
xglCreateDepthStencilView
xglCreateShader
xglCreateGraphicsPipeline
xglCreateComputePipeline
xglStorePipeline
xglLoadPipeline
xglCreatePipelineDelta
xglCreateSampler
xglCreateDescriptorSetLayout
xglBeginDescriptorRegionUpdate
xglEndDescriptorRegionUpdate
xglCreateDescriptorRegion
xglClearDescriptorRegion
xglAllocDescriptorSets
xglClearDescriptorSets
xglUpdateDescriptors
xglCreateDynamicViewportState
xglCreateDynamicRasterState
xglCreateDynamicColorBlendState
xglCreateDynamicDepthStencilState
xglCreateCommandBuffer
xglBeginCommandBuffer
xglEndCommandBuffer
xglResetCommandBuffer
xglCmdBindPipeline
xglCmdBindPipelineDelta
xglCmdBindDynamicStateObject
xglCmdBindDescriptorSet
xglCmdBindVertexBuffer
xglCmdBindIndexBuffer
xglCmdDraw
xglCmdDrawIndexed
xglCmdDrawIndirect
xglCmdDrawIndexedIndirect
xglCmdDispatch
xglCmdDispatchIndirect
xglCmdCopyBuffer
xglCmdCopyImage
xglCmdCopyBufferToImage
xglCmdCopyImageToBuffer
xglCmdCloneImageData
xglCmdUpdateBuffer
xglCmdFillBuffer
xglCmdClearColorImage
xglCmdClearColorImageRaw
xglCmdClearDepthStencil
xglCmdResolveImage
xglCmdSetEvent
xglCmdResetEvent
xglCmdWaitEvents
xglCmdPipelineBarrier
xglCmdBeginQuery
xglCmdEndQuery
xglCmdResetQueryPool
xglCmdWriteTimestamp
xglCmdInitAtomicCounters
xglCmdLoadAtomicCounters
xglCmdSaveAtomicCounters
xglCreateFramebuffer
xglCreateRenderPass
xglCmdBeginRenderPass
xglCmdEndRenderPass
xglDbgSetValidationLevel
xglDbgRegisterMsgCallback
xglDbgUnregisterMsgCallback
xglDbgSetMessageFilter
xglDbgSetObjectTag
xglDbgSetGlobalOption
xglDbgSetDeviceOption
xglCmdDbgMarkerBegin
xglCmdDbgMarkerEnd