Lines Matching +full:0 +full:- +full:1
1 /* SPDX-License-Identifier: GPL-2.0 OR MIT */
4 * Copyright 2008-2015 VMware, Inc., Palo Alto, CA., USA
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
29 * svga3d_surfacedefs.h --
49 * enum svga3d_block_desc - describes generic properties about formats.
53 SVGA3DBLOCKDESC_NONE = 0,
56 SVGA3DBLOCKDESC_BLUE = 1 << 0,
57 SVGA3DBLOCKDESC_W = 1 << 0,
58 SVGA3DBLOCKDESC_BUMP_L = 1 << 0,
61 SVGA3DBLOCKDESC_GREEN = 1 << 1,
62 SVGA3DBLOCKDESC_V = 1 << 1,
65 SVGA3DBLOCKDESC_RED = 1 << 2,
66 SVGA3DBLOCKDESC_U = 1 << 2,
67 SVGA3DBLOCKDESC_LUMINANCE = 1 << 2,
70 SVGA3DBLOCKDESC_ALPHA = 1 << 3,
71 SVGA3DBLOCKDESC_Q = 1 << 3,
74 SVGA3DBLOCKDESC_BUFFER = 1 << 4,
77 SVGA3DBLOCKDESC_COMPRESSED = 1 << 5,
80 SVGA3DBLOCKDESC_FP = 1 << 6,
83 SVGA3DBLOCKDESC_PLANAR_YUV = 1 << 7,
86 SVGA3DBLOCKDESC_2PLANAR_YUV = 1 << 8,
89 SVGA3DBLOCKDESC_3PLANAR_YUV = 1 << 9,
92 SVGA3DBLOCKDESC_STENCIL = 1 << 11,
95 SVGA3DBLOCKDESC_TYPELESS = 1 << 12,
98 SVGA3DBLOCKDESC_SINT = 1 << 13,
101 SVGA3DBLOCKDESC_UINT = 1 << 14,
104 SVGA3DBLOCKDESC_NORM = 1 << 15,
107 SVGA3DBLOCKDESC_SRGB = 1 << 16,
110 SVGA3DBLOCKDESC_EXP = 1 << 17,
113 SVGA3DBLOCKDESC_COLOR = 1 << 18,
115 SVGA3DBLOCKDESC_DEPTH = 1 << 19,
117 SVGA3DBLOCKDESC_BUMP = 1 << 20,
120 SVGA3DBLOCKDESC_YUV_VIDEO = 1 << 21,
123 SVGA3DBLOCKDESC_MIXED = 1 << 22,
126 SVGA3DBLOCKDESC_CX = 1 << 23,
129 SVGA3DBLOCKDESC_BC1 = 1 << 24,
130 SVGA3DBLOCKDESC_BC2 = 1 << 25,
131 SVGA3DBLOCKDESC_BC3 = 1 << 26,
132 SVGA3DBLOCKDESC_BC4 = 1 << 27,
133 SVGA3DBLOCKDESC_BC5 = 1 << 28,
134 SVGA3DBLOCKDESC_BC6H = 1 << 29,
135 SVGA3DBLOCKDESC_BC7 = 1 << 30,
373 * struct svga3d_surface_desc - describes the actual pixel data.
397 {1, 1, 1}, 0, 0,
398 {{0}, {0}, {0}, {0}},
399 {{0}, {0}, {0}, {0}}},
402 {1, 1, 1}, 4, 4,
403 {{8}, {8}, {8}, {0}},
404 {{0}, {8}, {16}, {24}}},
407 {1, 1, 1}, 4, 4,
409 {{0}, {8}, {16}, {24}}},
412 {1, 1, 1}, 2, 2,
413 {{5}, {6}, {5}, {0}},
414 {{0}, {5}, {11}, {0}}},
417 {1, 1, 1}, 2, 2,
418 {{5}, {5}, {5}, {0}},
419 {{0}, {5}, {10}, {0}}},
422 {1, 1, 1}, 2, 2,
423 {{5}, {5}, {5}, {1}},
424 {{0}, {5}, {10}, {15}}},
427 {1, 1, 1}, 2, 2,
429 {{0}, {4}, {8}, {12}}},
432 {1, 1, 1}, 4, 4,
433 {{0}, {0}, {32}, {0}},
434 {{0}, {0}, {0}, {0}}},
437 {1, 1, 1}, 2, 2,
438 {{0}, {0}, {16}, {0}},
439 {{0}, {0}, {0}, {0}}},
442 {1, 1, 1}, 4, 4,
443 {{0}, {8}, {24}, {0}},
444 {{0}, {0}, {8}, {0}}},
447 {1, 1, 1}, 2, 2,
448 {{0}, {1}, {15}, {0}},
449 {{0}, {0}, {1}, {0}}},
452 {1, 1, 1}, 1, 1,
453 {{0}, {0}, {8}, {0}},
454 {{0}, {0}, {0}, {0}}},
457 {1, 1, 1}, 1, 1,
458 {{0}, {0}, {4}, {4}},
459 {{0}, {0}, {0}, {4}}},
462 {1, 1, 1}, 2, 2,
463 {{0}, {0}, {16}, {0}},
464 {{0}, {0}, {0}, {0}}},
467 {1, 1, 1}, 2, 2,
468 {{0}, {0}, {8}, {8}},
469 {{0}, {0}, {0}, {8}}},
472 {4, 4, 1}, 8, 8,
473 {{0}, {0}, {64}, {0}},
474 {{0}, {0}, {0}, {0}}},
477 {4, 4, 1}, 16, 16,
478 {{0}, {0}, {128}, {0}},
479 {{0}, {0}, {0}, {0}}},
482 {4, 4, 1}, 16, 16,
483 {{0}, {0}, {128}, {0}},
484 {{0}, {0}, {0}, {0}}},
487 {4, 4, 1}, 16, 16,
488 {{0}, {0}, {128}, {0}},
489 {{0}, {0}, {0}, {0}}},
492 {4, 4, 1}, 16, 16,
493 {{0}, {0}, {128}, {0}},
494 {{0}, {0}, {0}, {0}}},
497 {1, 1, 1}, 2, 2,
498 {{0}, {8}, {8}, {0}},
499 {{0}, {8}, {0}, {0}}},
502 {1, 1, 1}, 2, 2,
503 {{6}, {5}, {5}, {0}},
504 {{10}, {5}, {0}, {0}}},
507 {1, 1, 1}, 4, 4,
508 {{8}, {8}, {8}, {0}},
509 {{16}, {8}, {0}, {0}}},
512 {1, 1, 1}, 3, 3,
513 {{8}, {8}, {8}, {0}},
514 {{16}, {8}, {0}, {0}}},
517 {1, 1, 1}, 8, 8,
519 {{32}, {16}, {0}, {48}}},
522 {1, 1, 1}, 16, 16,
524 {{64}, {32}, {0}, {96}}},
527 {1, 1, 1}, 4, 4,
529 {{0}, {10}, {20}, {30}}},
532 {1, 1, 1}, 2, 2,
533 {{0}, {8}, {8}, {0}},
534 {{0}, {8}, {0}, {0}}},
537 {1, 1, 1}, 4, 4,
539 {{16}, {8}, {0}, {24}}},
542 {1, 1, 1}, 2, 2,
543 {{0}, {8}, {8}, {0}},
544 {{0}, {8}, {0}, {0}}},
547 {1, 1, 1}, 4, 4,
548 {{8}, {8}, {8}, {0}},
549 {{16}, {8}, {0}, {0}}},
552 {1, 1, 1}, 4, 4,
554 {{20}, {10}, {0}, {30}}},
557 {1, 1, 1}, 1, 1,
558 {{0}, {0}, {0}, {8}},
559 {{0}, {0}, {0}, {0}}},
562 {1, 1, 1}, 2, 2,
563 {{0}, {0}, {16}, {0}},
564 {{0}, {0}, {0}, {0}}},
567 {1, 1, 1}, 4, 4,
568 {{0}, {0}, {32}, {0}},
569 {{0}, {0}, {0}, {0}}},
572 {1, 1, 1}, 4, 4,
573 {{0}, {16}, {16}, {0}},
574 {{0}, {16}, {0}, {0}}},
577 {1, 1, 1}, 8, 8,
578 {{0}, {32}, {32}, {0}},
579 {{0}, {32}, {0}, {0}}},
582 {1, 1, 1}, 1, 1,
583 {{0}, {0}, {8}, {0}},
584 {{0}, {0}, {0}, {0}}},
587 {1, 1, 1}, 4, 4,
588 {{0}, {0}, {24}, {0}},
589 {{0}, {0}, {8}, {0}}},
592 {1, 1, 1}, 4, 4,
593 {{0}, {16}, {16}, {0}},
594 {{0}, {16}, {0}, {0}}},
597 {1, 1, 1}, 4, 4,
598 {{0}, {16}, {16}, {0}},
599 {{0}, {16}, {0}, {0}}},
602 {1, 1, 1}, 8, 8,
604 {{32}, {16}, {0}, {48}}},
607 {2, 1, 1}, 4, 4,
608 {{8}, {0}, {8}, {0}},
609 {{0}, {0}, {8}, {0}}},
612 {2, 1, 1}, 4, 4,
613 {{8}, {0}, {8}, {0}},
614 {{8}, {0}, {0}, {0}}},
617 {2, 2, 1}, 6, 2,
618 {{0}, {0}, {48}, {0}},
619 {{0}, {0}, {0}, {0}}},
622 {1, 1, 1}, 4, 4,
624 {{0}, {8}, {16}, {24}}},
627 {1, 1, 1}, 16, 16,
629 {{64}, {32}, {0}, {96}}},
632 {1, 1, 1}, 16, 16,
634 {{64}, {32}, {0}, {96}}},
637 {1, 1, 1}, 16, 16,
639 {{64}, {32}, {0}, {96}}},
642 {1, 1, 1}, 12, 12,
643 {{32}, {32}, {32}, {0}},
644 {{64}, {32}, {0}, {0}}},
647 {1, 1, 1}, 12, 12,
648 {{32}, {32}, {32}, {0}},
649 {{64}, {32}, {0}, {0}}},
652 {1, 1, 1}, 12, 12,
653 {{32}, {32}, {32}, {0}},
654 {{64}, {32}, {0}, {0}}},
657 {1, 1, 1}, 12, 12,
658 {{32}, {32}, {32}, {0}},
659 {{64}, {32}, {0}, {0}}},
662 {1, 1, 1}, 8, 8,
664 {{32}, {16}, {0}, {48}}},
667 {1, 1, 1}, 8, 8,
669 {{32}, {16}, {0}, {48}}},
672 {1, 1, 1}, 8, 8,
674 {{32}, {16}, {0}, {48}}},
677 {1, 1, 1}, 8, 8,
679 {{32}, {16}, {0}, {48}}},
682 {1, 1, 1}, 8, 8,
683 {{0}, {32}, {32}, {0}},
684 {{0}, {32}, {0}, {0}}},
687 {1, 1, 1}, 8, 8,
688 {{0}, {32}, {32}, {0}},
689 {{0}, {32}, {0}, {0}}},
692 {1, 1, 1}, 8, 8,
693 {{0}, {32}, {32}, {0}},
694 {{0}, {32}, {0}, {0}}},
697 {1, 1, 1}, 8, 8,
698 {{0}, {8}, {32}, {0}},
699 {{0}, {32}, {0}, {0}}},
702 {1, 1, 1}, 8, 8,
703 {{0}, {8}, {32}, {0}},
704 {{0}, {32}, {0}, {0}}},
707 {1, 1, 1}, 8, 8,
708 {{0}, {0}, {32}, {0}},
709 {{0}, {0}, {0}, {0}}},
712 {1, 1, 1}, 8, 8,
713 {{0}, {8}, {0}, {0}},
714 {{0}, {32}, {0}, {0}}},
717 {1, 1, 1}, 4, 4,
719 {{20}, {10}, {0}, {30}}},
722 {1, 1, 1}, 4, 4,
724 {{20}, {10}, {0}, {30}}},
727 {1, 1, 1}, 4, 4,
728 {{10}, {11}, {11}, {0}},
729 {{22}, {11}, {0}, {0}}},
732 {1, 1, 1}, 4, 4,
734 {{16}, {8}, {0}, {24}}},
737 {1, 1, 1}, 4, 4,
739 {{16}, {8}, {0}, {24}}},
742 {1, 1, 1}, 4, 4,
744 {{16}, {8}, {0}, {24}}},
747 {1, 1, 1}, 4, 4,
749 {{16}, {8}, {0}, {24}}},
752 {1, 1, 1}, 4, 4,
754 {{16}, {8}, {0}, {24}}},
757 {1, 1, 1}, 4, 4,
758 {{0}, {16}, {16}, {0}},
759 {{0}, {16}, {0}, {0}}},
762 {1, 1, 1}, 4, 4,
763 {{0}, {16}, {16}, {0}},
764 {{0}, {16}, {0}, {0}}},
767 {1, 1, 1}, 4, 4,
768 {{0}, {16}, {16}, {0}},
769 {{0}, {16}, {0}, {0}}},
772 {1, 1, 1}, 4, 4,
773 {{0}, {0}, {32}, {0}},
774 {{0}, {0}, {0}, {0}}},
777 {1, 1, 1}, 4, 4,
778 {{0}, {0}, {32}, {0}},
779 {{0}, {0}, {0}, {0}}},
782 {1, 1, 1}, 4, 4,
783 {{0}, {0}, {32}, {0}},
784 {{0}, {0}, {0}, {0}}},
787 {1, 1, 1}, 4, 4,
788 {{0}, {0}, {32}, {0}},
789 {{0}, {0}, {0}, {0}}},
792 {1, 1, 1}, 4, 4,
793 {{0}, {8}, {24}, {0}},
794 {{0}, {24}, {0}, {0}}},
797 {1, 1, 1}, 4, 4,
798 {{0}, {8}, {24}, {0}},
799 {{0}, {24}, {0}, {0}}},
802 {1, 1, 1}, 4, 4,
803 {{0}, {0}, {24}, {0}},
804 {{0}, {0}, {0}, {0}}},
807 {1, 1, 1}, 4, 4,
808 {{0}, {8}, {0}, {0}},
809 {{0}, {24}, {0}, {0}}},
812 {1, 1, 1}, 2, 2,
813 {{0}, {8}, {8}, {0}},
814 {{0}, {8}, {0}, {0}}},
817 {1, 1, 1}, 2, 2,
818 {{0}, {8}, {8}, {0}},
819 {{0}, {8}, {0}, {0}}},
822 {1, 1, 1}, 2, 2,
823 {{0}, {8}, {8}, {0}},
824 {{0}, {8}, {0}, {0}}},
827 {1, 1, 1}, 2, 2,
828 {{0}, {8}, {8}, {0}},
829 {{0}, {8}, {0}, {0}}},
832 {1, 1, 1}, 2, 2,
833 {{0}, {0}, {16}, {0}},
834 {{0}, {0}, {0}, {0}}},
837 {1, 1, 1}, 2, 2,
838 {{0}, {0}, {16}, {0}},
839 {{0}, {0}, {0}, {0}}},
842 {1, 1, 1}, 2, 2,
843 {{0}, {0}, {16}, {0}},
844 {{0}, {0}, {0}, {0}}},
847 {1, 1, 1}, 2, 2,
848 {{0}, {0}, {16}, {0}},
849 {{0}, {0}, {0}, {0}}},
852 {1, 1, 1}, 2, 2,
853 {{0}, {0}, {16}, {0}},
854 {{0}, {0}, {0}, {0}}},
857 {1, 1, 1}, 1, 1,
858 {{0}, {0}, {8}, {0}},
859 {{0}, {0}, {0}, {0}}},
862 {1, 1, 1}, 1, 1,
863 {{0}, {0}, {8}, {0}},
864 {{0}, {0}, {0}, {0}}},
867 {1, 1, 1}, 1, 1,
868 {{0}, {0}, {8}, {0}},
869 {{0}, {0}, {0}, {0}}},
872 {1, 1, 1}, 1, 1,
873 {{0}, {0}, {8}, {0}},
874 {{0}, {0}, {0}, {0}}},
877 {1, 1, 1}, 1, 1,
878 {{0}, {0}, {8}, {0}},
879 {{0}, {0}, {0}, {0}}},
882 {1, 1, 1}, 1, 1,
883 {{0}, {0}, {8}, {0}},
884 {{0}, {0}, {0}, {0}}},
887 {1, 1, 1}, 4, 4,
889 {{18}, {9}, {0}, {27}}},
892 {2, 1, 1}, 4, 4,
893 {{0}, {8}, {8}, {0}},
894 {{0}, {0}, {8}, {0}}},
897 {2, 1, 1}, 4, 4,
898 {{0}, {8}, {8}, {0}},
899 {{0}, {8}, {0}, {0}}},
902 {4, 4, 1}, 8, 8,
903 {{0}, {0}, {64}, {0}},
904 {{0}, {0}, {0}, {0}}},
907 {4, 4, 1}, 8, 8,
908 {{0}, {0}, {64}, {0}},
909 {{0}, {0}, {0}, {0}}},
912 {4, 4, 1}, 16, 16,
913 {{0}, {0}, {128}, {0}},
914 {{0}, {0}, {0}, {0}}},
917 {4, 4, 1}, 16, 16,
918 {{0}, {0}, {128}, {0}},
919 {{0}, {0}, {0}, {0}}},
922 {4, 4, 1}, 16, 16,
923 {{0}, {0}, {128}, {0}},
924 {{0}, {0}, {0}, {0}}},
927 {4, 4, 1}, 16, 16,
928 {{0}, {0}, {128}, {0}},
929 {{0}, {0}, {0}, {0}}},
932 {4, 4, 1}, 8, 8,
933 {{0}, {0}, {64}, {0}},
934 {{0}, {0}, {0}, {0}}},
937 {4, 4, 1}, 8, 8,
938 {{0}, {0}, {64}, {0}},
939 {{0}, {0}, {0}, {0}}},
942 {4, 4, 1}, 8, 8,
943 {{0}, {0}, {64}, {0}},
944 {{0}, {0}, {0}, {0}}},
947 {4, 4, 1}, 16, 16,
948 {{0}, {0}, {128}, {0}},
949 {{0}, {0}, {0}, {0}}},
952 {4, 4, 1}, 16, 16,
953 {{0}, {0}, {128}, {0}},
954 {{0}, {0}, {0}, {0}}},
957 {4, 4, 1}, 16, 16,
958 {{0}, {0}, {128}, {0}},
959 {{0}, {0}, {0}, {0}}},
962 {1, 1, 1}, 4, 4,
964 {{20}, {10}, {0}, {30}}},
967 {1, 1, 1}, 4, 4,
969 {{0}, {8}, {16}, {24}}},
972 {1, 1, 1}, 4, 4,
974 {{0}, {8}, {16}, {24}}},
977 {1, 1, 1}, 4, 4,
978 {{8}, {8}, {8}, {0}},
979 {{0}, {8}, {16}, {24}}},
982 {1, 1, 1}, 4, 4,
983 {{8}, {8}, {8}, {0}},
984 {{0}, {8}, {16}, {24}}},
987 {1, 1, 1}, 2, 2,
988 {{0}, {0}, {16}, {0}},
989 {{0}, {0}, {0}, {0}}},
992 {1, 1, 1}, 4, 4,
993 {{0}, {0}, {24}, {0}},
994 {{0}, {0}, {8}, {0}}},
997 {1, 1, 1}, 4, 4,
998 {{0}, {8}, {24}, {0}},
999 {{0}, {0}, {8}, {0}}},
1002 {2, 2, 1}, 6, 2,
1003 {{0}, {0}, {48}, {0}},
1004 {{0}, {0}, {0}, {0}}},
1007 {1, 1, 1}, 16, 16,
1009 {{64}, {32}, {0}, {96}}},
1012 {1, 1, 1}, 8, 8,
1014 {{32}, {16}, {0}, {48}}},
1017 {1, 1, 1}, 8, 8,
1019 {{32}, {16}, {0}, {48}}},
1022 {1, 1, 1}, 8, 8,
1023 {{0}, {32}, {32}, {0}},
1024 {{0}, {32}, {0}, {0}}},
1027 {1, 1, 1}, 4, 4,
1029 {{20}, {10}, {0}, {30}}},
1032 {1, 1, 1}, 4, 4,
1034 {{16}, {8}, {0}, {24}}},
1037 {1, 1, 1}, 4, 4,
1038 {{0}, {16}, {16}, {0}},
1039 {{0}, {16}, {0}, {0}}},
1042 {1, 1, 1}, 4, 4,
1043 {{0}, {16}, {16}, {0}},
1044 {{0}, {16}, {0}, {0}}},
1047 {1, 1, 1}, 4, 4,
1048 {{0}, {16}, {16}, {0}},
1049 {{0}, {16}, {0}, {0}}},
1052 {1, 1, 1}, 4, 4,
1053 {{0}, {0}, {32}, {0}},
1054 {{0}, {0}, {0}, {0}}},
1057 {1, 1, 1}, 2, 2,
1058 {{0}, {8}, {8}, {0}},
1059 {{0}, {8}, {0}, {0}}},
1062 {1, 1, 1}, 2, 2,
1063 {{0}, {0}, {16}, {0}},
1064 {{0}, {0}, {0}, {0}}},
1067 {1, 1, 1}, 2, 2,
1068 {{0}, {0}, {16}, {0}},
1069 {{0}, {0}, {0}, {0}}},
1072 {1, 1, 1}, 1, 1,
1073 {{0}, {0}, {0}, {8}},
1074 {{0}, {0}, {0}, {0}}},
1077 {4, 4, 1}, 8, 8,
1078 {{0}, {0}, {64}, {0}},
1079 {{0}, {0}, {0}, {0}}},
1082 {4, 4, 1}, 16, 16,
1083 {{0}, {0}, {128}, {0}},
1084 {{0}, {0}, {0}, {0}}},
1087 {4, 4, 1}, 16, 16,
1088 {{0}, {0}, {128}, {0}},
1089 {{0}, {0}, {0}, {0}}},
1092 {1, 1, 1}, 2, 2,
1093 {{5}, {6}, {5}, {0}},
1094 {{0}, {5}, {11}, {0}}},
1097 {1, 1, 1}, 2, 2,
1098 {{5}, {5}, {5}, {1}},
1099 {{0}, {5}, {10}, {15}}},
1102 {1, 1, 1}, 4, 4,
1104 {{0}, {8}, {16}, {24}}},
1107 {1, 1, 1}, 4, 4,
1108 {{8}, {8}, {8}, {0}},
1109 {{0}, {8}, {16}, {24}}},
1112 {4, 4, 1}, 8, 8,
1113 {{0}, {0}, {64}, {0}},
1114 {{0}, {0}, {0}, {0}}},
1117 {4, 4, 1}, 16, 16,
1118 {{0}, {0}, {128}, {0}},
1119 {{0}, {0}, {0}, {0}}},
1122 {1, 1, 1}, 2, 2,
1124 {{0}, {4}, {8}, {12}}},
1127 {4, 4, 1}, 16, 16,
1128 {{0}, {0}, {128}, {0}},
1129 {{0}, {0}, {0}, {0}}},
1132 {4, 4, 1}, 16, 16,
1133 {{0}, {0}, {128}, {0}},
1134 {{0}, {0}, {0}, {0}}},
1137 {4, 4, 1}, 16, 16,
1138 {{0}, {0}, {128}, {0}},
1139 {{0}, {0}, {0}, {0}}},
1142 {4, 4, 1}, 16, 16,
1143 {{0}, {0}, {128}, {0}},
1144 {{0}, {0}, {0}, {0}}},
1147 {4, 4, 1}, 16, 16,
1148 {{0}, {0}, {128}, {0}},
1149 {{0}, {0}, {0}, {0}}},
1152 {4, 4, 1}, 16, 16,
1153 {{0}, {0}, {128}, {0}},
1154 {{0}, {0}, {0}, {0}}},
1157 {1, 1, 1}, 4, 4,
1159 {{0}, {8}, {16}, {24}}},
1165 return (tmp > (uint64_t) ((u32) -1)) ? (u32) -1 : tmp; in clamped_umul32()
1169 * svga3dsurface_get_desc - Look up the appropriate SVGA3dSurfaceDesc for the
1182 * svga3dsurface_get_mip_size - Given a base level size and the mip level,
1190 size.width = max_t(u32, base_level.width >> mip_level, 1); in svga3dsurface_get_mip_size()
1191 size.height = max_t(u32, base_level.height >> mip_level, 1); in svga3dsurface_get_mip_size()
1192 size.depth = max_t(u32, base_level.depth >> mip_level, 1); in svga3dsurface_get_mip_size()
1193 size.pad64 = 0; in svga3dsurface_get_mip_size()
1203 block_size->width = __KERNEL_DIV_ROUND_UP(pixel_size->width, in svga3dsurface_get_size_in_blocks()
1204 desc->block_size.width); in svga3dsurface_get_size_in_blocks()
1205 block_size->height = __KERNEL_DIV_ROUND_UP(pixel_size->height, in svga3dsurface_get_size_in_blocks()
1206 desc->block_size.height); in svga3dsurface_get_size_in_blocks()
1207 block_size->depth = __KERNEL_DIV_ROUND_UP(pixel_size->depth, in svga3dsurface_get_size_in_blocks()
1208 desc->block_size.depth); in svga3dsurface_get_size_in_blocks()
1214 return (desc->block_desc & SVGA3DBLOCKDESC_PLANAR_YUV) != 0; in svga3dsurface_is_planar_surface()
1226 pitch = blocks.width * desc->pitch_bytes_per_block; in svga3dsurface_calculate_pitch()
1232 * svga3dsurface_get_image_buffer_size - Calculates image buffer size.
1239 * This function is overflow-safe. If the result would have overflowed, instead
1256 total_size = clamped_umul32(total_size, desc->bytes_per_block); in svga3dsurface_get_image_buffer_size()
1260 if (pitch == 0) in svga3dsurface_get_image_buffer_size()
1270 * svga3dsurface_get_serialized_size - Get the serialized size for the image.
1279 u32 total_size = 0; in svga3dsurface_get_serialized_size()
1282 for (mip = 0; mip < num_mip_levels; mip++) { in svga3dsurface_get_serialized_size()
1286 &size, 0); in svga3dsurface_get_serialized_size()
1293 * svga3dsurface_get_serialized_size_extended - Returns the number of bytes
1308 total_size *= max_t(u32, 1, num_samples); in svga3dsurface_get_serialized_size_extended()
1314 * svga3dsurface_get_pixel_offset - Compute the offset (in bytes) to a pixel
1326 const u32 bw = desc->block_size.width, bh = desc->block_size.height; in svga3dsurface_get_pixel_offset()
1327 const u32 bd = desc->block_size.depth; in svga3dsurface_get_pixel_offset()
1329 desc->bytes_per_block; in svga3dsurface_get_pixel_offset()
1333 x / bw * desc->bytes_per_block); in svga3dsurface_get_pixel_offset()
1355 mipChainBytes = 0; in svga3dsurface_get_image_offset()
1356 mipChainBytesToLevel = 0; in svga3dsurface_get_image_offset()
1357 for (i = 0; i < numMipLevels; i++) { in svga3dsurface_get_image_offset()
1359 bytes = svga3dsurface_get_image_buffer_size(desc, &mipSize, 0); in svga3dsurface_get_image_offset()
1372 * svga3dsurface_is_gb_screen_target_format - Is the specified format usable as
1374 * (with just the GBObjects cap-bit
1394 * svga3dsurface_is_dx_screen_target_format - Is the specified format usable as
1413 * svga3dsurface_is_screen_target_format - Is the specified format usable as a
1432 * struct svga3dsurface_mip - Mimpmap level information
1447 * struct svga3dsurface_cache - Cached surface information
1469 * struct svga3dsurface_loc - Surface location
1482 * svga3dsurface_subres - Compute the subresource from layer and mipmap.
1492 return cache->num_mip_levels * layer + mip_level; in svga3dsurface_subres()
1496 * svga3dsurface_setup_cache - Build a surface cache entry
1503 * Return: Zero on success, -EINVAL on invalid surface layout.
1515 memset(cache, 0, sizeof(*cache)); in svga3dsurface_setup_cache()
1516 cache->desc = desc = svga3dsurface_get_desc(format); in svga3dsurface_setup_cache()
1517 cache->num_mip_levels = num_mip_levels; in svga3dsurface_setup_cache()
1518 cache->num_layers = num_layers; in svga3dsurface_setup_cache()
1519 for (i = 0; i < cache->num_mip_levels; i++) { in svga3dsurface_setup_cache()
1520 struct svga3dsurface_mip *mip = &cache->mip[i]; in svga3dsurface_setup_cache()
1522 mip->size = svga3dsurface_get_mip_size(*size, i); in svga3dsurface_setup_cache()
1523 mip->bytes = svga3dsurface_get_image_buffer_size in svga3dsurface_setup_cache()
1524 (desc, &mip->size, 0); in svga3dsurface_setup_cache()
1525 mip->row_stride = in svga3dsurface_setup_cache()
1526 __KERNEL_DIV_ROUND_UP(mip->size.width, in svga3dsurface_setup_cache()
1527 desc->block_size.width) * in svga3dsurface_setup_cache()
1528 desc->bytes_per_block * num_samples; in svga3dsurface_setup_cache()
1529 if (!mip->row_stride) in svga3dsurface_setup_cache()
1532 mip->img_stride = in svga3dsurface_setup_cache()
1533 __KERNEL_DIV_ROUND_UP(mip->size.height, in svga3dsurface_setup_cache()
1534 desc->block_size.height) * in svga3dsurface_setup_cache()
1535 mip->row_stride; in svga3dsurface_setup_cache()
1536 if (!mip->img_stride) in svga3dsurface_setup_cache()
1539 cache->mip_chain_bytes += mip->bytes; in svga3dsurface_setup_cache()
1541 cache->sheet_bytes = cache->mip_chain_bytes * num_layers; in svga3dsurface_setup_cache()
1542 if (!cache->sheet_bytes) in svga3dsurface_setup_cache()
1545 return 0; in svga3dsurface_setup_cache()
1549 return -EINVAL; in svga3dsurface_setup_cache()
1553 * svga3dsurface_get_loc - Get a surface location from an offset into the
1564 const struct svga3dsurface_mip *mip = &cache->mip[0]; in svga3dsurface_get_loc()
1565 const struct svga3d_surface_desc *desc = cache->desc; in svga3dsurface_get_loc()
1569 if (offset >= cache->sheet_bytes) in svga3dsurface_get_loc()
1570 offset %= cache->sheet_bytes; in svga3dsurface_get_loc()
1572 layer = offset / cache->mip_chain_bytes; in svga3dsurface_get_loc()
1573 offset -= layer * cache->mip_chain_bytes; in svga3dsurface_get_loc()
1574 for (i = 0; i < cache->num_mip_levels; ++i, ++mip) { in svga3dsurface_get_loc()
1575 if (mip->bytes > offset) in svga3dsurface_get_loc()
1577 offset -= mip->bytes; in svga3dsurface_get_loc()
1580 loc->sub_resource = svga3dsurface_subres(cache, i, layer); in svga3dsurface_get_loc()
1581 loc->z = offset / mip->img_stride; in svga3dsurface_get_loc()
1582 offset -= loc->z * mip->img_stride; in svga3dsurface_get_loc()
1583 loc->z *= desc->block_size.depth; in svga3dsurface_get_loc()
1584 loc->y = offset / mip->row_stride; in svga3dsurface_get_loc()
1585 offset -= loc->y * mip->row_stride; in svga3dsurface_get_loc()
1586 loc->y *= desc->block_size.height; in svga3dsurface_get_loc()
1587 loc->x = offset / desc->bytes_per_block; in svga3dsurface_get_loc()
1588 loc->x *= desc->block_size.width; in svga3dsurface_get_loc()
1592 * svga3dsurface_inc_loc - Clamp increment a surface location with one block
1597 * When computing the size of a range as size = end - start, the range does not
1607 const struct svga3d_surface_desc *desc = cache->desc; in svga3dsurface_inc_loc()
1608 u32 mip = loc->sub_resource % cache->num_mip_levels; in svga3dsurface_inc_loc()
1609 const struct drm_vmw_size *size = &cache->mip[mip].size; in svga3dsurface_inc_loc()
1611 loc->sub_resource++; in svga3dsurface_inc_loc()
1612 loc->x += desc->block_size.width; in svga3dsurface_inc_loc()
1613 if (loc->x > size->width) in svga3dsurface_inc_loc()
1614 loc->x = size->width; in svga3dsurface_inc_loc()
1615 loc->y += desc->block_size.height; in svga3dsurface_inc_loc()
1616 if (loc->y > size->height) in svga3dsurface_inc_loc()
1617 loc->y = size->height; in svga3dsurface_inc_loc()
1618 loc->z += desc->block_size.depth; in svga3dsurface_inc_loc()
1619 if (loc->z > size->depth) in svga3dsurface_inc_loc()
1620 loc->z = size->depth; in svga3dsurface_inc_loc()
1624 * svga3dsurface_min_loc - The start location in a subresource
1634 loc->sub_resource = sub_resource; in svga3dsurface_min_loc()
1635 loc->x = loc->y = loc->z = 0; in svga3dsurface_min_loc()
1639 * svga3dsurface_min_loc - The end location in a subresource
1655 loc->sub_resource = sub_resource + 1; in svga3dsurface_max_loc()
1656 mip = sub_resource % cache->num_mip_levels; in svga3dsurface_max_loc()
1657 size = &cache->mip[mip].size; in svga3dsurface_max_loc()
1658 loc->x = size->width; in svga3dsurface_max_loc()
1659 loc->y = size->height; in svga3dsurface_max_loc()
1660 loc->z = size->depth; in svga3dsurface_max_loc()