blob: dec3b25b25f3c5a2324116f5dcb2257099eed43d [file] [log] [blame]
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.hardware.graphics.composer@2.3;
import android.hardware.graphics.common@1.1::RenderIntent;
import android.hardware.graphics.common@1.1::PixelFormat;
import android.hardware.graphics.common@1.2::ColorMode;
import android.hardware.graphics.common@1.2::Dataspace;
import android.hardware.graphics.composer@2.1::IComposerClient.Command;
import @2.2::IComposerClient;
import @2.1::Display;
import @2.1::Error;
interface IComposerClient extends @2.2::IComposerClient {
enum Command : @2.2::IComposerClient.Command {
/**
* SET_LAYER_COLOR_TRANSFORM has this pseudo prototype
*
* setLayerColorTransform(float[16] matrix);
*
* This command has the following binary layout in bytes:
*
* 0 - 16 * 4: matrix
*
* Sets a matrix for color transform which will be applied on this layer
* before composition.
*
* If the device is not capable of apply the matrix on this layer, it must force
* this layer to client composition during VALIDATE_DISPLAY.
*
* The matrix provided is an affine color transformation of the following
* form:
*
* |r.r r.g r.b 0|
* |g.r g.g g.b 0|
* |b.r b.g b.b 0|
* |Tr Tg Tb 1|
*
* This matrix must be provided in row-major form:
*
* {r.r, r.g, r.b, 0, g.r, ...}.
*
* Given a matrix of this form and an input color [R_in, G_in, B_in],
* the input color must first be converted to linear space
* [R_linear, G_linear, B_linear], then the output linear color
* [R_out_linear, G_out_linear, B_out_linear] will be:
*
* R_out_linear = R_linear * r.r + G_linear * g.r + B_linear * b.r + Tr
* G_out_linear = R_linear * r.g + G_linear * g.g + B_linear * b.g + Tg
* B_out_linear = R_linear * r.b + G_linear * g.b + B_linear * b.b + Tb
*
* [R_out_linear, G_out_linear, B_out_linear] must then be converted to
* gamma space: [R_out, G_out, B_out] before blending.
*
* @param matrix is a 4x4 transform matrix (16 floats) as described above.
*/
SET_LAYER_COLOR_TRANSFORM = 0x40d << @2.1::IComposerClient.Command:OPCODE_SHIFT,
};
/**
* Returns the port and data that describe a physical display. The port is
* a unique number that identifies a physical connector (e.g. eDP, HDMI)
* for display output. The data blob is parsed to determine its format,
* typically EDID 1.3 as specified in VESA E-EDID Standard Release A
* Revision 1.
*
* @param display is the display to query.
* @return error is NONE upon success. Otherwise,
* BAD_DISPLAY when an invalid display handle was passed in.
* UNSUPPORTED when identification data is unavailable.
* @return port is the connector to which the display is connected.
* @return data is the EDID 1.3 blob identifying the display.
*/
@callflow(next="*")
getDisplayIdentificationData(Display display)
generates (Error error,
uint8_t port,
vec<uint8_t> data);
/**
* getReadbackBufferAttributes_2_3
* Returns the format which should be used when allocating a buffer for use by
* device readback as well as the dataspace in which its contents must be
* interpreted.
*
* The width and height of this buffer must be those of the currently-active
* display configuration, and the usage flags must consist of the following:
* BufferUsage::CPU_READ | BufferUsage::GPU_TEXTURE |
* BufferUsage::COMPOSER_OUTPUT
*
* The format and dataspace provided must be sufficient such that if a
* correctly-configured buffer is passed into setReadbackBuffer, filled by
* the device, and then displayed by the client as a full-screen buffer, the
* output of the display remains the same (subject to the note about protected
* content in the description of setReadbackBuffer).
*
* If the active configuration or color mode of this display has changed
* since a previous call to this function, it must be called again prior to
* setting a readback buffer such that the returned format and dataspace will
* be updated accordingly.
*
* Parameters:
* @param display - the display on which to create the layer.
*
* @return format - the format the client should use when allocating a device
* readback buffer
* @return dataspace - the dataspace to use when interpreting the
* contents of a device readback buffer
* @return error is NONE upon success. Otherwise,
* BAD_DISPLAY when an invalid display handle was passed in.
* UNSUPPORTED if not supported on underlying HAL
*
* See also:
* setReadbackBuffer
* getReadbackBufferFence
*/
getReadbackBufferAttributes_2_3(Display display)
generates (Error error,
PixelFormat format,
Dataspace dataspace);
/**
* getClientTargetSupport_2_3
* Returns whether a client target with the given properties can be
* handled by the device.
*
* This function must return true for a client target with width and
* height equal to the active display configuration dimensions,
* PixelFormat::RGBA_8888, and Dataspace::UNKNOWN. It is not required to
* return true for any other configuration.
*
* @param display is the display to query.
* @param width is the client target width in pixels.
* @param height is the client target height in pixels.
* @param format is the client target format.
* @param dataspace is the client target dataspace, as described in
* setLayerDataspace.
* @return error is NONE upon success. Otherwise,
* BAD_DISPLAY when an invalid display handle was passed in.
* UNSUPPORTED when the given configuration is not supported.
*/
@callflow(next="*")
getClientTargetSupport_2_3(Display display,
uint32_t width,
uint32_t height,
PixelFormat format,
Dataspace dataspace)
generates (Error error);
/**
* Executes commands from the input command message queue. Return values
* generated by the input commands are written to the output command
* message queue in the form of value commands.
*
* @param inLength is the length of input commands.
* @param inHandles is an array of handles referenced by the input
* commands.
* @return error is NONE upon success. Otherwise,
* BAD_PARAMETER when inLength is not equal to the length of
* commands in the input command message queue.
* NO_RESOURCES when the output command message queue was not
* properly drained.
* @param outQueueChanged indicates whether the output command message
* queue has changed.
* @param outLength is the length of output commands.
* @param outHandles is an array of handles referenced by the output
* commands.
*/
executeCommands_2_3(uint32_t inLength,
vec<handle> inHandles)
generates (Error error,
bool outQueueChanged,
uint32_t outLength,
vec<handle> outHandles);
/**
* Returns the render intents supported by the specified display and color
* mode.
*
* For SDR color modes, RenderIntent::COLORIMETRIC must be supported. For
* HDR color modes, RenderIntent::TONE_MAP_COLORIMETRIC must be supported.
*
* @param display is the display to query.
* @param mode is the color mode to query.
* @return error is NONE upon success. Otherwise,
* BAD_DISPLAY when an invalid display handle was passed in.
* BAD_PARAMETER when an invalid color mode was passed in.
* @return intents is an array of render intents.
*/
getRenderIntents_2_3(Display display, ColorMode mode)
generates (Error error,
vec<RenderIntent> intents);
/**
* Returns the color modes supported on this display.
*
* All devices must support at least ColorMode::NATIVE.
*
* @param display is the display to query.
* @return error is NONE upon success. Otherwise,
* BAD_DISPLAY when an invalid display handle was passed in.
* @return modes is an array of color modes.
*/
getColorModes_2_3(Display display)
generates (Error error,
vec<ColorMode> modes);
/**
* Sets the color mode and render intent of the given display.
*
* The color mode and render intent change must take effect on next
* presentDisplay.
*
* All devices must support at least ColorMode::NATIVE and
* RenderIntent::COLORIMETRIC, and displays are assumed to be in this mode
* upon hotplug.
*
* @param display is the display to which the color mode is set.
* @param mode is the color mode to set to.
* @param intent is the render intent to set to.
* @return error is NONE upon success. Otherwise,
* BAD_DISPLAY when an invalid display handle was passed in.
* BAD_PARAMETER when mode or intent is invalid
* UNSUPPORTED when mode or intent is not supported on this
* display.
*/
setColorMode_2_3(Display display, ColorMode mode, RenderIntent intent)
generates (Error error);
};