Lines Matching +full:frame +full:- +full:buffer
1 /*-
103 mask = efifb->fb_mask_red | efifb->fb_mask_green |
104 efifb->fb_mask_blue | efifb->fb_mask_reserved;
122 efifb->fb_mask_red = 0x000000ff;
123 efifb->fb_mask_green = 0x0000ff00;
124 efifb->fb_mask_blue = 0x00ff0000;
125 efifb->fb_mask_reserved = 0xff000000;
128 efifb->fb_mask_red = 0x00ff0000;
129 efifb->fb_mask_green = 0x0000ff00;
130 efifb->fb_mask_blue = 0x000000ff;
131 efifb->fb_mask_reserved = 0xff000000;
134 efifb->fb_mask_red = pixinfo->RedMask;
135 efifb->fb_mask_green = pixinfo->GreenMask;
136 efifb->fb_mask_blue = pixinfo->BlueMask;
137 efifb->fb_mask_reserved = pixinfo->ReservedMask;
156 efifb->fb_addr =
158 mode->FrameBufferBase & 0xffffffff;
160 mode->FrameBufferBase;
162 efifb->fb_size = mode->FrameBufferSize;
163 efifb->fb_height = info->VerticalResolution;
164 efifb->fb_width = info->HorizontalResolution;
165 efifb->fb_stride = info->PixelsPerScanLine;
166 result = efifb_mask_from_pixfmt(efifb, info->PixelFormat,
167 &info->PixelInformation);
182 status = uga->Blt(uga, &pix0, EfiUgaVideoToBltBuffer,
185 printf("UGA BLT operation failed (video->buffer)");
186 return (-1);
196 return (-1);
204 status = pciio->Mem.Read(pciio, EfiPciIoWidthUint32,
208 printf("Error reading frame buffer (before)");
211 status = uga->Blt(uga, &pix1, EfiUgaBltBufferToVideo,
217 status = pciio->Mem.Read(pciio, EfiPciIoWidthUint32,
221 printf("Error reading frame buffer (after)");
224 status = uga->Blt(uga, &pix0, EfiUgaBltBufferToVideo,
237 size -= count;
239 printf("No change detected in frame buffer");
242 printf(" -- error %lu\n", EFI_ERROR_CODE(status));
244 return (-1);
257 status = BS->LocateHandle(ByProtocol, &uga_guid, NULL, &bufsz, NULL);
261 status = BS->LocateHandle(ByProtocol, &uga_guid, NULL, &bufsz, buf);
294 /* Attempt to get the frame buffer address (imprecise). */
298 status = pciio->GetBarAttributes(pciio, bar, NULL,
304 /* 32-bit address space descriptor (MEMIO) */
308 /* 64-bit address space descriptor (MEMIO) */
315 BS->FreePool(resattr);
319 /* We assume the largest BAR is the frame buffer. */
339 status = uga->GetMode(uga, &horiz, &vert, &depth, &refresh);
342 efifb->fb_height = vert;
343 efifb->fb_width = horiz;
345 if (efifb->fb_height == 0 || efifb->fb_width == 0)
355 /* Try to find the frame buffer. */
356 status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr,
357 &efifb->fb_size);
359 efifb->fb_addr = 0;
360 efifb->fb_size = 0;
364 * There's no reliable way to detect the frame buffer or the
365 * offset within the frame buffer of the visible region, nor
370 offset = -1;
397 if (offset >= 0 && efifb->fb_width == horiz &&
398 efifb->fb_height == vert && efifb->fb_addr == fbaddr) {
399 efifb->fb_addr += offset;
400 efifb->fb_size -= offset;
401 efifb->fb_stride = stride;
413 efifb->fb_stride = efifb->fb_width;
415 np = efifb->fb_stride & (efifb->fb_stride - 1);
417 efifb->fb_stride |= (np - 1);
418 efifb->fb_stride++;
424 if (efifb->fb_addr == 0) {
431 * The visible part of the frame buffer may not start at
433 * always be able to read from the frame buffer, which
436 * pixel change in the frame buffer, which would have it
438 * 1/256th of the frame buffer. This number is mostly
440 * where we can't read from the frame buffer the offset
445 * frame buffer.
447 offset = efifb_uga_find_pixel(uga, 0, pciio, efifb->fb_addr,
448 efifb->fb_size >> 8);
449 if (offset == -1) {
450 printf("Unable to reliably detect frame buffer.\n");
452 efifb->fb_addr += offset;
453 efifb->fb_size -= offset;
457 efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4;
458 efifb->fb_addr = strtoul(ev, &p, 0);
465 if (pciio != NULL && offset != -1) {
468 efifb->fb_addr, horiz * 8);
469 if (offset != -1)
470 efifb->fb_stride = offset >> 2;
475 efifb->fb_stride = strtoul(ev, &p, 0);
482 * frame buffer.
484 efifb->fb_size = efifb->fb_height * efifb->fb_stride * 4;
489 * Fetch EDID info. Caller must free the buffer.
502 status = BS->OpenProtocol(h, guid, (void **)&edid, IH, NULL,
505 edid->SizeOfEdid == 0) {
507 status = BS->OpenProtocol(h, guid, (void **)&edid, IH, NULL,
510 edid->SizeOfEdid == 0)
514 size = MAX(sizeof(*edid_infop), edid->SizeOfEdid);
520 memcpy(edid_infop, edid->Edid, edid->SizeOfEdid);
526 if (edid_infop->header.version != 1)
558 status = BS->LocateHandle(ByProtocol, &gop_guid, NULL, &hsize, hlist);
574 gfx_state->tg_fb_type = FB_TEXT;
578 status = BS->LocateHandle(ByProtocol, &gop_guid, NULL, &hsize, hlist);
583 status = BS->LocateHandle(ByProtocol, &gop_guid, NULL, &hsize,
605 if (tgop->Mode->Info->PixelFormat == PixelBltOnly ||
606 tgop->Mode->Info->PixelFormat >= PixelFormatMax)
623 gfx_state->tg_fb_type = FB_GOP;
624 gfx_state->tg_private = gop;
628 status = BS->LocateProtocol(&uga_guid, NULL, (VOID **)&uga);
630 gfx_state->tg_fb_type = FB_UGA;
631 gfx_state->tg_private = uga;
637 switch (gfx_state->tg_fb_type) {
639 rv = efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info);
650 gfx_state->tg_fb.fb_addr = efifb.fb_addr;
651 gfx_state->tg_fb.fb_size = efifb.fb_size;
652 gfx_state->tg_fb.fb_height = efifb.fb_height;
653 gfx_state->tg_fb.fb_width = efifb.fb_width;
654 gfx_state->tg_fb.fb_stride = efifb.fb_stride;
655 gfx_state->tg_fb.fb_mask_red = efifb.fb_mask_red;
656 gfx_state->tg_fb.fb_mask_green = efifb.fb_mask_green;
657 gfx_state->tg_fb.fb_mask_blue = efifb.fb_mask_blue;
658 gfx_state->tg_fb.fb_mask_reserved = efifb.fb_mask_reserved;
660 gfx_state->tg_fb.fb_bpp = fls(efifb.fb_mask_red | efifb.fb_mask_green |
663 if (gfx_state->tg_shadow_fb != NULL)
664 BS->FreePages((uintptr_t)gfx_state->tg_shadow_fb,
665 gfx_state->tg_shadow_sz);
666 gfx_state->tg_shadow_sz =
669 status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
670 gfx_state->tg_shadow_sz, &ptr);
671 gfx_state->tg_shadow_fb = status == EFI_SUCCESS ?
685 printf("%ux%ux%u, stride=%u", efifb->fb_width, efifb->fb_height,
686 depth, efifb->fb_stride);
688 printf("\n frame buffer: address=%jx, size=%jx",
689 (uintmax_t)efifb->fb_addr, (uintmax_t)efifb->fb_size);
691 efifb->fb_mask_red, efifb->fb_mask_green,
692 efifb->fb_mask_blue);
700 if (strcasecmp(res->name, cmp) == 0)
702 if (res->alias != NULL && strcasecmp(res->alias, cmp) == 0)
725 *width = res->width;
726 *height = res->height;
759 for (mode = 0; mode < gop->Mode->MaxMode; mode++) {
760 status = gop->QueryMode(gop, mode, &infosz, &info);
763 efifb_from_gop(&efifb, gop->Mode, info);
764 width = info->HorizontalResolution;
765 height = info->VerticalResolution;
777 status = gop->SetMode(gop, best_mode);
796 conout = ST->ConOut;
798 for (i = 0; i < conout->Mode->MaxMode; i++) {
799 status = conout->QueryMode(conout, i, &cols, &rows);
808 conout->SetMode(conout, best_mode);
820 COMMAND_SET(efi_autoresize, "efi-autoresizecons", "EFI Auto-resize Console", command_autoresize);
828 /* If it's set and non-zero, we'll select a console mode instead */
879 status = gop->SetMode(gop, mode);
895 efifb_from_gop(&efifb, gop->Mode, gop->Mode->Info);
901 printf(" %dx%d", rp->width, rp->height);
909 print_efifb(gop->Mode->Mode, &efifb, 1);
919 for (mode = 0; mode < gop->Mode->MaxMode; mode++) {
920 status = gop->QueryMode(gop, mode, &infosz, &info);
923 efifb_from_gop(&efifb, gop->Mode, info);
960 print_efifb(-1, &efifb, 1);