summaryrefslogtreecommitdiff
path: root/src/gallium/targets/xorg-vmwgfx
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/targets/xorg-vmwgfx')
-rw-r--r--src/gallium/targets/xorg-vmwgfx/Makefile15
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c3
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_driver.h1
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_screen.c45
-rw-r--r--src/gallium/targets/xorg-vmwgfx/vmw_target.c26
5 files changed, 79 insertions, 11 deletions
diff --git a/src/gallium/targets/xorg-vmwgfx/Makefile b/src/gallium/targets/xorg-vmwgfx/Makefile
index c0ff999116..04a444f5e9 100644
--- a/src/gallium/targets/xorg-vmwgfx/Makefile
+++ b/src/gallium/targets/xorg-vmwgfx/Makefile
@@ -8,6 +8,7 @@ C_SOURCES = \
vmw_video.c \
vmw_ioctl.c \
vmw_ctrl.c \
+ vmw_target.c \
vmw_screen.c
DRIVER_INCLUDES = \
@@ -15,16 +16,18 @@ DRIVER_INCLUDES = \
DRIVER_DEFINES = \
-std=gnu99 \
+ -DGALLIUM_RBUG \
+ -DGALLIUM_TRACE \
-DHAVE_CONFIG_H
-DRIVER_LINKS = \
+DRIVER_PIPES = \
$(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \
$(TOP)/src/gallium/winsys/svga/drm/libsvgadrm.a \
- $(TOP)/src/gallium/drivers/trace/libtrace.a \
- $(TOP)/src/gallium/drivers/rbug/librbug.a \
$(TOP)/src/gallium/drivers/svga/libsvga.a \
- $(GALLIUM_AUXILIARIES) \
- $(shell pkg-config --libs --silence-errors libkms) \
- $(shell pkg-config --libs libdrm)
+ $(TOP)/src/gallium/drivers/trace/libtrace.a \
+ $(TOP)/src/gallium/drivers/rbug/librbug.a
+
+DRIVER_LINKS = \
+ $(shell pkg-config --libs libdrm libkms)
include ../Makefile.xorg
diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
index 1cc8ddaac3..237b308ae3 100644
--- a/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_ctrl.c
@@ -32,9 +32,6 @@
* allows X clients to communicate with the driver.
*/
-
-#define NEED_REPLIES
-#define NEED_EVENTS
#include "dixstruct.h"
#include "extnsionst.h"
#include <X11/X.h>
diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_driver.h b/src/gallium/targets/xorg-vmwgfx/vmw_driver.h
index d6e3620cd3..8dfc9d2efb 100644
--- a/src/gallium/targets/xorg-vmwgfx/vmw_driver.h
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_driver.h
@@ -59,6 +59,7 @@ struct vmw_customizer
/* vmw_video.c */
void *video_priv;
+ uint64_t max_fb_size;
};
static INLINE struct vmw_customizer *
diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
index 64934d53f6..8173908f55 100644
--- a/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_screen.c
@@ -35,6 +35,7 @@
#include <pipe/p_context.h>
#include "cursorstr.h"
+#include "../../winsys/svga/drm/vmwgfx_drm.h"
void vmw_winsys_screen_set_throttling(struct pipe_screen *screen,
uint32_t throttle_us);
@@ -111,13 +112,29 @@ vmw_context_no_throttle(CustomizerPtr cust,
}
static Bool
-vmw_screen_init(CustomizerPtr cust, int fd)
+vmw_check_fb_size(CustomizerPtr cust,
+ unsigned long pitch,
+ unsigned long height)
+{
+ struct vmw_customizer *vmw = vmw_customizer(cust);
+
+ /**
+ * 1) Is there a pitch alignment?
+ * 2) The 1024 byte pad is an arbitrary value to be on
+ */
+
+ return ((uint64_t) pitch * height + 1024ULL < vmw->max_fb_size);
+}
+
+static Bool
+vmw_pre_init(CustomizerPtr cust, int fd)
{
struct vmw_customizer *vmw = vmw_customizer(cust);
drmVersionPtr ver;
vmw->fd = fd;
- ver = drmGetVersion(fd);
+
+ ver = drmGetVersion(vmw->fd);
if (ver == NULL ||
(ver->version_major == 1 && ver->version_minor < 1)) {
cust->swap_throttling = TRUE;
@@ -128,11 +145,34 @@ vmw_screen_init(CustomizerPtr cust, int fd)
cust->dirty_throttling = FALSE;
cust->winsys_context_throttle = vmw_context_throttle;
debug_printf("%s: Enabling kernel throttling.\n", __func__);
+
+ if (ver->version_major > 1 ||
+ (ver->version_major == 1 && ver->version_minor >= 3)) {
+ struct drm_vmw_getparam_arg arg;
+ int ret;
+
+ arg.param = DRM_VMW_PARAM_MAX_FB_SIZE;
+ ret = drmCommandWriteRead(fd, DRM_VMW_GET_PARAM, &arg,
+ sizeof(arg));
+ if (!ret) {
+ vmw->max_fb_size = arg.value;
+ cust->winsys_check_fb_size = vmw_check_fb_size;
+ debug_printf("%s: Enabling fb size check.\n", __func__);
+ }
+ }
}
if (ver)
drmFreeVersion(ver);
+ return TRUE;
+}
+
+static Bool
+vmw_screen_init(CustomizerPtr cust)
+{
+ struct vmw_customizer *vmw = vmw_customizer(cust);
+
vmw_screen_cursor_init(vmw);
vmw_ctrl_ext_init(vmw);
@@ -199,6 +239,7 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags)
cust = &vmw->base;
+ cust->winsys_pre_init = vmw_pre_init;
cust->winsys_screen_init = vmw_screen_init;
cust->winsys_screen_close = vmw_screen_close;
cust->winsys_enter_vt = vmw_screen_enter_vt;
diff --git a/src/gallium/targets/xorg-vmwgfx/vmw_target.c b/src/gallium/targets/xorg-vmwgfx/vmw_target.c
new file mode 100644
index 0000000000..15089d6db2
--- /dev/null
+++ b/src/gallium/targets/xorg-vmwgfx/vmw_target.c
@@ -0,0 +1,26 @@
+
+#include "target-helpers/inline_debug_helper.h"
+#include "state_tracker/drm_driver.h"
+#include "svga/drm/svga_drm_public.h"
+#include "svga/svga_public.h"
+
+static struct pipe_screen *
+create_screen(int fd)
+{
+ struct svga_winsys_screen *sws;
+ struct pipe_screen *screen;
+
+ sws = svga_drm_winsys_screen_create(fd);
+ if (!sws)
+ return NULL;
+
+ screen = svga_screen_create(sws);
+ if (!screen)
+ return NULL;
+
+ screen = debug_screen_wrap(screen);
+
+ return screen;
+}
+
+DRM_DRIVER_DESCRIPTOR("vmwgfx", "vmwgfx", create_screen)