Skip to content

Commit af6cad1

Browse files
authored
Merge pull request #99 from ardera/feature/legacy-modesetting
reimplement legacy modesetting
2 parents 449c73f + 20d60e7 commit af6cad1

File tree

5 files changed

+665
-92
lines changed

5 files changed

+665
-92
lines changed

include/compositor.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,17 @@ struct rendertarget {
221221
int height,
222222
int zpos
223223
);
224+
int (*present_legacy)(
225+
struct rendertarget *target,
226+
struct drmdev *drmdev,
227+
uint32_t drm_plane_id,
228+
int offset_x,
229+
int offset_y,
230+
int width,
231+
int height,
232+
int zpos,
233+
bool set_mode
234+
);
224235
};
225236

226237
struct flutterpi_backing_store {

include/modesetting.h

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct drmdev {
3838
int fd;
3939

4040
pthread_mutex_t mutex;
41+
bool supports_atomic_modesetting;
4142

4243
size_t n_connectors;
4344
struct drm_connector *connectors;
@@ -88,6 +89,11 @@ int drmdev_configure(
8889
const drmModeModeInfo *mode
8990
);
9091

92+
int drmdev_plane_get_type(
93+
struct drmdev *drmdev,
94+
uint32_t plane_id
95+
);
96+
9197
int drmdev_plane_supports_setting_rotation_value(
9298
struct drmdev *drmdev,
9399
uint32_t plane_id,
@@ -166,6 +172,61 @@ int drmdev_atomic_req_commit(
166172
void *userdata
167173
);
168174

175+
int drmdev_legacy_set_mode_and_fb(
176+
struct drmdev *drmdev,
177+
uint32_t fb_id
178+
);
179+
180+
/**
181+
* @brief Do a nonblocking, vblank-synced framebuffer swap.
182+
*/
183+
int drmdev_legacy_primary_plane_pageflip(
184+
struct drmdev *drmdev,
185+
uint32_t fb_id,
186+
void *userdata
187+
);
188+
189+
/**
190+
* @brief Do a blocking, vblank-synced framebuffer swap.
191+
* Using this in combination with @ref drmdev_legacy_primary_plane_pageflip
192+
* is not a good idea, since it will block until the primary plane pageflip is complete,
193+
* and then block even longer till the overlay plane pageflip completes the vblank after.
194+
*/
195+
int drmdev_legacy_overlay_plane_pageflip(
196+
struct drmdev *drmdev,
197+
uint32_t plane_id,
198+
uint32_t fb_id,
199+
int32_t crtc_x,
200+
int32_t crtc_y,
201+
int32_t crtc_w,
202+
int32_t crtc_h,
203+
uint32_t src_x,
204+
uint32_t src_y,
205+
uint32_t src_w,
206+
uint32_t src_h
207+
);
208+
209+
int drmdev_legacy_set_connector_property(
210+
struct drmdev *drmdev,
211+
const char *name,
212+
uint64_t value
213+
);
214+
215+
int drmdev_legacy_set_crtc_property(
216+
struct drmdev *drmdev,
217+
const char *name,
218+
uint64_t value
219+
);
220+
221+
int drmdev_legacy_set_plane_property(
222+
struct drmdev *drmdev,
223+
uint32_t plane_id,
224+
const char *name,
225+
uint64_t value
226+
);
227+
228+
float mode_get_vrefresh(const drmModeModeInfo *mode);
229+
169230
inline static struct drm_connector *__next_connector(const struct drmdev *drmdev, const struct drm_connector *connector) {
170231
bool found = connector == NULL;
171232
for (int i = 0; i < drmdev->n_connectors; i++) {

0 commit comments

Comments
 (0)