summaryrefslogtreecommitdiff
path: root/driver/xf86-video-ati/src/radeon_bo_helper.h
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-01-13 07:16:49 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-01-13 07:16:49 +0000
commit103115c941c611d5d6762981bfad91070ddcbddb (patch)
tree5bf35b01285357243ff10e623d5d1b4ba77a7385 /driver/xf86-video-ati/src/radeon_bo_helper.h
parent954e7a463dad8f37e1dbfb8522ccb554d2ccfaea (diff)
update to xf86-video-ati 18.1.0
tested by brynet@ matthieu@ and myself on a wide range of radeons
Diffstat (limited to 'driver/xf86-video-ati/src/radeon_bo_helper.h')
-rw-r--r--driver/xf86-video-ati/src/radeon_bo_helper.h55
1 files changed, 54 insertions, 1 deletions
diff --git a/driver/xf86-video-ati/src/radeon_bo_helper.h b/driver/xf86-video-ati/src/radeon_bo_helper.h
index e1856adb1..cc3d1d3bd 100644
--- a/driver/xf86-video-ati/src/radeon_bo_helper.h
+++ b/driver/xf86-video-ati/src/radeon_bo_helper.h
@@ -23,12 +23,32 @@
#ifndef RADEON_BO_HELPER_H
#define RADEON_BO_HELPER_H 1
-extern struct radeon_bo*
+#ifdef USE_GLAMOR
+#include <gbm.h>
+#endif
+
+#define RADEON_BO_FLAGS_GBM 0x1
+
+struct radeon_buffer {
+ union {
+#ifdef USE_GLAMOR
+ struct gbm_bo *gbm;
+#endif
+ struct radeon_bo *radeon;
+ } bo;
+ uint32_t ref_count;
+ uint32_t flags;
+};
+
+extern struct radeon_buffer *
radeon_alloc_pixmap_bo(ScrnInfoPtr pScrn, int width, int height, int depth,
int usage_hint, int bitsPerPixel, int *new_pitch,
struct radeon_surface *new_surface, uint32_t *new_tiling);
extern void
+radeon_finish(ScrnInfoPtr scrn, struct radeon_buffer *bo);
+
+extern void
radeon_pixmap_clear(PixmapPtr pixmap);
extern uint32_t
@@ -57,4 +77,37 @@ static inline PixmapPtr get_drawable_pixmap(DrawablePtr drawable)
return drawable->pScreen->GetWindowPixmap((WindowPtr)drawable);
}
+static inline void
+radeon_buffer_ref(struct radeon_buffer *buffer)
+{
+ buffer->ref_count++;
+}
+
+static inline void
+radeon_buffer_unref(struct radeon_buffer **buffer)
+{
+ struct radeon_buffer *buf = *buffer;
+
+ if (!buf)
+ return;
+
+ if (buf->ref_count > 1) {
+ buf->ref_count--;
+ return;
+ }
+
+#ifdef USE_GLAMOR
+ if (buf->flags & RADEON_BO_FLAGS_GBM) {
+ gbm_bo_destroy(buf->bo.gbm);
+ } else
+#endif
+ {
+ radeon_bo_unmap(buf->bo.radeon);
+ radeon_bo_unref(buf->bo.radeon);
+ }
+
+ free(buf);
+ *buffer = NULL;
+}
+
#endif /* RADEON_BO_HELPER_H */