1 /* 2 * Copyright 2012, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Alexander von Gluck, kallisti5@unixzen.com 7 */ 8 #ifndef _RADEON_HD_RINGQUEUE_H 9 #define _RADEON_HD_RINGQUEUE_H 10 11 12 #include "Accelerant.h" 13 14 #include <stdint.h> 15 16 17 #define RADEON_QUEUE_MAX 3 18 // Basic r100+ graphic data ring 19 #define RADEON_QUEUE_TYPE_GFX_INDEX 0 20 // Cayman+ have two compute command processor rings 21 #define CAYMAN_QUEUE_TYPE_CP1_INDEX 1 22 #define CAYMAN_QUEUE_TYPE_CP2_INDEX 2 23 24 25 int compute_order(unsigned long size); 26 27 28 // A basic ring buffer for passing render data into card. 29 // Data flows from the host to the GPU 30 class RingQueue { 31 public: 32 RingQueue(size_t bytes, uint32 queueType); 33 ~RingQueue(); 34 size_t Read(unsigned char* data, size_t bytes); 35 size_t Write(unsigned char* data, size_t bytes); 36 status_t Empty(); 37 38 size_t GetSize() {return fSize;}; 39 size_t GetWriteAvail() {return fWriteBytesAvail;} 40 size_t GetReadAvail() {return fSize - fWriteBytesAvail;} 41 intptr_t GetLocation() {return (intptr_t)fData;} 42 43 private: 44 uint32 fQueueType; 45 46 unsigned char* fData; 47 size_t fSize; 48 size_t fWriteBytesAvail; 49 int fReadPtr; 50 int fWritePtr; 51 52 uint32 fAlignMask; 53 }; 54 55 56 #endif /* _RADEON_HD_RINGQUEUE_H */ 57