From: Jochen Rollwagen <joro-2013-zqRNUXuvxA0b1SvskN2V4Q@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH xf86-video-ati] Use finer-grained pointer types in mem copying functions
Date: Fri, 25 Nov 2016 11:00:02 +0100 [thread overview]
Message-ID: <58380BA2.3060006@t-online.de> (raw)
In-Reply-To: <dd911a26-9976-6570-f5ac-5efe67e27928-otUistvHUpPR7s880joybQ@public.gmane.org>
This commit modifies some pointer definitions in functions copying
memory corresponding to those in memcpy.
That should enable a compiler to produce better code (though i haven't
checked whether that's the case).
---
src/radeon.h | 2 +-
src/radeon_accel.c | 10 +++++-----
src/radeon_dri2.c | 14 +++++++-------
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/radeon.h b/src/radeon.h
index ad7e69c..cbc7866 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -599,7 +599,7 @@ typedef struct {
/* radeon_accel.c */
extern Bool RADEONAccelInit(ScreenPtr pScreen);
extern void RADEONEngineInit(ScrnInfoPtr pScrn);
-extern void RADEONCopySwap(uint8_t *dst, uint8_t *src, unsigned int
size, int swap);
+extern void RADEONCopySwap(uint8_t * __restrict dst, const uint8_t *
__restrict src, unsigned int size, int swap);
extern void RADEONInit3DEngine(ScrnInfoPtr pScrn);
extern int radeon_cs_space_remaining(ScrnInfoPtr pScrn);
diff --git a/src/radeon_accel.c b/src/radeon_accel.c
index af2fc99..8c748f2 100644
--- a/src/radeon_accel.c
+++ b/src/radeon_accel.c
@@ -128,13 +128,13 @@ int radeon_cs_space_remaining(ScrnInfoPtr pScrn)
return (info->cs->ndw - info->cs->cdw);
}
-void RADEONCopySwap(uint8_t *dst, uint8_t *src, unsigned int size, int
swap)
+void RADEONCopySwap(uint8_t * __restrict dst, const uint8_t *
__restrict src, unsigned int size, int swap)
{
switch(swap) {
case RADEON_HOST_DATA_SWAP_32BIT:
{
- unsigned int *d = (unsigned int *)dst;
- unsigned int *s = (unsigned int *)src;
+ unsigned int * __restrict d = (unsigned int *)dst;
+ unsigned int * __restrict s = (unsigned int *)src;
unsigned int nwords = size >> 2;
for (; nwords > 0; --nwords, ++d, ++s)
@@ -148,8 +148,8 @@ void RADEONCopySwap(uint8_t *dst, uint8_t *src,
unsigned int size, int swap)
}
case RADEON_HOST_DATA_SWAP_16BIT:
{
- unsigned short *d = (unsigned short *)dst;
- unsigned short *s = (unsigned short *)src;
+ unsigned short * __restrict d = (unsigned short *)dst;
+ unsigned short * __restrict s = (unsigned short *)src;
unsigned int nwords = size >> 1;
for (; nwords > 0; --nwords, ++d, ++s)
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 860ff29..0ff42e0 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -339,14 +339,14 @@ static void
radeon_dri2_copy_region2(ScreenPtr pScreen,
DrawablePtr drawable,
RegionPtr region,
- BufferPtr dest_buffer,
- BufferPtr src_buffer)
+ BufferPtr __restrict dest_buffer,
+ const BufferPtr __restrict src_buffer)
{
- struct dri2_buffer_priv *src_private = src_buffer->driverPrivate;
- struct dri2_buffer_priv *dst_private = dest_buffer->driverPrivate;
+ struct dri2_buffer_priv * __restrict src_private =
src_buffer->driverPrivate;
+ struct dri2_buffer_priv * __restrict dst_private =
dest_buffer->driverPrivate;
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
- DrawablePtr src_drawable;
- DrawablePtr dst_drawable;
+ DrawablePtr __restrict src_drawable;
+ DrawablePtr __restrict dst_drawable;
RegionPtr copy_clip;
GCPtr gc;
RADEONInfoPtr info = RADEONPTR(pScrn);
@@ -435,7 +435,7 @@ radeon_dri2_copy_region2(ScreenPtr pScreen,
void
radeon_dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion,
- DRI2BufferPtr pDstBuffer, DRI2BufferPtr pSrcBuffer)
+ DRI2BufferPtr __restrict pDstBuffer,
DRI2BufferPtr __restrict pSrcBuffer)
{
return radeon_dri2_copy_region2(pDraw->pScreen, pDraw, pRegion,
pDstBuffer, pSrcBuffer);
--
1.7.9.5
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2016-11-25 10:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-24 18:00 [PATCH] xf86-video-ati: Fix build for xserver < 1.13 Jochen Rollwagen
[not found] ` <58372ADA.8040009-zqRNUXuvxA0b1SvskN2V4Q@public.gmane.org>
2016-11-25 9:14 ` Michel Dänzer
[not found] ` <dd911a26-9976-6570-f5ac-5efe67e27928-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-11-25 10:00 ` Jochen Rollwagen [this message]
[not found] ` <58380BA2.3060006-zqRNUXuvxA0b1SvskN2V4Q@public.gmane.org>
2016-11-28 9:43 ` [PATCH xf86-video-ati] Use finer-grained pointer types in mem copying functions Michel Dänzer
[not found] ` <f3c04cd0-06b0-85c4-48d0-1bfbdd98dfdf-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-11-28 18:18 ` [PATCH xf86-video-ati] Replace loop with clz to calculate log base 2 on non-x86 platforms in radeon.h Jochen Rollwagen
[not found] ` <583C74DA.2070701-zqRNUXuvxA0b1SvskN2V4Q@public.gmane.org>
2016-11-29 7:32 ` Michel Dänzer
[not found] ` <e3556fa8-39eb-6b1d-9d71-316c23bff9ea-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-11-30 17:52 ` Jochen Rollwagen
[not found] ` <583F11F6.7000005-zqRNUXuvxA0b1SvskN2V4Q@public.gmane.org>
2016-12-01 0:57 ` Michel Dänzer
[not found] ` <b61bde0b-5120-5eaa-4243-18e30091ef86-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-12-02 9:31 ` Jochen Rollwagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58380BA2.3060006@t-online.de \
--to=joro-2013-zqrnuxuvxa0b1svskn2v4q@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox