Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 976cdded authored by Avi Shif's avatar Avi Shif Committed by Alec Mouri
Browse files

graphics: Add 12 bits and 14 bits formats



Add six new formats to the formats definitions. The new formats
have two distinct properties:
Each format includes either one component (only R),
two components (R ang G) or four components (R, G, B and A).
The size of each component in the format is either 12 bits or 14 bits.

Test: Manual compilation of the AOSP tree.

Bug: 414794424
Bug: 417782684
Flag: com.android.graphics.hwui.flags.requested_formats_12_14
Test: builds
Change-Id: Ia647735f14ef715fc8a7a01059452625e577e76f
Signed-off-by: default avatarAvi Shif <avi.shif@arm.com>
parent 429bd452
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -19066,12 +19066,18 @@ package android.hardware {
    field public static final int D_FP32 = 51; // 0x33
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int RGBA_10101010 = 59; // 0x3b
    field public static final int RGBA_1010102 = 43; // 0x2b
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_12_14") public static final int RGBA_12121212 = 65; // 0x41
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_12_14") public static final int RGBA_14141414 = 66; // 0x42
    field public static final int RGBA_8888 = 1; // 0x1
    field public static final int RGBA_FP16 = 22; // 0x16
    field public static final int RGBX_8888 = 2; // 0x2
    field public static final int RGB_565 = 4; // 0x4
    field public static final int RGB_888 = 3; // 0x3
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_12_14") public static final int RG_1212 = 63; // 0x3f
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_12_14") public static final int RG_1414 = 64; // 0x40
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int RG_1616 = 58; // 0x3a
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_12_14") public static final int R_12 = 61; // 0x3d
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_12_14") public static final int R_14 = 62; // 0x3e
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int R_16 = 57; // 0x39
    field @FlaggedApi("com.android.graphics.hwui.flags.requested_formats_v") public static final int R_8 = 56; // 0x38
    field public static final int S_UI8 = 53; // 0x35
+64 −0
Original line number Diff line number Diff line
@@ -71,6 +71,12 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
            R_16,
            RG_1616,
            RGBA_10101010,
            R_12,
            R_14,
            RG_1212,
            RG_1414,
            RGBA_12121212,
            RGBA_14141414,
    })
    public @interface Format {
    }
@@ -142,6 +148,64 @@ public final class HardwareBuffer implements Parcelable, AutoCloseable {
    /** Format: 10 bits each red, green, blue, alpha */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_V)
    public static final int RGBA_10101010 = 0x3b;
    /**
     * 16 bit format with a single 12-bit component. The format is 16 bits
     * unsigned integer that has 12 bits of R component in the top 12 bits
     * of the 16-bit word with the bottom 4 bits unused.
     */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_12_14)
    public static final int R_12 = 0x3d;
     /**
     * 16 bit format with a single 14-bit component. The format is 16-bit
     * unsigned integer that has 14 bits of R component in the top 14 bits
     * of the 16-bit word with the bottom 2 bits unused.
     */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_12_14)
    public static final int R_14 = 0x3e;
    /**
     * 32-bit format that has 12-bit R and G components, in that order,
     * from the lowest memory address to the highest memory address. The
     * format is 32-bit unsigned integer that has a 12-bit R component
     * in the top 12 bits of the word in bytes 0..1, and a 12-bit G
     * component in the top 12 bits of the word in bytes 2..3, with the
     * bottom 4 bits of each word unused.
     */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_12_14)
    public static final int RG_1212 = 0x3f;
    /**
     * 32-bit format that has 14-bit R and G components, in that order,
     * from the lowest memory address to the highest memory address. The
     * format is 32-bit unsigned integer that has a 14-bit R component
     * in the top 14 bits of the word in bytes 0..1, and a 14-bit G
     * component in the top 14 bits of the word in bytes 2..3, with the
     * bottom 2 bits of each word unused.
     */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_12_14)
    public static final int RG_1414 = 0x40;
    /**
     * 64-bit format that has 12-bit R, G, B, and A components, in that order,
     * from the lowest memory address to the highest memory address. The
     * format is 64-bit unsigned integer that has a 12-bit R component in
     * the top 12 bits of the word in bytes 0..1, a 12-bit G component in
     * the top 12 bits of the word in bytes 2..3, a 12-bit B component in
     * the top 12 bits of the word in bytes 4..5, and a 12-bit A component
     * in the top 12 bits of the word in bytes 6..7, with the bottom 4 bits
     * of each word unused.
     */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_12_14)
    public static final int RGBA_12121212 = 0x41;
    /**
     * 64-bit format that has 14-bit R, G, B, and A components, in that order,
     * from the lowest memory address to the highest memory address. The
     * format is 64-bit unsigned integer that has a 14-bit R component in
     * the top 14 bits of the word in bytes 0..1, a 14-bit G component in
     * the top 14 bits of the word in bytes 2..3, a 14-bit B component in
     * the top 14 bits of the word in bytes 4..5, and a 14-bit A component
     * in the top 14 bits of the word in bytes 6..7, with the bottom 2 bits
     * of each word unused.
     */
    @FlaggedApi(com.android.graphics.hwui.flags.Flags.FLAG_REQUESTED_FORMATS_12_14)
    public static final int RGBA_14141414 = 0x42;

    // Note: do not rename, this field is used by native code
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
+8 −0
Original line number Diff line number Diff line
@@ -89,6 +89,14 @@ flag {
  bug: "292545615"
}

flag {
  name: "requested_formats_12_14"
  is_exported: true
  namespace: "core_graphics"
  description: "Add new 12 & 14-bit formats in the SDK"
  bug: "390471495"
}

flag {
  name: "draw_region"
  namespace: "core_graphics"