jobcontrol.hh revision 10915
1/* 2 * Copyright (c) 2014-2015 ARM Limited 3 * All rights reserved 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 * Authors: Andreas Sandberg 18 */ 19 20#ifndef _LIBNOMALIMODEL_JOBCONTROL_HH 21#define _LIBNOMALIMODEL_JOBCONTROL_HH 22 23#include <vector> 24 25#include "gpublock.hh" 26#include "jobslot.hh" 27#include "types.hh" 28 29namespace NoMali { 30 31class GPU; 32 33/** 34 * Minimal GPU job control implementation. 35 * 36 * This class implements the job control block of a Midgard style 37 * GPU. The job control block mainly coordinates interrupt delivery 38 * and register mappings for the different job slots within the 39 * block. The actual job slots are implemented by the JobSlot class. 40 * 41 * @see JobSlot 42 */ 43class JobControl 44 : public GPUBlockInt 45{ 46 public: 47 JobControl(GPU &_gpu); 48 virtual ~JobControl(); 49 50 uint32_t readReg(RegAddr idx) override; 51 void writeReg(RegAddr idx, uint32_t value) override; 52 53 uint32_t readRegRaw(RegAddr idx) override; 54 void writeRegRaw(RegAddr idx, uint32_t value) override; 55 56 /** 57 * Signal job done. 58 * 59 * Calling this method raises the job done interrupt for a 60 * specific job slot. This is typically called from the job slot 61 * running the job chain. 62 * 63 * @param slot Job slot number. 64 */ 65 void jobDone(uint8_t slot); 66 /** 67 * Signal job failed. 68 * 69 * Calling this method raises the job failed interrupt for a 70 * specific job slot. This is typically called from the job slot 71 * running the job chain. 72 * 73 * @param slot Job slot number. 74 */ 75 void jobFailed(uint8_t slot); 76 77 protected: 78 /** 79 * Update the state of the job slot state snapshot register. 80 * 81 * @param jobs Bit mask representing which job slots to update. 82 */ 83 void updateJsState(uint16_t jobs); 84 85 void onInterrupt(int set) override; 86 87 /** Job slots belonging to this job control block */ 88 std::vector<JobSlot> slots; 89}; 90 91} 92 93#endif // _LIBNOMALIMODEL_JOBCONTROL_HH 94