~thopiekar/arm-mali/libvdpau-sunxi

« back to all changes in this revision

Viewing changes to rgba.c

  • Committer: Jens Kuske
  • Date: 2016-02-16 13:12:22 UTC
  • Revision ID: git-v1:685769372a8281bf67046a958883323aaf14d232
Use libcedrus

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 */
19
19
 
20
20
#include <string.h>
 
21
#include <cedrus/cedrus.h>
21
22
#include <sys/ioctl.h>
22
23
#include "vdpau_private.h"
23
 
#include "ve.h"
24
24
#include "kernel-headers/g2d_driver.h"
25
25
#include "rgba.h"
26
26
 
57
57
 
58
58
        if (device->osd_enabled)
59
59
        {
60
 
                rgba->data = ve_malloc(width * height * 4);
 
60
                rgba->data = cedrus_mem_alloc(device->cedrus, width * height * 4);
61
61
                if (!rgba->data)
62
62
                        return VDP_STATUS_RESOURCES;
63
63
 
74
74
void rgba_destroy(rgba_surface_t *rgba)
75
75
{
76
76
        if (rgba->device->osd_enabled)
77
 
                ve_free(rgba->data);
 
77
                cedrus_mem_free(rgba->data);
78
78
}
79
79
 
80
80
VdpStatus rgba_put_bits_native(rgba_surface_t *rgba,
96
96
                // full width
97
97
                const int bytes_to_copy =
98
98
                        (d_rect.x1 - d_rect.x0) * (d_rect.y1 - d_rect.y0) * 4;
99
 
                memcpy(rgba->data->virt + d_rect.y0 * rgba->width * 4,
 
99
                memcpy(cedrus_mem_get_pointer(rgba->data) + d_rect.y0 * rgba->width * 4,
100
100
                           source_data[0], bytes_to_copy);
101
101
        } else {
102
102
                const unsigned int bytes_in_line = (d_rect.x1-d_rect.x0) * 4;
103
103
                unsigned int y;
104
104
                for (y = d_rect.y0; y < d_rect.y1; y ++) {
105
 
                        memcpy(rgba->data->virt + (y * rgba->width + d_rect.x0) * 4,
 
105
                        memcpy(cedrus_mem_get_pointer(rgba->data) + (y * rgba->width + d_rect.x0) * 4,
106
106
                                   source_data[0] + (y - d_rect.y0) * source_pitches[0],
107
107
                                   bytes_in_line);
108
108
                }
132
132
        int x, y;
133
133
        const uint32_t *colormap = color_table;
134
134
        const uint8_t *src_ptr = source_data[0];
135
 
        uint32_t *dst_ptr = rgba->data->virt;
 
135
        uint32_t *dst_ptr = cedrus_mem_get_pointer(rgba->data);
136
136
 
137
137
        VdpRect d_rect = {0, 0, rgba->width, rgba->height};
138
138
        if (destination_rect)
242
242
                rgba_flush(dest);
243
243
 
244
244
                args.flag = G2D_FIL_PIXEL_ALPHA;
245
 
                args.dst_image.addr[0] = dest->data->phys + 0x40000000;
 
245
                args.dst_image.addr[0] = cedrus_mem_get_phys_addr(dest->data);
246
246
                args.dst_image.w = dest->width;
247
247
                args.dst_image.h = dest->height;
248
248
                args.dst_image.format = G2D_FMT_ARGB_AYUV8888;
278
278
                rgba_flush(src);
279
279
 
280
280
                args.flag = (dest->flags & RGBA_FLAG_NEEDS_CLEAR) ? G2D_BLT_NONE : G2D_BLT_PIXEL_ALPHA;
281
 
                args.src_image.addr[0] = src->data->phys + 0x40000000;
 
281
                args.src_image.addr[0] = cedrus_mem_get_phys_addr(src->data);
282
282
                args.src_image.w = src->width;
283
283
                args.src_image.h = src->height;
284
284
                args.src_image.format = G2D_FMT_ARGB_AYUV8888;
287
287
                args.src_rect.y = src_rect->y0;
288
288
                args.src_rect.w = src_rect->x1 - src_rect->x0;
289
289
                args.src_rect.h = src_rect->y1 - src_rect->y0;
290
 
                args.dst_image.addr[0] = dest->data->phys + 0x40000000;
 
290
                args.dst_image.addr[0] = cedrus_mem_get_phys_addr(dest->data);
291
291
                args.dst_image.w = dest->width;
292
292
                args.dst_image.h = dest->height;
293
293
                args.dst_image.format = G2D_FMT_ARGB_AYUV8888;
305
305
{
306
306
        if (rgba->flags & RGBA_FLAG_NEEDS_FLUSH)
307
307
        {
308
 
                ve_flush_cache(rgba->data);
 
308
                cedrus_mem_flush_cache(rgba->data);
309
309
                rgba->flags &= ~RGBA_FLAG_NEEDS_FLUSH;
310
310
        }
311
311
}