def apply_mode(): global fb mode = pykms.Videomode() mode.clock = pclk_khz_widget.get_val() mode.hdisplay = hdisp2_widget.get_val() mode.hsync_start = hss_widget.get_val() mode.hsync_end = hse_widget.get_val() mode.htotal = htot_widget.get_val() mode.vdisplay = vdisp2_widget.get_val() mode.vsync_start = vss_widget.get_val() mode.vsync_end = vse_widget.get_val() mode.vtotal = vtot_widget.get_val() if ilace_box.state: mode.flags |= DRM_MODE_FLAG_INTERLACE if dblclk_box.state: mode.flags |= DRM_MODE_FLAG_DBLCLK if hsync_pol.state == True: mode.flags |= DRM_MODE_FLAG_PHSYNC elif hsync_pol.state == False: mode.flags |= DRM_MODE_FLAG_NHSYNC if vsync_pol.state == True: mode.flags |= DRM_MODE_FLAG_PVSYNC elif vsync_pol.state == False: mode.flags |= DRM_MODE_FLAG_NVSYNC fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24") pykms.draw_test_pattern(fb) crtc.set_mode(conn, fb, mode)
def apply_mode(): global fb mode = pykms.Videomode() mode.clock = pclk_khz_widget.get_val() mode.hdisplay = hdisp2_widget.get_val() mode.hsync_start = hss_widget.get_val() mode.hsync_end = hse_widget.get_val() mode.htotal = htot_widget.get_val() mode.vdisplay = vdisp2_widget.get_val() mode.vsync_start = vss_widget.get_val() mode.vsync_end = vse_widget.get_val() mode.vtotal = vtot_widget.get_val() if ilace_box.state: mode.flags |= DRM_MODE_FLAG_INTERLACE if dblclk_box.state: mode.flags |= DRM_MODE_FLAG_DBLCLK if hsync_pol.state == True: mode.flags |= DRM_MODE_FLAG_PHSYNC elif hsync_pol.state == False: mode.flags |= DRM_MODE_FLAG_NHSYNC if vsync_pol.state == True: mode.flags |= DRM_MODE_FLAG_PVSYNC elif vsync_pol.state == False: mode.flags |= DRM_MODE_FLAG_NVSYNC fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); pykms.draw_test_pattern(fb); crtc.set_mode(conn, fb, mode)
import pykms import argparse parser = argparse.ArgumentParser() parser.add_argument("-c", "--connector", default="") parser.add_argument("-l", "--legacy", action="store_true", default=False) args = parser.parse_args() card = pykms.Card() res = pykms.ResourceManager(card) conn = res.reserve_connector(args.connector) crtc = res.reserve_crtc(conn) mode = conn.get_default_mode() fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); pykms.draw_test_pattern(fb); crtc.set_mode(conn, fb, mode) use_legacy = args.legacy if not use_legacy: prop = crtc.get_prop("GAMMA_LUT") if not prop: prop = crtc.get_prop("DEGAMMA_LUT") if not prop: print("No gamma property found") exit(-1) else:
#!/usr/bin/python3 import pykms from helpers import * card = pykms.Card() res = pykms.ResourceManager(card) conn = res.reserve_connector() crtc = res.reserve_crtc(conn) mode = conn.get_default_mode() fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "XR24"); pykms.draw_test_pattern(fb); crtc.set_mode(conn, fb, mode) print("OK")
conn = res.reserve_connector(args.connector) crtc = res.reserve_crtc(conn) if args.modename == None: mode = conn.get_default_mode() else: mode = conn.get_mode(args.modename) modeb = mode.to_blob(card) format = pykms.PixelFormat.ARGB8888 plane1 = res.reserve_generic_plane(crtc, format) plane2 = res.reserve_generic_plane(crtc, format) print("Got plane1 %d %d plane2 %d %d" % (plane1.idx, plane1.id, plane2.idx, plane2.id)) fb1 = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, format) pykms.draw_test_pattern(fb1) fb2 = pykms.DumbFramebuffer(card, mode.hdisplay >> 1, mode.vdisplay >> 1, format) pykms.draw_test_pattern(fb2) alpha = 0 card.disable_planes() req = pykms.AtomicReq(card) req.add(conn, "CRTC_ID", crtc.id) req.add(crtc, {"ACTIVE": 1, "MODE_ID": modeb.id}) req.add_plane(plane1, fb1, crtc) req.add_plane(plane2, fb2, crtc)
import pykms card = pykms.Card() res = pykms.ResourceManager(card) conn = res.reserve_connector("HDMI") crtc = res.reserve_crtc(conn) mode = conn.get_default_mode() modeb = mode.to_blob(card) plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.UYVY) #plane = res.reserve_generic_plane(crtc, pykms.PixelFormat.Undefined) print("Got plane %d %d" % (plane.idx, plane.id)) fb = pykms.DumbFramebuffer(card, mode.hdisplay, mode.vdisplay, "UYVY") pykms.draw_test_pattern(fb) req = pykms.AtomicReq(card) req.add(conn, "CRTC_ID", crtc.id) req.add(crtc, {"ACTIVE": 1, "MODE_ID": modeb.id}) input("Press enter to enable crtc idx %d at %s" % (crtc.idx, conn.fullname)) r = req.commit_sync(allow_modeset=True) input("Press enter to enable plane idx %d at %s" % (plane.idx, conn.fullname)) req = pykms.AtomicReq(card) req.add( plane, { "FB_ID": fb.id, "CRTC_ID": crtc.id,