Lines Matching +full:vga +full:- +full:format

1 // SPDX-License-Identifier: GPL-2.0-only
70 OFDRM_MODEL_QEMU, /* QEMU VGA */
81 return -EINVAL; in display_get_validated_int()
90 return -EINVAL; in display_get_validated_int0()
99 u32 format; in display_get_validated_format() local
103 format = drm_mode_legacy_fb_format(8, 8); in display_get_validated_format()
107 format = drm_mode_legacy_fb_format(16, depth); in display_get_validated_format()
110 format = drm_mode_legacy_fb_format(32, 24); in display_get_validated_format()
114 return ERR_PTR(-EINVAL); in display_get_validated_format()
118 * DRM formats assume little-endian byte order. Update the format in display_get_validated_format()
119 * if the scanout buffer uses big-endian ordering. in display_get_validated_format()
122 switch (format) { in display_get_validated_format()
124 format = DRM_FORMAT_BGRX8888; in display_get_validated_format()
127 format = DRM_FORMAT_BGRA8888; in display_get_validated_format()
130 format = DRM_FORMAT_RGB565 | DRM_FORMAT_BIG_ENDIAN; in display_get_validated_format()
133 format = DRM_FORMAT_XRGB1555 | DRM_FORMAT_BIG_ENDIAN; in display_get_validated_format()
140 info = drm_format_info(format); in display_get_validated_format()
142 drm_err(dev, "cannot find framebuffer format for depth %u\n", depth); in display_get_validated_format()
143 return ERR_PTR(-EINVAL); in display_get_validated_format()
164 big_endian = !of_property_read_bool(of_node, "little-endian"); in display_get_big_endian_of()
166 big_endian = of_property_read_bool(of_node, "big-endian"); in display_get_big_endian_of()
255 } else if (of_node_name_prefix(of_node, "vga,Display-")) { in display_get_model_of()
261 vendor_p = of_get_property(of_parent, "vendor-id", NULL); in display_get_model_of()
262 device_p = of_get_property(of_parent, "device-id", NULL); in display_get_model_of()
271 } else if (of_device_is_compatible(of_node, "qemu,std-vga")) { in display_get_model_of()
298 /* firmware-buffer settings */
301 const struct drm_format_info *format; member
331 vendor_p = of_get_property(of_node, "vendor-id", NULL); in display_get_pci_dev_of()
333 return ERR_PTR(-ENODEV); in display_get_pci_dev_of()
336 device_p = of_get_property(of_node, "device-id", NULL); in display_get_pci_dev_of()
338 return ERR_PTR(-ENODEV); in display_get_pci_dev_of()
343 return ERR_PTR(-ENODEV); in display_get_pci_dev_of()
357 struct drm_device *dev = &odev->dev; in ofdrm_device_init_pci()
358 struct platform_device *pdev = to_platform_device(dev->dev); in ofdrm_device_init_pci()
359 struct device_node *of_node = pdev->dev.of_node; in ofdrm_device_init_pci()
366 * resource conflicts. PCI-device management has to be tied to in ofdrm_device_init_pci()
377 dev_name(&pcidev->dev), ret); in ofdrm_device_init_pci()
380 ret = devm_add_action_or_reset(&pdev->dev, ofdrm_pci_release, pcidev); in ofdrm_device_init_pci()
400 struct platform_device *pdev = to_platform_device(odev->dev.dev); in ofdrm_find_fb_resource()
404 for (i = 0; pdev->num_resources; ++i) { in ofdrm_find_fb_resource()
410 if (fb_res->start && resource_contains(res, fb_res)) in ofdrm_find_fb_resource()
426 struct drm_device *dev = &odev->dev; in get_cmap_address_of()
436 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
439 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
442 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
446 return IOMEM_ERR_PTR(-ENODEV); in get_cmap_address_of()
448 mem = devm_ioremap(dev->dev, address + offset, size); in get_cmap_address_of()
450 return IOMEM_ERR_PTR(-ENOMEM); in get_cmap_address_of()
459 struct drm_device *dev = &odev->dev; in ofdrm_mach64_cmap_ioremap()
466 cmap_base = devm_ioremap(dev->dev, address, 0x1000); in ofdrm_mach64_cmap_ioremap()
468 return IOMEM_ERR_PTR(-ENOMEM); in ofdrm_mach64_cmap_ioremap()
476 void __iomem *addr = odev->cmap_base + 0xcc0; in ofdrm_mach64_cmap_write()
477 void __iomem *data = odev->cmap_base + 0xcc0 + 1; in ofdrm_mach64_cmap_write()
495 void __iomem *addr = odev->cmap_base + 0xb0; in ofdrm_rage128_cmap_write()
496 void __iomem *data = odev->cmap_base + 0xb4; in ofdrm_rage128_cmap_write()
513 void __iomem *dac_ctl = odev->cmap_base + 0x58; in ofdrm_rage_m3a_cmap_write()
514 void __iomem *addr = odev->cmap_base + 0xb0; in ofdrm_rage_m3a_cmap_write()
515 void __iomem *data = odev->cmap_base + 0xb4; in ofdrm_rage_m3a_cmap_write()
539 void __iomem *dac_ctl = odev->cmap_base + 0x58; in ofdrm_rage_m3b_cmap_write()
540 void __iomem *addr = odev->cmap_base + 0xb0; in ofdrm_rage_m3b_cmap_write()
541 void __iomem *data = odev->cmap_base + 0xb4; in ofdrm_rage_m3b_cmap_write()
572 void __iomem *data = ((unsigned int __iomem *)odev->cmap_base) + index; in ofdrm_gxt2000_cmap_write()
595 void __iomem *lutsel = odev->cmap_base + AVIVO_DC_LUT_RW_SELECT; in ofdrm_avivo_cmap_write()
596 void __iomem *addr = odev->cmap_base + AVIVO_DC_LUT_RW_INDEX; in ofdrm_avivo_cmap_write()
597 void __iomem *data = odev->cmap_base + AVIVO_DC_LUT_30_COLOR; in ofdrm_avivo_cmap_write()
621 struct drm_device *dev = &odev->dev; in ofdrm_qemu_cmap_ioremap()
627 return IOMEM_ERR_PTR(-ENODEV); in ofdrm_qemu_cmap_ioremap()
629 cmap_base = devm_ioremap(dev->dev, address + 0x3c8, 2); in ofdrm_qemu_cmap_ioremap()
631 return IOMEM_ERR_PTR(-ENOMEM); in ofdrm_qemu_cmap_ioremap()
639 void __iomem *addr = odev->cmap_base; in ofdrm_qemu_cmap_write()
640 void __iomem *data = odev->cmap_base + 1; in ofdrm_qemu_cmap_write()
649 const struct drm_format_info *format) in ofdrm_device_set_gamma_linear() argument
651 struct drm_device *dev = &odev->dev; in ofdrm_device_set_gamma_linear()
654 switch (format->format) { in ofdrm_device_set_gamma_linear()
663 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma_linear()
671 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma_linear()
677 odev->funcs->cmap_write(odev, i, i, i, i); in ofdrm_device_set_gamma_linear()
680 drm_warn_once(dev, "Unsupported format %p4cc for gamma correction\n", in ofdrm_device_set_gamma_linear()
681 &format->format); in ofdrm_device_set_gamma_linear()
687 const struct drm_format_info *format, in ofdrm_device_set_gamma() argument
690 struct drm_device *dev = &odev->dev; in ofdrm_device_set_gamma()
693 switch (format->format) { in ofdrm_device_set_gamma()
702 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma()
710 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma()
720 odev->funcs->cmap_write(odev, i, r, g, b); in ofdrm_device_set_gamma()
724 drm_warn_once(dev, "Unsupported format %p4cc for gamma correction\n", in ofdrm_device_set_gamma()
725 &format->format); in ofdrm_device_set_gamma()
737 /* Primary-plane format; required for color mgmt. */
738 const struct drm_format_info *format; member
748 __drm_atomic_helper_crtc_destroy_state(&ofdrm_crtc_state->base); in ofdrm_crtc_state_destroy()
760 struct drm_device *dev = plane->dev; in ofdrm_primary_plane_helper_atomic_check()
765 struct drm_framebuffer *new_fb = new_plane_state->fb; in ofdrm_primary_plane_helper_atomic_check()
766 struct drm_crtc *new_crtc = new_plane_state->crtc; in ofdrm_primary_plane_helper_atomic_check()
772 new_crtc_state = drm_atomic_get_new_crtc_state(new_state, new_plane_state->crtc); in ofdrm_primary_plane_helper_atomic_check()
780 else if (!new_plane_state->visible) in ofdrm_primary_plane_helper_atomic_check()
783 if (new_fb->format != odev->format) { in ofdrm_primary_plane_helper_atomic_check()
786 /* format conversion necessary; reserve buffer */ in ofdrm_primary_plane_helper_atomic_check()
787 buf = drm_format_conv_state_reserve(&new_shadow_plane_state->fmtcnv_state, in ofdrm_primary_plane_helper_atomic_check()
788 odev->pitch, GFP_KERNEL); in ofdrm_primary_plane_helper_atomic_check()
790 return -ENOMEM; in ofdrm_primary_plane_helper_atomic_check()
793 new_crtc_state = drm_atomic_get_new_crtc_state(new_state, new_plane_state->crtc); in ofdrm_primary_plane_helper_atomic_check()
796 new_ofdrm_crtc_state->format = new_fb->format; in ofdrm_primary_plane_helper_atomic_check()
804 struct drm_device *dev = plane->dev; in ofdrm_primary_plane_helper_atomic_update()
809 struct drm_framebuffer *fb = plane_state->fb; in ofdrm_primary_plane_helper_atomic_update()
810 unsigned int dst_pitch = odev->pitch; in ofdrm_primary_plane_helper_atomic_update()
811 const struct drm_format_info *dst_format = odev->format; in ofdrm_primary_plane_helper_atomic_update()
825 struct iosys_map dst = odev->screen_base; in ofdrm_primary_plane_helper_atomic_update()
826 struct drm_rect dst_clip = plane_state->dst; in ofdrm_primary_plane_helper_atomic_update()
832 drm_fb_blit(&dst, &dst_pitch, dst_format->format, shadow_plane_state->data, fb, in ofdrm_primary_plane_helper_atomic_update()
833 &damage, &shadow_plane_state->fmtcnv_state); in ofdrm_primary_plane_helper_atomic_update()
844 struct drm_device *dev = plane->dev; in ofdrm_primary_plane_helper_atomic_disable()
846 struct iosys_map dst = odev->screen_base; in ofdrm_primary_plane_helper_atomic_disable()
849 unsigned int dst_pitch = odev->pitch; in ofdrm_primary_plane_helper_atomic_disable()
850 const struct drm_format_info *dst_format = odev->format; in ofdrm_primary_plane_helper_atomic_disable()
856 plane_state->src_x >> 16, plane_state->src_y >> 16, in ofdrm_primary_plane_helper_atomic_disable()
857 plane_state->src_w >> 16, plane_state->src_h >> 16); in ofdrm_primary_plane_helper_atomic_disable()
868 memset_io(dst_vmap, 0, linepixels * dst_format->cpp[0]); in ofdrm_primary_plane_helper_atomic_disable()
892 struct ofdrm_device *odev = ofdrm_device_of_dev(crtc->dev); in ofdrm_crtc_helper_mode_valid()
894 return drm_crtc_helper_mode_valid_fixed(crtc, mode, &odev->mode); in ofdrm_crtc_helper_mode_valid()
902 struct drm_device *dev = crtc->dev; in ofdrm_crtc_helper_atomic_check()
906 if (!new_crtc_state->enable) in ofdrm_crtc_helper_atomic_check()
913 if (new_crtc_state->color_mgmt_changed) { in ofdrm_crtc_helper_atomic_check()
914 struct drm_property_blob *gamma_lut = new_crtc_state->gamma_lut; in ofdrm_crtc_helper_atomic_check()
916 if (gamma_lut && (gamma_lut->length != gamma_lut_length)) { in ofdrm_crtc_helper_atomic_check()
917 drm_dbg(dev, "Incorrect gamma_lut length %zu\n", gamma_lut->length); in ofdrm_crtc_helper_atomic_check()
918 return -EINVAL; in ofdrm_crtc_helper_atomic_check()
927 struct ofdrm_device *odev = ofdrm_device_of_dev(crtc->dev); in ofdrm_crtc_helper_atomic_flush()
931 if (crtc_state->enable && crtc_state->color_mgmt_changed) { in ofdrm_crtc_helper_atomic_flush()
932 const struct drm_format_info *format = ofdrm_crtc_state->format; in ofdrm_crtc_helper_atomic_flush() local
934 if (crtc_state->gamma_lut) in ofdrm_crtc_helper_atomic_flush()
935 ofdrm_device_set_gamma(odev, format, crtc_state->gamma_lut->data); in ofdrm_crtc_helper_atomic_flush()
937 ofdrm_device_set_gamma_linear(odev, format); in ofdrm_crtc_helper_atomic_flush()
957 if (crtc->state) in ofdrm_crtc_reset()
958 ofdrm_crtc_state_destroy(to_ofdrm_crtc_state(crtc->state)); in ofdrm_crtc_reset()
961 __drm_atomic_helper_crtc_reset(crtc, &ofdrm_crtc_state->base); in ofdrm_crtc_reset()
968 struct drm_device *dev = crtc->dev; in ofdrm_crtc_atomic_duplicate_state()
969 struct drm_crtc_state *crtc_state = crtc->state; in ofdrm_crtc_atomic_duplicate_state()
982 __drm_atomic_helper_crtc_duplicate_state(crtc, &new_ofdrm_crtc_state->base); in ofdrm_crtc_atomic_duplicate_state()
983 new_ofdrm_crtc_state->format = ofdrm_crtc_state->format; in ofdrm_crtc_atomic_duplicate_state()
985 return &new_ofdrm_crtc_state->base; in ofdrm_crtc_atomic_duplicate_state()
1005 struct ofdrm_device *odev = ofdrm_device_of_dev(connector->dev); in ofdrm_connector_helper_get_modes()
1007 return drm_connector_helper_get_modes_fixed(connector, &odev->mode); in ofdrm_connector_helper_get_modes()
1093 struct device_node *of_node = pdev->dev.of_node; in ofdrm_device_create()
1099 const struct drm_format_info *format; in ofdrm_device_create() local
1112 odev = devm_drm_dev_alloc(&pdev->dev, drv, struct ofdrm_device, dev); in ofdrm_device_create()
1115 dev = &odev->dev; in ofdrm_device_create()
1123 * OF display-node settings in ofdrm_device_create()
1131 odev->funcs = &ofdrm_unknown_device_funcs; in ofdrm_device_create()
1134 odev->funcs = &ofdrm_mach64_device_funcs; in ofdrm_device_create()
1137 odev->funcs = &ofdrm_rage128_device_funcs; in ofdrm_device_create()
1140 odev->funcs = &ofdrm_rage_m3a_device_funcs; in ofdrm_device_create()
1143 odev->funcs = &ofdrm_rage_m3b_device_funcs; in ofdrm_device_create()
1146 odev->funcs = &ofdrm_radeon_device_funcs; in ofdrm_device_create()
1149 odev->funcs = &ofdrm_gxt2000_device_funcs; in ofdrm_device_create()
1152 odev->funcs = &ofdrm_avivo_device_funcs; in ofdrm_device_create()
1155 odev->funcs = &ofdrm_qemu_device_funcs; in ofdrm_device_create()
1174 format = display_get_validated_format(dev, depth, big_endian); in ofdrm_device_create()
1175 if (IS_ERR(format)) in ofdrm_device_create()
1176 return ERR_CAST(format); in ofdrm_device_create()
1178 linebytes = drm_format_info_min_pitch(format, 0, width); in ofdrm_device_create()
1180 return ERR_PTR(-EINVAL); in ofdrm_device_create()
1201 return ERR_PTR(-EINVAL); in ofdrm_device_create()
1205 fb_base = res->start; in ofdrm_device_create()
1211 return ERR_PTR(-EINVAL); in ofdrm_device_create()
1212 fb_base = res->start; in ofdrm_device_create()
1220 fb_pgsize = fb_base - fb_pgbase + round_up(fb_size, PAGE_SIZE); in ofdrm_device_create()
1228 mem = devm_request_mem_region(&pdev->dev, fb_pgbase, fb_pgsize, drv->name); in ofdrm_device_create()
1231 return ERR_PTR(-ENOMEM); in ofdrm_device_create()
1234 screen_base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem)); in ofdrm_device_create()
1236 return ERR_PTR(-ENOMEM); in ofdrm_device_create()
1238 if (odev->funcs->cmap_ioremap) { in ofdrm_device_create()
1239 void __iomem *cmap_base = odev->funcs->cmap_ioremap(odev, of_node, fb_base); in ofdrm_device_create()
1245 odev->cmap_base = cmap_base; in ofdrm_device_create()
1253 iosys_map_set_vaddr_iomem(&odev->screen_base, screen_base); in ofdrm_device_create()
1254 odev->mode = ofdrm_mode(width, height); in ofdrm_device_create()
1255 odev->format = format; in ofdrm_device_create()
1256 odev->pitch = linebytes; in ofdrm_device_create()
1258 drm_dbg(dev, "display mode={" DRM_MODE_FMT "}\n", DRM_MODE_ARG(&odev->mode)); in ofdrm_device_create()
1259 drm_dbg(dev, "framebuffer format=%p4cc, size=%dx%d, linebytes=%d byte\n", in ofdrm_device_create()
1260 &format->format, width, height, linebytes); in ofdrm_device_create()
1263 * Mode-setting pipeline in ofdrm_device_create()
1273 dev->mode_config.min_width = width; in ofdrm_device_create()
1274 dev->mode_config.max_width = max_width; in ofdrm_device_create()
1275 dev->mode_config.min_height = height; in ofdrm_device_create()
1276 dev->mode_config.max_height = max_height; in ofdrm_device_create()
1277 dev->mode_config.funcs = &ofdrm_mode_config_funcs; in ofdrm_device_create()
1278 dev->mode_config.preferred_depth = format->depth; in ofdrm_device_create()
1279 dev->mode_config.quirk_addfb_prefer_host_byte_order = true; in ofdrm_device_create()
1283 nformats = drm_fb_build_fourcc_list(dev, &format->format, 1, in ofdrm_device_create()
1284 odev->formats, ARRAY_SIZE(odev->formats)); in ofdrm_device_create()
1286 primary_plane = &odev->primary_plane; in ofdrm_device_create()
1288 odev->formats, nformats, in ofdrm_device_create()
1298 crtc = &odev->crtc; in ofdrm_device_create()
1305 if (odev->cmap_base) { in ofdrm_device_create()
1312 encoder = &odev->encoder; in ofdrm_device_create()
1316 encoder->possible_crtcs = drm_crtc_mask(crtc); in ofdrm_device_create()
1320 connector = &odev->connector; in ofdrm_device_create()
1370 dev = &odev->dev; in ofdrm_probe()
1376 color_mode = drm_format_info_bpp(odev->format, 0); in ofdrm_probe()
1378 color_mode = odev->format->depth; // can be 15 or 16 in ofdrm_probe()
1400 .name = "of-display",