16a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul/*
26a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * Copyright (C) 2015 The Android Open Source Project
36a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul *
46a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * Licensed under the Apache License, Version 2.0 (the "License");
56a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * you may not use this file except in compliance with the License.
66a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * You may obtain a copy of the License at
76a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul *
86a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul *      http://www.apache.org/licenses/LICENSE-2.0
96a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul *
106a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * Unless required by applicable law or agreed to in writing, software
116a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * distributed under the License is distributed on an "AS IS" BASIS,
126a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * See the License for the specific language governing permissions and
146a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul * limitations under the License.
156a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul */
166a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
176a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul#ifndef ANDROID_DRM_CRTC_H_
186a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul#define ANDROID_DRM_CRTC_H_
196a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
206a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul#include "drmmode.h"
21877be974a2d4fc518700be8ffe803a50cb716eadSean Paul#include "drmproperty.h"
226a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
236a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul#include <stdint.h>
246a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul#include <xf86drmMode.h>
256a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
266a55e9fb8e16c63c2e42bde31814f963205f722dSean Paulnamespace android {
276a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
28877be974a2d4fc518700be8ffe803a50cb716eadSean Paulclass DrmResources;
29877be974a2d4fc518700be8ffe803a50cb716eadSean Paul
306a55e9fb8e16c63c2e42bde31814f963205f722dSean Paulclass DrmCrtc {
316a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul public:
32877be974a2d4fc518700be8ffe803a50cb716eadSean Paul  DrmCrtc(DrmResources *drm, drmModeCrtcPtr c, unsigned pipe);
33ff30b52303cdbeb9cbfb054e2a12da1135ea49c9Zach Reizner  DrmCrtc(const DrmCrtc &) = delete;
34ff30b52303cdbeb9cbfb054e2a12da1135ea49c9Zach Reizner  DrmCrtc &operator=(const DrmCrtc &) = delete;
356a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
36877be974a2d4fc518700be8ffe803a50cb716eadSean Paul  int Init();
37877be974a2d4fc518700be8ffe803a50cb716eadSean Paul
386a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  uint32_t id() const;
396a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  unsigned pipe() const;
406a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
416a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  int display() const;
426a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  void set_display(int display);
436a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
446a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  bool can_bind(int display) const;
456a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
46877be974a2d4fc518700be8ffe803a50cb716eadSean Paul  const DrmProperty &active_property() const;
47877be974a2d4fc518700be8ffe803a50cb716eadSean Paul  const DrmProperty &mode_property() const;
48877be974a2d4fc518700be8ffe803a50cb716eadSean Paul
496a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul private:
50877be974a2d4fc518700be8ffe803a50cb716eadSean Paul  DrmResources *drm_;
51877be974a2d4fc518700be8ffe803a50cb716eadSean Paul
526a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  uint32_t id_;
536a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  unsigned pipe_;
546a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  int display_;
556a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
566a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  uint32_t x_;
576a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  uint32_t y_;
586a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  uint32_t width_;
596a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  uint32_t height_;
606a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
616a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul  DrmMode mode_;
625f9339cc2d9206bdaea047fef4e1d06d2911c81bSean Paul  bool mode_valid_;
63877be974a2d4fc518700be8ffe803a50cb716eadSean Paul
64877be974a2d4fc518700be8ffe803a50cb716eadSean Paul  DrmProperty active_property_;
65877be974a2d4fc518700be8ffe803a50cb716eadSean Paul  DrmProperty mode_property_;
666a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul};
676a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul}
686a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul
696a55e9fb8e16c63c2e42bde31814f963205f722dSean Paul#endif  // ANDROID_DRM_CRTC_H_
70