mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 08:08:06 +02:00
svga: move host logging to winsys
This patch adds a host_log interface to svga_winsys and moves the host logging code to the winsys layer. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Neha Bhende <bhenden@vmware.com>
This commit is contained in:
parent
da8d9e2d88
commit
9c5f407b0b
9 changed files with 44 additions and 40 deletions
|
|
@ -15,8 +15,6 @@ C_SOURCES := \
|
|||
svga_hw_reg.h \
|
||||
svga_link.c \
|
||||
svga_link.h \
|
||||
svga_msg.c \
|
||||
svga_msg.h \
|
||||
svga_mksstats.h \
|
||||
svga_pipe_blend.c \
|
||||
svga_pipe_blit.c \
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ files_svga = files(
|
|||
'svga_draw_elements.c',
|
||||
'svga_format.c',
|
||||
'svga_link.c',
|
||||
'svga_msg.c',
|
||||
'svga_pipe_blend.c',
|
||||
'svga_pipe_blit.c',
|
||||
'svga_pipe_clear.c',
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
#include "svga_public.h"
|
||||
#include "svga_context.h"
|
||||
#include "svga_format.h"
|
||||
#include "svga_msg.h"
|
||||
#include "svga_screen.h"
|
||||
#include "svga_tgsi.h"
|
||||
#include "svga_resource_texture.h"
|
||||
|
|
@ -891,17 +890,18 @@ svga_get_driver_query_info(struct pipe_screen *screen,
|
|||
static void
|
||||
init_logging(struct pipe_screen *screen)
|
||||
{
|
||||
struct svga_screen *svgascreen = svga_screen(screen);
|
||||
static const char *log_prefix = "Mesa: ";
|
||||
char host_log[1000];
|
||||
|
||||
/* Log Version to Host */
|
||||
util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix),
|
||||
"%s%s", log_prefix, svga_get_name(screen));
|
||||
svga_host_log(host_log);
|
||||
"%s%s\n", log_prefix, svga_get_name(screen));
|
||||
svgascreen->sws->host_log(svgascreen->sws, host_log);
|
||||
|
||||
util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix),
|
||||
"%s" PACKAGE_VERSION MESA_GIT_SHA1, log_prefix);
|
||||
svga_host_log(host_log);
|
||||
svgascreen->sws->host_log(svgascreen->sws, host_log);
|
||||
|
||||
/* If the SVGA_EXTRA_LOGGING env var is set, log the process's command
|
||||
* line (program name and arguments).
|
||||
|
|
@ -910,8 +910,8 @@ init_logging(struct pipe_screen *screen)
|
|||
char cmdline[1000];
|
||||
if (os_get_command_line(cmdline, sizeof(cmdline))) {
|
||||
util_snprintf(host_log, sizeof(host_log) - strlen(log_prefix),
|
||||
"%s%s", log_prefix, cmdline);
|
||||
svga_host_log(host_log);
|
||||
"%s%s\n", log_prefix, cmdline);
|
||||
svgascreen->sws->host_log(svgascreen->sws, host_log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -753,6 +753,11 @@ struct svga_winsys_screen
|
|||
void
|
||||
(*stats_time_pop)();
|
||||
|
||||
/**
|
||||
* Send a host log message
|
||||
*/
|
||||
void
|
||||
(*host_log)(struct svga_winsys_screen *sws, const char *message);
|
||||
|
||||
/** Have VGPU v10 hardware? */
|
||||
boolean have_vgpu10;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ C_SOURCES := \
|
|||
vmw_fence.c \
|
||||
vmw_fence.h \
|
||||
vmwgfx_drm.h \
|
||||
vmw_msg.c \
|
||||
vmw_msg.h \
|
||||
vmw_screen.c \
|
||||
vmw_screen_dri.c \
|
||||
vmw_screen.h \
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ files_svgadrm = files(
|
|||
'vmw_buffer.c',
|
||||
'vmw_context.c',
|
||||
'vmw_fence.c',
|
||||
'vmw_msg.c',
|
||||
'vmw_screen.c',
|
||||
'vmw_screen_dri.c',
|
||||
'vmw_screen_ioctl.c',
|
||||
|
|
|
|||
49
src/gallium/drivers/svga/svga_msg.c → src/gallium/winsys/svga/drm/vmw_msg.c
Executable file → Normal file
49
src/gallium/drivers/svga/svga_msg.c → src/gallium/winsys/svga/drm/vmw_msg.c
Executable file → Normal file
|
|
@ -29,7 +29,8 @@
|
|||
#include "util/u_memory.h"
|
||||
#include "util/u_string.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "svga_msg.h"
|
||||
#include "svga_winsys.h"
|
||||
#include "vmw_msg.h"
|
||||
|
||||
|
||||
#define MESSAGE_STATUS_SUCCESS 0x0001
|
||||
|
|
@ -83,7 +84,7 @@
|
|||
port_num, magic, \
|
||||
ax, bx, cx, dx, si, di) \
|
||||
({ \
|
||||
__asm__ volatile ("inl %%dx, %%eax;" : \
|
||||
__asm__ volatile ("inl %%dx, %%eax;" : \
|
||||
"=a"(ax), \
|
||||
"=b"(bx), \
|
||||
"=c"(cx), \
|
||||
|
|
@ -128,7 +129,7 @@ typedef uint64_t VMW_REG;
|
|||
port_num, magic, bp, \
|
||||
ax, bx, cx, dx, si, di) \
|
||||
({ \
|
||||
__asm__ volatile ("push %%rbp;" \
|
||||
__asm__ volatile ("push %%rbp;" \
|
||||
"movq %12, %%rbp;" \
|
||||
"rep outsb;" \
|
||||
"pop %%rbp;" : \
|
||||
|
|
@ -152,7 +153,7 @@ typedef uint64_t VMW_REG;
|
|||
port_num, magic, bp, \
|
||||
ax, bx, cx, dx, si, di) \
|
||||
({ \
|
||||
__asm__ volatile ("push %%rbp;" \
|
||||
__asm__ volatile ("push %%rbp;" \
|
||||
"movq %12, %%rbp;" \
|
||||
"rep insb;" \
|
||||
"pop %%rbp" : \
|
||||
|
|
@ -183,7 +184,7 @@ typedef uint32_t VMW_REG;
|
|||
port_num, magic, bp, \
|
||||
ax, bx, cx, dx, si, di) \
|
||||
({ \
|
||||
__asm__ volatile ("push %%ebp;" \
|
||||
__asm__ volatile ("push %%ebp;" \
|
||||
"mov %12, %%ebp;" \
|
||||
"rep outsb;" \
|
||||
"pop %%ebp;" : \
|
||||
|
|
@ -208,7 +209,7 @@ typedef uint32_t VMW_REG;
|
|||
port_num, magic, bp, \
|
||||
ax, bx, cx, dx, si, di) \
|
||||
({ \
|
||||
__asm__ volatile ("push %%ebp;" \
|
||||
__asm__ volatile ("push %%ebp;" \
|
||||
"mov %12, %%ebp;" \
|
||||
"rep insb;" \
|
||||
"pop %%ebp" : \
|
||||
|
|
@ -252,7 +253,7 @@ typedef uint32_t VMW_REG;
|
|||
(void) in_cx; (void) bp; \
|
||||
(void) ax; (void) bx; (void) cx; \
|
||||
(void) dx; (void) si; (void) di;
|
||||
|
||||
|
||||
|
||||
#define VMW_PORT_HB_IN(cmd, in_cx, in_si, in_di, \
|
||||
port_num, magic, bp, \
|
||||
|
|
@ -283,7 +284,7 @@ struct rpc_channel {
|
|||
|
||||
|
||||
/**
|
||||
* svga_open_channel
|
||||
* vmw_open_channel
|
||||
*
|
||||
* @channel: RPC channel
|
||||
* @protocol:
|
||||
|
|
@ -291,7 +292,7 @@ struct rpc_channel {
|
|||
* Returns: PIPE_OK on success, PIPE_ERROR otherwise
|
||||
*/
|
||||
static enum pipe_error
|
||||
svga_open_channel(struct rpc_channel *channel, unsigned protocol)
|
||||
vmw_open_channel(struct rpc_channel *channel, unsigned protocol)
|
||||
{
|
||||
VMW_REG ax = 0, bx = 0, cx = 0, dx = 0, si = 0, di = 0;
|
||||
|
||||
|
|
@ -321,7 +322,7 @@ svga_open_channel(struct rpc_channel *channel, unsigned protocol)
|
|||
* Returns: PIPE_OK on success, PIPE_ERROR otherwises
|
||||
*/
|
||||
static enum pipe_error
|
||||
svga_close_channel(struct rpc_channel *channel)
|
||||
vmw_close_channel(struct rpc_channel *channel)
|
||||
{
|
||||
VMW_REG ax = 0, bx = 0, cx = 0, dx = 0, si, di;
|
||||
|
||||
|
|
@ -344,7 +345,7 @@ svga_close_channel(struct rpc_channel *channel)
|
|||
|
||||
|
||||
/**
|
||||
* svga_send_msg: Sends a message to the host
|
||||
* vmw_send_msg: Sends a message to the host
|
||||
*
|
||||
* @channel: RPC channel
|
||||
* @logmsg: NULL terminated string
|
||||
|
|
@ -352,7 +353,7 @@ svga_close_channel(struct rpc_channel *channel)
|
|||
* Returns: PIPE_OK on success
|
||||
*/
|
||||
static enum pipe_error
|
||||
svga_send_msg(struct rpc_channel *channel, const char *msg)
|
||||
vmw_send_msg(struct rpc_channel *channel, const char *msg)
|
||||
{
|
||||
VMW_REG ax = 0, bx = 0, cx = 0, dx = 0, si, di, bp;
|
||||
size_t msg_len = strlen(msg);
|
||||
|
|
@ -406,46 +407,42 @@ svga_send_msg(struct rpc_channel *channel, const char *msg)
|
|||
|
||||
|
||||
/**
|
||||
* svga_host_log: Sends a log message to the host
|
||||
* vmw_svga_winsys_host_log: Sends a log message to the host
|
||||
*
|
||||
* @log: NULL terminated string
|
||||
*
|
||||
* Returns: PIPE_OK on success
|
||||
*/
|
||||
enum pipe_error
|
||||
svga_host_log(const char *log)
|
||||
void
|
||||
vmw_svga_winsys_host_log(struct svga_winsys_screen *sws, const char *log)
|
||||
{
|
||||
struct rpc_channel channel;
|
||||
char *msg;
|
||||
int msg_len;
|
||||
enum pipe_error ret = PIPE_OK;
|
||||
|
||||
#ifdef MSG_NOT_IMPLEMENTED
|
||||
return ret;
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (!log)
|
||||
return ret;
|
||||
return;
|
||||
|
||||
msg_len = strlen(log) + strlen("log ") + 1;
|
||||
msg = CALLOC(1, msg_len);
|
||||
if (msg == NULL) {
|
||||
debug_printf("Cannot allocate memory for log message\n");
|
||||
return PIPE_ERROR_OUT_OF_MEMORY;
|
||||
return;
|
||||
}
|
||||
|
||||
util_sprintf(msg, "log %s", log);
|
||||
|
||||
if (svga_open_channel(&channel, RPCI_PROTOCOL_NUM) ||
|
||||
svga_send_msg(&channel, msg) ||
|
||||
svga_close_channel(&channel)) {
|
||||
if (vmw_open_channel(&channel, RPCI_PROTOCOL_NUM) ||
|
||||
vmw_send_msg(&channel, msg) ||
|
||||
vmw_close_channel(&channel)) {
|
||||
debug_printf("Failed to send log\n");
|
||||
|
||||
ret = PIPE_ERROR;
|
||||
}
|
||||
|
||||
FREE(msg);
|
||||
|
||||
return ret;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -26,17 +26,16 @@
|
|||
* Author:
|
||||
* Sinclair Yeh <syeh@vmware.com>
|
||||
*/
|
||||
#ifndef _SVGA_MSG_H
|
||||
#define _SVGA_MSG_H
|
||||
#ifndef _VMW_MSG_H
|
||||
#define _VMW_MSG_H
|
||||
|
||||
/**
|
||||
* svga_host_log: Sends a log message to the host
|
||||
* vmw_host_log: Sends a log message to the host
|
||||
*
|
||||
* @log: NULL terminated string
|
||||
*
|
||||
* Returns: PIPE_OK on success
|
||||
*/
|
||||
enum pipe_error svga_host_log(const char *log);
|
||||
void vmw_svga_winsys_host_log(struct svga_winsys_screen *sws, const char *log);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -48,6 +48,7 @@
|
|||
#include "vmw_surface.h"
|
||||
#include "vmw_buffer.h"
|
||||
#include "vmw_fence.h"
|
||||
#include "vmw_msg.h"
|
||||
#include "vmw_shader.h"
|
||||
#include "vmw_query.h"
|
||||
#include "svga3d_surfacedefs.h"
|
||||
|
|
@ -509,6 +510,8 @@ vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws)
|
|||
vws->base.stats_time_push = vmw_svga_winsys_stats_time_push;
|
||||
vws->base.stats_time_pop = vmw_svga_winsys_stats_time_pop;
|
||||
|
||||
vws->base.host_log = vmw_svga_winsys_host_log;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue