diff options
author | Russell King <rmk_cubox@arm.linux.org.uk> | 2013-05-21 12:09:33 +0100 |
---|---|---|
committer | Russell King <rmk@arm.linux.org.uk> | 2013-05-21 12:16:40 +0100 |
commit | 725cd0b771768a03c838d7972a2e2357091f1574 (patch) | |
tree | 49d4658e9e17459f1b9faab28e28c253c85b9ddc | |
parent | 38c232e6ae0b9eed2b15146bd940f95c9f0b36b7 (diff) |
Rename dove -> armada
As this is not specific to Armada 510 (Dove) devices, but also appears
on other Marvell Armada devices, use "armada" as the name rather than
"dove".
Signed-off-by: Russell King <rmk_cubox@arm.linux.org.uk>
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | Makefile.am | 18 | ||||
-rw-r--r-- | armada_bufmgr.c (renamed from dove_bufmgr.c) | 170 | ||||
-rw-r--r-- | armada_bufmgr.h | 46 | ||||
-rw-r--r-- | armada_ioctl.h | 138 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/control | 16 | ||||
-rw-r--r-- | debian/libdrm-armada-dev.install (renamed from debian/libdrm-dove-dev.install) | 0 | ||||
-rw-r--r-- | debian/libdrm-armada2.install | 1 | ||||
-rw-r--r-- | debian/libdrm-dove2.install | 1 | ||||
-rwxr-xr-x | debian/rules | 4 | ||||
-rw-r--r-- | dove_bufmgr.h | 46 | ||||
-rw-r--r-- | dove_ioctl.h | 138 | ||||
-rw-r--r-- | libdrm_armada.pc.in (renamed from libdrm_dove.pc.in) | 6 |
15 files changed, 305 insertions, 297 deletions
@@ -4,11 +4,12 @@ autom4te.cache/ build-aux/ build/ configure +debian/autoreconf.after +debian/autoreconf.before debian/files +debian/*.debhelper debian/*.log debian/*.substvars debian/tmp/ -debian/libdrm-dove-dev/ -debian/libdrm-dove1-dbg/ -debian/libdrm-dove1/ +debian/libdrm-armada*/ m4/ diff --git a/Makefile.am b/Makefile.am index 3f0c0e4..bce944b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,17 +2,17 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_CFLAGS = $(WARN_CFLAGS) @LIBDRM_CFLAGS@ -libdrm_dove_la_LTLIBRARIES = libdrm_dove.la -libdrm_dove_ladir = $(libdir) -libdrm_dove_la_LDFLAGS = -version-info 2:0:0 -no-undefined -libdrm_dove_la_LIBADD = @LIBDRM_LIBS@ @CLOCK_LIB@ +libdrm_armada_la_LTLIBRARIES = libdrm_armada.la +libdrm_armada_ladir = $(libdir) +libdrm_armada_la_LDFLAGS = -version-info 0:0:0 -no-undefined +libdrm_armada_la_LIBADD = @LIBDRM_LIBS@ @CLOCK_LIB@ -libdrm_dove_la_SOURCES = \ - dove_bufmgr.c \ +libdrm_armada_la_SOURCES = \ + armada_bufmgr.c \ libdrm_lists.h -libdrm_doveincludedir = ${includedir}/libdrm -libdrm_doveinclude_HEADERS = dove_bufmgr.h +libdrm_armadaincludedir = ${includedir}/libdrm +libdrm_armadainclude_HEADERS = armada_bufmgr.h pkgconfigdir = @pkgconfigdir@ -pkgconfig_DATA = libdrm_dove.pc +pkgconfig_DATA = libdrm_armada.pc diff --git a/dove_bufmgr.c b/armada_bufmgr.c index eb2596b..01d9955 100644 --- a/dove_bufmgr.c +++ b/armada_bufmgr.c @@ -9,8 +9,8 @@ #include <drm.h> #include "libdrm_lists.h" -#include "dove_bufmgr.h" -#include "dove_ioctl.h" +#include "armada_bufmgr.h" +#include "armada_ioctl.h" #ifndef container_of #define container_of(ptr, type, member) ({ \ @@ -45,25 +45,25 @@ static size_t bucket_size[NUM_BUCKETS] = { 2621440, 3145728, 3670016, }; -struct dove_bucket { +struct armada_bucket { drmMMListHead head; /* LRU list of bos in this size */ size_t size; }; -struct dove_bo_cache { - struct dove_bucket buckets[NUM_BUCKETS]; +struct armada_bo_cache { + struct armada_bucket buckets[NUM_BUCKETS]; drmMMListHead head; /* LRU list of all freed bos */ time_t last_cleaned; }; -struct drm_dove_bufmgr { - struct dove_bo_cache cache; +struct drm_armada_bufmgr { + struct armada_bo_cache cache; int fd; }; -struct dove_bo { - struct drm_dove_bo bo; - struct drm_dove_bufmgr *mgr; /* manager associated with this bo */ +struct armada_bo { + struct drm_armada_bo bo; + struct drm_armada_bufmgr *mgr; /* manager associated with this bo */ drmMMListHead bucket; /* Cache bucket list */ drmMMListHead free; /* Free list */ time_t free_time; /* Time this bo was freed */ @@ -72,7 +72,7 @@ struct dove_bo { uint32_t name; /* Global name */ }; -#define to_dove_bo(_bo) container_of(_bo, struct dove_bo, bo) +#define to_armada_bo(_bo) container_of(_bo, struct armada_bo, bo) #ifndef DRM_IOCTL_MODE_CREATE_DUMB /* create a dumb scanout buffer */ @@ -106,7 +106,7 @@ struct drm_mode_map_dumb { #endif /* Given a width and bpp, return the pitch of a bo */ -static unsigned dove_bo_pitch(unsigned width, unsigned bpp) +static unsigned armada_bo_pitch(unsigned width, unsigned bpp) { unsigned pitch = bpp != 4 ? width * ((bpp + 7) / 8) : width / 2; @@ -115,12 +115,12 @@ static unsigned dove_bo_pitch(unsigned width, unsigned bpp) } /* Given the pitch and height, return the allocated size in bytes of a bo */ -static size_t dove_bo_size(unsigned pitch, unsigned height) +static size_t armada_bo_size(unsigned pitch, unsigned height) { return pitch * height; } -static size_t dove_bo_round_size(size_t size) +static size_t armada_bo_round_size(size_t size) { if (size > 1048576) size = (size + 1048575) & ~1048575; @@ -131,7 +131,7 @@ static size_t dove_bo_round_size(size_t size) return size; } -static void dove_bo_free(struct dove_bo *bo) +static void armada_bo_free(struct armada_bo *bo) { int ret, fd = bo->mgr->fd; @@ -140,7 +140,7 @@ static void dove_bo_free(struct dove_bo *bo) bo->bo.ptr = NULL; } - if (bo->bo.type == DRM_DOVE_BO_DUMB) { + if (bo->bo.type == DRM_ARMADA_BO_DUMB) { struct drm_mode_destroy_dumb arg; memset(&arg, 0, sizeof(arg)); @@ -158,7 +158,7 @@ static void dove_bo_free(struct dove_bo *bo) free(bo); } -static void dove_bo_cache_init(struct dove_bo_cache *cache) +static void armada_bo_cache_init(struct armada_bo_cache *cache) { struct timespec time; unsigned i; @@ -174,26 +174,26 @@ static void dove_bo_cache_init(struct dove_bo_cache *cache) } } -static void dove_bo_cache_fini(struct dove_bo_cache *cache) +static void armada_bo_cache_fini(struct armada_bo_cache *cache) { while (!DRMLISTEMPTY(&cache->head)) { - struct dove_bo *bo; + struct armada_bo *bo; - bo = DRMLISTENTRY(struct dove_bo, cache->head.next, free); + bo = DRMLISTENTRY(struct armada_bo, cache->head.next, free); DRMLISTDEL(&bo->bucket); DRMLISTDEL(&bo->free); - dove_bo_free(bo); + armada_bo_free(bo); } } -static struct dove_bucket *dove_find_bucket(struct dove_bo_cache *cache, size_t size) +static struct armada_bucket *armada_find_bucket(struct armada_bo_cache *cache, size_t size) { unsigned i; for (i = 0; i < NUM_BUCKETS; i++) { - struct dove_bucket *bucket = &cache->buckets[i]; + struct armada_bucket *bucket = &cache->buckets[i]; if (bucket->size >= size) return bucket; @@ -202,7 +202,7 @@ static struct dove_bucket *dove_find_bucket(struct dove_bo_cache *cache, size_t return NULL; } -static void dove_bo_cache_clean(struct dove_bo_cache *cache, time_t time) +static void armada_bo_cache_clean(struct armada_bo_cache *cache, time_t time) { if (time - cache->last_cleaned < BO_CACHE_CLEAN_INTERVAL) return; @@ -210,37 +210,37 @@ static void dove_bo_cache_clean(struct dove_bo_cache *cache, time_t time) cache->last_cleaned = time; while (!DRMLISTEMPTY(&cache->head)) { - struct dove_bo *bo; + struct armada_bo *bo; - bo = DRMLISTENTRY(struct dove_bo, cache->head.next, free); + bo = DRMLISTENTRY(struct armada_bo, cache->head.next, free); if (time - bo->free_time < BO_CACHE_MAX_AGE) break; DRMLISTDEL(&bo->bucket); DRMLISTDEL(&bo->free); - dove_bo_free(bo); + armada_bo_free(bo); } } -static struct dove_bo *dove_bo_bucket_get(struct dove_bucket *bucket, size_t size) +static struct armada_bo *armada_bo_bucket_get(struct armada_bucket *bucket, size_t size) { - struct dove_bo *bo = NULL; + struct armada_bo *bo = NULL; if (!DRMLISTEMPTY(&bucket->head)) { drmMMListHead *entry = bucket->head.next; - bo = DRMLISTENTRY(struct dove_bo, entry, bucket); + bo = DRMLISTENTRY(struct armada_bo, entry, bucket); DRMLISTDEL(&bo->bucket); DRMLISTDEL(&bo->free); } return bo; } -static void dove_bo_cache_put(struct dove_bo *bo) +static void armada_bo_cache_put(struct armada_bo *bo) { - struct dove_bo_cache *cache = &bo->mgr->cache; - struct dove_bucket *bucket = dove_find_bucket(cache, bo->alloc_size); + struct armada_bo_cache *cache = &bo->mgr->cache; + struct armada_bucket *bucket = armada_find_bucket(cache, bo->alloc_size); if (bucket) { struct timespec time; @@ -251,29 +251,29 @@ static void dove_bo_cache_put(struct dove_bo *bo) DRMLISTADDTAIL(&bo->bucket, &bucket->head); DRMLISTADDTAIL(&bo->free, &cache->head); - dove_bo_cache_clean(cache, time.tv_sec); + armada_bo_cache_clean(cache, time.tv_sec); return; } - dove_bo_free(bo); + armada_bo_free(bo); } -struct drm_dove_bo *drm_dove_bo_create_phys(struct drm_dove_bufmgr *mgr, +struct drm_armada_bo *drm_armada_bo_create_phys(struct drm_armada_bufmgr *mgr, uint32_t phys, size_t size) { - struct dove_bo *bo; + struct armada_bo *bo; int fd = mgr->fd; bo = calloc(1, sizeof *bo); if (bo) { - struct drm_dove_gem_create_phys arg; + struct drm_armada_gem_create_phys arg; int ret; memset(&arg, 0, sizeof(arg)); arg.phys = phys; arg.size = size; - ret = drmIoctl(fd, DRM_IOCTL_DOVE_GEM_CREATE_PHYS, &arg); + ret = drmIoctl(fd, DRM_IOCTL_ARMADA_GEM_CREATE_PHYS, &arg); if (ret) { free(bo); return NULL; @@ -282,7 +282,7 @@ struct drm_dove_bo *drm_dove_bo_create_phys(struct drm_dove_bufmgr *mgr, bo->bo.handle = arg.handle; bo->bo.size = size; bo->bo.phys = phys; - bo->bo.type = DRM_DOVE_BO_LINEAR; + bo->bo.type = DRM_ARMADA_BO_LINEAR; bo->alloc_size = size; bo->ref = 1; bo->mgr = mgr; @@ -290,25 +290,25 @@ struct drm_dove_bo *drm_dove_bo_create_phys(struct drm_dove_bufmgr *mgr, return &bo->bo; } -struct drm_dove_bo *drm_dove_bo_create(struct drm_dove_bufmgr *mgr, +struct drm_armada_bo *drm_armada_bo_create(struct drm_armada_bufmgr *mgr, unsigned w, unsigned h, unsigned bpp) { - struct drm_dove_gem_create arg; - struct dove_bucket *bucket; - struct dove_bo *bo; + struct drm_armada_gem_create arg; + struct armada_bucket *bucket; + struct armada_bo *bo; unsigned pitch; size_t alloc_size; int fd = mgr->fd; int ret; - pitch = dove_bo_pitch(w, bpp); - alloc_size = dove_bo_size(pitch, h); + pitch = armada_bo_pitch(w, bpp); + alloc_size = armada_bo_size(pitch, h); /* Try to find a bucket for this allocation */ - bucket = dove_find_bucket(&mgr->cache, alloc_size); + bucket = armada_find_bucket(&mgr->cache, alloc_size); if (bucket) { /* Can we allocate from our cache? */ - bo = dove_bo_bucket_get(bucket, alloc_size); + bo = armada_bo_bucket_get(bucket, alloc_size); if (bo) { bo->bo.size = pitch * h; bo->bo.pitch = pitch; @@ -320,7 +320,7 @@ struct drm_dove_bo *drm_dove_bo_create(struct drm_dove_bufmgr *mgr, alloc_size = bucket->size; } else { /* No bucket, so round the size up according to our old rules */ - alloc_size = dove_bo_round_size(alloc_size); + alloc_size = armada_bo_round_size(alloc_size); } /* No, create a new bo */ @@ -334,7 +334,7 @@ struct drm_dove_bo *drm_dove_bo_create(struct drm_dove_bufmgr *mgr, arg.bpp = bpp; arg.size = alloc_size; - ret = drmIoctl(fd, DRM_IOCTL_DOVE_GEM_CREATE, &arg); + ret = drmIoctl(fd, DRM_IOCTL_ARMADA_GEM_CREATE, &arg); if (ret) { free(bo); return NULL; @@ -344,7 +344,7 @@ struct drm_dove_bo *drm_dove_bo_create(struct drm_dove_bufmgr *mgr, bo->bo.handle = arg.handle; bo->bo.size = pitch * h; bo->bo.pitch = pitch; - bo->bo.type = DRM_DOVE_BO_SHMEM; + bo->bo.type = DRM_ARMADA_BO_SHMEM; bo->alloc_size = alloc_size; bo->ref = 1; bo->mgr = mgr; @@ -352,10 +352,10 @@ struct drm_dove_bo *drm_dove_bo_create(struct drm_dove_bufmgr *mgr, return &bo->bo; } -struct drm_dove_bo *drm_dove_bo_create_from_name(struct drm_dove_bufmgr *mgr, +struct drm_armada_bo *drm_armada_bo_create_from_name(struct drm_armada_bufmgr *mgr, uint32_t name) { - struct dove_bo *bo; + struct armada_bo *bo; int fd = mgr->fd; bo = calloc(1, sizeof *bo); @@ -373,7 +373,7 @@ struct drm_dove_bo *drm_dove_bo_create_from_name(struct drm_dove_bufmgr *mgr, bo->bo.ref = 1; bo->bo.handle = arg.handle; bo->bo.size = arg.size; - bo->bo.type = DRM_DOVE_BO_LINEAR; /* assumed */ + bo->bo.type = DRM_ARMADA_BO_LINEAR; /* assumed */ bo->alloc_size = arg.size; bo->ref = 1; bo->name = name; @@ -382,10 +382,10 @@ struct drm_dove_bo *drm_dove_bo_create_from_name(struct drm_dove_bufmgr *mgr, return &bo->bo; } -struct drm_dove_bo *drm_dove_bo_dumb_create(struct drm_dove_bufmgr *mgr, +struct drm_armada_bo *drm_armada_bo_dumb_create(struct drm_armada_bufmgr *mgr, unsigned w, unsigned h, unsigned bpp) { - struct dove_bo *bo; + struct armada_bo *bo; int fd = mgr->fd; bo = calloc(1, sizeof *bo); @@ -407,7 +407,7 @@ struct drm_dove_bo *drm_dove_bo_dumb_create(struct drm_dove_bufmgr *mgr, bo->bo.handle = arg.handle; bo->bo.size = arg.size; bo->bo.pitch = arg.pitch; - bo->bo.type = DRM_DOVE_BO_DUMB; + bo->bo.type = DRM_ARMADA_BO_DUMB; bo->alloc_size = arg.size; bo->ref = 1; bo->mgr = mgr; @@ -415,29 +415,29 @@ struct drm_dove_bo *drm_dove_bo_dumb_create(struct drm_dove_bufmgr *mgr, return &bo->bo; } -void drm_dove_bo_get(struct drm_dove_bo *dbo) +void drm_armada_bo_get(struct drm_armada_bo *dbo) { - struct dove_bo *bo = to_dove_bo(dbo); + struct armada_bo *bo = to_armada_bo(dbo); bo->ref++; } -void drm_dove_bo_put(struct drm_dove_bo *dbo) +void drm_armada_bo_put(struct drm_armada_bo *dbo) { - struct dove_bo *bo = to_dove_bo(dbo); + struct armada_bo *bo = to_armada_bo(dbo); if (bo->ref-- == 1) { int ret; - if (bo->bo.type == DRM_DOVE_BO_SHMEM) - dove_bo_cache_put(bo); + if (bo->bo.type == DRM_ARMADA_BO_SHMEM) + armada_bo_cache_put(bo); else - dove_bo_free(bo); + armada_bo_free(bo); } } -int drm_dove_bo_flink(struct drm_dove_bo *dbo, uint32_t *name) +int drm_armada_bo_flink(struct drm_armada_bo *dbo, uint32_t *name) { - struct dove_bo *bo = to_dove_bo(dbo); + struct armada_bo *bo = to_armada_bo(dbo); int fd = bo->mgr->fd; if (!bo->name) { @@ -455,16 +455,16 @@ int drm_dove_bo_flink(struct drm_dove_bo *dbo, uint32_t *name) return 0; } -int drm_dove_bo_map(struct drm_dove_bo *dbo) +int drm_armada_bo_map(struct drm_armada_bo *dbo) { - struct dove_bo *bo = to_dove_bo(dbo); + struct armada_bo *bo = to_armada_bo(dbo); void *map; int ret, fd = bo->mgr->fd; if (bo->bo.ptr) return 0; - if (bo->bo.type == DRM_DOVE_BO_DUMB) { + if (bo->bo.type == DRM_ARMADA_BO_DUMB) { struct drm_mode_map_dumb arg; memset(&arg, 0, sizeof(arg)); @@ -479,15 +479,15 @@ int drm_dove_bo_map(struct drm_dove_bo *dbo) if (map == MAP_FAILED) return -1; - } else if (bo->bo.type == DRM_DOVE_BO_SHMEM) { - struct drm_dove_gem_mmap arg; + } else if (bo->bo.type == DRM_ARMADA_BO_SHMEM) { + struct drm_armada_gem_mmap arg; memset(&arg, 0, sizeof(arg)); arg.handle = bo->bo.handle; arg.offset = 0; arg.size = bo->alloc_size; - ret = drmIoctl(fd, DRM_IOCTL_DOVE_GEM_MMAP, &arg); + ret = drmIoctl(fd, DRM_IOCTL_ARMADA_GEM_MMAP, &arg); if (ret) return -1; @@ -502,25 +502,25 @@ int drm_dove_bo_map(struct drm_dove_bo *dbo) return 0; } -uint32_t drm_dove_bo_phys(struct drm_dove_bo *dbo) +uint32_t drm_armada_bo_phys(struct drm_armada_bo *dbo) { - struct dove_bo *bo = to_dove_bo(dbo); - struct drm_dove_gem_prop arg; + struct armada_bo *bo = to_armada_bo(dbo); + struct drm_armada_gem_prop arg; int ret, fd = bo->mgr->fd; memset(&arg, 0, sizeof(arg)); arg.handle = bo->bo.handle; - ret = drmIoctl(fd, DRM_IOCTL_DOVE_GEM_PROP, &arg); + ret = drmIoctl(fd, DRM_IOCTL_ARMADA_GEM_PROP, &arg); return ret ? -1 : (uint32_t)arg.phys; } -int drm_dove_bo_subdata(struct drm_dove_bo *dbo, unsigned long offset, +int drm_armada_bo_subdata(struct drm_armada_bo *dbo, unsigned long offset, unsigned long size, const void *data) { - struct dove_bo *bo = to_dove_bo(dbo); - struct drm_dove_gem_pwrite arg; + struct armada_bo *bo = to_armada_bo(dbo); + struct drm_armada_gem_pwrite arg; int fd = bo->mgr->fd; memset(&arg, 0, sizeof(arg)); @@ -529,26 +529,26 @@ int drm_dove_bo_subdata(struct drm_dove_bo *dbo, unsigned long offset, arg.size = size; arg.ptr = (uint64_t)(uintptr_t)data; - return drmIoctl(fd, DRM_IOCTL_DOVE_GEM_PWRITE, &arg); + return drmIoctl(fd, DRM_IOCTL_ARMADA_GEM_PWRITE, &arg); } -int drm_dove_init(int fd, struct drm_dove_bufmgr **mgrp) +int drm_armada_init(int fd, struct drm_armada_bufmgr **mgrp) { - struct drm_dove_bufmgr *mgr; + struct drm_armada_bufmgr *mgr; mgr = calloc(1, sizeof(*mgr)); if (!mgr) return -1; - dove_bo_cache_init(&mgr->cache); + armada_bo_cache_init(&mgr->cache); mgr->fd = fd; *mgrp = mgr; return 0; } -void drm_dove_fini(struct drm_dove_bufmgr *mgr) +void drm_armada_fini(struct drm_armada_bufmgr *mgr) { - dove_bo_cache_fini(&mgr->cache); + armada_bo_cache_fini(&mgr->cache); free(mgr); } diff --git a/armada_bufmgr.h b/armada_bufmgr.h new file mode 100644 index 0000000..9e6188f --- /dev/null +++ b/armada_bufmgr.h @@ -0,0 +1,46 @@ +#ifndef DRM_ARMADA_GEM_H +#define DRM_ARMADA_GEM_H + +enum drm_armada_bo_type { + DRM_ARMADA_BO_DUMB, + DRM_ARMADA_BO_LINEAR, + DRM_ARMADA_BO_SHMEM +}; + +struct drm_armada_bufmgr; + +struct drm_armada_bo { + uint32_t ref; + uint32_t handle; + uint32_t size; + uint32_t pitch; + uint32_t phys; + void *ptr; + enum drm_armada_bo_type type; +}; + +int drm_armada_init(int fd, struct drm_armada_bufmgr **mgr); +void drm_armada_fini(struct drm_armada_bufmgr *); + +struct drm_armada_bo *drm_armada_bo_create(struct drm_armada_bufmgr *, + unsigned w, unsigned h, unsigned bpp); +struct drm_armada_bo *drm_armada_bo_create_phys(struct drm_armada_bufmgr *, + uint32_t phys, size_t size); +struct drm_armada_bo *drm_armada_bo_dumb_create(struct drm_armada_bufmgr *, + unsigned w, unsigned h, unsigned bpp); + +/* Create a BO from a global name */ +struct drm_armada_bo *drm_armada_bo_create_from_name(struct drm_armada_bufmgr *, + uint32_t name); + +/* Create a global name from a BO */ +int drm_armada_bo_flink(struct drm_armada_bo *bo, uint32_t *name); + +int drm_armada_bo_map(struct drm_armada_bo *bo); +uint32_t drm_armada_bo_phys(struct drm_armada_bo *bo); +void drm_armada_bo_get(struct drm_armada_bo *bo); +void drm_armada_bo_put(struct drm_armada_bo *bo); +int drm_armada_bo_subdata(struct drm_armada_bo *bo, unsigned long offset, + unsigned long size, const void *data); + +#endif diff --git a/armada_ioctl.h b/armada_ioctl.h new file mode 100644 index 0000000..780312c --- /dev/null +++ b/armada_ioctl.h @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2012 Russell King + * With inspiration from the i915 driver + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#ifndef DRM_ARMADA_IOCTL_H +#define DRM_ARMADA_IOCTL_H + +#define DRM_ARMADA_GEM_CREATE 0x00 +#define DRM_ARMADA_GEM_CREATE_PHYS 0x01 +#define DRM_ARMADA_GEM_MMAP 0x02 +#define DRM_ARMADA_GEM_PWRITE 0x03 +#define DRM_ARMADA_GEM_PROP 0x04 +#define DRM_ARMADA_GEM_CACHE 0x05 +#define DRM_ARMADA_OVERLAY_PUT_IMAGE 0x06 +#define DRM_ARMADA_OVERLAY_ATTRS 0x07 + +#define ARMADA_IOCTL(dir,name,str) \ + DRM_##dir(DRM_COMMAND_BASE + DRM_ARMADA_##name, struct drm_armada_##str) + +struct drm_armada_gem_create { + uint32_t height; + uint32_t width; + uint32_t bpp; + uint32_t handle; + uint32_t pitch; + uint32_t size; +}; +#define DRM_IOCTL_ARMADA_GEM_CREATE \ + ARMADA_IOCTL(IOWR, GEM_CREATE, gem_create) + +struct drm_armada_gem_create_phys { + uint32_t size; + uint32_t handle; + uint64_t phys; +}; +#define DRM_IOCTL_ARMADA_GEM_CREATE_PHYS \ + ARMADA_IOCTL(IOWR, GEM_CREATE_PHYS, gem_create_phys) + +struct drm_armada_gem_mmap { + uint32_t handle; + uint32_t pad; + uint64_t offset; + uint64_t size; + uint64_t addr; +}; +#define DRM_IOCTL_ARMADA_GEM_MMAP \ + ARMADA_IOCTL(IOWR, GEM_MMAP, gem_mmap) + +struct drm_armada_gem_pwrite { + uint32_t handle; + uint32_t offset; + uint32_t size; + uint64_t ptr; +}; +#define DRM_IOCTL_ARMADA_GEM_PWRITE \ + ARMADA_IOCTL(IOW, GEM_PWRITE, gem_pwrite) + +struct drm_armada_gem_prop { + uint64_t phys; + uint32_t handle; +}; +#define DRM_IOCTL_ARMADA_GEM_PROP \ + ARMADA_IOCTL(IOWR, GEM_PROP, gem_prop) + +struct drm_armada_gem_cache { + uint64_t ptr; + uint32_t handle; + uint32_t size; + uint32_t op; +}; +#define DRM_IOCTL_ARMADA_GEM_CACHE \ + ARMADA_IOCTL(IOW, GEM_CACHE, gem_cache) + +/* Same as Intel I915 */ +struct drm_armada_overlay_put_image { + uint32_t flags; +#define ARMADA_OVERLAY_TYPE_MASK 0x000000ff +#define ARMADA_OVERLAY_YUV_PLANAR 0x00000001 +#define ARMADA_OVERLAY_YUV_PACKED 0x00000002 +#define ARMADA_OVERLAY_RGB 0x00000003 +#define ARMADA_OVERLAY_DEPTH_MASK 0x0000ff00 +#define ARMADA_OVERLAY_RGB24 0x00001000 +#define ARMADA_OVERLAY_RGB16 0x00002000 +#define ARMADA_OVERLAY_RGB15 0x00003000 +#define ARMADA_OVERLAY_YUV422 0x00000100 +#define ARMADA_OVERLAY_YUV411 0x00000200 +#define ARMADA_OVERLAY_YUV420 0x00000300 +#define ARMADA_OVERLAY_YUV410 0x00000400 +#define ARMADA_OVERLAY_SWAP_MASK 0x00ff0000 +#define ARMADA_OVERLAY_NO_SWAP 0x00000000 +#define ARMADA_OVERLAY_UV_SWAP 0x00010000 +#define ARMADA_OVERLAY_Y_SWAP 0x00020000 +#define ARMADA_OVERLAY_Y_AND_UV_SWAP 0x00030000 +#define ARMADA_OVERLAY_FLAGS_MASK 0xff000000 +#define ARMADA_OVERLAY_ENABLE 0x01000000 + uint32_t bo_handle; + uint16_t stride_Y; + uint16_t stride_UV; + uint32_t offset_Y; + uint32_t offset_U; + uint32_t offset_V; + uint16_t src_width; + uint16_t src_height; + uint16_t src_scan_width; + uint16_t src_scan_height; + uint32_t crtc_id; + uint16_t dst_x; + uint16_t dst_y; + uint16_t dst_width; + uint16_t dst_height; +}; +#define DRM_IOCTL_ARMADA_OVERLAY_PUT_IMAGE \ + ARMADA_IOCTL(IOW, OVERLAY_PUT_IMAGE, overlay_put_image) + +/* Same as Intel I915 */ +struct drm_armada_overlay_attrs { + uint32_t flags; +#define ARMADA_OVERLAY_UPDATE_ATTRS (1<<0) +#define ARMADA_OVERLAY_UPDATE_GAMMA (1<<1) + uint32_t color_key; + int32_t brightness; + uint32_t contrast; + uint32_t saturation; + uint32_t gamma0; + uint32_t gamma1; + uint32_t gamma2; + uint32_t gamma3; + uint32_t gamma4; + uint32_t gamma5; +}; +#define DRM_IOCTL_ARMADA_OVERLAY_ATTRS \ + ARMADA_IOCTL(IOWR, OVERLAY_ATTRS, overlay_attrs) + +#endif diff --git a/configure.ac b/configure.ac index 0d5e518..0e1ab67 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ([2.63]) -AC_INIT([libdrm_dove], [2.0.0], [], [libdrm_dove]) +AC_INIT([libdrm_armada], [2.0.0], [], [libdrm_armada]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_MACRO_DIR([m4]) @@ -34,6 +34,6 @@ AC_SUBST(pkgconfigdir) AC_CONFIG_FILES([ Makefile - libdrm_dove.pc + libdrm_armada.pc ]) AC_OUTPUT diff --git a/debian/changelog b/debian/changelog index 95e7cd7..dc126c7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +libdrm-armada (2.0.1-1) unstable; urgency=low + + * Rename to Armada as this covers more devices than just the Armada 510 + Dove. + + -- Russell King <rmk_cubox@arm.linux.org.uk> Tue, 21 May 2013 10:54:58 +0100 + libdrm-dove (2.0.0-1) unstable; urgency=low * Re-vamp API to allow a buffer manager object, stop passing fd into diff --git a/debian/control b/debian/control index efbf3d0..909d780 100644 --- a/debian/control +++ b/debian/control @@ -1,4 +1,4 @@ -Source: libdrm-dove +Source: libdrm-armada Priority: optional Maintainer: Russell King <rmk+cubox@arm.linux.org.uk> Build-Depends: @@ -9,11 +9,11 @@ Build-Depends: Standards-Version: 3.9.2 Section: libs -Package: libdrm-dove-dev +Package: libdrm-armada-dev Section: libdevel Architecture: any Depends: - libdrm-dove2 (= ${binary:Version}), + libdrm-armada2 (= ${binary:Version}), ${misc:Depends}, Description: Userspace interface to kernel DRM services -- development files This library implements the userspace interface to the kernel DRM @@ -22,9 +22,9 @@ Description: Userspace interface to kernel DRM services -- development files The DRI is currently used on Linux to provide hardware-accelerated OpenGL drivers. . - This package provides the development environment for libdrm-dove2. + This package provides the development environment for libdrm-armada2. -Package: libdrm-dove2 +Package: libdrm-armada2 Section: libs Priority: extra Architecture: linux-any @@ -40,9 +40,9 @@ Description: Userspace interface to kernel DRM services -- runtime The DRI is currently used on Linux to provide hardware-accelerated OpenGL drivers. . - This package provides the runtime environment for libdrm-dove2. + This package provides the runtime environment for libdrm-armada2. -Package: libdrm-dove2-dbg +Package: libdrm-armada2-dbg Section: debug Priority: extra Architecture: linux-any @@ -56,4 +56,4 @@ Description: Userspace interface to kernel DRM services -- debugging symbols The DRI is currently used on Linux to provide hardware-accelerated OpenGL drivers. . - This package provides debugging symbols for the libdrm-dove2 package. + This package provides debugging symbols for the libdrm-armada2 package. diff --git a/debian/libdrm-dove-dev.install b/debian/libdrm-armada-dev.install index 757f698..757f698 100644 --- a/debian/libdrm-dove-dev.install +++ b/debian/libdrm-armada-dev.install diff --git a/debian/libdrm-armada2.install b/debian/libdrm-armada2.install new file mode 100644 index 0000000..3ddde58 --- /dev/null +++ b/debian/libdrm-armada2.install @@ -0,0 +1 @@ +usr/lib/*/lib*.so.* diff --git a/debian/libdrm-dove2.install b/debian/libdrm-dove2.install deleted file mode 100644 index c131245..0000000 --- a/debian/libdrm-dove2.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/libdrm_dove.so.2* diff --git a/debian/rules b/debian/rules index cc315f2..2d9cfa4 100755 --- a/debian/rules +++ b/debian/rules @@ -15,9 +15,9 @@ override_dh_install: dh_install --fail-missing override_dh_strip: - dh_strip -plibdrm-dove2 --dbg-package=libdrm-dove2-dbg + dh_strip -plibdrm-armada2 --dbg-package=libdrm-armada2-dbg dh_strip -s --remaining-packages %: - dh $@ --with quilt,autoreconf --builddirectory=build/ + dh $@ --with autoreconf --builddirectory=build/ diff --git a/dove_bufmgr.h b/dove_bufmgr.h deleted file mode 100644 index 18fae64..0000000 --- a/dove_bufmgr.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef DRM_DOVE_GEM_H -#define DRM_DOVE_GEM_H - -enum drm_dove_bo_type { - DRM_DOVE_BO_DUMB, - DRM_DOVE_BO_LINEAR, - DRM_DOVE_BO_SHMEM -}; - -struct drm_dove_bufmgr; - -struct drm_dove_bo { - uint32_t ref; - uint32_t handle; - uint32_t size; - uint32_t pitch; - uint32_t phys; - void *ptr; - enum drm_dove_bo_type type; -}; - -int drm_dove_init(int fd, struct drm_dove_bufmgr **mgr); -void drm_dove_fini(struct drm_dove_bufmgr *); - -struct drm_dove_bo *drm_dove_bo_create(struct drm_dove_bufmgr *, - unsigned w, unsigned h, unsigned bpp); -struct drm_dove_bo *drm_dove_bo_create_phys(struct drm_dove_bufmgr *, - uint32_t phys, size_t size); -struct drm_dove_bo *drm_dove_bo_dumb_create(struct drm_dove_bufmgr *, - unsigned w, unsigned h, unsigned bpp); - -/* Create a BO from a global name */ -struct drm_dove_bo *drm_dove_bo_create_from_name(struct drm_dove_bufmgr *, - uint32_t name); - -/* Create a global name from a BO */ -int drm_dove_bo_flink(struct drm_dove_bo *bo, uint32_t *name); - -int drm_dove_bo_map(struct drm_dove_bo *bo); -uint32_t drm_dove_bo_phys(struct drm_dove_bo *bo); -void drm_dove_bo_get(struct drm_dove_bo *bo); -void drm_dove_bo_put(struct drm_dove_bo *bo); -int drm_dove_bo_subdata(struct drm_dove_bo *bo, unsigned long offset, - unsigned long size, const void *data); - -#endif diff --git a/dove_ioctl.h b/dove_ioctl.h deleted file mode 100644 index 51997c2..0000000 --- a/dove_ioctl.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (C) 2012 Russell King - * With inspiration from the i915 driver - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef DRM_DOVE_IOCTL_H -#define DRM_DOVE_IOCTL_H - -#define DRM_DOVE_GEM_CREATE 0x00 -#define DRM_DOVE_GEM_CREATE_PHYS 0x01 -#define DRM_DOVE_GEM_MMAP 0x02 -#define DRM_DOVE_GEM_PWRITE 0x03 -#define DRM_DOVE_GEM_PROP 0x04 -#define DRM_DOVE_GEM_CACHE 0x05 -#define DRM_DOVE_OVERLAY_PUT_IMAGE 0x06 -#define DRM_DOVE_OVERLAY_ATTRS 0x07 - -#define DOVE_IOCTL(dir,name,str) \ - DRM_##dir(DRM_COMMAND_BASE + DRM_DOVE_##name, struct drm_dove_##str) - -struct drm_dove_gem_create { - uint32_t height; - uint32_t width; - uint32_t bpp; - uint32_t handle; - uint32_t pitch; - uint32_t size; -}; -#define DRM_IOCTL_DOVE_GEM_CREATE \ - DOVE_IOCTL(IOWR, GEM_CREATE, gem_create) - -struct drm_dove_gem_create_phys { - uint32_t size; - uint32_t handle; - uint64_t phys; -}; -#define DRM_IOCTL_DOVE_GEM_CREATE_PHYS \ - DOVE_IOCTL(IOWR, GEM_CREATE_PHYS, gem_create_phys) - -struct drm_dove_gem_mmap { - uint32_t handle; - uint32_t pad; - uint64_t offset; - uint64_t size; - uint64_t addr; -}; -#define DRM_IOCTL_DOVE_GEM_MMAP \ - DOVE_IOCTL(IOWR, GEM_MMAP, gem_mmap) - -struct drm_dove_gem_pwrite { - uint32_t handle; - uint32_t offset; - uint32_t size; - uint64_t ptr; -}; -#define DRM_IOCTL_DOVE_GEM_PWRITE \ - DOVE_IOCTL(IOW, GEM_PWRITE, gem_pwrite) - -struct drm_dove_gem_prop { - uint64_t phys; - uint32_t handle; -}; -#define DRM_IOCTL_DOVE_GEM_PROP \ - DOVE_IOCTL(IOWR, GEM_PROP, gem_prop) - -struct drm_dove_gem_cache { - uint64_t ptr; - uint32_t handle; - uint32_t size; - uint32_t op; -}; -#define DRM_IOCTL_DOVE_GEM_CACHE \ - DOVE_IOCTL(IOW, GEM_CACHE, gem_cache) - -/* Same as Intel I915 */ -struct drm_dove_overlay_put_image { - uint32_t flags; -#define DOVE_OVERLAY_TYPE_MASK 0x000000ff -#define DOVE_OVERLAY_YUV_PLANAR 0x00000001 -#define DOVE_OVERLAY_YUV_PACKED 0x00000002 -#define DOVE_OVERLAY_RGB 0x00000003 -#define DOVE_OVERLAY_DEPTH_MASK 0x0000ff00 -#define DOVE_OVERLAY_RGB24 0x00001000 -#define DOVE_OVERLAY_RGB16 0x00002000 -#define DOVE_OVERLAY_RGB15 0x00003000 -#define DOVE_OVERLAY_YUV422 0x00000100 -#define DOVE_OVERLAY_YUV411 0x00000200 -#define DOVE_OVERLAY_YUV420 0x00000300 -#define DOVE_OVERLAY_YUV410 0x00000400 -#define DOVE_OVERLAY_SWAP_MASK 0x00ff0000 -#define DOVE_OVERLAY_NO_SWAP 0x00000000 -#define DOVE_OVERLAY_UV_SWAP 0x00010000 -#define DOVE_OVERLAY_Y_SWAP 0x00020000 -#define DOVE_OVERLAY_Y_AND_UV_SWAP 0x00030000 -#define DOVE_OVERLAY_FLAGS_MASK 0xff000000 -#define DOVE_OVERLAY_ENABLE 0x01000000 - uint32_t bo_handle; - uint16_t stride_Y; - uint16_t stride_UV; - uint32_t offset_Y; - uint32_t offset_U; - uint32_t offset_V; - uint16_t src_width; - uint16_t src_height; - uint16_t src_scan_width; - uint16_t src_scan_height; - uint32_t crtc_id; - uint16_t dst_x; - uint16_t dst_y; - uint16_t dst_width; - uint16_t dst_height; -}; -#define DRM_IOCTL_DOVE_OVERLAY_PUT_IMAGE \ - DOVE_IOCTL(IOW, OVERLAY_PUT_IMAGE, overlay_put_image) - -/* Same as Intel I915 */ -struct drm_dove_overlay_attrs { - uint32_t flags; -#define DOVE_OVERLAY_UPDATE_ATTRS (1<<0) -#define DOVE_OVERLAY_UPDATE_GAMMA (1<<1) - uint32_t color_key; - int32_t brightness; - uint32_t contrast; - uint32_t saturation; - uint32_t gamma0; - uint32_t gamma1; - uint32_t gamma2; - uint32_t gamma3; - uint32_t gamma4; - uint32_t gamma5; -}; -#define DRM_IOCTL_DOVE_OVERLAY_ATTRS \ - DOVE_IOCTL(IOWR, OVERLAY_ATTRS, overlay_attrs) - -#endif diff --git a/libdrm_dove.pc.in b/libdrm_armada.pc.in index 80ad07a..8a3af77 100644 --- a/libdrm_dove.pc.in +++ b/libdrm_armada.pc.in @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -Name: libdrm_dove -Description: Userspace interface to kerenl DRM services +Name: libdrm_armada +Description: Userspace interface to kernel DRM services Version: @PACKAGE_VERSION@ Requires: libdrm -Libs: -L${libdir} -ldrm_dove +Libs: -L${libdir} -ldrm_armada Cflags: -I${includedir}/libdrm |