~ubuntu-branches/ubuntu/precise/xserver-xorg-video-intel/precise

« back to all changes in this revision

Viewing changes to src/sna/blt.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers, Robert Hooker, Christopher James Halse Rogers
  • Date: 2011-08-09 10:10:02 UTC
  • mfrom: (0.1.21 experimental)
  • Revision ID: james.westby@ubuntu.com-20110809101002-pguc3kc6pzh1cp5h
Tags: 2:2.15.901-1ubuntu1
[ Robert Hooker ]
* Merge from debian-experimental, remaining changes:
  - 101_copy-fb.patch
    + Plymouth integration patch
  - 120_check_privates.patch
    + Check for null privates pointer on render_dest_picture.
  - debian/xserver-xorg-video-intel.preinst.in:
  - debian/xserver-xorg-video-intel.postinst.in:
    + Remove obsolete /etc/modprobe.d/i915-kms.conf file on upgrades.
      KMS is the kernel default.
* Dropped patches:
  - 121_fdo-28798-fix.patch (upstream)

[ Christopher James Halse Rogers ]
* Refresh 101_copy-fb.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2011 Intel Corporation
 
3
 *
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a
 
5
 * copy of this software and associated documentation files (the "Software"),
 
6
 * to deal in the Software without restriction, including without limitation
 
7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
8
 * and/or sell copies of the Software, and to permit persons to whom the
 
9
 * Software is furnished to do so, subject to the following conditions:
 
10
 *
 
11
 * The above copyright notice and this permission notice (including the next
 
12
 * paragraph) shall be included in all copies or substantial portions of the
 
13
 * Software.
 
14
 *
 
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
20
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
21
 * SOFTWARE.
 
22
 *
 
23
 * Authors:
 
24
 *    Chris Wilson <chris@chris-wilson.co.uk>
 
25
 *
 
26
 */
 
27
 
 
28
#ifdef HAVE_CONFIG_H
 
29
#include "config.h"
 
30
#endif
 
31
 
 
32
#include "sna.h"
 
33
 
 
34
#if DEBUG_BLT
 
35
#undef DBG
 
36
#define DBG(x) ErrorF x
 
37
#else
 
38
#define NDEBUG 1
 
39
#endif
 
40
 
 
41
void
 
42
memcpy_blt(const void *src, void *dst, int bpp,
 
43
           uint16_t src_stride, uint16_t dst_stride,
 
44
           int16_t src_x, int16_t src_y,
 
45
           int16_t dst_x, int16_t dst_y,
 
46
           uint16_t width, uint16_t height)
 
47
{
 
48
        uint8_t *src_bytes;
 
49
        uint8_t *dst_bytes;
 
50
 
 
51
        assert(width && height);
 
52
        assert(bpp >= 8);
 
53
 
 
54
        DBG(("%s: src=(%d, %d), dst=(%d, %d), size=%dx%d, pitch=%d/%d\n",
 
55
             __FUNCTION__, src_x, src_y, dst_x, dst_y, width, height, src_stride, dst_stride));
 
56
 
 
57
        bpp /= 8;
 
58
        width *= bpp;
 
59
 
 
60
        src_bytes = (uint8_t *)src + src_stride * src_y + src_x * bpp;
 
61
        dst_bytes = (uint8_t *)dst + dst_stride * dst_y + dst_x * bpp;
 
62
 
 
63
        if (width == src_stride && width == dst_stride) {
 
64
                memcpy(dst_bytes, src_bytes, width * height);
 
65
                return;
 
66
        }
 
67
 
 
68
        do {
 
69
                memcpy(dst_bytes, src_bytes, width);
 
70
                src_bytes += src_stride;
 
71
                dst_bytes += dst_stride;
 
72
        } while (--height);
 
73
}