* [PATCH 2/7] intel: Factor out the repeated swap fallback code.
2012-11-17 21:11 [PATCH 1/7] configure.ac: Fix bad syntax for test calls Eric Anholt
@ 2012-11-17 21:11 ` Eric Anholt
2012-11-17 21:11 ` [PATCH 3/7] intel: Add printf attribute to intel_debug_fallback() Eric Anholt
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2012-11-17 21:11 UTC (permalink / raw)
To: intel-gfx
---
src/intel_dri.c | 54 +++++++++++++++++++++++-------------------------------
1 file changed, 23 insertions(+), 31 deletions(-)
diff --git a/src/intel_dri.c b/src/intel_dri.c
index 17d9d50..4c0827d 100644
--- a/src/intel_dri.c
+++ b/src/intel_dri.c
@@ -547,6 +547,23 @@ I830DRI2CopyRegion(DrawablePtr drawable, RegionPtr pRegion,
intel_batch_submit(scrn);
}
+static void
+I830DRI2FallbackBlitSwap(DrawablePtr drawable,
+ DRI2BufferPtr dst,
+ DRI2BufferPtr src)
+{
+ BoxRec box;
+ RegionRec region;
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = drawable->width;
+ box.y2 = drawable->height;
+ REGION_INIT(pScreen, ®ion, &box, 0);
+
+ I830DRI2CopyRegion(drawable, ®ion, dst, src);
+}
+
#if DRI2INFOREC_VERSION >= 4
static void I830DRI2ReferenceBuffer(DRI2Buffer2Ptr buffer)
@@ -996,17 +1013,8 @@ void I830DRI2FrameEventHandler(unsigned int frame, unsigned int tv_sec,
/* else fall through to exchange/blit */
case DRI2_SWAP: {
- BoxRec box;
- RegionRec region;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = drawable->width;
- box.y2 = drawable->height;
- REGION_INIT(pScreen, ®ion, &box, 0);
-
- I830DRI2CopyRegion(drawable,
- ®ion, swap_info->front, swap_info->back);
+ I830DRI2FallbackBlitSwap(drawable,
+ swap_info->front, swap_info->back);
DRI2SwapComplete(swap_info->client, drawable, frame, tv_sec, tv_usec,
DRI2_BLIT_COMPLETE,
swap_info->client ? swap_info->event_complete : NULL,
@@ -1089,17 +1097,10 @@ void I830DRI2FlipEventHandler(unsigned int frame, unsigned int tv_sec,
i830_dri2_del_frame_event(chain_drawable, chain);
} else if (!can_exchange(chain_drawable, chain->front, chain->back) ||
!I830DRI2ScheduleFlip(intel, chain_drawable, chain)) {
- BoxRec box;
- RegionRec region;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = chain_drawable->width;
- box.y2 = chain_drawable->height;
- REGION_INIT(pScreen, ®ion, &box, 0);
+ I830DRI2FallbackBlitSwap(drawable,
+ chain->front,
+ chain->back);
- I830DRI2CopyRegion(chain_drawable, ®ion,
- chain->front, chain->back);
DRI2SwapComplete(chain->client, chain_drawable, frame, tv_sec, tv_usec,
DRI2_BLIT_COMPLETE,
chain->client ? chain->event_complete : NULL,
@@ -1162,8 +1163,6 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
DRI2FrameEventPtr swap_info = NULL;
enum DRI2FrameEventType swap_type = DRI2_SWAP;
CARD64 current_msc;
- BoxRec box;
- RegionRec region;
/* Drawable not displayed... just complete the swap */
if (pipe == -1)
@@ -1313,14 +1312,7 @@ I830DRI2ScheduleSwap(ClientPtr client, DrawablePtr draw, DRI2BufferPtr front,
return TRUE;
blit_fallback:
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = draw->width;
- box.y2 = draw->height;
- REGION_INIT(pScreen, ®ion, &box, 0);
-
- I830DRI2CopyRegion(draw, ®ion, front, back);
-
+ I830DRI2FallbackBlitSwap(draw, front, back);
DRI2SwapComplete(client, draw, 0, 0, 0, DRI2_BLIT_COMPLETE, func, data);
if (swap_info)
i830_dri2_del_frame_event(draw, swap_info);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/7] intel: Add printf attribute to intel_debug_fallback().
2012-11-17 21:11 [PATCH 1/7] configure.ac: Fix bad syntax for test calls Eric Anholt
2012-11-17 21:11 ` [PATCH 2/7] intel: Factor out the repeated swap fallback code Eric Anholt
@ 2012-11-17 21:11 ` Eric Anholt
2012-11-17 21:11 ` [PATCH 4/7] uxa: Fix const-cast warning Eric Anholt
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2012-11-17 21:11 UTC (permalink / raw)
To: intel-gfx
Shuts up a bunch of warnings with xorg's shared warning flags, and
should give us more informative warnings in our code.
---
src/intel.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/intel.h b/src/intel.h
index d394750..53ce33c 100644
--- a/src/intel.h
+++ b/src/intel.h
@@ -553,6 +553,9 @@ intel_get_transformed_coordinates_3d(int x, int y, PictTransformPtr transform,
float *x_out, float *y_out, float *z_out);
static inline void
+intel_debug_fallback(ScrnInfoPtr scrn, const char *format, ...) _X_ATTRIBUTE_PRINTF(2, 3);
+
+static inline void
intel_debug_fallback(ScrnInfoPtr scrn, const char *format, ...)
{
intel_screen_private *intel = intel_get_screen_private(scrn);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/7] uxa: Fix const-cast warning.
2012-11-17 21:11 [PATCH 1/7] configure.ac: Fix bad syntax for test calls Eric Anholt
2012-11-17 21:11 ` [PATCH 2/7] intel: Factor out the repeated swap fallback code Eric Anholt
2012-11-17 21:11 ` [PATCH 3/7] intel: Add printf attribute to intel_debug_fallback() Eric Anholt
@ 2012-11-17 21:11 ` Eric Anholt
2012-11-17 21:11 ` [PATCH 5/7] uxa: Work around uninitialized-value warning Eric Anholt
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2012-11-17 21:11 UTC (permalink / raw)
To: intel-gfx
The server interfaces take a non-const GCOps, because it expects you
to be able to modify them.
---
uxa/uxa-accel.c | 2 +-
uxa/uxa-priv.h | 2 +-
uxa/uxa.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/uxa/uxa-accel.c b/uxa/uxa-accel.c
index 76425fe..522dd67 100644
--- a/uxa/uxa-accel.c
+++ b/uxa/uxa-accel.c
@@ -1038,7 +1038,7 @@ fallback:
uxa_check_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y);
}
-const GCOps uxa_ops = {
+GCOps uxa_ops = {
uxa_fill_spans,
uxa_set_spans,
uxa_put_image,
diff --git a/uxa/uxa-priv.h b/uxa/uxa-priv.h
index 3f639e7..4661575 100644
--- a/uxa/uxa-priv.h
+++ b/uxa/uxa-priv.h
@@ -296,7 +296,7 @@ void
uxa_add_traps(PicturePtr pPicture,
INT16 x_off, INT16 y_off, int ntrap, xTrap * traps);
-extern const GCOps uxa_ops;
+extern GCOps uxa_ops;
#ifdef RENDER
diff --git a/uxa/uxa.c b/uxa/uxa.c
index 2635b50..b15d3c1 100644
--- a/uxa/uxa.c
+++ b/uxa/uxa.c
@@ -268,7 +268,7 @@ uxa_validate_gc(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable)
}
set_ops:
- pGC->ops = (GCOps *) & uxa_ops;
+ pGC->ops = & uxa_ops;
}
static GCFuncs uxaGCFuncs = {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 5/7] uxa: Work around uninitialized-value warning.
2012-11-17 21:11 [PATCH 1/7] configure.ac: Fix bad syntax for test calls Eric Anholt
` (2 preceding siblings ...)
2012-11-17 21:11 ` [PATCH 4/7] uxa: Fix const-cast warning Eric Anholt
@ 2012-11-17 21:11 ` Eric Anholt
2012-11-17 21:11 ` [PATCH 6/7] uxa: Refactor early-exit paths of uxa_try_driver_composite() Eric Anholt
2012-11-17 21:11 ` [PATCH 7/7] Don't mark the list of chipsets const when we just cast the const away Eric Anholt
5 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2012-11-17 21:11 UTC (permalink / raw)
To: intel-gfx
The compiler isn't noticing that localDst only diverges from pDst when
the _copy variables have also been set.
---
uxa/uxa-render.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index 4463dc2..d783ea2 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -962,7 +962,7 @@ uxa_try_driver_composite(CARD8 op,
RegionRec region;
BoxPtr pbox;
int nbox;
- int xDst_copy, yDst_copy;
+ int xDst_copy = 0, yDst_copy = 0;
int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
PicturePtr localSrc, localMask = NULL;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 6/7] uxa: Refactor early-exit paths of uxa_try_driver_composite().
2012-11-17 21:11 [PATCH 1/7] configure.ac: Fix bad syntax for test calls Eric Anholt
` (3 preceding siblings ...)
2012-11-17 21:11 ` [PATCH 5/7] uxa: Work around uninitialized-value warning Eric Anholt
@ 2012-11-17 21:11 ` Eric Anholt
2012-11-17 21:11 ` [PATCH 7/7] Don't mark the list of chipsets const when we just cast the const away Eric Anholt
5 siblings, 0 replies; 8+ messages in thread
From: Eric Anholt @ 2012-11-17 21:11 UTC (permalink / raw)
To: intel-gfx
Saves 200b of code at -O2. I noticed this while fixing up the warning
in HEAD~1.
---
uxa/uxa-render.c | 79 +++++++++++++++++++-----------------------------------
1 file changed, 28 insertions(+), 51 deletions(-)
diff --git a/uxa/uxa-render.c b/uxa/uxa-render.c
index d783ea2..3678f6a 100644
--- a/uxa/uxa-render.c
+++ b/uxa/uxa-render.c
@@ -965,8 +965,9 @@ uxa_try_driver_composite(CARD8 op,
int xDst_copy = 0, yDst_copy = 0;
int src_off_x, src_off_y, mask_off_x, mask_off_y, dst_off_x, dst_off_y;
PixmapPtr pSrcPix, pMaskPix = NULL, pDstPix;
- PicturePtr localSrc, localMask = NULL;
+ PicturePtr localSrc = NULL, localMask = NULL;
PicturePtr localDst = pDst;
+ int ret = 0;
if (uxa_screen->info->check_composite &&
!(*uxa_screen->info->check_composite) (op, pSrc, pMask, pDst, width, height))
@@ -1018,9 +1019,8 @@ uxa_try_driver_composite(CARD8 op,
pDstPix =
uxa_get_offscreen_pixmap(localDst->pDrawable, &dst_off_x, &dst_off_y);
if (!pDstPix) {
- if (localDst != pDst)
- FreePicture(localDst, 0);
- return -1;
+ ret = -1;
+ goto error;
}
xDst += localDst->pDrawable->x;
@@ -1031,9 +1031,8 @@ uxa_try_driver_composite(CARD8 op,
width, height,
&xSrc, &ySrc);
if (!localSrc) {
- if (localDst != pDst)
- FreePicture(localDst, 0);
- return 0;
+ ret = 0;
+ goto error;
}
if (pMask) {
@@ -1042,72 +1041,38 @@ uxa_try_driver_composite(CARD8 op,
width, height,
&xMask, &yMask);
if (!localMask) {
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
- if (localDst != pDst)
- FreePicture(localDst, 0);
-
- return 0;
+ ret = 0;
+ goto error;
}
}
if (!miComputeCompositeRegion(®ion, localSrc, localMask, localDst,
xSrc, ySrc, xMask, yMask, xDst, yDst,
width, height)) {
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
- if (localMask && localMask != pMask)
- FreePicture(localMask, 0);
- if (localDst != pDst)
- FreePicture(localDst, 0);
-
- return 1;
+ ret = 1;
+ goto error;
}
pSrcPix = uxa_get_offscreen_pixmap(localSrc->pDrawable,
&src_off_x, &src_off_y);
if (!pSrcPix) {
- REGION_UNINIT(screen, ®ion);
-
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
- if (localMask && localMask != pMask)
- FreePicture(localMask, 0);
- if (localDst != pDst)
- FreePicture(localDst, 0);
-
- return 0;
+ ret = 0;
+ goto error;
}
if (localMask) {
pMaskPix = uxa_get_offscreen_pixmap(localMask->pDrawable,
&mask_off_x, &mask_off_y);
if (!pMaskPix) {
- REGION_UNINIT(screen, ®ion);
-
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
- if (localMask && localMask != pMask)
- FreePicture(localMask, 0);
- if (localDst != pDst)
- FreePicture(localDst, 0);
-
- return 0;
+ ret = 0;
+ goto error;
}
}
if (!(*uxa_screen->info->prepare_composite)
(op, localSrc, localMask, localDst, pSrcPix, pMaskPix, pDstPix)) {
- REGION_UNINIT(screen, ®ion);
-
- if (localSrc != pSrc)
- FreePicture(localSrc, 0);
- if (localMask && localMask != pMask)
- FreePicture(localMask, 0);
- if (localDst != pDst)
- FreePicture(localDst, 0);
-
- return -1;
+ ret = -1;
+ goto error;
}
if (pMask) {
@@ -1156,6 +1121,18 @@ uxa_try_driver_composite(CARD8 op,
}
return 1;
+
+error:
+ REGION_UNINIT(screen, ®ion);
+
+ if (localSrc && localSrc != pSrc)
+ FreePicture(localSrc, 0);
+ if (localMask && localMask != pMask)
+ FreePicture(localMask, 0);
+ if (localDst != pDst)
+ FreePicture(localDst, 0);
+
+ return ret;
}
/**
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 7/7] Don't mark the list of chipsets const when we just cast the const away.
2012-11-17 21:11 [PATCH 1/7] configure.ac: Fix bad syntax for test calls Eric Anholt
` (4 preceding siblings ...)
2012-11-17 21:11 ` [PATCH 6/7] uxa: Refactor early-exit paths of uxa_try_driver_composite() Eric Anholt
@ 2012-11-17 21:11 ` Eric Anholt
2012-11-18 11:54 ` Chris Wilson
5 siblings, 1 reply; 8+ messages in thread
From: Eric Anholt @ 2012-11-17 21:11 UTC (permalink / raw)
To: intel-gfx
Fixes another gcc warning.
---
src/intel_module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/intel_module.c b/src/intel_module.c
index ef62667..06d2ee7 100644
--- a/src/intel_module.c
+++ b/src/intel_module.c
@@ -111,7 +111,7 @@ static const struct intel_device_info intel_haswell_info = {
.gen = 75,
};
-static const SymTabRec _intel_chipsets[] = {
+static SymTabRec _intel_chipsets[] = {
{PCI_CHIP_I810, "i810"},
{PCI_CHIP_I810_DC100, "i810-dc100"},
{PCI_CHIP_I810_E, "i810e"},
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread