From: Roland Scheidegger Date: Thu, 24 Oct 2019 04:10:46 +0000 (+0200) Subject: winsys/svga: use new ioctl for logging X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b3c2daf3a73bd8e9f5dc4780a9074aa55f7cd0c;p=mesa.git winsys/svga: use new ioctl for logging Use the new ioctl for logging (rather than duplicating what the kernel is doing). This way it's also independent from the actual guest/host mechanism to do the logging. Signed-off-by: Roland Scheidegger Reviewed-by: Thomas Hellstrom Part-of: --- diff --git a/src/gallium/winsys/svga/drm/vmw_msg.c b/src/gallium/winsys/svga/drm/vmw_msg.c index 2a2d6a61297..e664769c279 100644 --- a/src/gallium/winsys/svga/drm/vmw_msg.c +++ b/src/gallium/winsys/svga/drm/vmw_msg.c @@ -31,6 +31,9 @@ #include "pipe/p_defines.h" #include "svga_winsys.h" #include "vmw_msg.h" +#include "vmwgfx_drm.h" +#include "vmw_screen.h" +#include "xf86drm.h" #define MESSAGE_STATUS_SUCCESS 0x0001 @@ -424,6 +427,7 @@ void vmw_svga_winsys_host_log(struct svga_winsys_screen *sws, const char *log) { struct rpc_channel channel; + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); char *msg; int msg_len; int ret; @@ -444,9 +448,21 @@ vmw_svga_winsys_host_log(struct svga_winsys_screen *sws, const char *log) sprintf(msg, "log %s", log); - if (!(ret = vmw_open_channel(&channel, RPCI_PROTOCOL_NUM))) { - ret = vmw_send_msg(&channel, msg); - vmw_close_channel(&channel); + if (vws->ioctl.have_drm_2_17) { + struct drm_vmw_msg_arg msg_arg; + + memset(&msg_arg, 0, sizeof(msg_arg)); + msg_arg.send = (uint64_t) (unsigned long) (msg); + msg_arg.send_only = 1; + + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_MSG, + &msg_arg, sizeof(msg_arg)); + + } else { + if (!(ret = vmw_open_channel(&channel, RPCI_PROTOCOL_NUM))) { + ret = vmw_send_msg(&channel, msg); + vmw_close_channel(&channel); + } } if (ret) diff --git a/src/gallium/winsys/svga/drm/vmw_screen.h b/src/gallium/winsys/svga/drm/vmw_screen.h index e0b1bb33bc4..c55de4a2b6f 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen.h +++ b/src/gallium/winsys/svga/drm/vmw_screen.h @@ -78,6 +78,8 @@ struct vmw_winsys_screen boolean have_drm_2_9; uint32_t drm_execbuf_version; boolean have_drm_2_15; + boolean have_drm_2_16; + boolean have_drm_2_17; } ioctl; struct { diff --git a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c index 2e84c811e82..4ce953fee8d 100644 --- a/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c +++ b/src/gallium/winsys/svga/drm/vmw_screen_ioctl.c @@ -973,7 +973,6 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) drmVersionPtr version; boolean drm_gb_capable; boolean have_drm_2_5; - boolean have_drm_2_16; const char *getenv_val; VMW_FUNC; @@ -990,8 +989,10 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) (version->version_major == 2 && version->version_minor > 8); vws->ioctl.have_drm_2_15 = version->version_major > 2 || (version->version_major == 2 && version->version_minor > 14); - have_drm_2_16 = version->version_major > 2 || + vws->ioctl.have_drm_2_16 = version->version_major > 2 || (version->version_major == 2 && version->version_minor > 15); + vws->ioctl.have_drm_2_17 = version->version_major > 2 || + (version->version_major == 2 && version->version_minor > 16); vws->ioctl.drm_execbuf_version = vws->ioctl.have_drm_2_9 ? 2 : 1; @@ -1116,7 +1117,7 @@ vmw_ioctl_init(struct vmw_winsys_screen *vws) else vws->ioctl.num_cap_3d = SVGA3D_DEVCAP_MAX; - if (have_drm_2_16) { + if (vws->ioctl.have_drm_2_16) { vws->base.have_coherent = TRUE; getenv_val = getenv("SVGA_FORCE_COHERENT"); if (getenv_val && strcmp(getenv_val, "0") != 0) diff --git a/src/gallium/winsys/svga/drm/vmwgfx_drm.h b/src/gallium/winsys/svga/drm/vmwgfx_drm.h index 02cab33f2f2..fcb741e3068 100644 --- a/src/gallium/winsys/svga/drm/vmwgfx_drm.h +++ b/src/gallium/winsys/svga/drm/vmwgfx_drm.h @@ -71,6 +71,7 @@ extern "C" { #define DRM_VMW_CREATE_EXTENDED_CONTEXT 26 #define DRM_VMW_GB_SURFACE_CREATE_EXT 27 #define DRM_VMW_GB_SURFACE_REF_EXT 28 +#define DRM_VMW_MSG 29 /*************************************************************************/ /** @@ -1213,6 +1214,22 @@ union drm_vmw_gb_surface_reference_ext_arg { struct drm_vmw_surface_arg req; }; +/** + * struct drm_vmw_msg_arg + * + * @send: Pointer to user-space msg string (null terminated). + * @receive: Pointer to user-space receive buffer. + * @send_only: Boolean whether this is only sending or receiving too. + * + * Argument to the DRM_VMW_MSG ioctl. + */ +struct drm_vmw_msg_arg { + __u64 send; + __u64 receive; + __s32 send_only; + __u32 receive_len; +}; + #if defined(__cplusplus) } #endif