aboutsummaryrefslogtreecommitdiffstats
path: root/omap
diff options
context:
space:
mode:
Diffstat (limited to 'omap')
-rw-r--r--omap/Makefile.am1
-rw-r--r--omap/omap_drm.c46
2 files changed, 27 insertions, 20 deletions
diff --git a/omap/Makefile.am b/omap/Makefile.am
index c77520b4..0778bdde 100644
--- a/omap/Makefile.am
+++ b/omap/Makefile.am
@@ -1,5 +1,6 @@
1AM_CFLAGS = \ 1AM_CFLAGS = \
2 $(WARN_CFLAGS) \ 2 $(WARN_CFLAGS) \
3 $(VISIBILITY_CFLAGS) \
3 -I$(top_srcdir) \ 4 -I$(top_srcdir) \
4 -I$(top_srcdir)/omap \ 5 -I$(top_srcdir)/omap \
5 $(PTHREADSTUBS_CFLAGS) \ 6 $(PTHREADSTUBS_CFLAGS) \
diff --git a/omap/omap_drm.c b/omap/omap_drm.c
index 89f14911..8b4ec466 100644
--- a/omap/omap_drm.c
+++ b/omap/omap_drm.c
@@ -39,6 +39,7 @@
39#include <unistd.h> 39#include <unistd.h>
40#include <pthread.h> 40#include <pthread.h>
41 41
42#include <libdrm.h>
42#include <xf86drm.h> 43#include <xf86drm.h>
43#include <xf86atomic.h> 44#include <xf86atomic.h>
44 45
@@ -91,7 +92,7 @@ static struct omap_device * omap_device_new_impl(int fd)
91 return dev; 92 return dev;
92} 93}
93 94
94struct omap_device * omap_device_new(int fd) 95drm_public struct omap_device * omap_device_new(int fd)
95{ 96{
96 struct omap_device *dev = NULL; 97 struct omap_device *dev = NULL;
97 98
@@ -114,13 +115,13 @@ struct omap_device * omap_device_new(int fd)
114 return dev; 115 return dev;
115} 116}
116 117
117struct omap_device * omap_device_ref(struct omap_device *dev) 118drm_public struct omap_device * omap_device_ref(struct omap_device *dev)
118{ 119{
119 atomic_inc(&dev->refcnt); 120 atomic_inc(&dev->refcnt);
120 return dev; 121 return dev;
121} 122}
122 123
123void omap_device_del(struct omap_device *dev) 124drm_public void omap_device_del(struct omap_device *dev)
124{ 125{
125 if (!atomic_dec_and_test(&dev->refcnt)) 126 if (!atomic_dec_and_test(&dev->refcnt))
126 return; 127 return;
@@ -131,7 +132,8 @@ void omap_device_del(struct omap_device *dev)
131 free(dev); 132 free(dev);
132} 133}
133 134
134int omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value) 135drm_public int
136omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value)
135{ 137{
136 struct drm_omap_param req = { 138 struct drm_omap_param req = {
137 .param = param, 139 .param = param,
@@ -148,7 +150,8 @@ int omap_get_param(struct omap_device *dev, uint64_t param, uint64_t *value)
148 return 0; 150 return 0;
149} 151}
150 152
151int omap_set_param(struct omap_device *dev, uint64_t param, uint64_t value) 153drm_public int
154omap_set_param(struct omap_device *dev, uint64_t param, uint64_t value)
152{ 155{
153 struct drm_omap_param req = { 156 struct drm_omap_param req = {
154 .param = param, 157 .param = param,
@@ -226,8 +229,8 @@ fail:
226 229
227 230
228/* allocate a new (un-tiled) buffer object */ 231/* allocate a new (un-tiled) buffer object */
229struct omap_bo * omap_bo_new(struct omap_device *dev, 232drm_public struct omap_bo *
230 uint32_t size, uint32_t flags) 233omap_bo_new(struct omap_device *dev, uint32_t size, uint32_t flags)
231{ 234{
232 union omap_gem_size gsize = { 235 union omap_gem_size gsize = {
233 .bytes = size, 236 .bytes = size,
@@ -239,8 +242,9 @@ struct omap_bo * omap_bo_new(struct omap_device *dev,
239} 242}
240 243
241/* allocate a new buffer object */ 244/* allocate a new buffer object */
242struct omap_bo * omap_bo_new_tiled(struct omap_device *dev, 245drm_public struct omap_bo *
243 uint32_t width, uint32_t height, uint32_t flags) 246omap_bo_new_tiled(struct omap_device *dev, uint32_t width,
247 uint32_t height, uint32_t flags)
244{ 248{
245 union omap_gem_size gsize = { 249 union omap_gem_size gsize = {
246 .tiled = { 250 .tiled = {
@@ -254,7 +258,7 @@ struct omap_bo * omap_bo_new_tiled(struct omap_device *dev,
254 return omap_bo_new_impl(dev, gsize, flags); 258 return omap_bo_new_impl(dev, gsize, flags);
255} 259}
256 260
257struct omap_bo * omap_bo_ref(struct omap_bo *bo) 261drm_public struct omap_bo *omap_bo_ref(struct omap_bo *bo)
258{ 262{
259 atomic_inc(&bo->refcnt); 263 atomic_inc(&bo->refcnt);
260 return bo; 264 return bo;
@@ -280,7 +284,8 @@ static int get_buffer_info(struct omap_bo *bo)
280} 284}
281 285
282/* import a buffer object from DRI2 name */ 286/* import a buffer object from DRI2 name */
283struct omap_bo * omap_bo_from_name(struct omap_device *dev, uint32_t name) 287drm_public struct omap_bo *
288omap_bo_from_name(struct omap_device *dev, uint32_t name)
284{ 289{
285 struct omap_bo *bo = NULL; 290 struct omap_bo *bo = NULL;
286 struct drm_gem_open req = { 291 struct drm_gem_open req = {
@@ -313,7 +318,8 @@ fail:
313 * fd so caller should close() the fd when it is otherwise done 318 * fd so caller should close() the fd when it is otherwise done
314 * with it (even if it is still using the 'struct omap_bo *') 319 * with it (even if it is still using the 'struct omap_bo *')
315 */ 320 */
316struct omap_bo * omap_bo_from_dmabuf(struct omap_device *dev, int fd) 321drm_public struct omap_bo *
322omap_bo_from_dmabuf(struct omap_device *dev, int fd)
317{ 323{
318 struct omap_bo *bo = NULL; 324 struct omap_bo *bo = NULL;
319 struct drm_prime_handle req = { 325 struct drm_prime_handle req = {
@@ -344,7 +350,7 @@ fail:
344} 350}
345 351
346/* destroy a buffer object */ 352/* destroy a buffer object */
347void omap_bo_del(struct omap_bo *bo) 353drm_public void omap_bo_del(struct omap_bo *bo)
348{ 354{
349 if (!bo) { 355 if (!bo) {
350 return; 356 return;
@@ -377,7 +383,7 @@ void omap_bo_del(struct omap_bo *bo)
377} 383}
378 384
379/* get the global flink/DRI2 buffer name */ 385/* get the global flink/DRI2 buffer name */
380int omap_bo_get_name(struct omap_bo *bo, uint32_t *name) 386drm_public int omap_bo_get_name(struct omap_bo *bo, uint32_t *name)
381{ 387{
382 if (!bo->name) { 388 if (!bo->name) {
383 struct drm_gem_flink req = { 389 struct drm_gem_flink req = {
@@ -398,7 +404,7 @@ int omap_bo_get_name(struct omap_bo *bo, uint32_t *name)
398 return 0; 404 return 0;
399} 405}
400 406
401uint32_t omap_bo_handle(struct omap_bo *bo) 407drm_public uint32_t omap_bo_handle(struct omap_bo *bo)
402{ 408{
403 return bo->handle; 409 return bo->handle;
404} 410}
@@ -406,7 +412,7 @@ uint32_t omap_bo_handle(struct omap_bo *bo)
406/* caller owns the dmabuf fd that is returned and is responsible 412/* caller owns the dmabuf fd that is returned and is responsible
407 * to close() it when done 413 * to close() it when done
408 */ 414 */
409int omap_bo_dmabuf(struct omap_bo *bo) 415drm_public int omap_bo_dmabuf(struct omap_bo *bo)
410{ 416{
411 if (!bo->fd) { 417 if (!bo->fd) {
412 struct drm_prime_handle req = { 418 struct drm_prime_handle req = {
@@ -425,7 +431,7 @@ int omap_bo_dmabuf(struct omap_bo *bo)
425 return dup(bo->fd); 431 return dup(bo->fd);
426} 432}
427 433
428uint32_t omap_bo_size(struct omap_bo *bo) 434drm_public uint32_t omap_bo_size(struct omap_bo *bo)
429{ 435{
430 if (!bo->size) { 436 if (!bo->size) {
431 get_buffer_info(bo); 437 get_buffer_info(bo);
@@ -433,7 +439,7 @@ uint32_t omap_bo_size(struct omap_bo *bo)
433 return bo->size; 439 return bo->size;
434} 440}
435 441
436void * omap_bo_map(struct omap_bo *bo) 442drm_public void *omap_bo_map(struct omap_bo *bo)
437{ 443{
438 if (!bo->map) { 444 if (!bo->map) {
439 if (!bo->offset) { 445 if (!bo->offset) {
@@ -449,7 +455,7 @@ void * omap_bo_map(struct omap_bo *bo)
449 return bo->map; 455 return bo->map;
450} 456}
451 457
452int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op) 458drm_public int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op)
453{ 459{
454 struct drm_omap_gem_cpu_prep req = { 460 struct drm_omap_gem_cpu_prep req = {
455 .handle = bo->handle, 461 .handle = bo->handle,
@@ -459,7 +465,7 @@ int omap_bo_cpu_prep(struct omap_bo *bo, enum omap_gem_op op)
459 DRM_OMAP_GEM_CPU_PREP, &req, sizeof(req)); 465 DRM_OMAP_GEM_CPU_PREP, &req, sizeof(req));
460} 466}
461 467
462int omap_bo_cpu_fini(struct omap_bo *bo, enum omap_gem_op op) 468drm_public int omap_bo_cpu_fini(struct omap_bo *bo, enum omap_gem_op op)
463{ 469{
464 struct drm_omap_gem_cpu_fini req = { 470 struct drm_omap_gem_cpu_fini req = {
465 .handle = bo->handle, 471 .handle = bo->handle,