summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg
diff options
context:
space:
mode:
authorThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-05 12:04:08 +0200
committerThomas Balling Sørensen <tball@tball-laptop.(none)>2010-10-05 12:04:08 +0200
commit1218430e1200a08cd64b6555d3fd1fd0274ad9e5 (patch)
treee060fb27b8388a4bd237ca39fc20f1675c5e367c /src/gallium/state_trackers/xorg
parent63b1525cf0a50e3d31328c3b56355a86056e4c05 (diff)
parentbf21b7006c63c3dc47045c22d4f372dfe6c7ce67 (diff)
Merge branch 'master' into pipe-video
Conflicts: configs/linux-dri configure.ac src/gallium/drivers/nvfx/Makefile src/gallium/include/pipe/p_defines.h src/gallium/include/pipe/p_screen.h src/gallium/include/state_tracker/dri1_api.h src/gallium/include/state_tracker/drm_api.h src/gallium/tests/python/samples/tri.py src/gallium/tests/trivial/Makefile src/gallium/tests/unit/Makefile src/gallium/tests/unit/SConscript src/gallium/tests/unit/u_format_test.c src/gallium/winsys/nouveau/drm/nouveau_drm_api.c
Diffstat (limited to 'src/gallium/state_trackers/xorg')
-rw-r--r--src/gallium/state_trackers/xorg/SConscript4
-rw-r--r--src/gallium/state_trackers/xorg/xorg_crtc.c16
-rw-r--r--src/gallium/state_trackers/xorg/xorg_dri2.c20
-rw-r--r--src/gallium/state_trackers/xorg/xorg_driver.c307
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.c99
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa.h1
-rw-r--r--src/gallium/state_trackers/xorg/xorg_exa_tgsi.c2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_output.c68
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.c39
-rw-r--r--src/gallium/state_trackers/xorg/xorg_renderer.h2
-rw-r--r--src/gallium/state_trackers/xorg/xorg_tracker.h29
-rw-r--r--src/gallium/state_trackers/xorg/xorg_xv.c14
12 files changed, 336 insertions, 265 deletions
diff --git a/src/gallium/state_trackers/xorg/SConscript b/src/gallium/state_trackers/xorg/SConscript
index 5d0b6613ac7..0b598dab6e3 100644
--- a/src/gallium/state_trackers/xorg/SConscript
+++ b/src/gallium/state_trackers/xorg/SConscript
@@ -11,13 +11,15 @@ if 'xorg' in env['statetrackers']:
'#/src/mesa',
])
- env.ParseConfig('pkg-config --cflags --libs xorg-server')
+ env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server')
conf = env.Configure()
if conf.CheckHeader('X11/extensions/dpmsconst.h'):
env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')])
+ conf.Finish()
+
st_xorg = env.ConvenienceLibrary(
target = 'st_xorg',
source = [ 'xorg_composite.c',
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index 669bd9edcf0..26a907f205e 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -50,6 +50,7 @@
#include <X11/extensions/dpms.h>
#endif
+#include "state_tracker/drm_driver.h"
#include "util/u_inlines.h"
#include "util/u_rect.h"
@@ -90,11 +91,11 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
modesettingPtr ms = modesettingPTR(crtc->scrn);
xf86OutputPtr output = NULL;
- drmModeConnectorPtr drm_connector;
struct crtc_private *crtcp = crtc->driver_private;
drmModeCrtcPtr drm_crtc = crtcp->drm_crtc;
drmModeModeInfo drm_mode;
int i, ret;
+ unsigned int connector_id;
for (i = 0; i < config->num_output; output = NULL, i++) {
output = config->output[i];
@@ -106,7 +107,7 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
if (!output)
return FALSE;
- drm_connector = output->driver_private;
+ connector_id = xorg_output_get_id(output);
drm_mode.clock = mode->Clock;
drm_mode.hdisplay = mode->HDisplay;
@@ -127,7 +128,7 @@ crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
drm_mode.name[DRM_DISPLAY_MODE_LEN - 1] = '\0';
ret = drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y,
- &drm_connector->connector_id, 1, &drm_mode);
+ &connector_id, 1, &drm_mode);
if (ret)
return FALSE;
@@ -147,6 +148,7 @@ crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue,
/* XXX: hockup */
}
+#if 0 /* Implement and enable to enable rotation and reflection. */
static void *
crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height)
{
@@ -169,6 +171,8 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data)
/* ScrnInfoPtr pScrn = crtc->scrn; */
}
+#endif
+
/*
* Cursor functions
*/
@@ -363,9 +367,9 @@ static const xf86CrtcFuncsRec crtc_funcs = {
.hide_cursor = crtc_hide_cursor,
.load_cursor_argb = crtc_load_cursor_argb,
- .shadow_create = crtc_shadow_create,
- .shadow_allocate = crtc_shadow_allocate,
- .shadow_destroy = crtc_shadow_destroy,
+ .shadow_create = NULL,
+ .shadow_allocate = NULL,
+ .shadow_destroy = NULL,
.gamma_set = crtc_gamma_set,
.destroy = crtc_destroy,
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index b90f9c908d2..704aed6a82c 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -42,6 +42,8 @@
#include "util/u_format.h"
+#include "state_tracker/drm_driver.h"
+
/* Make all the #if cases in the code esier to read */
#ifndef DRI2INFOREC_VERSION
#define DRI2INFOREC_VERSION 1
@@ -299,6 +301,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
GCPtr gc;
RegionPtr copy_clip;
Bool save_accel;
+ CustomizerPtr cust = ms->cust;
/*
* In driCreateBuffers we dewrap windows into the
@@ -352,7 +355,8 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
ValidateGC(dst_draw, gc);
/* If this is a full buffer swap, throttle on the previous one */
- if (dst_priv->fence && REGION_NUM_RECTS(pRegion) == 1) {
+ if (ms->swapThrottling &&
+ dst_priv->fence && REGION_NUM_RECTS(pRegion) == 1) {
BoxPtr extents = REGION_EXTENTS(pScreen, pRegion);
if (extents->x1 == 0 && extents->y1 == 0 &&
@@ -374,6 +378,9 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
DamageRegionAppend(src_draw, pRegion);
DamageRegionProcessPending(src_draw);
+ if (cust && cust->winsys_context_throttle)
+ cust->winsys_context_throttle(cust, ms->ctx, THROTTLE_SWAP);
+
(*gc->ops->CopyArea)(src_draw, dst_draw, gc,
0, 0, pDraw->width, pDraw->height, 0, 0);
ms->exa->accel = save_accel;
@@ -381,8 +388,13 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
FreeScratchGC(gc);
ms->ctx->flush(ms->ctx, PIPE_FLUSH_SWAPBUFFERS,
- pDestBuffer->attachment == DRI2BufferFrontLeft ?
+ (pDestBuffer->attachment == DRI2BufferFrontLeft
+ && ms->swapThrottling) ?
&dst_priv->fence : NULL);
+
+ if (cust && cust->winsys_context_throttle)
+ cust->winsys_context_throttle(cust, ms->ctx, THROTTLE_RENDER);
+
}
Bool
@@ -403,7 +415,7 @@ xorg_dri2_init(ScreenPtr pScreen)
}
#endif
- dri2info.version = DRI2INFOREC_VERSION;
+ dri2info.version = min(DRI2INFOREC_VERSION, 3);
dri2info.fd = ms->fd;
dri2info.driverName = pScrn->driverName;
@@ -437,10 +449,12 @@ xorg_dri2_init(ScreenPtr pScreen)
ms->d_depth_bits_last =
ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24X8_UNORM,
PIPE_TEXTURE_2D,
+ 0,
PIPE_BIND_DEPTH_STENCIL, 0);
ms->ds_depth_bits_last =
ms->screen->is_format_supported(ms->screen, PIPE_FORMAT_Z24_UNORM_S8_USCALED,
PIPE_TEXTURE_2D,
+ 0,
PIPE_BIND_DEPTH_STENCIL, 0);
return DRI2ScreenInit(pScreen, &dri2info);
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index 3687ee0db4e..e10ff2f9508 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -51,6 +51,7 @@
#include <pciaccess.h>
+#include "state_tracker/drm_driver.h"
#include "pipe/p_context.h"
#include "xorg_tracker.h"
#include "xorg_winsys.h"
@@ -79,12 +80,18 @@ typedef enum
OPTION_SW_CURSOR,
OPTION_2D_ACCEL,
OPTION_DEBUG_FALLBACK,
+ OPTION_THROTTLE_SWAP,
+ OPTION_THROTTLE_DIRTY,
+ OPTION_3D_ACCEL
} drv_option_enums;
static const OptionInfoRec drv_options[] = {
{OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_2D_ACCEL, "2DAccel", OPTV_BOOLEAN, {0}, FALSE},
{OPTION_DEBUG_FALLBACK, "DebugFallback", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_THROTTLE_SWAP, "SwapThrottling", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_THROTTLE_DIRTY, "DirtyThrottling", OPTV_BOOLEAN, {0}, FALSE},
+ {OPTION_3D_ACCEL, "3DAccel", OPTV_BOOLEAN, {0}, FALSE},
{-1, NULL, OPTV_NONE, {0}, FALSE}
};
@@ -141,8 +148,6 @@ xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
static Bool drv_init_front_buffer_functions(ScrnInfoPtr pScrn);
static Bool drv_close_screen(int scrnIndex, ScreenPtr pScreen);
-static Bool drv_save_hw_state(ScrnInfoPtr pScrn);
-static Bool drv_restore_hw_state(ScrnInfoPtr pScrn);
/*
@@ -185,6 +190,7 @@ drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height)
{
xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
modesettingPtr ms = modesettingPTR(pScrn);
+ CustomizerPtr cust = ms->cust;
ScreenPtr pScreen = pScrn->pScreen;
int old_width, old_height;
PixmapPtr rootPixmap;
@@ -193,6 +199,16 @@ drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height)
if (width == pScrn->virtualX && height == pScrn->virtualY)
return TRUE;
+ if (cust && cust->winsys_check_fb_size &&
+ !cust->winsys_check_fb_size(cust, width*pScrn->bitsPerPixel / 8,
+ height)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Requested framebuffer size %dx%dx%d will not fit "
+ "in display memory.\n",
+ width, height, pScrn->bitsPerPixel);
+ return FALSE;
+ }
+
old_width = pScrn->virtualX;
old_height = pScrn->virtualY;
pScrn->virtualX = width;
@@ -265,18 +281,13 @@ drv_init_drm(ScrnInfoPtr pScrn)
);
- ms->api = drm_api_create();
- ms->fd = drmOpen(ms->api ? ms->api->driver_name : NULL, BusID);
+ ms->fd = drmOpen(driver_descriptor.driver_name, BusID);
+ ms->isMaster = TRUE;
xfree(BusID);
if (ms->fd >= 0)
return TRUE;
- if (ms->api && ms->api->destroy)
- ms->api->destroy(ms->api);
-
- ms->api = NULL;
-
return FALSE;
}
@@ -284,21 +295,6 @@ drv_init_drm(ScrnInfoPtr pScrn)
}
static Bool
-drv_close_drm(ScrnInfoPtr pScrn)
-{
- modesettingPtr ms = modesettingPTR(pScrn);
-
- if (ms->api && ms->api->destroy)
- ms->api->destroy(ms->api);
- ms->api = NULL;
-
- drmClose(ms->fd);
- ms->fd = -1;
-
- return TRUE;
-}
-
-static Bool
drv_init_resource_management(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
@@ -312,17 +308,11 @@ drv_init_resource_management(ScrnInfoPtr pScrn)
if (ms->screen || ms->kms)
return TRUE;
- if (ms->api) {
- ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL);
+ if (!ms->no3D)
+ ms->screen = driver_descriptor.create_screen(ms->fd);
- if (ms->screen)
- return TRUE;
-
- if (ms->api->destroy)
- ms->api->destroy(ms->api);
-
- ms->api = NULL;
- }
+ if (ms->screen)
+ return TRUE;
#ifdef HAVE_LIBKMS
if (!kms_create(ms->fd, &ms->kms))
@@ -332,31 +322,20 @@ drv_init_resource_management(ScrnInfoPtr pScrn)
return FALSE;
}
-static Bool
-drv_close_resource_management(ScrnInfoPtr pScrn)
+static void
+drv_cleanup_fences(ScrnInfoPtr pScrn)
{
modesettingPtr ms = modesettingPTR(pScrn);
int i;
- if (ms->screen) {
- assert(ms->ctx == NULL);
+ assert(ms->screen);
- for (i = 0; i < XORG_NR_FENCES; i++) {
- if (ms->fence[i]) {
- ms->screen->fence_finish(ms->screen, ms->fence[i], 0);
- ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL);
- }
+ for (i = 0; i < XORG_NR_FENCES; i++) {
+ if (ms->fence[i]) {
+ ms->screen->fence_finish(ms->screen, ms->fence[i], 0);
+ ms->screen->fence_reference(ms->screen, &ms->fence[i], NULL);
}
- ms->screen->destroy(ms->screen);
}
- ms->screen = NULL;
-
-#ifdef HAVE_LIBKMS
- if (ms->kms)
- kms_destroy(&ms->kms);
-#endif
-
- return TRUE;
}
static Bool
@@ -367,8 +346,8 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
rgb defaultWeight = { 0, 0, 0 };
EntityInfoPtr pEnt;
EntPtr msEnt = NULL;
- int max_width, max_height;
CustomizerPtr cust;
+ Bool use3D;
if (pScrn->numEntities != 1)
return FALSE;
@@ -388,7 +367,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
return FALSE;
ms = modesettingPTR(pScrn);
- ms->SaveGeneration = -1;
ms->pEnt = pEnt;
ms->cust = cust;
@@ -421,10 +399,22 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
}
ms->fd = -1;
- ms->api = NULL;
if (!drv_init_drm(pScrn))
return FALSE;
+ use3D = cust ? !cust->no_3d : TRUE;
+ ms->from_3D = xf86GetOptValBool(ms->Options, OPTION_3D_ACCEL,
+ &use3D) ?
+ X_CONFIG : X_PROBED;
+
+ ms->no3D = !use3D;
+
+ if (!drv_init_resource_management(pScrn)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not init "
+ "Gallium3D or libKMS.");
+ return FALSE;
+ }
+
pScrn->monitor = pScrn->confScreen->monitor;
pScrn->progClock = TRUE;
pScrn->rgbBits = 8;
@@ -463,27 +453,52 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
xf86CrtcConfigInit(pScrn, &crtc_config_funcs);
xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
- max_width = 2048; /* A very low default */
- max_height = 2048; /* see screen_init */
- xf86CrtcSetSizeRange(pScrn, 320, 200, max_width, max_height);
+ /* get max width and height */
+ {
+ drmModeResPtr res;
+ int max_width, max_height;
+
+ res = drmModeGetResources(ms->fd);
+ max_width = res->max_width;
+ max_height = res->max_height;
+
+ if (ms->screen) {
+ int max;
+
+ max = ms->screen->get_param(ms->screen,
+ PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+ max = 1 << (max - 1);
+ max_width = max < max_width ? max : max_width;
+ max_height = max < max_height ? max : max_height;
+ }
+
+ xf86CrtcSetSizeRange(pScrn, res->min_width,
+ res->min_height, max_width, max_height);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Min width %d, Max Width %d.\n",
+ res->min_width, max_width);
+ xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
+ "Min height %d, Max Height %d.\n",
+ res->min_height, max_height);
+ drmModeFreeResources(res);
+ }
+
if (xf86ReturnOptValBool(ms->Options, OPTION_SW_CURSOR, FALSE)) {
ms->SWCursor = TRUE;
}
- drv_save_hw_state(pScrn);
-
xorg_crtc_init(pScrn);
xorg_output_init(pScrn);
+ if (cust && cust->winsys_pre_init && !cust->winsys_pre_init(cust, ms->fd))
+ return FALSE;
+
if (!xf86InitialConfiguration(pScrn, TRUE)) {
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n");
- drv_restore_hw_state(pScrn);
return FALSE;
}
- drv_restore_hw_state(pScrn);
-
/*
* If the driver can do gamma correction, it should call xf86SetGamma() here.
*/
@@ -521,22 +536,6 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags)
return TRUE;
}
-static Bool
-drv_save_hw_state(ScrnInfoPtr pScrn)
-{
- /*xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);*/
-
- return TRUE;
-}
-
-static Bool
-drv_restore_hw_state(ScrnInfoPtr pScrn)
-{
- /*xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);*/
-
- return TRUE;
-}
-
static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
pointer pReadmask)
{
@@ -550,23 +549,29 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout,
if (ms->ctx) {
int j;
- ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, &ms->fence[XORG_NR_FENCES-1]);
+ ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE,
+ ms->dirtyThrottling ?
+ &ms->fence[XORG_NR_FENCES-1] :
+ NULL);
- if (ms->fence[0])
- ms->ctx->screen->fence_finish(ms->ctx->screen, ms->fence[0], 0);
+ if (ms->dirtyThrottling) {
+ if (ms->fence[0])
+ ms->ctx->screen->fence_finish(ms->ctx->screen,
+ ms->fence[0], 0);
- /* The amount of rendering generated by a block handler can be
- * quite small. Let us get a fair way ahead of hardware before
- * throttling.
- */
- for (j = 0; j < XORG_NR_FENCES - 1; j++)
- ms->screen->fence_reference(ms->screen,
- &ms->fence[j],
- ms->fence[j+1]);
-
- ms->screen->fence_reference(ms->screen,
- &ms->fence[XORG_NR_FENCES-1],
- NULL);
+ /* The amount of rendering generated by a block handler can be
+ * quite small. Let us get a fair way ahead of hardware before
+ * throttling.
+ */
+ for (j = 0; j < XORG_NR_FENCES - 1; j++)
+ ms->screen->fence_reference(ms->screen,
+ &ms->fence[j],
+ ms->fence[j+1]);
+
+ ms->screen->fence_reference(ms->screen,
+ &ms->fence[XORG_NR_FENCES-1],
+ NULL);
+ }
}
@@ -643,48 +648,45 @@ drv_create_screen_resources(ScreenPtr pScreen)
}
static Bool
+drv_set_master(ScrnInfoPtr pScrn)
+{
+ modesettingPtr ms = modesettingPTR(pScrn);
+
+ if (!ms->isMaster && drmSetMaster(ms->fd) != 0) {
+ if (errno == EINVAL) {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "drmSetMaster failed: 2.6.29 or newer kernel required for "
+ "multi-server DRI\n");
+ } else {
+ xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+ "drmSetMaster failed: %s\n", strerror(errno));
+ }
+ return FALSE;
+ }
+
+ ms->isMaster = TRUE;
+ return TRUE;
+}
+
+
+static Bool
drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
modesettingPtr ms = modesettingPTR(pScrn);
- unsigned max_width, max_height;
VisualPtr visual;
CustomizerPtr cust = ms->cust;
+ MessageType from_st;
+ MessageType from_dt;
- if (!drv_init_drm(pScrn)) {
- FatalError("Could not init DRM");
+ if (!drv_set_master(pScrn))
return FALSE;
- }
-
- if (!drv_init_resource_management(pScrn)) {
- FatalError("Could not init resource management (!pipe_screen && !libkms)");
- return FALSE;
- }
if (!drv_init_front_buffer_functions(pScrn)) {
FatalError("Could not init front buffer manager");
return FALSE;
}
- /* get max width and height */
- {
- drmModeResPtr res;
- res = drmModeGetResources(ms->fd);
- max_width = res->max_width;
- max_height = res->max_height;
- drmModeFreeResources(res);
- }
-
- if (ms->screen) {
- int max;
- max = ms->screen->get_param(ms->screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
- max = 1 << (max - 1);
- max_width = max < max_width ? max : max_width;
- max_height = max < max_height ? max : max_height;
- }
-
- xf86CrtcSetSizeRange(pScrn, 1, 1, max_width, max_height);
-
pScrn->pScreen = pScreen;
/* HW dependent - FIXME */
@@ -736,6 +738,19 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
ms->accelerate_2d = xf86ReturnOptValBool(ms->Options, OPTION_2D_ACCEL, FALSE);
ms->debug_fallback = xf86ReturnOptValBool(ms->Options, OPTION_DEBUG_FALLBACK, ms->accelerate_2d);
+ if (cust && cust->winsys_screen_init)
+ cust->winsys_screen_init(cust);
+
+ ms->swapThrottling = cust ? cust->swap_throttling : TRUE;
+ from_st = xf86GetOptValBool(ms->Options, OPTION_THROTTLE_SWAP,
+ &ms->swapThrottling) ?
+ X_CONFIG : X_DEFAULT;
+
+ ms->dirtyThrottling = cust ? cust->dirty_throttling : TRUE;
+ from_dt = xf86GetOptValBool(ms->Options, OPTION_THROTTLE_DIRTY,
+ &ms->dirtyThrottling) ?
+ X_CONFIG : X_DEFAULT;
+
if (ms->screen) {
ms->exa = xorg_exa_init(pScrn, ms->accelerate_2d);
@@ -755,11 +770,16 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Fallback debugging is %s\n",
ms->debug_fallback ? "enabled" : "disabled");
#ifdef DRI2
- xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is %s\n",
+ xf86DrvMsg(pScrn->scrnIndex, ms->from_3D, "3D Acceleration is %s\n",
ms->screen ? "enabled" : "disabled");
#else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "3D Acceleration is disabled\n");
#endif
+ xf86DrvMsg(pScrn->scrnIndex, from_st, "Swap Throttling is %s.\n",
+ ms->swapThrottling ? "enabled" : "disabled");
+ xf86DrvMsg(pScrn->scrnIndex, from_dt, "Dirty Throttling is %s.\n",
+ ms->dirtyThrottling ? "enabled" : "disabled");
+
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "##################################\n");
miInitializeBackingStore(pScreen);
@@ -792,9 +812,6 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
if (serverGeneration == 1)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
- if (cust && cust->winsys_screen_init)
- cust->winsys_screen_init(cust, ms->fd);
-
return drv_enter_vt(scrnIndex, 1);
}
@@ -848,12 +865,15 @@ drv_leave_vt(int scrnIndex, int flags)
drmModeRmFB(ms->fd, ms->fb_id);
ms->fb_id = -1;
- drv_restore_hw_state(pScrn);
+ /* idle hardware */
+ if (!ms->kms)
+ drv_cleanup_fences(pScrn);
if (drmDropMaster(ms->fd))
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"drmDropMaster failed: %s\n", strerror(errno));
+ ms->isMaster = FALSE;
pScrn->vtSema = FALSE;
}
@@ -867,25 +887,8 @@ drv_enter_vt(int scrnIndex, int flags)
modesettingPtr ms = modesettingPTR(pScrn);
CustomizerPtr cust = ms->cust;
- if (drmSetMaster(ms->fd)) {
- if (errno == EINVAL) {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "drmSetMaster failed: 2.6.29 or newer kernel required for "
- "multi-server DRI\n");
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "drmSetMaster failed: %s\n", strerror(errno));
- }
- }
-
- /*
- * Only save state once per server generation since that's what most
- * drivers do. Could change this to save state at each VT enter.
- */
- if (ms->SaveGeneration != serverGeneration) {
- ms->SaveGeneration = serverGeneration;
- drv_save_hw_state(pScrn);
- }
+ if (!drv_set_master(pScrn))
+ return FALSE;
if (!ms->create_front_buffer(pScrn))
return FALSE;
@@ -917,10 +920,6 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
modesettingPtr ms = modesettingPTR(pScrn);
CustomizerPtr cust = ms->cust;
- if (pScrn->vtSema) {
- drv_leave_vt(scrnIndex, 0);
- }
-
if (ms->cursor) {
FreeCursor(ms->cursor, None);
ms->cursor = NULL;
@@ -952,12 +951,14 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen)
xorg_exa_close(pScrn);
ms->exa = NULL;
- drv_close_resource_management(pScrn);
-
- drv_close_drm(pScrn);
+ /* calls drop master make sure we don't talk to 3D HW after that */
+ if (pScrn->vtSema) {
+ drv_leave_vt(scrnIndex, 0);
+ }
pScrn->vtSema = FALSE;
pScreen->CloseScreen = ms->CloseScreen;
+
return (*pScreen->CloseScreen) (scrnIndex, pScreen);
}
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index d5a1be81747..6b2c80fbca6 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -346,7 +346,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg)
XORG_FALLBACK("not GXcopy");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0)) {
XORG_FALLBACK("format %s", util_format_name(priv->tex->format));
}
@@ -427,39 +427,26 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
XORG_FALLBACK("alu not GXcopy");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format %s", util_format_name(priv->tex->format));
if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format,
- src_priv->tex->target,
+ src_priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pSrc format %s", util_format_name(src_priv->tex->format));
exa->copy.src = src_priv;
exa->copy.dst = priv;
- /* For same-surface copies, the pipe->surface_copy path is clearly
- * superior, providing it is implemented. In other cases it's not
- * clear what the better path would be, and eventually we'd
- * probably want to gather timings and choose dynamically.
+ /* XXX this used to use resource_copy_region for same-surface copies,
+ * but they were redefined to not allow overlaps (some of the util code
+ * always assumed this anyway).
+ * Drivers should implement accelerated resource_copy_region or it will
+ * be slow - disable for now.
*/
- if (exa->pipe->surface_copy &&
- exa->copy.src == exa->copy.dst) {
-
+ if (0 && exa->copy.src != exa->copy.dst) {
exa->copy.use_surface_copy = TRUE;
-
- exa->copy.src_surface =
- exa->scrn->get_tex_surface( exa->scrn,
- exa->copy.src->tex,
- 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE);
-
- exa->copy.dst_surface =
- exa->scrn->get_tex_surface( exa->scrn,
- exa->copy.dst->tex,
- 0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION );
}
else {
exa->copy.use_surface_copy = FALSE;
@@ -475,7 +462,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir,
exa->scrn->get_tex_surface(exa->scrn,
exa->copy.dst->tex,
0, 0, 0,
- PIPE_BIND_BLIT_DESTINATION);
+ PIPE_BIND_RENDER_TARGET);
renderer_copy_prepare(exa->renderer,
@@ -505,14 +492,19 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY,
(void) priv;
if (exa->copy.use_surface_copy) {
- /* XXX: consider exposing >1 box in surface_copy interface.
- */
- exa->pipe->surface_copy( exa->pipe,
- exa->copy.dst_surface,
- dstX, dstY,
- exa->copy.src_surface,
- srcX, srcY,
- width, height );
+ struct pipe_subresource subdst, subsrc;
+ subdst.face = 0;
+ subdst.level = 0;
+ subsrc.face = 0;
+ subsrc.level = 0;
+ exa->pipe->resource_copy_region( exa->pipe,
+ exa->copy.dst->tex,
+ subdst,
+ dstX, dstY, 0,
+ exa->copy.src->tex,
+ subsrc,
+ srcX, srcY, 0,
+ width, height );
}
else {
renderer_copy_pixmap(exa->renderer,
@@ -539,7 +531,6 @@ ExaDoneCopy(PixmapPtr pPixmap)
exa->copy.src = NULL;
exa->copy.dst = NULL;
- pipe_surface_reference(&exa->copy.src_surface, NULL);
pipe_surface_reference(&exa->copy.dst_surface, NULL);
pipe_resource_reference(&exa->copy.src_texture, NULL);
}
@@ -638,7 +629,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_RENDER_TARGET, 0))
XORG_FALLBACK("pDst format: %s", util_format_name(priv->tex->format));
@@ -653,7 +644,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pSrc format: %s", util_format_name(priv->tex->format));
@@ -670,7 +661,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture,
XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex");
if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format,
- priv->tex->target,
+ priv->tex->target, 0,
PIPE_BIND_SAMPLER_VIEW, 0))
XORG_FALLBACK("pMask format: %s", util_format_name(priv->tex->format));
@@ -889,23 +880,18 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
texture = exa->scrn->resource_create(exa->scrn, &template);
if (priv->tex) {
- struct pipe_surface *dst_surf;
- struct pipe_surface *src_surf;
-
- dst_surf = exa->scrn->get_tex_surface(
- exa->scrn, texture, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION);
- src_surf = xorg_gpu_surface(exa->pipe->screen, priv);
- if (exa->pipe->surface_copy) {
- exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width0),
- min(height, texture->height0));
- } else {
- util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf,
- 0, 0, min(width, texture->width0),
- min(height, texture->height0));
- }
- exa->scrn->tex_surface_destroy(dst_surf);
- exa->scrn->tex_surface_destroy(src_surf);
+ struct pipe_subresource subdst, subsrc;
+
+ subdst.face = 0;
+ subdst.level = 0;
+ subsrc.face = 0;
+ subsrc.level = 0;
+ exa->pipe->resource_copy_region(exa->pipe, texture,
+ subdst, 0, 0, 0,
+ priv->tex,
+ subsrc, 0, 0, 0,
+ min(width, texture->width0),
+ min(height, texture->height0));
}
pipe_resource_reference(&priv->tex, texture);
@@ -980,6 +966,8 @@ xorg_exa_close(ScrnInfoPtr pScrn)
renderer_destroy(exa->renderer);
+ xorg_exa_finish(exa);
+
if (exa->pipe)
exa->pipe->destroy(exa->pipe);
exa->pipe = NULL;
@@ -997,6 +985,7 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
modesettingPtr ms = modesettingPTR(pScrn);
struct exa_context *exa;
ExaDriverPtr pExa;
+ CustomizerPtr cust = ms->cust;
exa = xcalloc(1, sizeof(struct exa_context));
if (!exa)
@@ -1058,6 +1047,8 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel)
/* Share context with DRI */
ms->ctx = exa->pipe;
+ if (cust && cust->winsys_context_throttle)
+ cust->winsys_context_throttle(cust, ms->ctx, THROTTLE_RENDER);
exa->renderer = renderer_create(exa->pipe);
exa->accel = accel;
@@ -1073,11 +1064,7 @@ out_err:
struct pipe_surface *
xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv)
{
-
- /* seems to get called both for blits and render target usage */
return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0,
- PIPE_BIND_BLIT_SOURCE |
- PIPE_BIND_BLIT_DESTINATION |
PIPE_BIND_RENDER_TARGET);
}
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h
index a35e9a5c901..86a1afc06e6 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.h
+++ b/src/gallium/state_trackers/xorg/xorg_exa.h
@@ -40,7 +40,6 @@ struct exa_context
struct exa_pixmap_priv *src;
struct exa_pixmap_priv *dst;
- struct pipe_surface *src_surface;
struct pipe_surface *dst_surface;
struct pipe_resource *src_texture;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
index 3e5e6bd6a6e..fe1aab3ab98 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c
@@ -642,7 +642,7 @@ void xorg_shaders_destroy(struct xorg_shaders *sc)
cache_destroy(sc->r->cso, sc->fs_hash,
PIPE_SHADER_FRAGMENT);
- free(sc);
+ FREE(sc);
}
static INLINE void *
diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c
index 13c3fb97e3b..61206ed751c 100644
--- a/src/gallium/state_trackers/xorg/xorg_output.c
+++ b/src/gallium/state_trackers/xorg/xorg_output.c
@@ -51,6 +51,13 @@
#include "xorg_tracker.h"
+struct output_private
+{
+ drmModeConnectorPtr drm_connector;
+
+ int c;
+};
+
static char *output_enum_list[] = {
"Unknown",
"VGA",
@@ -82,22 +89,38 @@ output_dpms(xf86OutputPtr output, int mode)
static xf86OutputStatus
output_detect(xf86OutputPtr output)
{
- drmModeConnectorPtr drm_connector = output->driver_private;
+ modesettingPtr ms = modesettingPTR(output->scrn);
+ struct output_private *priv = output->driver_private;
+ drmModeConnectorPtr drm_connector;
+ xf86OutputStatus status;
+
+ drm_connector = drmModeGetConnector(ms->fd, priv->drm_connector->connector_id);
+ if (drm_connector) {
+ drmModeFreeConnector(priv->drm_connector);
+ priv->drm_connector = drm_connector;
+ } else {
+ drm_connector = priv->drm_connector;
+ }
switch (drm_connector->connection) {
case DRM_MODE_CONNECTED:
- return XF86OutputStatusConnected;
+ status = XF86OutputStatusConnected;
+ break;
case DRM_MODE_DISCONNECTED:
- return XF86OutputStatusDisconnected;
+ status = XF86OutputStatusDisconnected;
+ break;
default:
- return XF86OutputStatusUnknown;
+ status = XF86OutputStatusUnknown;
}
+
+ return status;
}
static DisplayModePtr
output_get_modes(xf86OutputPtr output)
{
- drmModeConnectorPtr drm_connector = output->driver_private;
+ struct output_private *priv = output->driver_private;
+ drmModeConnectorPtr drm_connector = priv->drm_connector;
drmModeModeInfoPtr drm_mode = NULL;
DisplayModePtr modes = NULL, mode = NULL;
int i;
@@ -139,6 +162,15 @@ output_get_modes(xf86OutputPtr output)
static int
output_mode_valid(xf86OutputPtr output, DisplayModePtr pMode)
{
+ modesettingPtr ms = modesettingPTR(output->scrn);
+ CustomizerPtr cust = ms->cust;
+
+ if (cust && cust->winsys_check_fb_size &&
+ !cust->winsys_check_fb_size(cust, pMode->HDisplay *
+ output->scrn->bitsPerPixel / 8,
+ pMode->VDisplay))
+ return MODE_BAD;
+
return MODE_OK;
}
@@ -161,7 +193,10 @@ output_get_property(xf86OutputPtr output, Atom property)
static void
output_destroy(xf86OutputPtr output)
{
- drmModeFreeConnector(output->driver_private);
+ struct output_private *priv = output->driver_private;
+ drmModeFreeConnector(priv->drm_connector);
+ xfree(priv);
+ output->driver_private = NULL;
}
static const xf86OutputFuncsRec output_funcs = {
@@ -188,6 +223,7 @@ xorg_output_init(ScrnInfoPtr pScrn)
drmModeResPtr res;
drmModeConnectorPtr drm_connector = NULL;
drmModeEncoderPtr drm_encoder = NULL;
+ struct output_private *priv;
char name[32];
int c, v, p;
@@ -226,9 +262,16 @@ xorg_output_init(ScrnInfoPtr pScrn)
drm_connector->connector_type_id);
+ priv = xcalloc(sizeof(*priv), 1);
+ if (!priv) {
+ continue;
+ }
+
output = xf86OutputCreate(pScrn, &output_funcs, name);
- if (!output)
+ if (!output) {
+ xfree(priv);
continue;
+ }
drm_encoder = drmModeGetEncoder(ms->fd, drm_connector->encoders[0]);
if (drm_encoder) {
@@ -238,7 +281,9 @@ xorg_output_init(ScrnInfoPtr pScrn)
output->possible_crtcs = 0;
output->possible_clones = 0;
}
- output->driver_private = drm_connector;
+ priv->c = c;
+ priv->drm_connector = drm_connector;
+ output->driver_private = priv;
output->subpixel_order = SubPixelHorizontalRGB;
output->interlaceAllowed = FALSE;
output->doubleScanAllowed = FALSE;
@@ -248,4 +293,11 @@ xorg_output_init(ScrnInfoPtr pScrn)
drmModeFreeResources(res);
}
+unsigned
+xorg_output_get_id(xf86OutputPtr output)
+{
+ struct output_private *priv = output->driver_private;
+ return priv->drm_connector->connector_id;
+}
+
/* vim: set sw=4 ts=8 sts=4: */
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 13fa561390f..92f1cc50653 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -7,7 +7,6 @@
#include "util/u_draw_quad.h"
#include "util/u_math.h"
#include "util/u_memory.h"
-#include "util/u_rect.h"
#include "util/u_sampler.h"
#include "util/u_inlines.h"
@@ -448,7 +447,7 @@ void renderer_copy_prepare(struct xorg_renderer *r,
struct xorg_shader shader;
assert(screen->is_format_supported(screen, dst_surface->format,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_RENDER_TARGET,
0));
(void) screen;
@@ -524,7 +523,7 @@ renderer_clone_texture(struct xorg_renderer *r,
/* the coming in texture should already have that invariance */
debug_assert(screen->is_format_supported(screen, src->format,
- PIPE_TEXTURE_2D,
+ PIPE_TEXTURE_2D, 0,
PIPE_BIND_SAMPLER_VIEW, 0));
format = src->format;
@@ -547,25 +546,19 @@ renderer_clone_texture(struct xorg_renderer *r,
{
/* copy source framebuffer surface into texture */
- struct pipe_surface *ps_read = screen->get_tex_surface(
- screen, src, 0, 0, 0, PIPE_BIND_BLIT_SOURCE);
- struct pipe_surface *ps_tex = screen->get_tex_surface(
- screen, pt, 0, 0, 0, PIPE_BIND_BLIT_DESTINATION );
- if (pipe->surface_copy) {
- pipe->surface_copy(pipe,
- ps_tex, /* dest */
- 0, 0, /* destx/y */
- ps_read,
- 0, 0, src->width0, src->height0);
- } else {
- util_surface_copy(pipe, FALSE,
- ps_tex, /* dest */
- 0, 0, /* destx/y */
- ps_read,
- 0, 0, src->width0, src->height0);
- }
- pipe_surface_reference(&ps_read, NULL);
- pipe_surface_reference(&ps_tex, NULL);
+ struct pipe_subresource subsrc, subdst;
+ subsrc.face = 0;
+ subsrc.level = 0;
+ subdst.face = 0;
+ subdst.level = 0;
+ pipe->resource_copy_region(pipe,
+ pt, /* dest */
+ subdst,
+ 0, 0, 0, /* destx/y/z */
+ src,
+ subsrc,
+ 0, 0, 0,
+ src->width0, src->height0);
}
return pt;
@@ -608,7 +601,7 @@ void renderer_copy_pixmap(struct xorg_renderer *r,
void renderer_draw_yuv(struct xorg_renderer *r,
- int src_x, int src_y, int src_w, int src_h,
+ float src_x, float src_y, float src_w, float src_h,
int dst_x, int dst_y, int dst_w, int dst_h,
struct pipe_resource **textures)
{
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h
index 0454a6513d4..fb09fabe156 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.h
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.h
@@ -54,7 +54,7 @@ void renderer_set_constants(struct xorg_renderer *r,
void renderer_draw_yuv(struct xorg_renderer *r,
- int src_x, int src_y, int src_w, int src_h,
+ float src_x, float src_y, float src_w, float src_h,
int dst_x, int dst_y, int dst_w, int dst_h,
struct pipe_resource **textures);
diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h
index cb6773424a8..be1a9fda48d 100644
--- a/src/gallium/state_trackers/xorg/xorg_tracker.h
+++ b/src/gallium/state_trackers/xorg/xorg_tracker.h
@@ -49,7 +49,6 @@
#include "pipe/p_screen.h"
#include "util/u_inlines.h"
#include "util/u_debug.h"
-#include "state_tracker/drm_api.h"
#define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg);
@@ -67,12 +66,27 @@ typedef struct
#define XORG_NR_FENCES 3
+enum xorg_throttling_reason {
+ THROTTLE_RENDER,
+ THROTTLE_SWAP
+};
+
typedef struct _CustomizerRec
{
- Bool (*winsys_screen_init)(struct _CustomizerRec *cust, int fd);
+ Bool dirty_throttling;
+ Bool swap_throttling;
+ Bool no_3d;
+ Bool (*winsys_pre_init) (struct _CustomizerRec *cust, int fd);
+ Bool (*winsys_screen_init)(struct _CustomizerRec *cust);
Bool (*winsys_screen_close)(struct _CustomizerRec *cust);
Bool (*winsys_enter_vt)(struct _CustomizerRec *cust);
Bool (*winsys_leave_vt)(struct _CustomizerRec *cust);
+ void (*winsys_context_throttle)(struct _CustomizerRec *cust,
+ struct pipe_context *pipe,
+ enum xorg_throttling_reason reason);
+ Bool (*winsys_check_fb_size) (struct _CustomizerRec *cust,
+ unsigned long pitch,
+ unsigned long height);
} CustomizerRec, *CustomizerPtr;
typedef struct _modesettingRec
@@ -91,13 +105,16 @@ typedef struct _modesettingRec
Bool noAccel;
Bool SWCursor;
CursorPtr cursor;
+ Bool swapThrottling;
+ Bool dirtyThrottling;
CloseScreenProcPtr CloseScreen;
+ Bool no3D;
+ Bool from_3D;
+ Bool isMaster;
/* Broken-out options. */
OptionInfoPtr Options;
- unsigned int SaveGeneration;
-
void (*blockHandler)(int, pointer, pointer, pointer);
struct pipe_fence_handle *fence[XORG_NR_FENCES];
@@ -113,7 +130,6 @@ typedef struct _modesettingRec
struct kms_bo *root_bo;
/* gallium */
- struct drm_api *api;
struct pipe_screen *screen;
struct pipe_context *ctx;
boolean d_depth_bits_last;
@@ -192,6 +208,9 @@ xorg_crtc_cursor_destroy(xf86CrtcPtr crtc);
void
xorg_output_init(ScrnInfoPtr pScrn);
+unsigned
+xorg_output_get_id(xf86OutputPtr output);
+
/***********************************************************************
* xorg_xv.c
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index a221594454e..f98bd939010 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -413,7 +413,7 @@ setup_fs_video_constants(struct xorg_renderer *r, boolean hdtv)
static void
draw_yuv(struct xorg_xv_port_priv *port,
- int src_x, int src_y, int src_w, int src_h,
+ float src_x, float src_y, float src_w, float src_h,
int dst_x, int dst_y, int dst_w, int dst_h)
{
struct pipe_resource **textures = port->yuv[port->current_set];
@@ -562,10 +562,10 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
int box_y2 = pbox->y2;
float diff_x = (float)src_w / (float)dst_w;
float diff_y = (float)src_h / (float)dst_h;
- int offset_x = box_x1 - dstX + pPixmap->screen_x;
- int offset_y = box_y1 - dstY + pPixmap->screen_y;
- int offset_w;
- int offset_h;
+ float offset_x = box_x1 - dstX + pPixmap->screen_x;
+ float offset_y = box_y1 - dstY + pPixmap->screen_y;
+ float offset_w;
+ float offset_h;
x = box_x1;
y = box_y1;
@@ -576,8 +576,8 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id,
offset_h = dst_h - h;
draw_yuv(pPriv,
- src_x + offset_x*diff_x, src_y + offset_y*diff_y,
- src_w - offset_w*diff_x, src_h - offset_h*diff_y,
+ (float) src_x + offset_x*diff_x, (float) src_y + offset_y*diff_y,
+ (float) src_w - offset_w*diff_x, (float) src_h - offset_h*diff_y,
x, y, w, h);
pbox++;