1 /* 2 * Copyright 2004-2008, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Jérôme Duval, korli@users.sourceforge.net. 7 * Michael Pfeiffer, laplace@users.sourceforge.net 8 */ 9 10 11 #include <scheduler.h> 12 13 14 static struct { 15 uint32 what; 16 int32 priority; 17 } sWhatPriorityArray[] = { 18 // highest priority first 19 {B_MIDI_PROCESSING, 0x78}, 20 {B_AUDIO_RECORDING | B_AUDIO_PLAYBACK, 0x73}, 21 {B_LIVE_AUDIO_MANIPULATION, 0x6e}, 22 {B_VIDEO_RECORDING, 0x19}, 23 {B_VIDEO_PLAYBACK, 0x14}, 24 {B_USER_INPUT_HANDLING, 0x0f}, 25 {B_LIVE_VIDEO_MANIPULATION, 0x0e}, 26 {B_LIVE_3D_RENDERING, 0x0c}, 27 {B_STATUS_RENDERING, 0xa}, 28 {B_OFFLINE_PROCESSING, 0x06}, 29 {B_NUMBER_CRUNCHING, 0x05}, 30 {(uint32)-1, -1} 31 }; 32 33 34 int32 35 suggest_thread_priority(uint32 what, int32 period, bigtime_t jitter, 36 bigtime_t length) 37 { 38 int i; 39 int32 priority = what == B_DEFAULT_MEDIA_PRIORITY ? 0x0a : 0; 40 // default priority 41 42 for (i = 0; sWhatPriorityArray[i].what != (uint32)-1; i ++) { 43 if ((what & sWhatPriorityArray[i].what) != 0) { 44 priority = sWhatPriorityArray[i].priority; 45 break; 46 } 47 } 48 49 return priority; 50 } 51 52 53 bigtime_t 54 estimate_max_scheduling_latency(thread_id thread) 55 { 56 if (thread == -1) 57 thread = find_thread(NULL); 58 59 return 0; 60 } 61 62